Inode

Struct Inode 

Source
#[repr(C, packed(1))]
pub struct Inode { pub magic: [u8; 8], pub ino: Option<InodeNumber>, pub ftype: u32, pub size: u64, pub link_count: u64, pub dblocks: [Option<LogicalBlockAddress>; 12], pub iblock: Option<LogicalBlockAddress>, pub diblock: Option<LogicalBlockAddress>, pub _pad: [u8; 112], }
Expand description

Represent a single inode within a inode array.

Fields§

§magic: [u8; 8]

File system magic: “KeOSFFSI”.

§ino: Option<InodeNumber>

The unique inode number assigned to this file or directory.

§ftype: u32

The type of the file (e.g., regular file, directory, symbolic link).

Uses a u32 to store values corresponding to FileType.

§size: u64

The total size of the file in bytes.

§link_count: u64

The number of links alive in the file system.

§dblocks: [Option<LogicalBlockAddress>; 12]

Directly mapped data blocks.

These 12 blocks store the first portions of a file’s data, allowing for efficient access to small files without requiring indirect blocks.

§iblock: Option<LogicalBlockAddress>

An indirect block, which contains pointers to additional data blocks.

This extends the file size capability beyond direct blocks by storing an array of logical block addresses in a separate block.

§diblock: Option<LogicalBlockAddress>

A doubly indirect block, which contains pointers to indirect blocks.

This allows for even larger file sizes by introducing an extra level of indirection.

§_pad: [u8; 112]

A padding to align to the power of two.

Trait Implementations§

Source§

impl Debug for Inode

Source§

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

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

impl Default for Inode

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for Inode

§

impl RefUnwindSafe for Inode

§

impl Send for Inode

§

impl Sync for Inode

§

impl Unpin for Inode

§

impl UnwindSafe for Inode

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.