pub struct Anon { /* private fields */ }Implementations§
Source§impl Anon
impl Anon
Sourcepub fn new_for_binder_device() -> Self
pub fn new_for_binder_device() -> Self
Returns a new Anon instance for use in a binder device FD.
Sourcepub fn new_for_socket(kernel_private: bool) -> Self
pub fn new_for_socket(kernel_private: bool) -> Self
Returns a new Anon instance for use as the FsNodeOps of a socket.
Sourcepub fn new_file_extended<L>(
locked: &mut Locked<L>,
current_task: &CurrentTask,
ops: Box<dyn FileOps>,
flags: OpenFlags,
name: &'static str,
info: FsNodeInfo,
) -> Result<FileHandle, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn new_file_extended<L>(
locked: &mut Locked<L>,
current_task: &CurrentTask,
ops: Box<dyn FileOps>,
flags: OpenFlags,
name: &'static str,
info: FsNodeInfo,
) -> Result<FileHandle, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
Returns a new anonymous file with the specified properties, and a unique FsNode.
Sourcepub fn new_file<L>(
locked: &mut Locked<L>,
current_task: &CurrentTask,
ops: Box<dyn FileOps>,
flags: OpenFlags,
name: &'static str,
) -> Result<FileHandle, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn new_file<L>(
locked: &mut Locked<L>,
current_task: &CurrentTask,
ops: Box<dyn FileOps>,
flags: OpenFlags,
name: &'static str,
) -> Result<FileHandle, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
Returns a new anonymous file with the specified properties, and a unique FsNode.
Sourcepub fn new_private_file<L>(
locked: &mut Locked<L>,
current_task: &CurrentTask,
ops: Box<dyn FileOps>,
flags: OpenFlags,
name: &'static str,
) -> FileHandlewhere
L: LockEqualOrBefore<FileOpsCore>,
pub fn new_private_file<L>(
locked: &mut Locked<L>,
current_task: &CurrentTask,
ops: Box<dyn FileOps>,
flags: OpenFlags,
name: &'static str,
) -> FileHandlewhere
L: LockEqualOrBefore<FileOpsCore>,
Returns a new anonymous file backed by a single “private” FsNode, to which no security
labeling nor access-checks will be applied.
Sourcepub fn new_private_file_extended<L>(
locked: &mut Locked<L>,
current_task: &CurrentTask,
ops: Box<dyn FileOps>,
flags: OpenFlags,
name: &'static str,
info: FsNodeInfo,
) -> FileHandlewhere
L: LockEqualOrBefore<FileOpsCore>,
pub fn new_private_file_extended<L>(
locked: &mut Locked<L>,
current_task: &CurrentTask,
ops: Box<dyn FileOps>,
flags: OpenFlags,
name: &'static str,
info: FsNodeInfo,
) -> FileHandlewhere
L: LockEqualOrBefore<FileOpsCore>,
Returns a new private anonymous file, applying caller-supplied info.
Sourcepub fn is_private(fs_node: &FsNode) -> bool
pub fn is_private(fs_node: &FsNode) -> bool
Returns true if the fs_node is Anon and private to the Kernel/FileSystem, in which
case it should not have access checks applied by the LSM layer.
This may become part of FsNodeOps in future, if other private node use-cases are found.
Trait Implementations§
Source§impl FsNodeOps for Anon
impl FsNodeOps for Anon
Source§fn lookup(
&self,
_locked: &mut Locked<FileOpsCore>,
_node: &FsNode,
_current_task: &CurrentTask,
_name: &FsStr,
) -> Result<FsNodeHandle, Errno>
fn lookup( &self, _locked: &mut Locked<FileOpsCore>, _node: &FsNode, _current_task: &CurrentTask, _name: &FsStr, ) -> Result<FsNodeHandle, Errno>
Find an existing child node and populate the child parameter. Return the node. Read more
Source§fn mknod(
&self,
_locked: &mut Locked<FileOpsCore>,
_node: &FsNode,
_current_task: &CurrentTask,
_name: &FsStr,
_mode: FileMode,
_dev: DeviceType,
_owner: FsCred,
) -> Result<FsNodeHandle, Errno>
fn mknod( &self, _locked: &mut Locked<FileOpsCore>, _node: &FsNode, _current_task: &CurrentTask, _name: &FsStr, _mode: FileMode, _dev: DeviceType, _owner: FsCred, ) -> Result<FsNodeHandle, Errno>
Create and return the given child node. Read more
Source§fn mkdir(
&self,
_locked: &mut Locked<FileOpsCore>,
_node: &FsNode,
_current_task: &CurrentTask,
_name: &FsStr,
_mode: FileMode,
_owner: FsCred,
) -> Result<FsNodeHandle, Errno>
fn mkdir( &self, _locked: &mut Locked<FileOpsCore>, _node: &FsNode, _current_task: &CurrentTask, _name: &FsStr, _mode: FileMode, _owner: FsCred, ) -> Result<FsNodeHandle, Errno>
Create and return the given child node as a subdirectory.
Source§fn create_symlink(
&self,
_locked: &mut Locked<FileOpsCore>,
_node: &FsNode,
_current_task: &CurrentTask,
_name: &FsStr,
_target: &FsStr,
_owner: FsCred,
) -> Result<FsNodeHandle, Errno>
fn create_symlink( &self, _locked: &mut Locked<FileOpsCore>, _node: &FsNode, _current_task: &CurrentTask, _name: &FsStr, _target: &FsStr, _owner: FsCred, ) -> Result<FsNodeHandle, Errno>
Creates a symlink with the given
target path.Source§fn unlink(
&self,
_locked: &mut Locked<FileOpsCore>,
_node: &FsNode,
_current_task: &CurrentTask,
_name: &FsStr,
_child: &FsNodeHandle,
) -> Result<(), Errno>
fn unlink( &self, _locked: &mut Locked<FileOpsCore>, _node: &FsNode, _current_task: &CurrentTask, _name: &FsStr, _child: &FsNodeHandle, ) -> Result<(), Errno>
Remove the child with the given name, if the child exists. Read more
Source§fn create_file_ops(
&self,
_locked: &mut Locked<FileOpsCore>,
_node: &FsNode,
_current_task: &CurrentTask,
_flags: OpenFlags,
) -> Result<Box<dyn FileOps>, Errno>
fn create_file_ops( &self, _locked: &mut Locked<FileOpsCore>, _node: &FsNode, _current_task: &CurrentTask, _flags: OpenFlags, ) -> Result<Box<dyn FileOps>, Errno>
Build the
FileOps for the file associated to this node. Read moreSource§fn internal_name(&self, _node: &FsNode) -> Option<FsString>
fn internal_name(&self, _node: &FsNode) -> Option<FsString>
Returns a descriptive name for this node, suitable to report to userspace in situations
where the node’s path is unavailable (e.g. because it is anonymous, and has no path).
If no name is returned then a default name of the form “<class:[<node_id>]” will be used.
Source§fn check_access(
&self,
_locked: &mut Locked<FileOpsCore>,
node: &FsNode,
current_task: &CurrentTask,
access: PermissionFlags,
info: &RwLock<FsNodeInfo>,
reason: CheckAccessReason,
audit_context: Auditable<'_>,
) -> Result<(), Errno>
fn check_access( &self, _locked: &mut Locked<FileOpsCore>, node: &FsNode, current_task: &CurrentTask, access: PermissionFlags, info: &RwLock<FsNodeInfo>, reason: CheckAccessReason, audit_context: Auditable<'_>, ) -> Result<(), Errno>
Delegate the access check to the node.
Source§fn create_dir_entry_ops(&self) -> Box<dyn DirEntryOps>
fn create_dir_entry_ops(&self) -> Box<dyn DirEntryOps>
Build the
DirEntryOps for a new [DirEntry] that will be associated
to this node.Source§fn create_tmpfile(
&self,
_node: &FsNode,
_current_task: &CurrentTask,
_mode: FileMode,
_owner: FsCred,
) -> Result<FsNodeHandle, Errno>
fn create_tmpfile( &self, _node: &FsNode, _current_task: &CurrentTask, _mode: FileMode, _owner: FsCred, ) -> Result<FsNodeHandle, Errno>
Creates an anonymous file. Read more
Source§fn readlink(
&self,
_locked: &mut Locked<FileOpsCore>,
_node: &FsNode,
_current_task: &CurrentTask,
) -> Result<SymlinkTarget, Errno>
fn readlink( &self, _locked: &mut Locked<FileOpsCore>, _node: &FsNode, _current_task: &CurrentTask, ) -> Result<SymlinkTarget, Errno>
Reads the symlink from this node.
Source§fn link(
&self,
_locked: &mut Locked<FileOpsCore>,
_node: &FsNode,
_current_task: &CurrentTask,
_name: &FsStr,
_child: &FsNodeHandle,
) -> Result<(), Errno>
fn link( &self, _locked: &mut Locked<FileOpsCore>, _node: &FsNode, _current_task: &CurrentTask, _name: &FsStr, _child: &FsNodeHandle, ) -> Result<(), Errno>
Create a hard link with the given name to the given child.
Source§fn append_lock_read<'a>(
&'a self,
locked: &'a mut Locked<BeforeFsNodeAppend>,
node: &'a FsNode,
current_task: &CurrentTask,
) -> Result<(RwQueueReadGuard<'a, FsNodeAppend>, &'a mut Locked<FsNodeAppend>), Errno>
fn append_lock_read<'a>( &'a self, locked: &'a mut Locked<BeforeFsNodeAppend>, node: &'a FsNode, current_task: &CurrentTask, ) -> Result<(RwQueueReadGuard<'a, FsNodeAppend>, &'a mut Locked<FsNodeAppend>), Errno>
Acquire the necessary append lock for the operations that depend on them.
Should be done before calling
allocate or truncate to avoid lock ordering issues.Source§fn truncate(
&self,
_locked: &mut Locked<FileOpsCore>,
_guard: &AppendLockGuard<'_>,
_node: &FsNode,
_current_task: &CurrentTask,
_length: u64,
) -> Result<(), Errno>
fn truncate( &self, _locked: &mut Locked<FileOpsCore>, _guard: &AppendLockGuard<'_>, _node: &FsNode, _current_task: &CurrentTask, _length: u64, ) -> Result<(), Errno>
Change the length of the file.
Source§fn allocate(
&self,
_locked: &mut Locked<FileOpsCore>,
_guard: &AppendLockGuard<'_>,
_node: &FsNode,
_current_task: &CurrentTask,
_mode: FallocMode,
_offset: u64,
_length: u64,
) -> Result<(), Errno>
fn allocate( &self, _locked: &mut Locked<FileOpsCore>, _guard: &AppendLockGuard<'_>, _node: &FsNode, _current_task: &CurrentTask, _mode: FallocMode, _offset: u64, _length: u64, ) -> Result<(), Errno>
Manipulate allocated disk space for the file.
Source§fn initial_info(&self, _info: &mut FsNodeInfo)
fn initial_info(&self, _info: &mut FsNodeInfo)
Update the supplied info with initial state (e.g. size) for the node. Read more
Source§fn fetch_and_refresh_info<'a>(
&self,
_locked: &mut Locked<FileOpsCore>,
_node: &FsNode,
_current_task: &CurrentTask,
info: &'a RwLock<FsNodeInfo>,
) -> Result<RwLockReadGuard<'a, FsNodeInfo>, Errno>
fn fetch_and_refresh_info<'a>( &self, _locked: &mut Locked<FileOpsCore>, _node: &FsNode, _current_task: &CurrentTask, info: &'a RwLock<FsNodeInfo>, ) -> Result<RwLockReadGuard<'a, FsNodeInfo>, Errno>
Update node.info as needed. Read more
Source§fn update_attributes(
&self,
_locked: &mut Locked<FileOpsCore>,
_current_task: &CurrentTask,
_info: &FsNodeInfo,
_has: zxio_node_attr_has_t,
) -> Result<(), Errno>
fn update_attributes( &self, _locked: &mut Locked<FileOpsCore>, _current_task: &CurrentTask, _info: &FsNodeInfo, _has: zxio_node_attr_has_t, ) -> Result<(), Errno>
Update node attributes persistently.
Source§fn get_xattr(
&self,
_locked: &mut Locked<FileOpsCore>,
_node: &FsNode,
_current_task: &CurrentTask,
_name: &FsStr,
_max_size: usize,
) -> Result<ValueOrSize<FsString>, Errno>
fn get_xattr( &self, _locked: &mut Locked<FileOpsCore>, _node: &FsNode, _current_task: &CurrentTask, _name: &FsStr, _max_size: usize, ) -> Result<ValueOrSize<FsString>, Errno>
Get an extended attribute on the node. Read more
Source§fn set_xattr(
&self,
_locked: &mut Locked<FileOpsCore>,
_node: &FsNode,
_current_task: &CurrentTask,
_name: &FsStr,
_value: &FsStr,
_op: XattrOp,
) -> Result<(), Errno>
fn set_xattr( &self, _locked: &mut Locked<FileOpsCore>, _node: &FsNode, _current_task: &CurrentTask, _name: &FsStr, _value: &FsStr, _op: XattrOp, ) -> Result<(), Errno>
Set an extended attribute on the node.
fn remove_xattr( &self, _locked: &mut Locked<FileOpsCore>, _node: &FsNode, _current_task: &CurrentTask, _name: &FsStr, ) -> Result<(), Errno>
Source§fn list_xattrs(
&self,
_locked: &mut Locked<FileOpsCore>,
_node: &FsNode,
_current_task: &CurrentTask,
_max_size: usize,
) -> Result<ValueOrSize<Vec<FsString>>, Errno>
fn list_xattrs( &self, _locked: &mut Locked<FileOpsCore>, _node: &FsNode, _current_task: &CurrentTask, _max_size: usize, ) -> Result<ValueOrSize<Vec<FsString>>, Errno>
An implementation can systematically return a value. Otherwise, if
max_size is 0, it can
instead return the size of the 0 separated string needed to represent the value, and can
return an ERANGE error if max_size is not 0, and lesser than the required size.Source§fn forget(
self: Box<Self>,
_locked: &mut Locked<FileOpsCore>,
_current_task: &CurrentTask,
_info: FsNodeInfo,
) -> Result<(), Errno>
fn forget( self: Box<Self>, _locked: &mut Locked<FileOpsCore>, _current_task: &CurrentTask, _info: FsNodeInfo, ) -> Result<(), Errno>
Called when the FsNode is freed by the Kernel.
Source§fn enable_fsverity(
&self,
_descriptor: &fsverity_descriptor,
) -> Result<(), Errno>
fn enable_fsverity( &self, _descriptor: &fsverity_descriptor, ) -> Result<(), Errno>
Marks that FS-Verity is being built. Writes fsverity descriptor and merkle tree, the latter
computed by the filesystem.
This should ensure there are no writable file handles. Returns EEXIST if the file was
already fsverity-enabled. Returns EBUSY if this ioctl was already running on this file.
Source§fn get_fsverity_descriptor(
&self,
_log_blocksize: u8,
) -> Result<fsverity_descriptor, Errno>
fn get_fsverity_descriptor( &self, _log_blocksize: u8, ) -> Result<fsverity_descriptor, Errno>
Read fsverity descriptor, if the node is fsverity-enabled. Else returns ENODATA.
Auto Trait Implementations§
impl Freeze for Anon
impl RefUnwindSafe for Anon
impl Send for Anon
impl Sync for Anon
impl Unpin for Anon
impl UnwindSafe for Anon
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
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
Converts the given service transport handle of type
T to [Self]Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T, U> MultiArchFrom<T> for Uwhere
U: From<T>,
impl<T, U> MultiArchFrom<T> for Uwhere
U: From<T>,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T, U> TryIntoExt<U> for Twhere
U: TryFromExt<T>,
impl<T, U> TryIntoExt<U> for Twhere
U: TryFromExt<T>,
type Error = <U as TryFromExt<T>>::Error
§fn try_into_ext(self) -> Result<U, <T as TryIntoExt<U>>::Error>
fn try_into_ext(self) -> Result<U, <T as TryIntoExt<U>>::Error>
Tries to perform the conversion.