#[repr(C, packed(1))]pub struct Ext2Inode {Show 18 fields
pub mode: u16,
pub uid: u16,
pub size: u32,
pub atime: u32,
pub ctime: u32,
pub mtime: u32,
pub dtime: u32,
pub gid: u16,
pub links_count: u16,
pub blocks: u32,
pub flags: u32,
pub osd1: u32,
pub block: [u32; 15],
pub generation: u32,
pub file_acl: u32,
pub dir_acl: u32,
pub faddr: u32,
pub osd2: [u8; 12],
}Expand description
ext2 Inode structure
Each file and directory is represented by an inode that contains metadata about the file and pointers to its data blocks.
Fields§
§mode: u16File mode (permissions and file type)
uid: u16Owner UID
size: u32Size in bytes
atime: u32Access time
ctime: u32Creation time
mtime: u32Modification time
dtime: u32Deletion time
gid: u16Group ID
links_count: u16Link count
blocks: u32Blocks count (512-byte blocks)
flags: u32File flags
osd1: u32OS dependent 1
block: [u32; 15]Pointers to blocks (0-11 direct, 12 indirect, 13 double indirect, 14 triple indirect)
generation: u32File version (for NFS)
file_acl: u32File ACL
dir_acl: u32Directory ACL / high 32 bits of file size
faddr: u32Fragment address
osd2: [u8; 12]OS dependent 2
Implementations§
Source§impl Ext2Inode
impl Ext2Inode
pub fn empty() -> Self
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self, FileSystemError>
pub fn from_bytes(data: &[u8]) -> Result<Self, FileSystemError>
Parse inode from raw bytes using unsafe type conversion for efficiency
Sourcepub fn get_links_count(&self) -> u16
pub fn get_links_count(&self) -> u16
Get link count
Sourcepub fn get_blocks(&self) -> u32
pub fn get_blocks(&self) -> u32
Get blocks count (512-byte blocks)
Sourcepub fn is_char_device(&self) -> bool
pub fn is_char_device(&self) -> bool
Check if this is a character device
Sourcepub fn is_block_device(&self) -> bool
pub fn is_block_device(&self) -> bool
Check if this is a block device
Sourcepub fn is_symlink(&self) -> bool
pub fn is_symlink(&self) -> bool
Check if this is a symbolic link
Sourcepub fn get_device_info(&self) -> Option<(u32, u32)>
pub fn get_device_info(&self) -> Option<(u32, u32)>
Get device information for device files Returns (major, minor) device numbers
Sourcepub fn read_symlink_target(
&self,
filesystem: &Ext2FileSystem,
) -> Result<String, FileSystemError>
pub fn read_symlink_target( &self, filesystem: &Ext2FileSystem, ) -> Result<String, FileSystemError>
Read symbolic link target from inode
This method handles both fast symlinks (target stored in block array) and slow symlinks (target stored in data blocks).
§Arguments
filesystem- Reference to the ext2 filesystem for block reading
§Returns
The target path of the symbolic link, or an error if this is not a symlink or if the target cannot be read.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ext2Inode
impl RefUnwindSafe for Ext2Inode
impl Send for Ext2Inode
impl Sync for Ext2Inode
impl Unpin for Ext2Inode
impl UnwindSafe for Ext2Inode
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
§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)
clone_to_uninit)