Load a new BlockCache from disk.
(block_id: usize, block_device: Arc<dyn BlockDevice>)
| 16 | impl BlockCache { |
| 17 | /// Load a new BlockCache from disk. |
| 18 | pub fn new(block_id: usize, block_device: Arc<dyn BlockDevice>) -> Self { |
| 19 | // for alignment and move effciency |
| 20 | let mut cache = vec![0u8; BLOCK_SZ]; |
| 21 | block_device.read_block(block_id, &mut cache); |
| 22 | Self { |
| 23 | cache, |
| 24 | block_id, |
| 25 | block_device, |
| 26 | modified: false, |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | fn addr_of_offset(&self, offset: usize) -> usize { |
| 31 | &self.cache[offset] as *const _ as usize |
nothing calls this directly
no test coverage detected