#[repr(C)]pub struct SuperBlock {
pub magic: [u8; 8],
pub block_count: u64,
pub block_count_inused: u64,
pub inode_count: u64,
pub inode_count_inused: u64,
pub has_journal: u64,
pub _pad: [u8; 4048],
}Expand description
On-disk representation of the superblock of the Fast File System (FFS).
The superblock contains essential metadata about the filesystem, including the total number of blocks and inodes, as well as the size of the journal.
Fields§
§magic: [u8; 8]File system magic: “KeOSFFS\0”.
block_count: u64Total number of blocks in the filesystem.
block_count_inused: u64In-used count of blocks in the filesystem.
inode_count: u64Total number of inodes in the filesystem.
inode_count_inused: u64In-used count of inodes in the filesystem.
has_journal: u64A indicator that this filesystem have journaling feature.
_pad: [u8; 4048]Padding to align to Block size.
Implementations§
Source§impl SuperBlock
impl SuperBlock
Sourcepub fn from_disk(disk: &Disk) -> Result<BlockPointsTo<Self>, KernelError>
pub fn from_disk(disk: &Disk) -> Result<BlockPointsTo<Self>, KernelError>
Loads the superblock structure from disk.
This function reads the first 8 sectors (4096 bytes) from the disk. It is the first step when mounting a file system, as the superblock contains metadata such as layout information, and journals.
§Parameters
disk: A reference to the block device implementing theDisktrait.
§Returns
Ok(Box<SuperBlock>): If the superblock is successfully read.Err(KernelError): If any sector read fails.
Trait Implementations§
Source§impl Clone for SuperBlock
impl Clone for SuperBlock
Source§fn clone(&self) -> SuperBlock
fn clone(&self) -> SuperBlock
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SuperBlock
impl Debug for SuperBlock
Source§impl Default for SuperBlock
impl Default for SuperBlock
Source§impl MetaData for SuperBlock
impl MetaData for SuperBlock
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
impl Copy for SuperBlock
Auto Trait Implementations§
impl Freeze for SuperBlock
impl RefUnwindSafe for SuperBlock
impl Send for SuperBlock
impl Sync for SuperBlock
impl Unpin for SuperBlock
impl UnwindSafe for SuperBlock
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)