Expand description
The typed failure of one Linux filesystem primitive:
the call, the path and the error number.
What:
The typed failure of one Linux filesystem primitive (statfs, a btrfs ioctl, FICLONE, renameat2):
which operation, on which path, and the operating system’s error number.
Why:
The primitives of the cheap-worktree ladder and the subvolume migration all fall through on failure, never panic;
the caller decides from the error number whether the next rung applies (the filesystem lacks the feature) or the
work must stop (a real fault), and the message names the operation and path a person can act on.
In TS you’d write (pseudocode):
class PrimitiveError extends Error { constructor(readonly operation: string, readonly path: string, readonly errno: number) { super(`...`); } }Structs§
- Primitive
Error - What:
One failed primitive call.
&'static stris text compiled into the executable (siblingStringis owned);i32is the Cerrnovalue (siblingsi64andu32exist; the C API returns a 32-bit signed integer). Why: The operation names the call as the kernel documents it (for exampleBTRFS_IOC_SNAP_CREATE_V2), so a report can be searched in the kernel sources.
Functions§
- c_path
- What:
A path as the NUL-terminated C string the system calls take.
Why:
A path with an interior NUL byte can name no file, so it fails with
EINVALbefore any call, instead of reaching a system call with a truncated name.