diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-30 00:01:29 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-30 00:57:20 -0300 |
| commit | 79efd33ba0964796d4dc4653b68435755b35f834 (patch) | |
| tree | e67f93ebba2684671817cb6903f746d1ea1db04f /src/fs.zig | |
| parent | f264dbc4a646da695331fe7401fa013cbb720b6a (diff) | |
| download | pardes-79efd33ba0964796d4dc4653b68435755b35f834.tar.gz pardes-79efd33ba0964796d4dc4653b68435755b35f834.zip | |
9p: a mount keeps its connection and sends each operation's walk, stat, open and first read or write in one flight, a new connection's version and attach before them: an operation through it is one round trip where it was six or seven (a directory, or a file of no stated length, two: 9P's only end is an empty read); a file whose stat gave its length is read ahead, its Treads 14 at a time; reads are timed by their progress, so a large remote file opens at 80 and 207 ms (1.3 MB timed out); a write refused unopened behind a truncating open that parked is sent again after it; Unmount lets the connection go; the CLI, --wait and Handover dial afresh, pipelined; reference.typ says how a session elsewhere mounts through ssh -L
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/fs.zig')
| -rw-r--r-- | src/fs.zig | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -921,7 +921,7 @@ pub fn readLimit(p: *pardes.Pardes, path: []const u8, max_bytes: usize) ![]u8 { if (!std.mem.eql(u8, name, mount.name)) continue; // A peer answers on its own time, and the peer may be this very // editor: the turn goes out with the request. - return pardes.tape.site(.read_mount, p.gpa, ninep_io.Client.readLimit, .{ p.gpa, mount.dial, remote_path, path, limit }); + return pardes.tape.site(.read_mount, p.gpa, ninep_io.Client.readMount, .{ p.gpa, mount.dial, remote_path, path, limit }); } return error.FileNotFound; } @@ -1009,7 +1009,7 @@ fn writeOut(p: *pardes.Pardes, dial: ?[]const u8, path: []const u8, bytes: []con defer p.gpa.free(copy); pardes.turn.rest(); defer pardes.turn.wake(); - if (dial) |d| return ninep_io.Client.write(p.gpa, d, path, copy); + if (dial) |d| return ninep_io.Client.writeMount(p.gpa, d, path, copy); return writeFile(path, copy); } @@ -1542,6 +1542,7 @@ pub fn unmount(p: *Pardes, name: []const u8) !void { (path.len == prefix.len or path[prefix.len] == '/')) return error.MountInUse; } const removed = p.fs.mounts.orderedRemove(index); + if (comptime pardes.hosted) ninep_io.Client.forget(removed.dial); p.gpa.free(removed.name); p.gpa.free(removed.dial); return; |
