#[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: u32The type of the file (e.g., regular file, directory, symbolic link).
Uses a u32 to store values corresponding to FileType.
size: u64The total size of the file in bytes.
link_count: u64The 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.