diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 10:49:23 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-19 11:41:14 -0300 |
| commit | 4569aefd55d04f434f2e2ed5e6e4a511a414cdc7 (patch) | |
| tree | 53bbb915ea64c0ddcf93f7f61d25c33071ff2427 /core/ninep | |
| parent | 70c1aed30c6884024ecc2bd7f82d47e371d58ca4 (diff) | |
| download | pardes-4569aefd55d04f434f2e2ed5e6e4a511a414cdc7.tar.gz pardes-4569aefd55d04f434f2e2ed5e6e4a511a414cdc7.zip | |
fs: the file system's sites are read through the tape a step is handed, and the reads no tape saw are listed (the handle's step 2, P20, pardes-handle-sizing's second noun): every site of core/fs.zig is the handle's, the core's (`p.tape`: /os's stat, listing and read, a mount's read) where a function holds the core, else a `tape: *Tape` parameter, taken by 16 functions (fs.makeDirs, expandHome, expandHomeFrom, resolveOs, readFile, readFileLimit, readRestore, restorePath; exec.kindOf; up to a core: dump.directory, restoreFile, onDisk, Db.statePath, Core.recentKeeps, Core.parentTrouble, config.Runtime.apply); fs.resolve takes its optional core's tape, `none` without one; sam's World carries the session's tape for `~user`; the bodies of make_dirs, read_file and kind take Zig's io from the tape, and /os's stat and listing are handed it, so fs.zig and exec.zig read the process's io nowhere; the finding, what stopped compiling for want of an io: fs.readHost's two direct callers, both host halves (the tape's own read by path of a record sent by hash, which takes its tape's io; a client's join reading a plain kind's file through the walk's dump hook, whose mode `join_files` is now the host's io), and by reading one step's read no tape saw, ninep/ctl.zig's bare deniedAbove in a /pager open (served in serveFs, which a client replays), now taped as its neighbours are (`p.tape.value(.denied, ..)`, no new site); the host's own calls of these (the launcher, a -l dump, fonts, theme files, Upgrade, a dump failure's message, gui tests) pass `&tape.none`, recorded by nobody as before; and the replay's dump check now puts the core's tape aside with `on` (its dump's `onDisk` replayed a site the tape did not have: every --replay seed diverged at its end in the first gate). The five numbers: (1) functions that gained the parameter 16 (row: 19 + 7); (2) perfops 97 counts within 0.1%, largest image-frame on small +0.0295%, none on a per-row path gained it; (3) stopped compiling for want of an io: fs.readHost from tape.byHash and from dump.slotWrite (host halves), osHandle's io local (fed only sites); (4) global io uses 6 (10), calls into the free functions 80 (92), machine_lines fs.zig 39 -> 38, exec.zig 4 -> 3; (5) lines changed: tests 33, code about 130 (20 of them in host files). Lines in files not this work's: dev/tui/tui.zig 990, dev/gui/gui.zig 613 629 1054 3057 6171 6264 7494 8290, dev/file_watch.zig 612 644, dev/host_io.zig 1521, runtime/main.zig 1373 1391 1398, runtime/macos.zig 646 668, runtime/upgrade.zig 349 396 (each one argument). Gate: tui core-test 837/980 (143 skipped), shell-test 1015/1018, pane-test 183/184, behaviour-test 275/275 and --replay 20 seeds 0 failures, process-test lspcomplete and lspcompletemoved (the base's; pagercolor flaked once, passed alone three of three), replicas --clients 5 diverged 0, unequal 0, deltas wrong 0 (1731/0, 1620/0, 1737/0), quiet 545/0, 554/0, 651/0; daemon.py plain, --far, --games, --window-clients pass; semantics 2f615168fe07b35f (unmoved); frames 77/77 byte-identical in Debug, gui unit-test 1613/1617, perfab corpus2x +0.057% pictures identical in all 10 runs, perfops PASS
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/ninep')
| -rw-r--r-- | core/ninep/ctl.zig | 10 | ||||
| -rw-r--r-- | core/ninep/pane.zig | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/core/ninep/ctl.zig b/core/ninep/ctl.zig index 81600582..a4f16597 100644 --- a/core/ninep/ctl.zig +++ b/core/ninep/ctl.zig @@ -571,7 +571,7 @@ fn checkBuiltin(p: *Pardes, req: Req, line: []const u8, scope: builtins.Scope) ? .callstack_depth => arg.len == 0 or (std.fmt.parseInt(u8, arg, 10) catch 0) -% 1 < pardes.lsp.callstack_max_depth, else => probe: { var probe = p.settings; - break :probe probe.apply(setting, if (arg.len > 0) arg else null, p.sessionHome()); + break :probe probe.apply(p.tape, setting, if (arg.len > 0) arg else null, p.sessionHome()); }, }; if (takes) return null; @@ -679,13 +679,13 @@ pub fn writePager(p: *Pardes, req: Req) Reply { } if (dir.len > 0) if (pardes.filesystem.localPath(dir)) |local| { // A file there is no directory, ENOTDIR; nothing there, ENOENT. - if (exec_line.kindOf(local) != .directory) { - if (exec_line.kindOf(local) != null) + if (exec_line.kindOf(p.tape, local) != .directory) { + if (exec_line.kindOf(p.tape, local) != null) return tree.failText(req.tag, E.NOTDIR, std.fmt.bufPrint(&p.fs.ename, "pager: {s}: not a directory", .{dir[0..@min(dir.len, 256)]}) catch &p.fs.ename); // cut to ename's 320 return tree.failText(req.tag, E.NOENT, std.fmt.bufPrint(&p.fs.ename, "pager: {s}: no such directory", .{dir[0..@min(dir.len, 256)]}) catch &p.fs.ename); // cut to ename's 320 } // Nor one that may not be written, as a file's name there is refused. - if (pardes.filesystem.deniedAbove(local)) + if (p.tape.value(.denied, pardes.filesystem.deniedAbove, .{local})) return tree.failText(req.tag, E.PERM, std.fmt.bufPrint(&p.fs.ename, "pager: {s}: permission denied", .{dir[0..@min(dir.len, 256)]}) catch &p.fs.ename); // cut to ename's 320 }; const id = pardes.panes.Output.openPager(p, p.view().active, dir) catch |err| @@ -773,7 +773,7 @@ pub fn writeRoot(p: *Pardes, req: Req) Reply { if (!apply) continue; // ponytail: read on the 9P task, a small local file; a big // one would want pardes.turn's yield. - const bytes = fs.readFile(p.gpa, path) catch |err| return refuseQuoting(p, req, @errorName(err), path, ""); + const bytes = fs.readFile(p.tape, p.gpa, path) catch |err| return refuseQuoting(p, req, @errorName(err), path, ""); defer p.gpa.free(bytes); _ = pardes.Handover.adopt(p, bytes) catch |err| return refuseQuoting(p, req, @errorName(err), path, ""); continue; diff --git a/core/ninep/pane.zig b/core/ninep/pane.zig index 16d7762a..96a50703 100644 --- a/core/ninep/pane.zig +++ b/core/ninep/pane.zig @@ -900,7 +900,7 @@ fn writeName(p: *Pardes, req: Req, id: usize, pane: *Pane) Reply { // A directory (`~`, `/`, `foo/`) is no file to name a pane after: a // Save could only fail. Said now, EISDIR. const is_dir = name[name.len - 1] == '/' or std.mem.eql(u8, full, "/") or - (if (fs.localPath(full)) |local| exec.kindOf(local) == .directory else false); + (if (fs.localPath(full)) |local| exec.kindOf(p.tape, local) == .directory else false); if (is_dir) return tree.failText(req.tag, E.ISDIR, std.fmt.bufPrint(&p.fs.ename, "name: {s} is a directory, not a file", .{full[0..@min(full.len, 256)]}) catch &p.fs.ename); // cut to ename's 320 nameBuffer(p, id, full, false) catch |err| return Reply.fail(req.tag, switch (err) { error.OutOfMemory => E.NOMEM, @@ -944,7 +944,7 @@ pub fn nameBuffer(p: *Pardes, id: usize, full: []const u8, preserve_tag: bool) ! p.emit(.{ .watch = .{ .pane = @intCast(id), .on = false } }); events.noteLog(p, .rename, pane); // A name given: whether a file there is on disk is the disk's to say. - f.on_disk = f.output == null and pardes.Pardes.recentKeeps(f.path); + f.on_disk = f.output == null and pardes.Pardes.recentKeeps(p.tape, f.path); if (f.on_disk) p.recent.opened(p.recentGpa(), f.path); } |
