summaryrefslogtreecommitdiff
path: root/9ns/src/bridge.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-21 14:38:16 -0300
committerGabriel Schneider <[email protected]>2026-10-21 14:44:48 -0300
commitd5c37d9122240fe95d308fbe15874e14dd786c5a (patch)
tree3ed108d2af5bd7a5cb07491b16e855e5243b5d63 /9ns/src/bridge.zig
parentfe9772b178575fcab93de09fc61c2f13db7db1a8 (diff)
downloadcloud9-d5c37d9122240fe95d308fbe15874e14dd786c5a.tar.gz
cloud9-d5c37d9122240fe95d308fbe15874e14dd786c5a.zip
Build with Zig 0.17
Diffstat (limited to '9ns/src/bridge.zig')
-rw-r--r--9ns/src/bridge.zig18
1 files changed, 9 insertions, 9 deletions
diff --git a/9ns/src/bridge.zig b/9ns/src/bridge.zig
index b94ef78..c866238 100644
--- a/9ns/src/bridge.zig
+++ b/9ns/src/bridge.zig
@@ -1594,7 +1594,7 @@ const Mntgen = struct {
/// Never blocks on the worker; allocation or a racing death reject the
/// request with an errno reply instead.
fn enqueue(mg: *Mntgen, m: *Mount, raw: []const u8) void {
- const wants_reply = switch (@as(fuse.Opcode, @enumFromInt(std.mem.readInt(u32, raw[4..8], .little)))) {
+ const wants_reply = switch (@as(fuse.Opcode, @fromBackingInt(@intCast(std.mem.readInt(u32, raw[4..8], .little))))) {
.forget, .batch_forget => false,
else => true,
};
@@ -1670,7 +1670,7 @@ const Mntgen = struct {
var buf: [@sizeOf(fuse.InHeader) + @sizeOf(fuse.ForgetIn)]u8 = undefined;
const hdr = fuse.InHeader{
.len = @sizeOf(fuse.InHeader) + @sizeOf(fuse.ForgetIn),
- .opcode = @intFromEnum(fuse.Opcode.forget),
+ .opcode = @backingInt(fuse.Opcode.forget),
.unique = unique,
.nodeid = nodeid,
.uid = 0,
@@ -2155,7 +2155,7 @@ fn uniqueOf(raw: []const u8) u64 {
/// Whether the kernel expects an answer to a raw request: everything but
/// the forgets.
fn wantsReply(raw: []const u8) bool {
- return switch (@as(fuse.Opcode, @enumFromInt(std.mem.readInt(u32, raw[4..8], .little)))) {
+ return switch (@as(fuse.Opcode, @fromBackingInt(@intCast(std.mem.readInt(u32, raw[4..8], .little))))) {
.forget, .batch_forget => false,
else => true,
};
@@ -2689,17 +2689,17 @@ test "attr mapping saturates hostile lengths instead of overflowing" {
test "dirent names the kernel would reject are dropped from listings" {
try testing.expect(validDirentName("a"));
- try testing.expect(validDirentName("x" ** 1024));
+ try testing.expect(validDirentName(&@as([1024]u8, @splat('x'))));
try testing.expect(!validDirentName(""));
try testing.expect(!validDirentName("a/b"));
try testing.expect(!validDirentName("a\x00b"));
try testing.expect(!validDirentName("."));
try testing.expect(!validDirentName(".."));
- try testing.expect(!validDirentName("x" ** 1025));
+ try testing.expect(!validDirentName(&@as([1025]u8, @splat('x'))));
var buf: [4096]u8 = undefined;
var n: usize = 0;
- for ([_][]const u8{ ".", "..", "", "a/b", "keep", "x" ** 1025, "also" }) |name| {
+ for ([_][]const u8{ ".", "..", "", "a/b", "keep", &@as([1025]u8, @splat('x')), "also" }) |name| {
n += (try cloud9.Stat.encode(testStat(name, 0o644, 1, 0x30), buf[n..])).len;
}
var list: DirList = .{};
@@ -2744,7 +2744,7 @@ test "interrupt source: INTERRUPT in flight → Tflush, other INTERRUPTs ignored
// A FORGET arriving during a wait is copied into the stash, and the fd
// stays watched: an INTERRUPT can still arrive behind it.
var wire: [48]u8 = undefined;
- const hdr = fuse.InHeader{ .len = 48, .opcode = @intFromEnum(fuse.Opcode.forget), .unique = 99, .nodeid = 5, .uid = 0, .gid = 0, .pid = 0, .total_extlen = 0, .padding = 0 };
+ const hdr = fuse.InHeader{ .len = 48, .opcode = @backingInt(fuse.Opcode.forget), .unique = 99, .nodeid = 5, .uid = 0, .gid = 0, .pid = 0, .total_extlen = 0, .padding = 0 };
@memcpy(wire[0..40], std.mem.asBytes(&hdr));
@memcpy(wire[40..48], std.mem.asBytes(&fuse.ForgetIn{ .nlookup = 1 }));
try testing.expectEqual(@as(usize, 48), linux.write(pi.write_end, &wire, wire.len));
@@ -2845,7 +2845,7 @@ const FakeKernel = struct {
fn send(k: *FakeKernel, op: fuse.Opcode, unique: u64, nodeid: u64, parts: []const []const u8) !void {
var len: usize = @sizeOf(fuse.InHeader);
for (parts) |p| len += p.len;
- const header = fuse.InHeader{ .len = @intCast(len), .opcode = @intFromEnum(op), .unique = unique, .nodeid = nodeid, .uid = 0, .gid = 0, .pid = 0, .total_extlen = 0, .padding = 0 };
+ const header = fuse.InHeader{ .len = @intCast(len), .opcode = @backingInt(op), .unique = unique, .nodeid = nodeid, .uid = 0, .gid = 0, .pid = 0, .total_extlen = 0, .padding = 0 };
var wire: [512]u8 = undefined;
@memcpy(wire[0..@sizeOf(fuse.InHeader)], std.mem.asBytes(&header));
var at: usize = @sizeOf(fuse.InHeader);
@@ -2982,7 +2982,7 @@ test "serve: a parked READ holds up neither other READs nor metadata; its INTERR
try k.send(.interrupt, 11, 0, &.{std.mem.asBytes(&fuse.InterruptIn{ .unique = 10 })});
var r = try k.recv(3000);
try testing.expectEqual(@as(u64, 10), r.unique);
- try testing.expectEqual(-@as(i32, @intFromEnum(linux.E.INTR)), r.err);
+ try testing.expectEqual(-@as(i32, @backingInt(linux.E.INTR)), r.err);
try testing.expectEqual(@as(u32, 1), fs.flushes.load(.seq_cst));
try testing.expectEqual(hung_tag, fs.flush_oldtag.load(.seq_cst));