InodeBitmap

Struct InodeBitmap 

Source
#[repr(C, packed(1))]
pub struct InodeBitmap { bits: [u64; 512], }
Expand description

Represents the on-disk inode allocation bitmap for the file system.

Each bit in the InodeBitmap corresponds to a single inode on disk. A bit value of 1 indicates that the inode is in use, while 0 means the inode is free and available for allocation.

Fields§

§bits: [u64; 512]

Implementations§

Source§

impl InodeBitmap

Source

pub fn is_allocated(&self, pos: usize) -> bool

Checks whether a inode at the given position is allocated.

§Parameters
  • pos: The index of the inode to check.
§Returns
  • true if the inode is currently marked as allocated (bit is 1).
  • false if the inode is free (bit is 0).

This method is used to determine the allocation status of a inode in the file system’s inode bitmap.

Source

pub fn try_allocate(&mut self, pos: usize) -> bool

Attempts to allocate a inode at the given position.

§Parameters
  • pos: The index of the inode to allocate.
§Returns
  • true if the inode was previously free and is now marked as allocated.
  • false if the inode was already allocated (no change).

This method is used during inode allocation to claim a free inode. If the inode is already allocated, it fails without modifying the bitmap.

Source

pub fn deallocate(&mut self, pos: usize) -> bool

Trait Implementations§

Source§

impl Default for InodeBitmap

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl MetaData for InodeBitmap

Source§

fn load( ffs: &FastFileSystemInner, lba: LogicalBlockAddress, ) -> Result<BlockPointsTo<Self>, KernelError>

Loads a metadata structure from disk at the specified logical block address. Read more

Auto Trait Implementations§

§

impl Freeze for InodeBitmap

§

impl RefUnwindSafe for InodeBitmap

§

impl Send for InodeBitmap

§

impl Sync for InodeBitmap

§

impl Unpin for InodeBitmap

§

impl UnwindSafe for InodeBitmap

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.