Struct RemappedFilesystem

Source
pub struct RemappedFilesystem<F, A> {
    pub inner: F,
    pub mapping: BiBTreeMap<u64, u64>,
    pub allocator: A,
}
Expand description

Wraps a Filesystem and remaps its inodes.

Fields§

§inner: F§mapping: BiBTreeMap<u64, u64>§allocator: A

Implementations§

Source§

impl<F, A: InodeAllocator> RemappedFilesystem<F, A>

Source

pub fn new(inner: F, mapping: BiBTreeMap<u64, u64>, allocator: A) -> Self

Source

pub fn ext_to_int<E>(&self, ext: u64) -> Result<u64, Error<E>>

Source

pub fn int_to_ext<E>(&self, int: u64) -> Result<u64, Error<E>>

Source

pub async fn next_ext_ino<E>(&mut self) -> Result<u64, Error<E>>

Trait Implementations§

Source§

impl<A: InodeAllocator + Send + Sync, F: Filesystem + Send + Sync> Filesystem for RemappedFilesystem<F, A>

Source§

type Error = Error<<F as Filesystem>::Error>

Source§

fn inodes<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<BTreeSet<u64>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the set of inodes from the filesystem. Read more
Source§

fn destroy<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Close filesystem. See also fuser::Filesystem::destroy.
Source§

fn lookup<'life0, 'life1, 'async_trait>( &'life0 self, parent: u64, name: &'life1 OsStr, ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::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 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,

Release a file handle. See also fuser::Filesystem::release.
Source§

fn getattr<'life0, 'async_trait>( &'life0 self, ino_ext: u64, ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::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_ext: 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: u64, offset: u64, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = DirEntry> + Send + Sync + '_>, Self::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: u64, fh: u64, offset: i64, size: u32, ) -> Pin<Box<dyn Future<Output = Result<Bytes, Self::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,

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,

Create and open a file. See also fuser::Filesystem::create.
Source§

fn mkdir<'life0, 'async_trait>( &'life0 mut self, parent: u64, name: OsString, ) -> Pin<Box<dyn Future<Output = Result<FileAttr, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a directory. See also fuser::Filesystem::mkdir.
Source§

impl<A: InodeAllocator + Send + Sync, F: Filesystem + Refresh + Send + Sync> Refresh for RemappedFilesystem<F, A>

Source§

type Error = RefreshError<<F as Refresh>::Error, <F as Filesystem>::Error>

Source§

fn cleanup<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Cleanup caches
Source§

fn refresh<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Refresh filesystem

Auto Trait Implementations§

§

impl<F, A> Freeze for RemappedFilesystem<F, A>
where F: Freeze, A: Freeze,

§

impl<F, A> RefUnwindSafe for RemappedFilesystem<F, A>

§

impl<F, A> Send for RemappedFilesystem<F, A>
where F: Send, A: Send,

§

impl<F, A> Sync for RemappedFilesystem<F, A>
where F: Sync, A: Sync,

§

impl<F, A> Unpin for RemappedFilesystem<F, A>
where F: Unpin, A: Unpin,

§

impl<F, A> UnwindSafe for RemappedFilesystem<F, A>
where F: UnwindSafe, A: UnwindSafe,

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<F> InodeAllocator for F
where F: Filesystem + Send + Sync,

Source§

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,

Reserve a continuous number of inodes, returning the start. The range is disjoint from the previously allocated ones.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<_INNER> FilesystemSSUS for _INNER
where _INNER: Filesystem + Send + Sync + Unpin + 'static,