pub struct ActiveNamespaceNode { /* private fields */ }Expand description
A namespace node that keeps the underly mount busy.
Implementations§
Source§impl ActiveNamespaceNode
impl ActiveNamespaceNode
pub fn new(name: NamespaceNode) -> Self
pub fn to_passive(&self) -> NamespaceNode
pub fn into_mapping( self, mode: Option<FileWriteGuardMode>, ) -> Result<Arc<FileMapping>, Errno>
Methods from Deref<Target = NamespaceNode>§
Sourcepub fn open(
&self,
locked: &mut Locked<Unlocked>,
current_task: &CurrentTask,
flags: OpenFlags,
access_check: AccessCheck,
) -> Result<FileHandle, Errno>
pub fn open( &self, locked: &mut Locked<Unlocked>, current_task: &CurrentTask, flags: OpenFlags, access_check: AccessCheck, ) -> Result<FileHandle, Errno>
Create a FileObject corresponding to this namespace node.
This function is the primary way of instantiating FileObjects. Each FileObject records the NamespaceNode that created it in order to remember its path in the Namespace.
Sourcepub fn open_create_node<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
name: &FsStr,
mode: FileMode,
dev: DeviceType,
flags: OpenFlags,
) -> Result<NamespaceNode, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn open_create_node<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
name: &FsStr,
mode: FileMode,
dev: DeviceType,
flags: OpenFlags,
) -> Result<NamespaceNode, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
Create or open a node in the file system.
Works for any type of node other than a symlink.
Will return an existing node unless flags contains OpenFlags::EXCL.
Sourcepub fn create_node<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
name: &FsStr,
mode: FileMode,
dev: DeviceType,
) -> Result<NamespaceNode, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn create_node<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
name: &FsStr,
mode: FileMode,
dev: DeviceType,
) -> Result<NamespaceNode, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
Create a node in the file system.
Works for any type of node other than a symlink.
Does not return an existing node.
Sourcepub fn create_symlink<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
name: &FsStr,
target: &FsStr,
) -> Result<NamespaceNode, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn create_symlink<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
name: &FsStr,
target: &FsStr,
) -> Result<NamespaceNode, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
Create a symlink in the file system.
To create another type of node, use create_node.
Sourcepub fn create_tmpfile<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
mode: FileMode,
flags: OpenFlags,
) -> Result<NamespaceNode, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn create_tmpfile<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
mode: FileMode,
flags: OpenFlags,
) -> Result<NamespaceNode, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
Creates an anonymous file.
The FileMode::IFMT of the FileMode is always FileMode::IFREG.
Used by O_TMPFILE.
pub fn link<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
name: &FsStr,
child: &FsNodeHandle,
) -> Result<NamespaceNode, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn bind_socket<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
name: &FsStr,
socket: SocketHandle,
socket_address: SocketAddress,
mode: FileMode,
) -> Result<NamespaceNode, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn unlink<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
name: &FsStr,
kind: UnlinkKind,
must_be_directory: bool,
) -> Result<(), Errno>where
L: LockEqualOrBefore<FileOpsCore>,
Sourcepub fn lookup_child<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
context: &mut LookupContext,
basename: &FsStr,
) -> Result<NamespaceNode, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn lookup_child<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
context: &mut LookupContext,
basename: &FsStr,
) -> Result<NamespaceNode, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
Traverse down a parent-to-child link in the namespace.
Sourcepub fn parent(&self) -> Option<NamespaceNode>
pub fn parent(&self) -> Option<NamespaceNode>
Traverse up a child-to-parent link in the namespace.
This traversal matches the child-to-parent link in the underlying FsNode except at mountpoints, where the link switches from one filesystem to another.
Sourcepub fn parent_within_mount(&self) -> Option<DirEntryHandle>
pub fn parent_within_mount(&self) -> Option<DirEntryHandle>
Returns the parent, but does not escape mounts i.e. returns None if this node is the root of a mount.
Sourcepub fn is_descendant_of(&self, ancestor: &NamespaceNode) -> bool
pub fn is_descendant_of(&self, ancestor: &NamespaceNode) -> bool
Whether this namespace node is a descendant of the given node.
Walks up the namespace node tree looking for ancestor. If ancestor is found, returns true. Otherwise, returns false.
Sourcepub fn mount_if_root(&self) -> Result<&Arc<Mount>, Errno>
pub fn mount_if_root(&self) -> Result<&Arc<Mount>, Errno>
If this node is the root of a mount, return it. Otherwise EINVAL.
Sourcepub fn path_escaping_chroot(&self) -> FsString
pub fn path_escaping_chroot(&self) -> FsString
The path from the root of the namespace to this node.
Sourcepub fn path_from_root(
&self,
root: Option<&NamespaceNode>,
) -> PathWithReachability
pub fn path_from_root( &self, root: Option<&NamespaceNode>, ) -> PathWithReachability
Returns the path to this node, accounting for a custom root.
A task may have a custom root set by chroot.
pub fn mount(&self, what: WhatToMount, flags: MountFlags) -> Result<(), Errno>
Sourcepub fn unmount(&self, flags: UnmountFlags) -> Result<(), Errno>
pub fn unmount(&self, flags: UnmountFlags) -> Result<(), Errno>
If this is the root of a filesystem, unmount. Otherwise return EINVAL.
pub fn suid_and_sgid( &self, current_task: &CurrentTask, ) -> Result<UserAndOrGroupId, Errno>
pub fn update_atime(&self)
pub fn readlink<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
) -> Result<SymlinkTarget, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn notify(&self, event_mask: InotifyMask)
Sourcepub fn check_access<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
permission_flags: impl Into<PermissionFlags>,
reason: CheckAccessReason,
) -> Result<(), Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn check_access<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
permission_flags: impl Into<PermissionFlags>,
reason: CheckAccessReason,
) -> Result<(), Errno>where
L: LockEqualOrBefore<FileOpsCore>,
Check whether the node can be accessed in the current context with the specified access flags (read, write, or exec). Accounts for capabilities and whether the current user is the owner or is in the file’s group.
Sourcepub fn check_o_noatime_allowed(
&self,
current_task: &CurrentTask,
) -> Result<(), Errno>
pub fn check_o_noatime_allowed( &self, current_task: &CurrentTask, ) -> Result<(), Errno>
Checks if O_NOATIME is allowed,
pub fn truncate<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
length: u64,
) -> Result<(), Errno>where
L: LockBefore<BeforeFsNodeAppend>,
Trait Implementations§
Source§impl Clone for ActiveNamespaceNode
impl Clone for ActiveNamespaceNode
Source§fn clone(&self) -> ActiveNamespaceNode
fn clone(&self) -> ActiveNamespaceNode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ActiveNamespaceNode
impl Debug for ActiveNamespaceNode
Source§impl Deref for ActiveNamespaceNode
impl Deref for ActiveNamespaceNode
Source§impl Hash for ActiveNamespaceNode
impl Hash for ActiveNamespaceNode
Source§impl PartialEq for ActiveNamespaceNode
impl PartialEq for ActiveNamespaceNode
impl Eq for ActiveNamespaceNode
Auto Trait Implementations§
impl Freeze for ActiveNamespaceNode
impl !RefUnwindSafe for ActiveNamespaceNode
impl Send for ActiveNamespaceNode
impl Sync for ActiveNamespaceNode
impl Unpin for ActiveNamespaceNode
impl !UnwindSafe for ActiveNamespaceNode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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
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>
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>
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