Skip to main content

DirReader

Struct DirReader 

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

Implementations§

Source§

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

Source

pub fn new(inode_reader: InodeReader<R>) -> Self

Wrap an InodeReader to provide directory-level access.

Source

pub fn inode_reader(&self) -> &InodeReader<R>

Borrow the underlying InodeReader.

Source

pub fn inode_reader_mut(&mut self) -> &mut InodeReader<R>

Mutably borrow the underlying InodeReader.

Source

pub fn read_dir(&self, dir_ino: u64) -> Result<Vec<DirEntry>>

Read all (live) directory entries from inode dir_ino.

Reads the inode’s data blocks and calls parse_dir_block on each block-sized chunk, then filters out deleted entries (inode == 0).

Source

pub fn lookup(&self, dir_ino: u64, name: &[u8]) -> Result<Option<u64>>

Look up a single name in directory inode dir_ino.

Returns Ok(Some(ino)) when found, Ok(None) when not found.

Source

pub fn resolve_path(&self, path: &str) -> Result<u64>

Resolve an absolute path to an inode number.

Always starts at inode 2 (root). Follows symlinks up to MAX_SYMLINK_DEPTH times. Returns Ext4Error::PathNotFound when any component is missing.

Read the target of a symlink inode.

For short symlinks (size <= 60 and no extents), the path is stored inline in i_block. Otherwise it is read from the data blocks.

Auto Trait Implementations§

§

impl<R> !Freeze for DirReader<R>

§

impl<R> RefUnwindSafe for DirReader<R>

§

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

§

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

§

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

§

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

§

impl<R> UnwindSafe for DirReader<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.