summaryrefslogtreecommitdiff
path: root/src/block_device
diff options
context:
space:
mode:
authorChuyan Zhang <me@zcy.moe>2023-11-19 01:03:19 -0800
committerChuyan Zhang <me@zcy.moe>2023-11-19 01:03:19 -0800
commit8a45cd95353ae9fe1286dbc4fcd36faaa66c9f82 (patch)
treeaf7687f74197ec338f57dc0cd174f1c32bb60af2 /src/block_device
parent886df6daf6bb6b922276157dba1cc099e897a9ea (diff)
downloadmyfs-8a45cd95353ae9fe1286dbc4fcd36faaa66c9f82.tar.gz
myfs-8a45cd95353ae9fe1286dbc4fcd36faaa66c9f82.zip
Layer 1 test not passing
Diffstat (limited to 'src/block_device')
-rw-r--r--src/block_device/memory_disk.rs4
-rw-r--r--src/block_device/mod.rs1
2 files changed, 2 insertions, 3 deletions
diff --git a/src/block_device/memory_disk.rs b/src/block_device/memory_disk.rs
index 3876736..0639d3e 100644
--- a/src/block_device/memory_disk.rs
+++ b/src/block_device/memory_disk.rs
@@ -9,9 +9,9 @@ pub struct MemoryDisk {
}
impl MemoryDisk {
- pub fn new() -> Self {
+ pub fn new(block_number: usize) -> Self {
Self {
- arena: RefCell::new(vec![0u8; BLOCK_SIZE * 16384]),
+ arena: RefCell::new(vec![0u8; BLOCK_SIZE * block_number]),
}
}
}
diff --git a/src/block_device/mod.rs b/src/block_device/mod.rs
index c7e1362..a8fd8b7 100644
--- a/src/block_device/mod.rs
+++ b/src/block_device/mod.rs
@@ -1,6 +1,5 @@
/// Abstracts for block devices.
/// Currently only a mock memory disk.
-
pub mod memory_disk;
pub const BLOCK_SIZE: usize = 4096;
pub trait BlockDevice {