Files
1e0454d74a Add the POSIX operations: rename, links, attributes, statfs (#70)
* Add rename, links, symbolic links and attributes

git, npm, go build and cargo need them, and the Volume answered
rename, link and symlink with an error and refused chmod and utimens,
so git init failed on a mount.

The Volume now has Rename (atomic across a crash and across a failed
read; no-replace and exchange; a directory never below itself), Link,
Symlink, Readlink, Mknod, SetAttr (mode with setuid, setgid and
sticky; owner and group; times to the nanosecond; size), File.Punch,
Parent, Usage and Check. A file that is removed while a handle holds it
stays whole for the handle and goes with the last close. A directory's
times follow the entries made, removed and renamed in it, which git's
untracked cache relies on.

The layout grows only by optional fields: inode fields 6 owner, 7 group,
8 link count and 9 parent, and in the Head the links field (bit and tag
2: the number of inodes with more than one name, set by the first hard
link so a Volume that never makes one stays readable by every build)
and the usage field (tag 64: inodes and bytes stored, which statfs
reads). A directory's link count is derived, not stored.

Every operation reads before it stages, so one that fails changes
nothing. Check reads the whole namespace and fails on a name that
names nothing, a link count that is not the number of names, a parent
that is wrong or counters that are not what the tree holds; the crash
sweeps, the model of random operations against a plain tree and the
tests of the Head all lean on it.

Claude-Session: https://claude.ai/code/session_015XYKLnBbrbajqj1GpRydF8

* Serve the POSIX operations over FUSE

The mount answered rename, link and symlink with ENOSYS and refused
chmod and utimens. It now hands each to the Volume: rename, link,
symlink, readlink, mknod of pipes and sockets, setattr (mode, owner,
times, size, with UTIME_NOW), fallocate (allocate, keep size, punch,
zero range), statfs from the Volume's usage and capacity, and "." and
".." by inode.

It is mounted with default_permissions, so the kernel checks every
access against the mode, owner and group the Volume reports, and the
Volume checks none. A new inode is owned by the caller that made it.
One kernel inode stands for one Volume inode: the FUSE library numbers
a node by its identity, so a node made afresh for each lookup made
every hard link a file of its own, with its own cached size and pages.
The macOS front gets the same operations.

What the FUSE library has no request for is answered as the kernel
answers it: the flags of renameat2 are EINVAL, O_TMPFILE EOPNOTSUPP,
extended attributes ENOTSUP, a device node EPERM, and the library leaves
the sticky bit out of the attributes it answers with. Locks are the
kernel's, per mount. All of it is in SPECIFICATION 11.2.

Claude-Session: https://claude.ai/code/session_015XYKLnBbrbajqj1GpRydF8

* Gate the namespace tests and mutate them

The namespace tests join the gates they belong to: the model of random
operations to model and, in 60 seeds, to fuzz; the one that races
goroutines to race, with the handler tests of the mount; the rest run in
unit. 143 mutations break the namespace, the layout and the mount, each
in one place, and each has a test that must fail. A mutation of an
existing entry whose code moved is moved with it.

tools/ci/gitwork.sh is the git work of a coding run, which gives the
same tree hashes, file counts, modes, sizes and contents on a mount as
on tmpfs; tools/ci/treehash.sh is every fact about a tree and one hash
of them, for an npm ci or a pnpm install on both.

Claude-Session: https://claude.ai/code/session_015XYKLnBbrbajqj1GpRydF8

* Specify the namespace operations

SPECIFICATION 5.1 defines the links field (bit and tag 2) and the usage
field (tag 64); 6.1 the owner, group, link count and parent of an
inode and what a reader refuses; 6.4 what rename, link, remove, unlink
while open, attributes and times guarantee, and what a failed call
leaves; 7.1 punched holes; 8 and 9 the durability row and the limits;
11.2 what the mount cannot do because of the FUSE library; 12 the
acceptance criteria for HIP-1342, each a statement a program can check.
LLM.md, doc.go and the release checklist follow.

Claude-Session: https://claude.ai/code/session_015XYKLnBbrbajqj1GpRydF8

---------

Co-authored-by: hanzo-dev <[email protected]>
2026-11-19 05:29:20 -08:00
..