Skip to main content

ZeroOpenLayer

Struct ZeroOpenLayer 

Source
pub struct ZeroOpenLayer<L>
where L: Layer<Inode = u64, Handle = u64> + Send + Sync,
{ /* private fields */ }
Expand description

Wrap a handleless [Layer] so it presents a non-None handle to OverlayFs. See the module docs.

Implementations§

Source§

impl<L> ZeroOpenLayer<L>
where L: Layer<Inode = u64, Handle = u64> + Send + Sync,

Source

pub fn new(inner: L) -> Self

Wrap inner. The inner layer must already be ready to serve (e.g. a RAFS whose import has run).

Trait Implementations§

Source§

impl<L> FileSystem for ZeroOpenLayer<L>
where L: Layer<Inode = u64, Handle = u64> + Send + Sync,

Source§

fn open( &self, ctx: &Context, inode: u64, flags: u32, fuse_flags: u32, ) -> Result<(Option<u64>, OpenOptions, Option<u32>)>

Substitute a constant handle when the inner layer is handleless.

Source§

fn opendir( &self, ctx: &Context, inode: u64, flags: u32, ) -> Result<(Option<u64>, OpenOptions)>

Substitute a constant handle when the inner layer is handleless.

Source§

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

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 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 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
Read a symbolic link.
Remove a file. Read more
Source§

fn rmdir(&self, ctx: &Context, parent: u64, name: &CStr) -> Result<()>

Remove a directory. 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>

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 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 statfs(&self, ctx: &Context, inode: u64) -> Result<statvfs64>

Get information about the file system.
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 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 releasedir( &self, ctx: &Context, inode: u64, flags: u32, handle: u64, ) -> Result<()>

Release an open directory. Read more
Source§

fn access(&self, ctx: &Context, inode: u64, mask: u32) -> Result<()>

Check file access permissions. Read more
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>

Create a file node. Read more
§

fn mkdir( &self, ctx: &Context, parent: Self::Inode, name: &CStr, mode: u32, umask: u32, ) -> Result<Entry, Error>

Create a directory. Read more
§

fn rename( &self, ctx: &Context, olddir: Self::Inode, oldname: &CStr, newdir: Self::Inode, newname: &CStr, flags: u32, ) -> Result<(), Error>

Rename a file / directory. Read more
Create a hard link. Read more
§

fn create( &self, ctx: &Context, parent: Self::Inode, name: &CStr, args: CreateIn, ) -> Result<(Entry, Option<Self::Handle>, OpenOptions, Option<u32>), Error>

Create and open a file. Read more
§

fn flush( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, lock_owner: u64, ) -> Result<(), Error>

Flush the contents of a file. Read more
§

fn fsync( &self, ctx: &Context, inode: Self::Inode, datasync: bool, handle: Self::Handle, ) -> Result<(), Error>

Synchronize file contents. Read more
§

fn fallocate( &self, ctx: &Context, inode: Self::Inode, handle: Self::Handle, mode: u32, offset: u64, length: u64, ) -> Result<(), Error>

Allocate requested space for file data. Read more
§

fn setxattr( &self, ctx: &Context, inode: Self::Inode, name: &CStr, value: &[u8], flags: u32, ) -> Result<(), Error>

Set an extended attribute. Read more
§

fn removexattr( &self, ctx: &Context, inode: Self::Inode, name: &CStr, ) -> Result<(), Error>

Remove an extended attribute. Read more
§

fn fsyncdir( &self, ctx: &Context, inode: Self::Inode, datasync: bool, handle: Self::Handle, ) -> Result<(), Error>

Synchronize the contents of a directory. Read more
§

fn setupmapping( &self, _ctx: &Context, inode: Self::Inode, handle: Self::Handle, foffset: u64, len: u64, flags: u64, moffset: u64, vu_req: &mut (dyn FsCacheReqHandler + 'static), ) -> Result<(), Error>

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

fn removemapping( &self, _ctx: &Context, _inode: Self::Inode, requests: Vec<RemovemappingOne>, vu_req: &mut (dyn FsCacheReqHandler + 'static), ) -> Result<(), Error>

Teardown a mapping which was setup for guest DAX style access.
§

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>

Query file lock status
§

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>

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>

send ioctl to the file
§

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>

Poll a file’s events
§

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

TODO: support this
§

fn id_remap(&self, ctx: &mut Context) -> Result<(), Error>

Remap the external IDs in context to internal IDs.
Source§

impl<L> Layer for ZeroOpenLayer<L>
where L: Layer<Inode = u64, Handle = u64> + Send + Sync,

Source§

fn root_inode(&self) -> u64

Return the root inode number
§

fn create_whiteout( &self, ctx: &Context, parent: Self::Inode, name: &CStr, ) -> Result<Entry, Error>

Create whiteout file with name . Read more
§

fn delete_whiteout( &self, ctx: &Context, parent: Self::Inode, name: &CStr, ) -> Result<(), Error>

Delete whiteout file with name .
§

fn is_whiteout(&self, ctx: &Context, inode: Self::Inode) -> Result<bool, Error>

Check if the Inode is a whiteout file
§

fn set_opaque(&self, ctx: &Context, inode: Self::Inode) -> Result<(), Error>

Set the directory to opaque.
§

fn is_opaque(&self, ctx: &Context, inode: Self::Inode) -> Result<bool, Error>

Check if the directory is opaque.

Auto Trait Implementations§

§

impl<L> Freeze for ZeroOpenLayer<L>
where L: Freeze,

§

impl<L> RefUnwindSafe for ZeroOpenLayer<L>
where L: RefUnwindSafe,

§

impl<L> Send for ZeroOpenLayer<L>

§

impl<L> Sync for ZeroOpenLayer<L>

§

impl<L> Unpin for ZeroOpenLayer<L>
where L: Unpin,

§

impl<L> UnsafeUnpin for ZeroOpenLayer<L>
where L: UnsafeUnpin,

§

impl<L> UnwindSafe for ZeroOpenLayer<L>
where L: 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.

§

impl<T> Instrument for T

§

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

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ServiceExt for T

§

fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>
where Self: Sized,

Apply a transformation to the response body. Read more
§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
§

fn follow_redirects(self) -> FollowRedirect<Self>
where Self: Sized,

Follow redirect resposes using the Standard policy. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSync for T
where T: Sync,

§

impl<T> MaybeSync for T
where T: Sync,