pub struct SquashFs<R: Manager> {
pub superblock: SuperBlock,
pub inode_table: InodeTable,
pub fragments_table: FragmentsTable,
pub directory_tables: BTreeMap<u32, DirectoryTable>,
pub handles: RwLock<BTreeMap<u64, ReadFlags>>,
/* private fields */
}Expand description
Base structure representing a loaded SquashFS image.
Note that the tables (inode, directory…) are fully parsed on creation and kept in memory, rather than being accessed lazily.
This implements the fuser_async::Filesystem trait.
The type R is a deadpool pool manager for the underlying filesystem readers.
See crate::pools.
Fields§
§superblock: SuperBlock§inode_table: InodeTable§fragments_table: FragmentsTable§directory_tables: BTreeMap<u32, DirectoryTable>Table for each directory inode
handles: RwLock<BTreeMap<u64, ReadFlags>>Implementations§
Source§impl<T: AsyncSeekBufRead, R: Manager<Type = T, Error = Error> + Send + Sync> SquashFs<R>
impl<T: AsyncSeekBufRead, R: Manager<Type = T, Error = Error> + Send + Sync> SquashFs<R>
Sourcepub async fn read_file(
&self,
inode: u32,
offset: usize,
size: usize,
flags: ReadFlags,
compression: Compression,
) -> Result<Bytes, Error>
pub async fn read_file( &self, inode: u32, offset: usize, size: usize, flags: ReadFlags, compression: Compression, ) -> Result<Bytes, Error>
Read from a file from the archive
pub async fn read_file_impl( &self, file: &Box<dyn FileInode + Send + Sync>, __arg2: (impl AsyncSeekBufRead, u64), inode: u32, __arg4: (usize, usize), compression: Compression, ) -> Result<Bytes, Error>
Source§impl<R: Manager> SquashFs<R>
impl<R: Manager> SquashFs<R>
Sourcepub fn ino_to_fuse(&self, ino: u32) -> u64
pub fn ino_to_fuse(&self, ino: u32) -> u64
Remapping to ensure that the root inode is fuser::FUSE_ROOT_ID
Source§impl<T, R> SquashFs<R>
impl<T, R> SquashFs<R>
pub async fn has_handles(&self) -> bool
Sourcepub async fn from_reader(
options: &Options,
manager_factory: impl ManagerFactory<R>,
) -> Result<Self, Error>
pub async fn from_reader( options: &Options, manager_factory: impl ManagerFactory<R>, ) -> Result<Self, Error>
Open squashfs image from a reader factory, responsible for creating readers with the requested open flags.
Trait Implementations§
Source§impl<T: AsyncSeekBufRead, R: Manager<Type = T, Error = Error> + Send + Sync> Filesystem for SquashFs<R>
impl<T: AsyncSeekBufRead, R: Manager<Type = T, Error = Error> + Send + Sync> Filesystem for SquashFs<R>
type Error = Error
Source§fn inodes<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BTreeSet<u64>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn inodes<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BTreeSet<u64>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the set of inodes from the filesystem. Read more
Source§fn open<'life0, 'async_trait>(
&'life0 self,
_ino: u64,
flags: i32,
) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn open<'life0, 'async_trait>(
&'life0 self,
_ino: u64,
flags: i32,
) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Open a file and get a handle. See also
fuser::Filesystem::open.Source§fn release<'life0, 'async_trait>(
&'life0 self,
_ino: u64,
fh: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn release<'life0, 'async_trait>(
&'life0 self,
_ino: u64,
fh: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Release a file handle. See also
fuser::Filesystem::release.Source§fn lookup<'life0, 'life1, 'async_trait>(
&'life0 self,
parent: u64,
name: &'life1 OsStr,
) -> Pin<Box<dyn Future<Output = Result<FileAttr, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn lookup<'life0, 'life1, 'async_trait>(
&'life0 self,
parent: u64,
name: &'life1 OsStr,
) -> Pin<Box<dyn Future<Output = Result<FileAttr, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Lookup an entry by name in a directory. See also
fuser::Filesystem::lookup.Source§fn getattr<'life0, 'async_trait>(
&'life0 self,
ino_fuse: u64,
) -> Pin<Box<dyn Future<Output = Result<FileAttr, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn getattr<'life0, 'async_trait>(
&'life0 self,
ino_fuse: u64,
) -> Pin<Box<dyn Future<Output = Result<FileAttr, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get attributes on an entry. See also
fuser::Filesystem::getattr.Source§fn setattr<'life0, 'async_trait>(
&'life0 mut self,
_ino: u64,
_size: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn setattr<'life0, 'async_trait>(
&'life0 mut self,
_ino: u64,
_size: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set attributes. Currently only supports setting the size
Source§fn readdir<'life0, 'async_trait>(
&'life0 self,
ino_fuse: u64,
offset: u64,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = DirEntry> + Send + Sync + '_>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn readdir<'life0, 'async_trait>(
&'life0 self,
ino_fuse: u64,
offset: u64,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = DirEntry> + Send + Sync + '_>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Read a directory.
To be called repeatedly by specifying a gradually increasing offset,
until the returned iterator is empty. A minimum of two calls is required
to be certain that the end has been reached.
offset represents the index of the starting element.
See also fuser::Filesystem::readdir.Source§fn read<'life0, 'async_trait>(
&'life0 self,
ino_fuse: u64,
fh: u64,
offset: i64,
size: u32,
) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read<'life0, 'async_trait>(
&'life0 self,
ino_fuse: u64,
fh: u64,
offset: i64,
size: u32,
) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Read from a file. See also
fuser::Filesystem::read.Source§fn write<'life0, 'async_trait>(
&'life0 self,
_ino: u64,
_fh: u64,
_data: Bytes,
_offset: i64,
) -> Pin<Box<dyn Future<Output = Result<u32, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn write<'life0, 'async_trait>(
&'life0 self,
_ino: u64,
_fh: u64,
_data: Bytes,
_offset: i64,
) -> Pin<Box<dyn Future<Output = Result<u32, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Write to file. See also
fuser::Filesystem::write.Source§fn create<'life0, 'async_trait>(
&'life0 mut self,
_parent: u64,
_name: OsString,
_mode: u32,
_umask: u32,
_flags: i32,
) -> Pin<Box<dyn Future<Output = Result<(FileAttr, u64), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create<'life0, 'async_trait>(
&'life0 mut self,
_parent: u64,
_name: OsString,
_mode: u32,
_umask: u32,
_flags: i32,
) -> Pin<Box<dyn Future<Output = Result<(FileAttr, u64), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create and open a file. See also
fuser::Filesystem::create.Auto Trait Implementations§
impl<R> !Freeze for SquashFs<R>
impl<R> !RefUnwindSafe for SquashFs<R>
impl<R> Send for SquashFs<R>
impl<R> Sync for SquashFs<R>
impl<R> Unpin for SquashFs<R>
impl<R> !UnwindSafe for SquashFs<R>
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
Mutably borrows from an owned value. Read more
Source§impl<F> InodeAllocator for F
impl<F> InodeAllocator for F
type Error = <F as Filesystem>::Error
Source§fn allocate<'life0, 'async_trait>(
&'life0 mut self,
_n: usize,
) -> Pin<Box<dyn Future<Output = Result<u64, <F as InodeAllocator>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
F: 'async_trait,
fn allocate<'life0, 'async_trait>(
&'life0 mut self,
_n: usize,
) -> Pin<Box<dyn Future<Output = Result<u64, <F as InodeAllocator>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
F: 'async_trait,
Reserve a continuous number of inodes, returning the start.
The range is disjoint from the previously allocated ones.
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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