pub struct ErofsFilesystem { /* private fields */ }Expand description
The filesystem implementation for an EROFS image.
Implementations§
Source§impl ErofsFilesystem
impl ErofsFilesystem
Sourcepub fn new(reader: Arc<dyn Reader>) -> Result<Self, ErofsError>
pub fn new(reader: Arc<dyn Reader>) -> Result<Self, ErofsError>
Creates a new filesystem instance for an EROFS image from a reader.
Sourcepub fn feature_incompat(&self) -> FeatureIncompat
pub fn feature_incompat(&self) -> FeatureIncompat
Returns the feature incompat flags of the EROFS image.
Sourcepub fn block_size(&self) -> u64
pub fn block_size(&self) -> u64
Returns the block size of the EROFS image.
Sourcepub fn root_node(&self) -> DirectoryNode
pub fn root_node(&self) -> DirectoryNode
Returns the root node of the EROFS image.
pub fn total_bytes(&self) -> u64
pub fn total_inodes(&self) -> u64
Sourcepub fn read_file_range(
&self,
node: &FileNode,
offset: u64,
buf: &mut [u8],
) -> Result<usize, ErofsError>
pub fn read_file_range( &self, node: &FileNode, offset: u64, buf: &mut [u8], ) -> Result<usize, ErofsError>
Reads the data of the given file node into a buffer.
Sourcepub fn read_symlink(&self, node: &SymlinkNode) -> Result<Vec<u8>, ErofsError>
pub fn read_symlink(&self, node: &SymlinkNode) -> Result<Vec<u8>, ErofsError>
Reads the target path of the given symlink node.
Sourcepub fn read_directory(
&self,
node: &DirectoryNode,
entry_offset: usize,
entries: &mut [DirectoryEntry],
) -> Result<usize, ErofsError>
pub fn read_directory( &self, node: &DirectoryNode, entry_offset: usize, entries: &mut [DirectoryEntry], ) -> Result<usize, ErofsError>
Read a number of entries from a directory, starting at entry_offset. Will retrieve up to the number of entries in the directory or the size of the provided buffer, returning the number of entries filled in the buffer. If there are less filled entries then the number of entry slots provided in the buffer, there are no more entries in this directory. Entries are sorted lexicographically. Reads past the end of the number of entries will return zero entries filled.
TODO(https://fxbug.dev/479841115): It is possible for directories to omit their “.” entries in erofs, and in that case there is a flag marking it and we are expected to synthesize it. Parse that flag and implement it. TODO(https://fxbug.dev/479841115): This API is slightly awkward to hold. We should consider making it an iterator interface.
Sourcepub fn lookup(
&self,
dir: &DirectoryNode,
name: &str,
) -> Result<Option<Node>, ErofsError>
pub fn lookup( &self, dir: &DirectoryNode, name: &str, ) -> Result<Option<Node>, ErofsError>
Looks up a node by name in a directory.
Sourcepub fn iter_xattrs<'a>(
&'a self,
node: &NodeInner,
) -> Result<XattrIterator<'a>, ErofsError>
pub fn iter_xattrs<'a>( &'a self, node: &NodeInner, ) -> Result<XattrIterator<'a>, ErofsError>
Returns an iterator over the xattr entry headers for a node.
Sourcepub fn list_xattrs(&self, node: &NodeInner) -> Result<Vec<Vec<u8>>, ErofsError>
pub fn list_xattrs(&self, node: &NodeInner) -> Result<Vec<Vec<u8>>, ErofsError>
List all xattr names for a given node.
Auto Trait Implementations§
impl !RefUnwindSafe for ErofsFilesystem
impl !UnwindSafe for ErofsFilesystem
impl Freeze for ErofsFilesystem
impl Send for ErofsFilesystem
impl Sync for ErofsFilesystem
impl Unpin for ErofsFilesystem
impl UnsafeUnpin for ErofsFilesystem
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, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
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