pub trait BlockDevice: Send {
// Required methods
fn read_blocks(&self, block_id: u64, buf: &mut [u8]) -> Result<u32>;
fn write_blocks(&mut self, block_id: u64, buf: &[u8]) -> Result<u32>;
fn flush(&mut self) -> Result<()>;
fn block_size(&self) -> u32;
fn block_count(&self) -> u64;
// Provided methods
fn open(&mut self) -> Result<()> { ... }
fn close(&mut self) -> Result<()> { ... }
}Expand description
Trait for block devices that can be used with ext4 filesystems.
Implementors must provide block-level read/write operations. All operations are performed on aligned blocks.
Required Methods§
Sourcefn block_size(&self) -> u32
fn block_size(&self) -> u32
Get the physical block size in bytes.
Sourcefn block_count(&self) -> u64
fn block_count(&self) -> u64
Get the total number of blocks.