Skip to main content

InodeReader

Struct InodeReader 

Source
pub struct InodeReader<R: Read + Seek> { /* private fields */ }

Implementations§

Source§

impl<R: Read + Seek> InodeReader<R>

Source

pub fn new(br: BlockReader<R>) -> Self

Wrap a BlockReader to provide inode-level access.

Source

pub fn block_reader(&self) -> &BlockReader<R>

Borrow the underlying BlockReader.

Source

pub fn block_reader_mut(&mut self) -> &mut BlockReader<R>

Mutably borrow the underlying BlockReader.

Source

pub fn read_inode(&self, ino: u64) -> Result<Inode>

Read and parse inode ino (1-based).

Returns Ext4Error::InodeOutOfRange when ino == 0 or exceeds the filesystem’s inode count.

Source

pub fn read_inode_raw(&self, ino: u64) -> Result<Vec<u8>>

Read the raw inode bytes for an inode number. Returns the full inode-sized buffer from the inode table.

Source

pub fn inode_block_map(&self, ino: u64) -> Result<Vec<BlockMapping>>

Return the full logical→physical block mapping for inode ino.

Source

pub fn walk_extent_tree(&self, i_block: &[u8; 60]) -> Result<Vec<BlockMapping>>

Walk the extent tree rooted at i_block (60-byte raw field).

The first 12 bytes are the ExtentHeader; subsequent 12-byte slots are either ExtentLeaf entries (depth == 0) or ExtentIndex entries (depth > 0) whose child blocks must be read and recursed into.

Source

pub fn walk_indirect_blocks( &self, i_block: &[u8; 60], ) -> Result<Vec<BlockMapping>>

Walk legacy indirect-block pointers stored in i_block (60 bytes).

Layout (u32 LE pointers):

  • offsets 0..48 (12 direct pointers)
  • offset 48 single-indirect pointer
  • offset 52 double-indirect pointer
  • offset 56 triple-indirect pointer
Source

pub fn read_inode_data(&self, ino: u64) -> Result<Vec<u8>>

Read the entire data of inode ino, truncated to inode.size.

For inodes with the INLINE_DATA flag the content is the first size bytes of i_block (up to 60 bytes), returned directly.

Source

pub fn read_inode_data_range( &self, ino: u64, offset: u64, len: usize, ) -> Result<Vec<u8>>

Read a byte range [offset, offset+len) from inode ino’s data.

This is more efficient than read_inode_data for partial reads (e.g. FUSE read calls) because it skips blocks that fall entirely outside the requested window.

Source

pub fn is_inode_allocated(&self, ino: u64) -> Result<bool>

Return true if inode ino (1-based) is marked allocated in its group’s inode bitmap.

Source

pub fn is_block_allocated(&self, block: u64) -> Result<bool>

Return true if block block is marked allocated in its group’s block bitmap.

Source

pub fn iter_inodes_in_group(&self, group: u32) -> Result<Vec<(u64, Inode)>>

Return all valid inodes in group as (ino, Inode) pairs.

An entry is skipped when mode == 0 && dtime == 0 (empty slot).

Source

pub fn iter_all_inodes(&self) -> Result<Vec<(u64, Inode)>>

Return all valid inodes across all block groups.

Auto Trait Implementations§

§

impl<R> !Freeze for InodeReader<R>

§

impl<R> RefUnwindSafe for InodeReader<R>

§

impl<R> Send for InodeReader<R>
where R: Send,

§

impl<R> Sync for InodeReader<R>
where R: Send,

§

impl<R> Unpin for InodeReader<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for InodeReader<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for InodeReader<R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.