Skip to main content

Module xattr

Module xattr 

Source
Expand description

Shared extended-attribute type, used across every filesystem that carries POSIX-style xattrs (SquashFS, ext, XFS).

An xattr is a name in a namespace (user., trusted., security., system.) mapped to an arbitrary binary value. The canonical example is security.capability — a packed struct granting a binary its Linux capabilities (e.g. cap_net_raw on ping), which is why xattrs must survive a SquashFS rebuild and why an editor exposes the raw bytes rather than pretending the value is text.

Structs§

Xattr
One extended attribute: a fully-qualified name and its raw value bytes.

Constants§

NAMESPACES
A recognized xattr namespace prefix. A name without one of these cannot be represented on disk, so an editor rejects it up front.

Functions§

has_valid_namespace
True when name starts with a representable namespace prefix.
hex_encode
Lowercase hex, no separators.
parse_value
Parse a value written by a user: 0x-prefixed hex is decoded to raw bytes, anything else is taken as its UTF-8 bytes. The inverse of Xattr::value_display for round-tripping through an editor.