pub trait StorageDevice: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn get_info(&self) -> StorageInfo;
fn get_stats(&self) -> StorageStats;
fn reset_stats(&mut self);
fn read_sectors(
&mut self,
lba: u64,
count: u32,
buffer: &mut [u8],
) -> Result<u32, KernelError>;
fn write_sectors(
&mut self,
lba: u64,
count: u32,
data: &[u8],
) -> Result<u32, KernelError>;
fn flush(&mut self) -> Result<(), KernelError>;
fn is_ready(&self) -> bool;
fn max_transfer_sectors(&self) -> u32;
}Expand description
Storage device trait
Required Methods§
Sourcefn get_info(&self) -> StorageInfo
fn get_info(&self) -> StorageInfo
Get device information
Sourcefn get_stats(&self) -> StorageStats
fn get_stats(&self) -> StorageStats
Get device statistics
Sourcefn reset_stats(&mut self)
fn reset_stats(&mut self)
Reset statistics
Sourcefn read_sectors(
&mut self,
lba: u64,
count: u32,
buffer: &mut [u8],
) -> Result<u32, KernelError>
fn read_sectors( &mut self, lba: u64, count: u32, buffer: &mut [u8], ) -> Result<u32, KernelError>
Read sectors
Sourcefn write_sectors(
&mut self,
lba: u64,
count: u32,
data: &[u8],
) -> Result<u32, KernelError>
fn write_sectors( &mut self, lba: u64, count: u32, data: &[u8], ) -> Result<u32, KernelError>
Write sectors
Sourcefn flush(&mut self) -> Result<(), KernelError>
fn flush(&mut self) -> Result<(), KernelError>
Flush cache
Sourcefn max_transfer_sectors(&self) -> u32
fn max_transfer_sectors(&self) -> u32
Get maximum transfer size in sectors