⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

StorageDevice

Trait StorageDevice 

Source
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§

Source

fn name(&self) -> &str

Get device name

Source

fn get_info(&self) -> StorageInfo

Get device information

Source

fn get_stats(&self) -> StorageStats

Get device statistics

Source

fn reset_stats(&mut self)

Reset statistics

Source

fn read_sectors( &mut self, lba: u64, count: u32, buffer: &mut [u8], ) -> Result<u32, KernelError>

Read sectors

Source

fn write_sectors( &mut self, lba: u64, count: u32, data: &[u8], ) -> Result<u32, KernelError>

Write sectors

Source

fn flush(&mut self) -> Result<(), KernelError>

Flush cache

Source

fn is_ready(&self) -> bool

Check if device is ready

Source

fn max_transfer_sectors(&self) -> u32

Get maximum transfer size in sectors

Implementors§