Skip to main content

BlockDevice

Trait BlockDevice 

Source
pub trait BlockDevice: Send + Sync {
    // Required methods
    fn read_offset(&self, offset: usize) -> Result<Vec<u8>, BlockDeviceError>;
    fn write_offset(
        &mut self,
        offset: usize,
        data: &[u8],
    ) -> Result<(), BlockDeviceError>;
    fn size(&self) -> Result<usize, BlockDeviceError>;
}
Expand description

Block device trait that ext4_rs requires

This trait must be implemented by any device driver that wants to provide block-level access to EXT4 filesystems.

Required Methods§

Source

fn read_offset(&self, offset: usize) -> Result<Vec<u8>, BlockDeviceError>

Read data from the device at the given byte offset

Source

fn write_offset( &mut self, offset: usize, data: &[u8], ) -> Result<(), BlockDeviceError>

Write data to the device at the given byte offset

Source

fn size(&self) -> Result<usize, BlockDeviceError>

Get the size of the device in bytes

Implementors§