Struct fuse_backend_rs::api::vfs::Vfs
source · pub struct Vfs { /* private fields */ }
Expand description
A union fs that combines multiple backend file systems.
Implementations§
source§impl Vfs
impl Vfs
sourcepub fn new(opts: VfsOptions) -> Self
pub fn new(opts: VfsOptions) -> Self
Create a new vfs instance
sourcepub fn set_remove_pseudo_root(&mut self)
pub fn set_remove_pseudo_root(&mut self)
mark remove pseudo root inode when umount
sourcepub fn initialized(&self) -> bool
pub fn initialized(&self) -> bool
For sake of live-upgrade, only after negotiation is done, it’s safe to persist state of vfs.
sourcepub fn options(&self) -> VfsOptions
pub fn options(&self) -> VfsOptions
Get a snapshot of the current vfs options.
sourcepub fn mount(&self, fs: BackFileSystem, path: &str) -> VfsResult<VfsIndex>
pub fn mount(&self, fs: BackFileSystem, path: &str) -> VfsResult<VfsIndex>
Mount a backend file system to path
sourcepub fn get_rootfs(&self, path: &str) -> VfsResult<Option<Arc<BackFileSystem>>>
pub fn get_rootfs(&self, path: &str) -> VfsResult<Option<Arc<BackFileSystem>>>
Get the mounted backend file system alongside the path if there’s one.
sourcepub fn get_root_pseudofs(&self) -> &PseudoFs
pub fn get_root_pseudofs(&self) -> &PseudoFs
Get the root pseudo fs’s reference in vfs
Trait Implementations§
source§impl FileSystem for Vfs
impl FileSystem for Vfs
source§type Inode = VfsInode
type Inode = VfsInode
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 lookup(&self, ctx: &Context, parent: VfsInode, name: &CStr) -> Result<Entry>
fn lookup(&self, ctx: &Context, parent: VfsInode, name: &CStr) -> Result<Entry>
Look up a directory entry by name and get its attributes. Read more
source§fn getattr(
&self,
ctx: &Context,
inode: VfsInode,
handle: Option<u64>,
) -> Result<(stat64, Duration)>
fn getattr( &self, ctx: &Context, inode: VfsInode, handle: Option<u64>, ) -> Result<(stat64, Duration)>
Get attributes for a file / directory. Read more
source§fn setattr(
&self,
ctx: &Context,
inode: VfsInode,
attr: stat64,
handle: Option<u64>,
valid: SetattrValid,
) -> Result<(stat64, Duration)>
fn setattr( &self, ctx: &Context, inode: VfsInode, attr: stat64, handle: Option<u64>, valid: SetattrValid, ) -> Result<(stat64, Duration)>
Set attributes for a file / directory. Read more
source§fn symlink(
&self,
ctx: &Context,
linkname: &CStr,
parent: VfsInode,
name: &CStr,
) -> Result<Entry>
fn symlink( &self, ctx: &Context, linkname: &CStr, parent: VfsInode, name: &CStr, ) -> Result<Entry>
Create a symbolic link. Read more
source§fn mknod(
&self,
ctx: &Context,
inode: VfsInode,
name: &CStr,
mode: u32,
rdev: u32,
umask: u32,
) -> Result<Entry>
fn mknod( &self, ctx: &Context, inode: VfsInode, name: &CStr, mode: u32, rdev: u32, umask: u32, ) -> Result<Entry>
Create a file node. Read more
source§fn mkdir(
&self,
ctx: &Context,
parent: VfsInode,
name: &CStr,
mode: u32,
umask: u32,
) -> Result<Entry>
fn mkdir( &self, ctx: &Context, parent: VfsInode, name: &CStr, mode: u32, umask: u32, ) -> Result<Entry>
Create a directory. Read more
source§fn unlink(&self, ctx: &Context, parent: VfsInode, name: &CStr) -> Result<()>
fn unlink(&self, ctx: &Context, parent: VfsInode, name: &CStr) -> Result<()>
Remove a file. Read more
source§fn rmdir(&self, ctx: &Context, parent: VfsInode, name: &CStr) -> Result<()>
fn rmdir(&self, ctx: &Context, parent: VfsInode, name: &CStr) -> Result<()>
Remove a directory. Read more
source§fn rename(
&self,
ctx: &Context,
olddir: VfsInode,
oldname: &CStr,
newdir: VfsInode,
newname: &CStr,
flags: u32,
) -> Result<()>
fn rename( &self, ctx: &Context, olddir: VfsInode, oldname: &CStr, newdir: VfsInode, newname: &CStr, flags: u32, ) -> Result<()>
Rename a file / directory. Read more
source§fn link(
&self,
ctx: &Context,
inode: VfsInode,
newparent: VfsInode,
newname: &CStr,
) -> Result<Entry>
fn link( &self, ctx: &Context, inode: VfsInode, newparent: VfsInode, newname: &CStr, ) -> Result<Entry>
Create a hard link. Read more
source§fn open(
&self,
ctx: &Context,
inode: VfsInode,
flags: u32,
fuse_flags: u32,
) -> Result<(Option<u64>, OpenOptions, Option<u32>)>
fn open( &self, ctx: &Context, inode: VfsInode, flags: u32, fuse_flags: u32, ) -> Result<(Option<u64>, OpenOptions, Option<u32>)>
Open a file. Read more
source§fn create(
&self,
ctx: &Context,
parent: VfsInode,
name: &CStr,
args: CreateIn,
) -> Result<(Entry, Option<u64>, OpenOptions, Option<u32>)>
fn create( &self, ctx: &Context, parent: VfsInode, name: &CStr, args: CreateIn, ) -> Result<(Entry, Option<u64>, OpenOptions, Option<u32>)>
Create and open a file. Read more
source§fn read(
&self,
ctx: &Context,
inode: VfsInode,
handle: u64,
w: &mut dyn ZeroCopyWriter,
size: u32,
offset: u64,
lock_owner: Option<u64>,
flags: u32,
) -> Result<usize>
fn read( &self, ctx: &Context, inode: VfsInode, handle: u64, w: &mut dyn ZeroCopyWriter, size: u32, offset: u64, lock_owner: Option<u64>, flags: u32, ) -> Result<usize>
Read data from a file. Read more
source§fn write(
&self,
ctx: &Context,
inode: VfsInode,
handle: u64,
r: &mut dyn ZeroCopyReader,
size: u32,
offset: u64,
lock_owner: Option<u64>,
delayed_write: bool,
flags: u32,
fuse_flags: u32,
) -> Result<usize>
fn write( &self, ctx: &Context, inode: VfsInode, handle: u64, r: &mut dyn ZeroCopyReader, size: u32, offset: u64, lock_owner: Option<u64>, delayed_write: bool, flags: u32, fuse_flags: u32, ) -> Result<usize>
Write data to a file. Read more
source§fn flush(
&self,
ctx: &Context,
inode: VfsInode,
handle: u64,
lock_owner: u64,
) -> Result<()>
fn flush( &self, ctx: &Context, inode: VfsInode, handle: u64, lock_owner: u64, ) -> Result<()>
Flush the contents of a file. Read more
source§fn fsync(
&self,
ctx: &Context,
inode: VfsInode,
datasync: bool,
handle: u64,
) -> Result<()>
fn fsync( &self, ctx: &Context, inode: VfsInode, datasync: bool, handle: u64, ) -> Result<()>
Synchronize file contents. Read more
source§fn fallocate(
&self,
ctx: &Context,
inode: VfsInode,
handle: u64,
mode: u32,
offset: u64,
length: u64,
) -> Result<()>
fn fallocate( &self, ctx: &Context, inode: VfsInode, handle: u64, mode: u32, offset: u64, length: u64, ) -> Result<()>
Allocate requested space for file data. Read more
source§fn release(
&self,
ctx: &Context,
inode: VfsInode,
flags: u32,
handle: u64,
flush: bool,
flock_release: bool,
lock_owner: Option<u64>,
) -> Result<()>
fn release( &self, ctx: &Context, inode: VfsInode, flags: u32, handle: u64, flush: bool, flock_release: bool, lock_owner: Option<u64>, ) -> Result<()>
Release an open file. Read more
source§fn statfs(&self, ctx: &Context, inode: VfsInode) -> Result<statvfs64>
fn statfs(&self, ctx: &Context, inode: VfsInode) -> Result<statvfs64>
Get information about the file system.
source§fn setxattr(
&self,
ctx: &Context,
inode: VfsInode,
name: &CStr,
value: &[u8],
flags: u32,
) -> Result<()>
fn setxattr( &self, ctx: &Context, inode: VfsInode, name: &CStr, value: &[u8], flags: u32, ) -> Result<()>
Set an extended attribute. Read more
source§fn getxattr(
&self,
ctx: &Context,
inode: VfsInode,
name: &CStr,
size: u32,
) -> Result<GetxattrReply>
fn getxattr( &self, ctx: &Context, inode: VfsInode, name: &CStr, size: u32, ) -> Result<GetxattrReply>
Get an extended attribute. Read more
source§fn listxattr(
&self,
ctx: &Context,
inode: VfsInode,
size: u32,
) -> Result<ListxattrReply>
fn listxattr( &self, ctx: &Context, inode: VfsInode, size: u32, ) -> Result<ListxattrReply>
List extended attribute names. Read more
source§fn removexattr(&self, ctx: &Context, inode: VfsInode, name: &CStr) -> Result<()>
fn removexattr(&self, ctx: &Context, inode: VfsInode, name: &CStr) -> Result<()>
Remove an extended attribute. Read more
source§fn opendir(
&self,
ctx: &Context,
inode: VfsInode,
flags: u32,
) -> Result<(Option<u64>, OpenOptions)>
fn opendir( &self, ctx: &Context, inode: VfsInode, flags: u32, ) -> Result<(Option<u64>, OpenOptions)>
Open a directory for reading. Read more
source§fn readdir(
&self,
ctx: &Context,
inode: VfsInode,
handle: u64,
size: u32,
offset: u64,
add_entry: &mut dyn FnMut(DirEntry<'_>) -> Result<usize>,
) -> Result<()>
fn readdir( &self, ctx: &Context, inode: VfsInode, handle: u64, size: u32, offset: u64, add_entry: &mut dyn FnMut(DirEntry<'_>) -> Result<usize>, ) -> Result<()>
Read a directory. Read more
source§fn readdirplus(
&self,
ctx: &Context,
inode: VfsInode,
handle: u64,
size: u32,
offset: u64,
add_entry: &mut dyn FnMut(DirEntry<'_>, Entry) -> Result<usize>,
) -> Result<()>
fn readdirplus( &self, ctx: &Context, inode: VfsInode, handle: u64, size: u32, offset: u64, add_entry: &mut dyn FnMut(DirEntry<'_>, Entry) -> Result<usize>, ) -> Result<()>
Read a directory with entry attributes. Read more
source§fn fsyncdir(
&self,
ctx: &Context,
inode: VfsInode,
datasync: bool,
handle: u64,
) -> Result<()>
fn fsyncdir( &self, ctx: &Context, inode: VfsInode, datasync: bool, handle: u64, ) -> Result<()>
Synchronize the contents of a directory. Read more
source§fn releasedir(
&self,
ctx: &Context,
inode: VfsInode,
flags: u32,
handle: u64,
) -> Result<()>
fn releasedir( &self, ctx: &Context, inode: VfsInode, flags: u32, handle: u64, ) -> Result<()>
Release an open directory. Read more
source§fn access(&self, ctx: &Context, inode: VfsInode, mask: u32) -> Result<()>
fn access(&self, ctx: &Context, inode: VfsInode, mask: u32) -> Result<()>
Check file access permissions. Read more
source§fn id_remap(&self, ctx: &mut Context) -> Result<()>
fn id_remap(&self, ctx: &mut Context) -> Result<()>
Remap the external IDs in context to internal IDs.
source§fn batch_forget(&self, ctx: &Context, requests: Vec<(Self::Inode, u64)>)
fn batch_forget(&self, ctx: &Context, requests: Vec<(Self::Inode, u64)>)
Forget about multiple inodes. Read more
source§fn lseek(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
offset: u64,
whence: u32,
) -> Result<u64>
fn lseek( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, offset: u64, whence: u32, ) -> Result<u64>
Reposition read/write file offset.
source§fn getlk(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
owner: u64,
lock: FileLock,
flags: u32,
) -> Result<FileLock>
fn getlk( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, owner: u64, lock: FileLock, flags: u32, ) -> Result<FileLock>
Query file lock status
source§fn setlk(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
owner: u64,
lock: FileLock,
flags: u32,
) -> Result<()>
fn setlk( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, owner: u64, lock: FileLock, flags: u32, ) -> Result<()>
Grab a file read lock
source§fn setlkw(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
owner: u64,
lock: FileLock,
flags: u32,
) -> Result<()>
fn setlkw( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, owner: u64, lock: FileLock, flags: u32, ) -> Result<()>
Grab a file write lock
source§fn ioctl(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
flags: u32,
cmd: u32,
data: IoctlData<'_>,
out_size: u32,
) -> Result<IoctlData<'_>>
fn ioctl( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, flags: u32, cmd: u32, data: IoctlData<'_>, out_size: u32, ) -> Result<IoctlData<'_>>
send ioctl to the file
source§fn bmap(
&self,
ctx: &Context,
inode: Self::Inode,
block: u64,
blocksize: u32,
) -> Result<u64>
fn bmap( &self, ctx: &Context, inode: Self::Inode, block: u64, blocksize: u32, ) -> Result<u64>
Query a file’s block mapping info
source§fn poll(
&self,
ctx: &Context,
inode: Self::Inode,
handle: Self::Handle,
khandle: Self::Handle,
flags: u32,
events: u32,
) -> Result<u32>
fn poll( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, khandle: Self::Handle, flags: u32, events: u32, ) -> Result<u32>
Poll a file’s events
source§fn notify_reply(&self) -> Result<()>
fn notify_reply(&self) -> Result<()>
TODO: support this
Auto Trait Implementations§
impl !Freeze for Vfs
impl !RefUnwindSafe for Vfs
impl Send for Vfs
impl Sync for Vfs
impl Unpin for Vfs
impl !UnwindSafe for Vfs
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