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

BlockDevice

Trait BlockDevice 

Source
pub trait BlockDevice: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn block_size(&self) -> usize;
    fn block_count(&self) -> u64;
    fn read_blocks(
        &self,
        start_block: u64,
        buffer: &mut [u8],
    ) -> Result<(), KernelError>;
    fn write_blocks(
        &mut self,
        start_block: u64,
        buffer: &[u8],
    ) -> Result<(), KernelError>;

    // Provided method
    fn flush(&mut self) -> Result<(), KernelError> { ... }
}
Expand description

Block device trait

Required Methods§

Source

fn name(&self) -> &str

Get device name

Source

fn block_size(&self) -> usize

Get block size in bytes

Source

fn block_count(&self) -> u64

Get total number of blocks

Source

fn read_blocks( &self, start_block: u64, buffer: &mut [u8], ) -> Result<(), KernelError>

Read blocks from device

Source

fn write_blocks( &mut self, start_block: u64, buffer: &[u8], ) -> Result<(), KernelError>

Write blocks to device

Provided Methods§

Source

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

Flush any cached writes

Implementors§

Source§

impl BlockDevice for AhciBlockDevice

Available on crate feature alloc only.
Source§

impl BlockDevice for NvmeController

Source§

impl BlockDevice for RamBlockDevice