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

BlockFs

Struct BlockFs 

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

BlockFS filesystem

Implementations§

Source§

impl BlockFs

Source

pub fn new(block_count: u32, inode_count: u32) -> Self

Source

pub fn format(block_count: u32, inode_count: u32) -> Result<Self, KernelError>

Source

pub fn open_existing( backend: Arc<Mutex<dyn DiskBackend>>, ) -> Result<Self, KernelError>

Open an existing BlockFS from a disk backend.

Reads the superblock, validates the magic number, and loads the bitmap, inode table, and all data blocks into memory. The disk backend remains attached for subsequent sync operations.

Source

pub fn set_disk_backend( &self, backend: Arc<Mutex<dyn DiskBackend>>, load: bool, ) -> Result<(), KernelError>

Attach a disk backend for persistent storage.

When a disk backend is attached, sync() will write all dirty blocks to the device. Without a backend, BlockFS operates as a pure RAM filesystem.

If load is true, existing data is read from the disk into memory.

Source

pub fn detach_disk_backend(&self)

Detach the disk backend. Outstanding dirty blocks will NOT be flushed; call sync() first if persistence is needed.

Source

pub fn dirty_block_count(&self) -> usize

Get the number of dirty blocks pending sync.

Trait Implementations§

Source§

impl Filesystem for BlockFs

Source§

fn root(&self) -> Arc<dyn VfsNode>

Get the root node of the filesystem
Source§

fn name(&self) -> &str

Get filesystem name
Source§

fn is_readonly(&self) -> bool

Check if filesystem is read-only
Source§

fn sync(&self) -> Result<(), KernelError>

Sync filesystem to disk

Auto Trait Implementations§

§

impl Freeze for BlockFs

§

impl !RefUnwindSafe for BlockFs

§

impl Send for BlockFs

§

impl Sync for BlockFs

§

impl Unpin for BlockFs

§

impl !UnwindSafe for BlockFs

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.