Make everything scale with block size and format

This commit is contained in:
Jeremy Soller
2024-02-14 10:15:26 -07:00
parent 5f00068c26
commit 4e0ab54567
11 changed files with 53 additions and 93 deletions
+4 -2
View File
@@ -3,6 +3,8 @@ use simple_endian::*;
use crate::BLOCK_SIZE;
const BLOCK_LIST_ENTRIES: usize = BLOCK_SIZE as usize / mem::size_of::<BlockPtr<BlockRaw>>();
#[derive(Clone, Copy, Debug, Default)]
pub struct BlockData<T> {
addr: u64,
@@ -50,7 +52,7 @@ impl<T: ops::Deref<Target = [u8]>> BlockData<T> {
#[repr(packed)]
pub struct BlockList<T> {
pub ptrs: [BlockPtr<T>; 256],
pub ptrs: [BlockPtr<T>; BLOCK_LIST_ENTRIES],
}
impl<T> BlockList<T> {
@@ -67,7 +69,7 @@ impl<T> BlockList<T> {
impl<T> Default for BlockList<T> {
fn default() -> Self {
Self {
ptrs: [BlockPtr::default(); 256],
ptrs: [BlockPtr::default(); BLOCK_LIST_ENTRIES],
}
}
}