summaryrefslogtreecommitdiff
path: root/core/Core.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-19 10:49:23 -0300
committerGabriel Schneider <[email protected]>2026-11-19 11:41:14 -0300
commit4569aefd55d04f434f2e2ed5e6e4a511a414cdc7 (patch)
tree53bbb915ea64c0ddcf93f7f61d25c33071ff2427 /core/Core.zig
parent70c1aed30c6884024ecc2bd7f82d47e371d58ca4 (diff)
downloadpardes-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/Core.zig')
-rw-r--r--core/Core.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/Core.zig b/core/Core.zig
index 5bb0809e..3876b3e8 100644
--- a/core/Core.zig
+++ b/core/Core.zig
@@ -715,9 +715,9 @@ pub fn loadRecent(p: *Pardes) void {
/// Whether `path` is one Recent keeps: a file on this host's disk, not
/// the served tree's (`/virtual/`) nor a name never saved.
-pub fn recentKeeps(path: []const u8) bool {
+pub fn recentKeeps(tape: *pardes.tape.Tape, path: []const u8) bool {
const local = filesystem.localPath(path) orelse return false;
- return exec.kindOf(local) == .file;
+ return exec.kindOf(tape, local) == .file;
}
/// A file pane or a kind's (a PDF, a picture) closing: its place noted in Recent, when
@@ -1397,12 +1397,12 @@ fn missingInterpreter(bin: []const u8, out: []u8) ?[]const u8 {
/// The directory a write of `path` that failed with `err` went into:
/// what is there (a directory when it is no local path), whether it is
/// missing, and whether that is because one above refuses (EACCES).
-fn parentTrouble(path: []const u8, err: anyerror) struct { dir: []const u8, kind: ?std.Io.File.Kind, missing: bool, denied: bool } {
+fn parentTrouble(tape: *pardes.tape.Tape, path: []const u8, err: anyerror) struct { dir: []const u8, kind: ?std.Io.File.Kind, missing: bool, denied: bool } {
const dir = std.Io.Dir.path.dirname(path) orelse "/";
const local = filesystem.localPath(dir);
- const kind: ?std.Io.File.Kind = if (local) |l| exec.kindOf(l) else .directory;
+ const kind: ?std.Io.File.Kind = if (local) |l| exec.kindOf(tape, l) else .directory;
const missing = err == error.FileNotFound or err == error.NotDir or kind != .directory;
- const denied = missing and (if (local) |l| pardes.tape.value(.denied, filesystem.deniedAbove, .{l}) else false);
+ const denied = missing and (if (local) |l| tape.value(.denied, filesystem.deniedAbove, .{l}) else false);
return .{ .dir = dir, .kind = kind, .missing = missing, .denied = denied };
}
@@ -1416,7 +1416,7 @@ pub fn saveFailed(p: *Pardes, id: u8, path: []const u8, err: anyerror) void {
var what: pardes.Kind.Buf(limits.host_path_cap + 32) = .{};
// A write into a directory that is not there: said so, in the words
// a mount reads as ENOENT; EACCES when one above refuses.
- const parent = parentTrouble(path, err);
+ const parent = parentTrouble(p.tape, path, err);
if (parent.denied)
p.reportFailure(id, what.print("Save {s}: permission denied", .{path[0..@min(path.len, limits.host_path_cap)]}))
else if (parent.missing)
@@ -1437,7 +1437,7 @@ pub fn dumpFailed(p: *Pardes, path: []const u8, err: anyerror) void {
const operation = std.fmt.bufPrint(&what, "Dump {s}", .{path[0..@min(path.len, limits.host_path_cap)]}) catch unreachable; // cap + 5 fits cap + 8
// Into a DumpDir that is not there: said so, ENOENT, as a Save is;
// one that is there but no directory (`/dev/null`) says that.
- const parent = parentTrouble(path, err);
+ const parent = parentTrouble(p.tape, path, err);
var said: pardes.Kind.Buf(limits.host_path_cap + 48) = .{};
if (parent.denied and parent.kind == null)
p.reportFailure(v.active, said.print("{s}: permission denied", .{operation}))
@@ -1792,7 +1792,7 @@ pub fn sessionShell(p: *const Pardes) []const u8 {
/// A path's leading `~` (alone, or before `/` or `:`) as the session's home;
/// `~user` that user's (fs.expandHomeFrom).
pub fn expandHome(p: *const Pardes, path: []const u8, out: *[4096]u8) []const u8 {
- return filesystem.expandHomeFrom(path, out, p.sessionHome());
+ return filesystem.expandHomeFrom(p.tape, path, out, p.sessionHome());
}
/// The session's home, null for none.