summaryrefslogtreecommitdiff
path: root/src/9p.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-30 17:35:06 -0300
committerGabriel Schneider <[email protected]>2026-10-30 17:35:06 -0300
commit6d8da8721141284cf33bb901168b26135893eb86 (patch)
tree791d63401d4e85fbca1d597a8ce0326e70efd545 /src/9p.zig
parentefd43a3a2cf03bb741366331158b368abf9ac583 (diff)
parentbf6810a8f9d6cc82050e7d9c0cfb06358301b574 (diff)
downloadpardes-6d8da8721141284cf33bb901168b26135893eb86.tar.gz
pardes-6d8da8721141284cf33bb901168b26135893eb86.zip
Merge latest upstream into the macOS branch for Zig 0.17
Retain the macOS branch history and local Acme selection color while adopting upstream's current core and platform changes. Pin Zig and ZLS to 0.17.0, and fetch the existing zstbi compatibility commit through upstream after its original fork was removed.
Diffstat (limited to 'src/9p.zig')
-rw-r--r--src/9p.zig49
1 files changed, 23 insertions, 26 deletions
diff --git a/src/9p.zig b/src/9p.zig
index c0e7f61e..0979b66a 100644
--- a/src/9p.zig
+++ b/src/9p.zig
@@ -5,16 +5,10 @@
const cloud9 = @import("cloud9");
pub const fs = cloud9.fs;
pub const Server = cloud9.fs.Server;
-pub const Error = cloud9.Error;
-pub const Type = cloud9.Type;
-pub const isT = cloud9.isT;
pub const header_len = cloud9.header_len;
-pub const qid_len = cloud9.qid_len;
-pub const stat_fixed = cloud9.stat_fixed;
pub const notag = cloud9.notag;
pub const nofid = cloud9.nofid;
pub const max_welem = cloud9.max_welem;
-pub const iohdrsz = cloud9.iohdrsz;
pub const Qid = cloud9.Qid;
pub const Stat = cloud9.Stat;
pub const Msg = cloud9.Msg;
@@ -23,38 +17,33 @@ pub const frameLen = cloud9.frameLen;
pub const encode = cloud9.encode;
pub const decode = cloud9.decode;
pub const qtdir = cloud9.qtdir;
-pub const qtappend = cloud9.qtappend;
-pub const qtexcl = cloud9.qtexcl;
-pub const qtmount = cloud9.qtmount;
-pub const qtauth = cloud9.qtauth;
-pub const qttmp = cloud9.qttmp;
-pub const qtfile = cloud9.qtfile;
-pub const dmdir = cloud9.dmdir;
-pub const dmappend = cloud9.dmappend;
-pub const dmexcl = cloud9.dmexcl;
-pub const dmmount = cloud9.dmmount;
-pub const dmauth = cloud9.dmauth;
-pub const dmtmp = cloud9.dmtmp;
-pub const dmperm = cloud9.dmperm;
pub const Client = cloud9.Client;
-pub const ClientError = cloud9.ClientError;
-pub const max_tags = cloud9.max_tags;
pub const oread = cloud9.oread;
pub const owrite = cloud9.owrite;
pub const ordwr = cloud9.ordwr;
-pub const oexec = cloud9.oexec;
pub const otrunc = cloud9.otrunc;
-pub const ocexec = cloud9.ocexec;
-pub const orclose = cloud9.orclose;
pub const errmax = cloud9.fs.errmax;
pub const errString = cloud9.fs.errString;
pub const msize_min = cloud9.fs.msize_min;
/// The smallest msize a native listener offers (src/9p_io.zig).
pub const min_msize: u32 = 4096;
+/// What a native listener negotiates.
+pub const msize: u32 = 65536;
-/// The editor's engine: native fid count, native file names.
-pub const editor: cloud9.fs.Options = .{ .fid_capacity = max_fids, .name_capacity = 255 };
+/// The editor's engine: native fid count, native file names, and room to
+/// park a write of any size a frame can carry -- a request that would change
+/// a pane while the editor is out in a syscall waits in the engine
+/// (src/9p_io.zig, `serve`), and a write it cannot keep would fail instead.
+/// The largest write is msize less the Twrite header, 23 bytes (the test
+/// below asks a client), one byte more than `iohdrsz` allows for.
+/// Up to 128 reads held on one connection (a follower each of the log or
+/// an event file); the next is refused `too many reads waiting: 128`. A
+/// mount (9ns) keeps a wider window, 256, so held reads never take every
+/// one of its workers.
+pub const editor: cloud9.fs.Options = .{ .fid_capacity = max_fids, .name_capacity = 255, .park_data_max = msize - 23, .slot_capacity = max_held };
+
+pub const max_held: usize = 128;
/// The board's engine: the GPIO firmware's budget (src/esp32p4_9p.zig).
pub const board: cloud9.fs.Options = .{ .fid_capacity = board_fids, .name_capacity = board_name_capacity };
@@ -70,6 +59,14 @@ const Stub = struct {
pub const Reply = cloud9.fs.Reply;
};
+test "9p server: the editor's engine can park the largest write a client sends" {
+ var in: [4096]u8 = undefined;
+ var out: [4096]u8 = undefined;
+ var client: Client = .init(.{ .in = &in, .out = &out });
+ client.msize = msize;
+ try testing.expect(editor.park_data_max >= client.maxWrite());
+}
+
test "9p server: board and native capacities size the actual fid storage" {
const Board = Server(Stub, board);
const Native = Server(Stub, editor);