#[non_exhaustive]pub enum Operation {
Read,
Write,
Execute,
Delete,
Create,
Stat,
Chmod,
ChownUid,
ChownGid,
SetXattr {
namespace: XattrNamespace,
},
}Expand description
Operation being attempted on the target path.
Determines which permission bits to check and whether the check
Redirects to the parent directory (for Delete and Create).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Read
Read file contents or list directory entries. Requires r.
Write
Write file contents, truncate, or modify. Requires w.
Execute
Execute a binary or traverse a directory. Requires x.
Delete
Remove a file or directory. Checks w+x on parent.
Create
Create a new file or directory. Checks w+x on parent.
Stat
Stat/metadata read. Requires only path traversal (+x on ancestors).
Chmod
Change file mode bits (chmod). Gated by ownership or CAP_FOWNER.
ChownUid
Change file owner UID (chown). Requires CAP_CHOWN.
ChownGid
Change file owner GID (chown). Owner-in-group or CAP_CHOWN.
SetXattr
Set extended attribute (setxattr). Gated by namespace.
Fields
namespace: XattrNamespaceXattr namespace determines the capability required.
Implementations§
Source§impl Operation
impl Operation
Sourcepub fn is_metadata(&self) -> bool
pub fn is_metadata(&self) -> bool
Returns true if this operation uses the metadata check path.
Metadata ops bypass DAC mode-bit checks; they evaluate ownership
and capability rules directly. New variants MUST be added here —
no wildcard arm permitted (clippy::wildcard_enum_match_arm is denied).
Sourcepub fn checks_parent(&self) -> bool
pub fn checks_parent(&self) -> bool
Returns true if this operation checks the parent directory
Rather than the target itself.
Delete and Create require w+x on parent, not target.
Sourcepub fn target_component(&self, walk_len: usize) -> Option<usize>
pub fn target_component(&self, walk_len: usize) -> Option<usize>
Index into path walk of the component to check.
For most operations, last component (target). for Delete and
Create, second-to-last (parent directory). Returns None if
Walk is empty or too short for a parent-directed operation.