#[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
impl InodeBitmap
Sourcepub fn is_allocated(&self, pos: usize) -> bool
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
trueif the inode is currently marked as allocated (bit is 1).falseif 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.
Sourcepub fn try_allocate(&mut self, pos: usize) -> bool
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
trueif the inode was previously free and is now marked as allocated.falseif 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.
pub fn deallocate(&mut self, pos: usize) -> bool
Trait Implementations§
Source§impl Default for InodeBitmap
impl Default for InodeBitmap
Source§impl MetaData for InodeBitmap
impl MetaData for InodeBitmap
Source§fn load(
ffs: &FastFileSystemInner,
lba: LogicalBlockAddress,
) -> Result<BlockPointsTo<Self>, KernelError>
fn load( ffs: &FastFileSystemInner, lba: LogicalBlockAddress, ) -> Result<BlockPointsTo<Self>, KernelError>
Loads a metadata structure from disk at the specified logical block
address. Read more