32. A real filesystem: RedoxFS behind a capability FS server
In brief. A write-capable block path, an FS-server component whose handles are capabilities from birth (open-by-path exists only INSIDE the server, relative to a granted directory cap), and RedoxFS as the on-disk engine, ported behind its own Disk trait over blk IPC
Why it matters. the flagship userspace-reuse story the prior-art note predicted: a real CoW filesystem we did not write, running confined; and the thing 31's per-file grants point at
Phase 1 built (the write-capable block path; DECISIONS §22 area, notes/dma.md). Phase 2
built, read path (2026-07-28; DECISIONS §27, notes/fs-server.md): RedoxFS runs confined as a
three-process userspace service (block server over blk IPC, FS server over the vendored no_std core
with its own untyped heap, client holding a directory capability). A client opens the shipped
motd through a granted directory capability and reads it back, proven on aarch64 and riscv64 with
a host-tool consistency check. The contract is capability-shaped from birth and adds no system call. The
error type maps to the wire exactly once; creation stays host-side. Phase 2 write path proven
too (2026-07-29, through std::fs): the old "on-device writes loop inside RedoxFS's allocator
commit" open item was stale and is corrected in DECISIONS §27 and notes/fs-server.md. A guest write
now reads back when the host tool reopens the image, and that reopen is in the gate. What remains is a
contract gap, not a write-path one: no CREATE and no TRUNCATE verb, so std::fs::write and
File::create are honestly Unsupported and a write means opening a file the image already carries.
Deliverable. Three pieces. A write-capable block path (the driver and the confinement
validator already speak both directions; the write verbs and tests are the new work). An FS-server
component whose contract is capability-shaped from birth: a file handle is a capability.
Open-by-path exists only inside the server, resolved relative to a granted directory capability,
so designation keeps flowing the 31 way and no global namespace ever
appears. And RedoxFS as the on-disk engine: port the redoxfs core behind its own Disk
trait, implemented over blk IPC.
Why RedoxFS. The prior-art survey named it the best single candidate the day the reuse rule was written: a real CoW, transactional filesystem in Rust, MIT-licensed, shipping daily in Redox. It is only loosely coupled to Redox's system calls precisely because it also runs on Linux/FUSE. That is itself a gift (images can be created and inspected on the host with the same code that serves them on nife). It is the flagship form of the userspace-reuse thesis: the kernel confining a serious component we did not write.
The port plan, fixed by the audit (notes/redoxfs-audit.md; done against 0.9.1, by building, so the implementer starts here rather than rediscovering):
- Pin 0.9.1, vendor or patch-dep with the audit's patch: two added
use alloc::vec::Veclines (one each infilesystem.rsandrecord.rs, fixing three E0425 sites; with std on, the prelude suppliedVec, so the untested no_std path bit-rotted). Offer it upstream, ideally with a--no-default-featuresCI check, so the pin can eventually drop it. Build with--no-default-featureson the workspace nightly; both bare-metal targets are proven to compile. - The allocator comes first and is shared work with 27's PAL: an untyped-backed
GlobalAllocinuser_rt. The core is alloc-heavy; nothing else runs without this. - The
Diskimpl is a blk-IPC client:read_at(block, &mut [u8]),write_at(block, &[u8]),size(), all synchronous, returningsystem_call::error::Result; map that error type to ABI errors once, at the server boundary, and nowhere else. - Only operate on-device; never create. The std-gated core APIs are exactly creation
(
FileSystem::create, uuid v4, getrandom):mkfsand inspection stay host-side via FUSE. The server opens an existing image, full stop; entropy never becomes a userspace dependency. - Known-and-accepted: the unconditional
libcdep is a manifest wart (host-binaries-only, proven harmless onnonetargets), and aes/xts/argon2/lz4 ride along as binary size with encryption unused in phase one.
Risks, priced. (1) The core's std/alloc footprint needs auditing Audited, retired
(notes/redoxfs-audit.md): std is a feature, not an assumption. The ~5,400-line core compiles for
BOTH of our bare-metal targets today, three bit-rotted imports away from clean. The Disk trait is
three synchronous methods shaped exactly like a blk-IPC client. The one real
cost is a GlobalAlloc for the FS-server process, which milestone 27's PAL needs anyway;
creation paths (mkfs, uuid, entropy) are the only std-gated core APIs and stay on the host. (2) The write path is new on our
side, driver through validator through tests, and errors there eat filesystems; the CoW design
is forgiving, but the tests must include kill-mid-write. (3) Upstream coupling: pin a version,
carry patches, and record divergence, the same discipline as any vendored engine.
Prior art and reuse. RedoxFS is the reuse. Alternatives on the record: FAT (host interop
and simplicity, no integrity story), littlefs (proven, C, wrong-language FFI for less gain
than ghostty-vt would buy). Feeds 31 (per-file grants), 23 (a component with real state to
hand off across a live swap, the hardest handoff case yet named), 27 (std::fs).
Effort: 3 lanes (measured: the write-capable block path, the FS server, then integration).
Follow-on
- Milestone 31. The contract gap this block ends on: no
CREATEand noTRUNCATEverb, soFile::createandstd::fs::writewere honestly Unsupported. Milestone 31's phase 2 landed both. - Milestone 37. Risk 2's kill-mid-write tests, which grew into proving RedoxFS's crash consistency against DECISIONS §34's first condition rather than staying a test case.
- Milestone 203. Risk 3, upstream coupling. Pinning a version and carrying patches was done here; nothing in the tree would ever report that upstream had moved, which is what 203 built.
- Milestone 57. Item 4's "only operate on-device, never create" held until the write half needed
a
no_stdcreate.patches/redoxfs-no-std-create-uuid.patchtakes the disk id from the caller, so the constraint underneath survives: entropy never becomes a filesystem dependency. - Recorded.
notes/redoxfs-audit.mdholds item 5's known-and-accepted costs, both still true:libcis an unconditional manifest dependency used only by the host binaries, and aes, xts, argon2 and lz4 ride along as binary size with encryption unused. - Milestone 347. Offer the two RedoxFS
patches upstream.
patches/redoxfs-no-std-vec-import.patchandpatches/redoxfs-no-std-create-uuid.patchare written andpatches/README.mdnames the route, but no merge request exists on gitlab.redox-os.org. So the pin carries divergences that could have stopped existing, and every future bump re-applies them by hand.
Index row
the flagship userspace-reuse story: a real filesystem we did not write, confined