SuperBlock

Struct SuperBlock 

Source
#[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: u64

Total number of blocks in the filesystem.

§block_count_inused: u64

In-used count of blocks in the filesystem.

§inode_count: u64

Total number of inodes in the filesystem.

§inode_count_inused: u64

In-used count of inodes in the filesystem.

§has_journal: u64

A indicator that this filesystem have journaling feature.

§_pad: [u8; 4048]

Padding to align to Block size.

Implementations§

Source§

impl SuperBlock

Source

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 the Disk trait.
§Returns
  • Ok(Box<SuperBlock>): If the superblock is successfully read.
  • Err(KernelError): If any sector read fails.

Trait Implementations§

Source§

impl Clone for SuperBlock

Source§

fn clone(&self) -> SuperBlock

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SuperBlock

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SuperBlock

Source§

fn default() -> Self

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

impl MetaData for SuperBlock

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

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 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> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

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.