pub struct Inode {Show 18 fields
pub mode: u16,
pub uid: u32,
pub gid: u32,
pub size: u64,
pub atime: Timestamp,
pub ctime: Timestamp,
pub mtime: Timestamp,
pub dtime: u32,
pub crtime: Timestamp,
pub links_count: u16,
pub blocks_count: u64,
pub flags: InodeFlags,
pub i_block: [u8; 60],
pub generation: u32,
pub file_acl: u64,
pub extra_isize: u16,
pub checksum: u32,
pub projid: u32,
}Expand description
Parsed on-disk ext4 inode (128-byte base + optional extended fields).
Fields§
§mode: u16§uid: u32§gid: u32§size: u64Full 64-bit file size (i_size_lo | i_size_hi << 32).
atime: Timestamp§ctime: Timestamp§mtime: Timestamp§dtime: u32Deletion time (raw 32-bit seconds; 0 = not deleted).
crtime: TimestampCreation time — only valid when extra_isize >= 28.
links_count: u16§blocks_count: u64Full 48-bit block count in 512-byte units (i_blocks_lo | i_blocks_hi << 32).
flags: InodeFlags§i_block: [u8; 60]§generation: u32§file_acl: u64§extra_isize: u16§checksum: u32Combined 32-bit checksum (lo 16 at 0x7C, hi 16 at 0x82).
projid: u32Implementations§
Source§impl Inode
impl Inode
Sourcepub fn parse(buf: &[u8], inode_size: u16) -> Result<Self>
pub fn parse(buf: &[u8], inode_size: u16) -> Result<Self>
Parse an inode from buf.
inode_size is the value from the superblock (s_inode_size); it
determines how many bytes are available for extended fields.
Sourcepub fn mode_permissions(&self) -> u16
pub fn mode_permissions(&self) -> u16
Extract the permission bits (low 12 bits of i_mode).
Sourcepub fn uses_extents(&self) -> bool
pub fn uses_extents(&self) -> bool
True if this inode uses the extent tree (EXTENTS flag set).
Sourcepub fn has_inline_data(&self) -> bool
pub fn has_inline_data(&self) -> bool
True if this inode stores data inline in i_block.
Sourcepub fn is_deleted(&self) -> bool
pub fn is_deleted(&self) -> bool
True if the inode has been deleted (dtime != 0).
This is the authoritative deletion marker in ext4. When the kernel
deletes a file, it sets dtime to the current time. An inode with
links_count == 0 but dtime == 0 is an orphan (unlinked while
still open, or system crashed mid-deletion) — a forensically distinct
state. Use [is_orphan] to detect those.
Sourcepub fn verify_checksum(
&self,
raw_buf: &[u8],
uuid: &[u8; 16],
ino: u32,
generation: u32,
csum_seed: u32,
) -> bool
pub fn verify_checksum( &self, raw_buf: &[u8], uuid: &[u8; 16], ino: u32, generation: u32, csum_seed: u32, ) -> bool
Verify the inode’s CRC32C checksum (METADATA_CSUM feature).
The algorithm:
- Seed from
csum_seed(orcrc32c(0xFFFFFFFF, uuid)if zero) - Feed
le32(ino)thenle32(generation) - Feed the full raw inode bytes with both checksum fields zeroed
- Compare the 32-bit result against
self.checksum
Sourcepub fn is_orphan(&self) -> bool
pub fn is_orphan(&self) -> bool
True if the inode is an orphan: unlinked (links_count == 0) but
never fully deleted (dtime == 0) and still has content (mode != 0).
Orphans typically result from:
- A file unlinked while still held open by a process (common temp file pattern)
- A system crash during file deletion before
dtimewas written - An unclean shutdown leaving inodes in the orphan list
Forensically distinct from deleted inodes — orphans were not intentionally removed by the user/process at the time of imaging.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Inode
impl RefUnwindSafe for Inode
impl Send for Inode
impl Sync for Inode
impl Unpin for Inode
impl UnsafeUnpin for Inode
impl UnwindSafe for Inode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more