summaryrefslogtreecommitdiff
path: root/src/fs.zig
Commit message (Collapse)AuthorAge
* 9ns: acme's address and argument refusals reach the caller as EINVAL, not ↵Gabriel Schneider2026-10-01
| | | | | | | | | | | | | | | | | EIO; the word rules are cloud9.fs.enameErrno, for a server's tests to ask A server that keeps acme's spellings (pardes) refuses an address or a ctl argument with "no match for regexp", "address out of range", "addresses out of order", "range past end of body" and the like, as EINVAL, but none held a word 9ns knew, so a shell through the mount heard EIO. Each now maps to EINVAL, narrowly and after every older rule, so nothing that maps today is remapped. The rules move from 9ns into the cloud9 module as fs.enameErrno (Linux's numbers), 9ns's enameToErrno a cast of it, so a server's own tests can check that each refusal says its errno in words 9ns maps. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* fs: a request past the parking cap is refused "too many reads waiting: N", ↵Gabriel Schneider2026-09-30
| | | | | | | | | | | | | not EAGAIN's C string The engine refused a read or write it had no slot to park with "Resource temporarily unavailable", which reads as the C library's EAGAIN and says nothing about why. The refusal now says so in words and names the cap (opts.slot_capacity), so a client can tell it has too many reads held on one connection. Refusals of what cannot park at all (a walk, a write too long to copy) keep e_again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* fs: a stat of an open fid names its open to the backendGabriel Schneider2026-09-28
| | | | | | | | | acme's fsysstat answers from the fid's own window, so a file whose window went while it was open still stats. The backend's getattr for an open fid now carries its handle, so an editor can do the same: pardes keeps a run's answer after its pane closes, and a reader's fstat (cat's) must find it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* fs: a backend can keep a parked request by ticket and answer it later, and a ↵Gabriel Schneider2026-09-27
| | | | | | | | | | | | | | | | | | | | | clunk interrupts what is parked on its fid A backend holding a read that has nothing yet had to find its park by walking the engine's slots and matching a tag. Now Conn.hold() answers .again and returns a Ticket (slot and that park's sequence number); Conn.waiting() says whether that very park still waits, and Conn.answerWith() answers it with what a producer makes, asking the producer only while it waits and under the same lock, the way lib9p lets a server keep a Req and respond() later, so a consuming answer is never spent on a flushed request. The sequence number counts on across the connections a runner slot serves (initIn keeps it), so a ticket of one never names a park of the next. A clunk or remove fails everything parked on its fid with EINTR first, so no slot outlives its fid to be retried with a released handle or answered to a fid of the same number walked anew; retry's check for a vanished fid is gone with it. 9ns maps acme's "shut down" to EIO. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* fs: name EBUSY, for a second open of something one may hold at a timeGabriel Schneider2026-09-27
|
* fs, serve: set an engine up in place, so a large fid table costs only the ↵Gabriel Schneider2026-09-25
| | | | | | | | | | | | | | | fids used A kernel mount (9ns) holds a fid for every inode the kernel caches, so a server that wants `ls -l` of a directory of thousands of files to work needs a fid table of tens of thousands. Server.initIn sets an engine up in place and, with fid_index, never writes a fid slot at or past high_water; the walks over the table (references, reset, orphan) stop there. Runner.init sets each connection's small fields one by one and leaves the engine to start(), so connection slots nobody uses are never written. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* fs: a parked job whose fid was clunked is answered, not asked againGabriel Schneider2026-09-22
| | | | | | | | | | | | A client that gives up on a parked open sends Tclunk for its fid without a Tflush; the fid goes, the parked job stays. On retry the job went back to the backend, which did the work -- opened a handle, made an object -- and the reply then found no fid and dropped it, handle and all. Now the retry looks for the fid first and answers "fid unknown" without asking. Found by an adversarial review of pardes's use of the engine. Co-Authored-By: Claude Fable 5.1 <[email protected]>
* fs: let open, truncate, clunk and remove park on again, not only reads and ↵Gabriel Schneider2026-09-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | writes A backend that is not ready for a request answers `again` and the engine parks the request, so the connection goes on answering everything else and a retry asks the parked request later. That only worked for a read, readdir or write; every other op answering `again` failed with EAGAIN on the spot. pardes needs the rest. Its 9P is answered on the connection's task while the editor's own thread may be out in a syscall in the middle of a step, and in that window a request that would change a pane -- an open of /pane/new, a truncating open or wstat, a remove -- has to wait, not fail, and has to wait without holding the connection up, because the editor's own request may be the next frame on that very connection (it is, when the syscall goes through a mount of the editor's own tree). Parking is exactly that. A parked open, wstat, clunk or remove goes back into the job slot on retry and its reply then goes through `jobReply` like any other, which is why the slot keeps only what an open needs (`omode`, `step`); a wstat parks only as the truncation to zero a Linux client sends for O_TRUNC, and a clunk parks before it lets its fid go, since a release that was never paid still owns its handle. A walk, attach, stat, create or renaming wstat keeps names in the input frame that parking lets go of, so those still answer EAGAIN. A parked job retried and parked again sits the round out like a retried read does -- without that the first version of this looped forever in `retry`. Co-Authored-By: Claude Fable 5.1 <[email protected]>
* 9proc core becomes a backend of cloud9.fs; engine gains optional featuresGabriel Schneider2026-09-20
| | | | | | | | | | | | | | | | 9proc's own fid table, walk loop and dir-read engine are replaced by cloud9.fs.Server; the tree (static, vars, providers) is served through the engine's Req/Reply contract with node ids that keep the old qid scheme. Providers may answer later by returning error.Again (parked in the engine, retried each step, Tflush -> EINTR); no new files are exposed. Engine (backward compatible, all opt-in via Backend.features / Options): create, remove, wstat, reference accounting for backends that count handles, a salted fid index, name_capacity 0 (names from getattr), Reply.ename for backend-chosen error text, Attr.path/version/atime. Engine-level error strings and the 217-byte msize floor now apply to 9proc; tests updated accordingly. Co-Authored-By: Claude Fable 5.1 <[email protected]>
* Add the file-server engine: cloud9.fs.Server(Backend, Options)Gabriel Schneider2026-09-20
The asynchronous 9P file-server engine from the Pardes editor moves into the library: fid table, walks, directory cursors, a job/slot model where backend replies arrive later by tag (status again = parked), Tflush cancellation and orphaned fids on hangup. Allocation-free, no OS calls, no std.Io; comptime Options (fid, slot, park data, name and user capacities) replace the editor's constants. Backend contract types (Req, Reply/ReplyWith, Op, Status, Attr, E, error strings) live here. 29 engine tests plus the client tests that sat beside it in Pardes. Co-Authored-By: Claude Fable 5.1 <[email protected]>