Struct fuse_backend_rs::passthrough::PassthroughFs
source · pub struct PassthroughFs<S: BitmapSlice + Send + Sync = ()> { /* private fields */ }
Expand description
A file system that simply “passes through” all requests it receives to the underlying file system.
To keep the implementation simple it servers the contents of its root directory. Users that wish to serve only a specific directory should set up the environment so that that directory ends up as the root of the file system process. One way to accomplish this is via a combination of mount namespaces and the pivot_root system call.
Implementations§
source§impl<S: BitmapSlice + Send + Sync> PassthroughFs<S>
impl<S: BitmapSlice + Send + Sync> PassthroughFs<S>
sourcepub fn new(cfg: Config) -> Result<PassthroughFs<S>>
pub fn new(cfg: Config) -> Result<PassthroughFs<S>>
Create a Passthrough file system instance.
sourcepub fn keep_fds(&self) -> Vec<RawFd>
pub fn keep_fds(&self) -> Vec<RawFd>
Get the list of file descriptors which should be reserved across live upgrade.
sourcepub fn readlinkat_proc_file(&self, inode: u64) -> Result<PathBuf>
pub fn readlinkat_proc_file(&self, inode: u64) -> Result<PathBuf>
Get the file pathname corresponding to the Inode This function is used by Nydus blobfs
Trait Implementations§
source§impl<S: BitmapSlice + Send + Sync + 'static> BackendFileSystem for PassthroughFs<S>
impl<S: BitmapSlice + Send + Sync + 'static> BackendFileSystem for PassthroughFs<S>
source§impl<S: BitmapSlice + Send + Sync> FileSystem for PassthroughFs<S>
impl<S: BitmapSlice + Send + Sync> FileSystem for PassthroughFs<S>
source§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 statfs(&self, _ctx: &Context, inode: u64) -> Result<statvfs64>
fn statfs(&self, _ctx: &Context, inode: u64) -> Result<statvfs64>
Get information about the file system.
source§fn lookup(&self, _ctx: &Context, parent: u64, name: &CStr) -> Result<Entry>
fn lookup(&self, _ctx: &Context, parent: u64, name: &CStr) -> Result<Entry>
Look up a directory entry by name and get its attributes. Read more
source§fn batch_forget(&self, _ctx: &Context, requests: Vec<(u64, u64)>)
fn batch_forget(&self, _ctx: &Context, requests: Vec<(u64, u64)>)
Forget about multiple inodes. Read more
source§fn opendir(
&self,
_ctx: &Context,
inode: u64,
flags: u32,
) -> Result<(Option<u64>, OpenOptions)>
fn opendir( &self, _ctx: &Context, inode: u64, flags: u32, ) -> Result<(Option<u64>, OpenOptions)>
Open a directory for reading. Read more
source§fn releasedir(
&self,
_ctx: &Context,
inode: u64,
_flags: u32,
handle: u64,
) -> Result<()>
fn releasedir( &self, _ctx: &Context, inode: u64, _flags: u32, handle: u64, ) -> Result<()>
Release an open directory. Read more
source§fn mkdir(
&self,
ctx: &Context,
parent: u64,
name: &CStr,
mode: u32,
umask: u32,
) -> Result<Entry>
fn mkdir( &self, ctx: &Context, parent: u64, name: &CStr, mode: u32, umask: u32, ) -> Result<Entry>
Create a directory. Read more
source§fn rmdir(&self, _ctx: &Context, parent: u64, name: &CStr) -> Result<()>
fn rmdir(&self, _ctx: &Context, parent: u64, name: &CStr) -> Result<()>
Remove a directory. Read more
source§fn readdir(
&self,
_ctx: &Context,
inode: u64,
handle: u64,
size: u32,
offset: u64,
add_entry: &mut dyn FnMut(DirEntry<'_>) -> Result<usize>,
) -> Result<()>
fn readdir( &self, _ctx: &Context, inode: u64, 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: u64,
handle: u64,
size: u32,
offset: u64,
add_entry: &mut dyn FnMut(DirEntry<'_>, Entry) -> Result<usize>,
) -> Result<()>
fn readdirplus( &self, _ctx: &Context, inode: u64, 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 open(
&self,
_ctx: &Context,
inode: u64,
flags: u32,
fuse_flags: u32,
) -> Result<(Option<u64>, OpenOptions, Option<u32>)>
fn open( &self, _ctx: &Context, inode: u64, flags: u32, fuse_flags: u32, ) -> Result<(Option<u64>, OpenOptions, Option<u32>)>
Open a file. Read more
source§fn release(
&self,
_ctx: &Context,
inode: u64,
_flags: u32,
handle: u64,
_flush: bool,
_flock_release: bool,
_lock_owner: Option<u64>,
) -> Result<()>
fn release( &self, _ctx: &Context, inode: u64, _flags: u32, handle: u64, _flush: bool, _flock_release: bool, _lock_owner: Option<u64>, ) -> Result<()>
Release an open file. Read more
source§fn create(
&self,
ctx: &Context,
parent: u64,
name: &CStr,
args: CreateIn,
) -> Result<(Entry, Option<u64>, OpenOptions, Option<u32>)>
fn create( &self, ctx: &Context, parent: u64, name: &CStr, args: CreateIn, ) -> Result<(Entry, Option<u64>, OpenOptions, Option<u32>)>
Create and open a file. Read more
source§fn unlink(&self, _ctx: &Context, parent: u64, name: &CStr) -> Result<()>
fn unlink(&self, _ctx: &Context, parent: u64, name: &CStr) -> Result<()>
Remove a file. Read more
source§fn read(
&self,
_ctx: &Context,
inode: u64,
handle: u64,
w: &mut dyn ZeroCopyWriter,
size: u32,
offset: u64,
_lock_owner: Option<u64>,
flags: u32,
) -> Result<usize>
fn read( &self, _ctx: &Context, inode: u64, 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: u64,
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: u64, 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 getattr(
&self,
_ctx: &Context,
inode: u64,
handle: Option<u64>,
) -> Result<(stat64, Duration)>
fn getattr( &self, _ctx: &Context, inode: u64, handle: Option<u64>, ) -> Result<(stat64, Duration)>
Get attributes for a file / directory. Read more
source§fn setattr(
&self,
_ctx: &Context,
inode: u64,
attr: stat64,
handle: Option<u64>,
valid: SetattrValid,
) -> Result<(stat64, Duration)>
fn setattr( &self, _ctx: &Context, inode: u64, attr: stat64, handle: Option<u64>, valid: SetattrValid, ) -> Result<(stat64, Duration)>
Set attributes for a file / directory. Read more
source§fn rename(
&self,
_ctx: &Context,
olddir: u64,
oldname: &CStr,
newdir: u64,
newname: &CStr,
flags: u32,
) -> Result<()>
fn rename( &self, _ctx: &Context, olddir: u64, oldname: &CStr, newdir: u64, newname: &CStr, flags: u32, ) -> Result<()>
Rename a file / directory. Read more
source§fn mknod(
&self,
ctx: &Context,
parent: u64,
name: &CStr,
mode: u32,
rdev: u32,
umask: u32,
) -> Result<Entry>
fn mknod( &self, ctx: &Context, parent: u64, name: &CStr, mode: u32, rdev: u32, umask: u32, ) -> Result<Entry>
Create a file node. Read more
source§fn link(
&self,
_ctx: &Context,
inode: u64,
newparent: u64,
newname: &CStr,
) -> Result<Entry>
fn link( &self, _ctx: &Context, inode: u64, newparent: u64, newname: &CStr, ) -> Result<Entry>
Create a hard link. Read more
source§fn symlink(
&self,
ctx: &Context,
linkname: &CStr,
parent: u64,
name: &CStr,
) -> Result<Entry>
fn symlink( &self, ctx: &Context, linkname: &CStr, parent: u64, name: &CStr, ) -> Result<Entry>
Create a symbolic link. Read more
source§fn flush(
&self,
_ctx: &Context,
inode: u64,
handle: u64,
_lock_owner: u64,
) -> Result<()>
fn flush( &self, _ctx: &Context, inode: u64, handle: u64, _lock_owner: u64, ) -> Result<()>
Flush the contents of a file. Read more
source§fn fsync(
&self,
_ctx: &Context,
inode: u64,
datasync: bool,
handle: u64,
) -> Result<()>
fn fsync( &self, _ctx: &Context, inode: u64, datasync: bool, handle: u64, ) -> Result<()>
Synchronize file contents. Read more
source§fn fsyncdir(
&self,
ctx: &Context,
inode: u64,
datasync: bool,
handle: u64,
) -> Result<()>
fn fsyncdir( &self, ctx: &Context, inode: u64, datasync: bool, handle: u64, ) -> Result<()>
Synchronize the contents of a directory. Read more
source§fn access(&self, ctx: &Context, inode: u64, mask: u32) -> Result<()>
fn access(&self, ctx: &Context, inode: u64, mask: u32) -> Result<()>
Check file access permissions. Read more
source§fn setxattr(
&self,
_ctx: &Context,
inode: u64,
name: &CStr,
value: &[u8],
flags: u32,
) -> Result<()>
fn setxattr( &self, _ctx: &Context, inode: u64, name: &CStr, value: &[u8], flags: u32, ) -> Result<()>
Set an extended attribute. Read more
source§fn getxattr(
&self,
_ctx: &Context,
inode: u64,
name: &CStr,
size: u32,
) -> Result<GetxattrReply>
fn getxattr( &self, _ctx: &Context, inode: u64, name: &CStr, size: u32, ) -> Result<GetxattrReply>
Get an extended attribute. Read more
source§fn listxattr(
&self,
_ctx: &Context,
inode: u64,
size: u32,
) -> Result<ListxattrReply>
fn listxattr( &self, _ctx: &Context, inode: u64, size: u32, ) -> Result<ListxattrReply>
List extended attribute names. Read more
source§fn removexattr(&self, _ctx: &Context, inode: u64, name: &CStr) -> Result<()>
fn removexattr(&self, _ctx: &Context, inode: u64, name: &CStr) -> Result<()>
Remove an extended attribute. Read more
source§fn fallocate(
&self,
_ctx: &Context,
inode: u64,
handle: u64,
mode: u32,
offset: u64,
length: u64,
) -> Result<()>
fn fallocate( &self, _ctx: &Context, inode: u64, handle: u64, mode: u32, offset: u64, length: u64, ) -> Result<()>
Allocate requested space for file data. Read more
source§fn lseek(
&self,
_ctx: &Context,
inode: u64,
handle: u64,
offset: u64,
whence: u32,
) -> Result<u64>
fn lseek( &self, _ctx: &Context, inode: u64, handle: u64, 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
source§impl Layer for PassthroughFs
impl Layer for PassthroughFs
source§fn root_inode(&self) -> Self::Inode
fn root_inode(&self) -> Self::Inode
Return the root inode number
source§fn create_whiteout(
&self,
ctx: &Context,
parent: Self::Inode,
name: &CStr,
) -> Result<Entry>
fn create_whiteout( &self, ctx: &Context, parent: Self::Inode, name: &CStr, ) -> Result<Entry>
Create whiteout file with name . Read more
source§fn delete_whiteout(
&self,
ctx: &Context,
parent: Self::Inode,
name: &CStr,
) -> Result<()>
fn delete_whiteout( &self, ctx: &Context, parent: Self::Inode, name: &CStr, ) -> Result<()>
Delete whiteout file with name .
source§fn is_whiteout(&self, ctx: &Context, inode: Self::Inode) -> Result<bool>
fn is_whiteout(&self, ctx: &Context, inode: Self::Inode) -> Result<bool>
Check if the Inode is a whiteout file
Auto Trait Implementations§
impl<S = ()> !Freeze for PassthroughFs<S>
impl<S> RefUnwindSafe for PassthroughFs<S>where
S: RefUnwindSafe,
impl<S> Send for PassthroughFs<S>
impl<S> Sync for PassthroughFs<S>
impl<S> Unpin for PassthroughFs<S>where
S: Unpin,
impl<S> UnwindSafe for PassthroughFs<S>where
S: 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