Struct nydus_blobfs::BlobFs

source ·
pub struct BlobFs { /* 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 BlobFs

source

pub fn new(cfg: Config) -> Result<BlobFs>

Create a Blob file system instance.

source

pub fn import(&self) -> Result<()>

Initialize the PassthroughFs

Trait Implementations§

source§

impl BackendFileSystem for BlobFs

source§

fn mount(&self) -> Result<(Entry, u64)>

mount returns the backend file system root inode entry and the largest inode number it has.
source§

fn as_any(&self) -> &dyn Any

Provides a reference to the Any trait. This is useful to let the caller have access to the underlying type behind the trait.
source§

impl FileSystem for BlobFs

§

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 more
§

type Handle = u64

Represents a file or directory that is open for reading/writing.
source§

fn init(&self, capable: FsOptions) -> Result<FsOptions>

Initialize the file system. Read more
source§

fn destroy(&self)

Clean up the file system. Read more
source§

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>

Look up a directory entry by name and get its attributes. Read more
source§

fn forget(&self, _ctx: &Context, inode: u64, count: u64)

Forget about an inode. Read more
source§

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)>

Open a directory for reading. Read more
source§

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>

Create a directory. Read more
source§

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<()>

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<()>

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)>

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<()>

Release an open file. Read more
source§

fn create(
    &self,
    _ctx: &Context,
    _parent: u64,
    _name: &CStr,
    _args: CreateIn
) -> Result<(Entry, Option<u64>, OpenOptions)>

Create and open a file. Read more
Remove a file. Read more
source§

fn setupmapping(
    &self,
    _ctx: &Context,
    inode: u64,
    _handle: u64,
    foffset: u64,
    len: u64,
    flags: u64,
    moffset: u64,
    vu_req: &mut dyn FsCacheReqHandler
) -> Result<()>

Setup a mapping so that guest can access files in DAX style. Read more
source§

fn removemapping(
    &self,
    _ctx: &Context,
    _inode: u64,
    requests: Vec<RemovemappingOne>,
    vu_req: &mut dyn FsCacheReqHandler
) -> Result<()>

Teardown a mapping which was setup for guest DAX style access.
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>

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>

Write data to a file. Read more
source§

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)>

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<()>

Rename a file / directory. Read more
source§

fn mknod(
    &self,
    _ctx: &Context,
    _parent: u64,
    _name: &CStr,
    _mode: u32,
    _rdev: u32,
    _umask: u32
) -> Result<Entry>

Create a file node. Read more
Create a hard link. Read more
Create a symbolic link. Read more
Read a symbolic link.
source§

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<()>

Synchronize file contents. Read more
source§

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<()>

Check file access permissions. Read more
source§

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>

Get an extended attribute. Read more
source§

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<()>

Remove an extended attribute. Read more
source§

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>

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, Error>

Query file lock status
source§

fn setlk(
    &self,
    ctx: &Context,
    inode: Self::Inode,
    handle: Self::Handle,
    owner: u64,
    lock: FileLock,
    flags: u32
) -> Result<(), Error>

Grab a file read lock
source§

fn setlkw(
    &self,
    ctx: &Context,
    inode: Self::Inode,
    handle: Self::Handle,
    owner: u64,
    lock: FileLock,
    flags: u32
) -> Result<(), Error>

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<'_>, Error>

send ioctl to the file
source§

fn bmap(
    &self,
    ctx: &Context,
    inode: Self::Inode,
    block: u64,
    blocksize: u32
) -> Result<u64, Error>

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, Error>

Poll a file’s events
source§

fn notify_reply(&self) -> Result<(), Error>

TODO: support this

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

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 Twhere
    U: From<T>,

const: unstable · 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · 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