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

RamBlockDevice

Struct RamBlockDevice 

Source
pub struct RamBlockDevice { /* private fields */ }
Expand description

RAM-backed block device (for testing/ramdisk)

Implementations§

Source§

impl RamBlockDevice

Source

pub fn new(name: String, block_size: usize, block_count: u64) -> Self

Create a new RAM block device

Source

pub fn size(&self) -> usize

Get total size in bytes

Trait Implementations§

Source§

impl BlockDevice for RamBlockDevice

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

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

Flush any cached writes

Auto Trait Implementations§

§

impl Freeze for RamBlockDevice

§

impl RefUnwindSafe for RamBlockDevice

§

impl Send for RamBlockDevice

§

impl Sync for RamBlockDevice

§

impl Unpin for RamBlockDevice

§

impl UnwindSafe for RamBlockDevice

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.