pub struct FuseFs<P> {
provider: P,
path_by_luid: Bijection<u32, Arc<BlockPath>>,
ruid_by_path: RwLock<Bijection<Arc<BlockPath>, u32>>,
}
Fields§
§provider: P
§path_by_luid: Bijection<u32, Arc<BlockPath>>
§ruid_by_path: RwLock<Bijection<Arc<BlockPath>, u32>>
Implementations§
source§impl<P> FuseFs<P>
impl<P> FuseFs<P>
pub fn new(provider: P, fallback_path: Arc<BlockPath>) -> Self
fn path_from_luid(&self, luid: u32) -> &Arc<BlockPath>
fn luid_from_ruid(&self, ruid: u32) -> Result<u32>
fn convert_ruid(&self, attrs: BlockMetaSecrets) -> Result<BlockMetaSecrets>
fn fuse_entry(&self, attrs: Entry) -> Result<Entry>
Trait Implementations§
source§impl<P: 'static + FsProvider> FileSystem for FuseFs<P>
impl<P: 'static + FsProvider> FileSystem for FuseFs<P>
§type Inode = u64
type Inode = u64
Represents a location in the filesystem tree and can be used to perform operations that act
on the metadata of a file/directory (e.g.,
getattr
and setattr
). Can also be used as the
starting point for looking up paths in the filesystem tree. An Inode
may support operating
directly on the content of the path that to which it points. FileSystem
implementations
that support this should set the FsOptions::ZERO_MESSAGE_OPEN
option in the return value
of the init
function. On linux based systems, an Inode
is equivalent to opening a file
or directory with the libc::O_PATH
flag. Read moresource§fn init(&self, _capable: FsOptions) -> Result<FsOptions>
fn init(&self, _capable: FsOptions) -> Result<FsOptions>
Initialize the file system. Read more
source§fn lookup(
&self,
ctx: &Context,
parent: Self::Inode,
name: &CStr
) -> IoResult<Entry>
fn lookup( &self, ctx: &Context, parent: Self::Inode, name: &CStr ) -> IoResult<Entry>
Look up a directory entry by name and get its attributes. Read more
source§fn forget(&self, ctx: &Context, inode: Self::Inode, count: u64)
fn forget(&self, ctx: &Context, inode: Self::Inode, count: u64)
Forget about an inode. Read more
source§fn create(
&self,
ctx: &Context,
parent: Self::Inode,
name: &CStr,
args: CreateIn
) -> IoResult<(Entry, Option<Self::Handle>, OpenOptions)>
fn create( &self, ctx: &Context, parent: Self::Inode, name: &CStr, args: CreateIn ) -> IoResult<(Entry, Option<Self::Handle>, OpenOptions)>
Create and open a file. Read more
source§fn mkdir(
&self,
ctx: &Context,
parent: Self::Inode,
name: &CStr,
mode: u32,
umask: u32
) -> Result<Entry>
fn mkdir( &self, ctx: &Context, parent: Self::Inode, name: &CStr, mode: u32, umask: u32 ) -> Result<Entry>
Create a directory. Read more
source§fn open(
&self,
ctx: &Context,
inode: Self::Inode,
flags: u32,
_fuse_flags: u32
) -> IoResult<(Option<Self::Handle>, OpenOptions)>
fn open( &self, ctx: &Context, inode: Self::Inode, flags: u32, _fuse_flags: u32 ) -> IoResult<(Option<Self::Handle>, OpenOptions)>
Open a file. Read more
source§fn release(
&self,
ctx: &Context,
inode: Self::Inode,
flags: u32,
handle: Self::Handle,
_flush: bool,
_flock_release: bool,
_lock_owner: Option<u64>
) -> Result<()>
fn release( &self, ctx: &Context, inode: Self::Inode, flags: u32, handle: Self::Handle, _flush: bool, _flock_release: bool, _lock_owner: Option<u64> ) -> Result<()>
Release an open file. Read more
source§fn opendir(
&self,
ctx: &Context,
inode: Self::Inode,
flags: u32
) -> IoResult<(Option<Self::Handle>, OpenOptions)>
fn opendir( &self, ctx: &Context, inode: Self::Inode, flags: u32 ) -> IoResult<(Option<Self::Handle>, OpenOptions)>
Open a directory for reading. Read more
source§fn releasedir(
&self,
ctx: &Context,
inode: Self::Inode,
_flags: u32,
handle: Self::Handle
) -> Result<()>
fn releasedir( &self, ctx: &Context, inode: Self::Inode, _flags: u32, handle: Self::Handle ) -> Result<()>
Release an open directory. Read more
source§fn read(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
w: &mut dyn ZeroCopyWriter,
size: u32,
offset: u64,
_lock_owner: Option<u64>,
_flags: u32
) -> IoResult<usize>
fn read( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, w: &mut dyn ZeroCopyWriter, size: u32, offset: u64, _lock_owner: Option<u64>, _flags: u32 ) -> IoResult<usize>
Read data from a file. Read more
source§fn write(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
r: &mut dyn ZeroCopyReader,
size: u32,
offset: u64,
_lock_owner: Option<u64>,
_delayed_write: bool,
_flags: u32,
_fuse_flags: u32
) -> IoResult<usize>
fn write( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, r: &mut dyn ZeroCopyReader, size: u32, offset: u64, _lock_owner: Option<u64>, _delayed_write: bool, _flags: u32, _fuse_flags: u32 ) -> IoResult<usize>
Write data to a file. Read more
source§fn flush(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
_lock_owner: u64
) -> Result<()>
fn flush( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, _lock_owner: u64 ) -> Result<()>
Flush the contents of a file. Read more
source§fn readdir(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
size: u32,
offset: u64,
add_entry: &mut dyn FnMut(DirEntry<'_>) -> Result<usize>
) -> Result<()>
fn readdir( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, size: u32, offset: u64, add_entry: &mut dyn FnMut(DirEntry<'_>) -> Result<usize> ) -> Result<()>
Read a directory. Read more
source§fn link(
&self,
ctx: &Context,
inode: Self::Inode,
new_parent: Self::Inode,
new_name: &CStr
) -> Result<Entry>
fn link( &self, ctx: &Context, inode: Self::Inode, new_parent: Self::Inode, new_name: &CStr ) -> Result<Entry>
Create a hard link. Read more
source§fn unlink(&self, ctx: &Context, parent: Self::Inode, name: &CStr) -> Result<()>
fn unlink(&self, ctx: &Context, parent: Self::Inode, name: &CStr) -> Result<()>
Remove a file. Read more
source§fn rmdir(&self, ctx: &Context, parent: Self::Inode, name: &CStr) -> Result<()>
fn rmdir(&self, ctx: &Context, parent: Self::Inode, name: &CStr) -> Result<()>
Remove a directory. Read more
source§fn rename(
&self,
ctx: &Context,
olddir: Self::Inode,
oldname: &CStr,
newdir: Self::Inode,
newname: &CStr,
_flags: u32
) -> Result<()>
fn rename( &self, ctx: &Context, olddir: Self::Inode, oldname: &CStr, newdir: Self::Inode, newname: &CStr, _flags: u32 ) -> Result<()>
Rename a file / directory. Read more
source§fn getattr(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Option<Self::Handle>
) -> IoResult<(stat64, Duration)>
fn getattr( &self, ctx: &Context, inode: Self::Inode, handle: Option<Self::Handle> ) -> IoResult<(stat64, Duration)>
Get attributes for a file / directory. Read more
source§fn setattr(
&self,
ctx: &Context,
inode: Self::Inode,
attr: stat64,
handle: Option<Self::Handle>,
valid: SetattrValid
) -> IoResult<(stat64, Duration)>
fn setattr( &self, ctx: &Context, inode: Self::Inode, attr: stat64, handle: Option<Self::Handle>, valid: SetattrValid ) -> IoResult<(stat64, Duration)>
Set attributes for a file / directory. Read more
source§fn fsync(
&self,
ctx: &Context,
inode: Self::Inode,
_datasync: bool,
handle: Self::Handle
) -> IoResult<()>
fn fsync( &self, ctx: &Context, inode: Self::Inode, _datasync: bool, handle: Self::Handle ) -> IoResult<()>
Synchronize file contents. Read more
source§fn fsyncdir(
&self,
ctx: &Context,
inode: Self::Inode,
datasync: bool,
handle: Self::Handle
) -> IoResult<()>
fn fsyncdir( &self, ctx: &Context, inode: Self::Inode, datasync: bool, handle: Self::Handle ) -> IoResult<()>
Synchronize the contents of a directory. Read more
source§fn fallocate(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
mode: u32,
offset: u64,
length: u64
) -> IoResult<()>
fn fallocate( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, mode: u32, offset: u64, length: u64 ) -> IoResult<()>
Allocate requested space for file data. Read more
§fn batch_forget(&self, ctx: &Context, requests: Vec<(Self::Inode, u64), Global>)
fn batch_forget(&self, ctx: &Context, requests: Vec<(Self::Inode, u64), Global>)
Forget about multiple inodes. Read more
§fn readlink(
&self,
ctx: &Context,
inode: Self::Inode
) -> Result<Vec<u8, Global>, Error>
fn readlink( &self, ctx: &Context, inode: Self::Inode ) -> Result<Vec<u8, Global>, Error>
Read a symbolic link.
§fn symlink(
&self,
ctx: &Context,
linkname: &CStr,
parent: Self::Inode,
name: &CStr
) -> Result<Entry, Error>
fn symlink( &self, ctx: &Context, linkname: &CStr, parent: Self::Inode, name: &CStr ) -> Result<Entry, Error>
Create a symbolic link. Read more
§fn mknod(
&self,
ctx: &Context,
inode: Self::Inode,
name: &CStr,
mode: u32,
rdev: u32,
umask: u32
) -> Result<Entry, Error>
fn mknod( &self, ctx: &Context, inode: Self::Inode, name: &CStr, mode: u32, rdev: u32, umask: u32 ) -> Result<Entry, Error>
Create a file node. Read more
§fn statfs(&self, ctx: &Context, inode: Self::Inode) -> Result<statvfs64, Error>
fn statfs(&self, ctx: &Context, inode: Self::Inode) -> Result<statvfs64, Error>
Get information about the file system.
§fn setxattr(
&self,
ctx: &Context,
inode: Self::Inode,
name: &CStr,
value: &[u8],
flags: u32
) -> Result<(), Error>
fn setxattr( &self, ctx: &Context, inode: Self::Inode, name: &CStr, value: &[u8], flags: u32 ) -> Result<(), Error>
Set an extended attribute. Read more
§fn getxattr(
&self,
ctx: &Context,
inode: Self::Inode,
name: &CStr,
size: u32
) -> Result<GetxattrReply, Error>
fn getxattr( &self, ctx: &Context, inode: Self::Inode, name: &CStr, size: u32 ) -> Result<GetxattrReply, Error>
Get an extended attribute. Read more
§fn listxattr(
&self,
ctx: &Context,
inode: Self::Inode,
size: u32
) -> Result<ListxattrReply, Error>
fn listxattr( &self, ctx: &Context, inode: Self::Inode, size: u32 ) -> Result<ListxattrReply, Error>
List extended attribute names. Read more
§fn removexattr(
&self,
ctx: &Context,
inode: Self::Inode,
name: &CStr
) -> Result<(), Error>
fn removexattr( &self, ctx: &Context, inode: Self::Inode, name: &CStr ) -> Result<(), Error>
Remove an extended attribute. Read more
§fn readdirplus(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
size: u32,
offset: u64,
add_entry: &mut dyn FnMut(DirEntry<'_>, Entry) -> Result<usize, Error>
) -> Result<(), Error>
fn readdirplus( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, size: u32, offset: u64, add_entry: &mut dyn FnMut(DirEntry<'_>, Entry) -> Result<usize, Error> ) -> Result<(), Error>
Read a directory with entry attributes. Read more
§fn access(
&self,
ctx: &Context,
inode: Self::Inode,
mask: u32
) -> Result<(), Error>
fn access( &self, ctx: &Context, inode: Self::Inode, mask: u32 ) -> Result<(), Error>
Check file access permissions. Read more
§fn lseek(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
offset: u64,
whence: u32
) -> Result<u64, Error>
fn lseek( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, offset: u64, whence: u32 ) -> Result<u64, Error>
Reposition read/write file offset.
§fn getlk(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
owner: u64,
lock: FileLock,
flags: u32
) -> Result<FileLock, Error>
fn getlk( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, owner: u64, lock: FileLock, flags: u32 ) -> Result<FileLock, Error>
Query file lock status
§fn setlk(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
owner: u64,
lock: FileLock,
flags: u32
) -> Result<(), Error>
fn setlk( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, owner: u64, lock: FileLock, flags: u32 ) -> Result<(), Error>
Grab a file read lock
§fn setlkw(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
owner: u64,
lock: FileLock,
flags: u32
) -> Result<(), Error>
fn setlkw( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, owner: u64, lock: FileLock, flags: u32 ) -> Result<(), Error>
Grab a file write lock
§fn ioctl(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
flags: u32,
cmd: u32,
data: IoctlData<'_>,
out_size: u32
) -> Result<IoctlData<'_>, Error>
fn ioctl( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, flags: u32, cmd: u32, data: IoctlData<'_>, out_size: u32 ) -> Result<IoctlData<'_>, Error>
send ioctl to the file
§fn bmap(
&self,
ctx: &Context,
inode: Self::Inode,
block: u64,
blocksize: u32
) -> Result<u64, Error>
fn bmap( &self, ctx: &Context, inode: Self::Inode, block: u64, blocksize: u32 ) -> Result<u64, Error>
Query a file’s block mapping info
§fn poll(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
khandle: Self::Handle,
flags: u32,
events: u32
) -> Result<u32, Error>
fn poll( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, khandle: Self::Handle, flags: u32, events: u32 ) -> Result<u32, Error>
Poll a file’s events
§fn notify_reply(&self) -> Result<(), Error>
fn notify_reply(&self) -> Result<(), Error>
TODO: support this
impl<P: Sync> Sync for FuseFs<P>
Auto Trait Implementations§
impl<P> RefUnwindSafe for FuseFs<P>where P: RefUnwindSafe,
impl<P> Send for FuseFs<P>where P: Send,
impl<P> Unpin for FuseFs<P>where P: Unpin,
impl<P> UnwindSafe for FuseFs<P>where P: UnwindSafe,
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