diff options
Diffstat (limited to 'src/ninep/testing.zig')
| -rw-r--r-- | src/ninep/testing.zig | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/ninep/testing.zig b/src/ninep/testing.zig index ad1d84e4..44329eee 100644 --- a/src/ninep/testing.zig +++ b/src/ninep/testing.zig @@ -69,26 +69,14 @@ pub fn look_up(p: *Pardes, dir: u64, name: []const u8) Answer { return call(p, .{ .tag = 3, .op = .lookup, .node = dir, .data = name }); } -/// Creates a pane in /pane, as a client's mkdir does, and returns its serial. +/// Makes a pane the way a client does, by walking to /pane/new, and answers +/// the serial of the pane the walk landed on. +/// The open is what makes the pane; the handle it answers is the serial, which +/// is also what a read of that fid reports. pub fn newPane(p: *Pardes) !u32 { - const made = mkdir(p, "scratch"); - if (made.reply.status != .ok) return error.NoPane; - const target = tree.Node.target(made.reply.attr.node) orelse return error.NoPane; - return switch (target) { - .pane => |t| t.serial, - .top => error.NoPane, - }; -} - -pub fn mkdir(p: *Pardes, name: []const u8) Answer { - return call(p, .{ - .tag = 9, - .op = .open, - .node = @intFromEnum(tree.TopFile.pane), - .data = name, - .create = true, - .perm = 0x8000_0000 | 0o755, - }); + const made = call(p, .{ .tag = 8, .op = .open, .node = @intFromEnum(tree.TopFile.new) }); + if (made.reply.status != .ok or made.reply.handle == 0) return error.NoPane; + return made.reply.handle; } pub fn rmdir(p: *Pardes, node: u64) Answer { |
