| ... | @@ -196,7 +196,7 @@ pub const IO_Uring = struct { | ... | @@ -196,7 +196,7 @@ pub const IO_Uring = struct { |
| 196 | var submitted = self.flush_sq(); | 196 | var submitted = self.flush_sq(); |
| 197 | var flags: u32 = 0; | 197 | var flags: u32 = 0; |
| 198 | if (self.sq_ring_needs_enter(submitted, &flags) or wait_nr > 0) { | 198 | if (self.sq_ring_needs_enter(submitted, &flags) or wait_nr > 0) { |
| 199 | if (wait_nr > 0 or (self.flags & linux.IORING_SETUP_IOPOLL) > 0) { | 199 | if (wait_nr > 0 or (self.flags & linux.IORING_SETUP_IOPOLL) != 0) { |
| 200 | flags |= linux.IORING_ENTER_GETEVENTS; | 200 | flags |= linux.IORING_ENTER_GETEVENTS; |
| 201 | } | 201 | } |
| 202 | return try self.enter(submitted, wait_nr, flags); | 202 | return try self.enter(submitted, wait_nr, flags); |
| ... | @@ -243,7 +243,7 @@ pub const IO_Uring = struct { | ... | @@ -243,7 +243,7 @@ pub const IO_Uring = struct { |
| 243 | fn sq_ring_needs_enter(self: *IO_Uring, submitted: u32, flags: *u32) bool { | 243 | fn sq_ring_needs_enter(self: *IO_Uring, submitted: u32, flags: *u32) bool { |
| 244 | assert(flags.* == 0); | 244 | assert(flags.* == 0); |
| 245 | if ((self.flags & linux.IORING_SETUP_SQPOLL) == 0 and submitted > 0) return true; | 245 | if ((self.flags & linux.IORING_SETUP_SQPOLL) == 0 and submitted > 0) return true; |
| 246 | if ((@atomicLoad(u32, self.sq.flags, .Unordered) & linux.IORING_SQ_NEED_WAKEUP) > 0) { | 246 | if ((@atomicLoad(u32, self.sq.flags, .Unordered) & linux.IORING_SQ_NEED_WAKEUP) != 0) { |
| 247 | flags.* |= linux.IORING_ENTER_SQ_WAKEUP; | 247 | flags.* |= linux.IORING_ENTER_SQ_WAKEUP; |
| 248 | return true; | 248 | return true; |
| 249 | } | 249 | } |
| ... | @@ -316,7 +316,7 @@ pub const IO_Uring = struct { | ... | @@ -316,7 +316,7 @@ pub const IO_Uring = struct { |
| 316 | | 316 | |
| 317 | // Matches the implementation of cq_ring_needs_flush() in liburing. | 317 | // Matches the implementation of cq_ring_needs_flush() in liburing. |
| 318 | fn cq_ring_needs_flush(self: *IO_Uring) bool { | 318 | fn cq_ring_needs_flush(self: *IO_Uring) bool { |
| 319 | return (@atomicLoad(u32, self.sq.flags, .Unordered) & IORING_SQ_CQ_OVERFLOW) > 0; | 319 | return (@atomicLoad(u32, self.sq.flags, .Unordered) & IORING_SQ_CQ_OVERFLOW) != 0; |
| 320 | } | 320 | } |
| 321 | | 321 | |
| 322 | /// For advanced use cases only that implement custom completion queue methods. | 322 | /// For advanced use cases only that implement custom completion queue methods. |
| ... | @@ -570,7 +570,7 @@ pub const SubmissionQueue = struct { | ... | @@ -570,7 +570,7 @@ pub const SubmissionQueue = struct { |
| 570 | | 570 | |
| 571 | pub fn init(fd: i32, p: io_uring_params) !SubmissionQueue { | 571 | pub fn init(fd: i32, p: io_uring_params) !SubmissionQueue { |
| 572 | assert(fd >= 0); | 572 | assert(fd >= 0); |
| 573 | assert((p.features & linux.IORING_FEAT_SINGLE_MMAP) > 0); | 573 | assert((p.features & linux.IORING_FEAT_SINGLE_MMAP) != 0); |
| 574 | const size = std.math.max( | 574 | const size = std.math.max( |
| 575 | p.sq_off.array + p.sq_entries * @sizeOf(u32), | 575 | p.sq_off.array + p.sq_entries * @sizeOf(u32), |
| 576 | p.cq_off.cqes + p.cq_entries * @sizeOf(io_uring_cqe) | 576 | p.cq_off.cqes + p.cq_entries * @sizeOf(io_uring_cqe) |
| ... | @@ -636,7 +636,7 @@ pub const CompletionQueue = struct { | ... | @@ -636,7 +636,7 @@ pub const CompletionQueue = struct { |
| 636 | | 636 | |
| 637 | pub fn init(fd: i32, p: io_uring_params, sq: SubmissionQueue) !CompletionQueue { | 637 | pub fn init(fd: i32, p: io_uring_params, sq: SubmissionQueue) !CompletionQueue { |
| 638 | assert(fd >= 0); | 638 | assert(fd >= 0); |
| 639 | assert((p.features & linux.IORING_FEAT_SINGLE_MMAP) > 0); | 639 | assert((p.features & linux.IORING_FEAT_SINGLE_MMAP) != 0); |
| 640 | const mmap = sq.mmap; | 640 | const mmap = sq.mmap; |
| 641 | const cqes = @ptrCast( | 641 | const cqes = @ptrCast( |
| 642 | [*]io_uring_cqe, | 642 | [*]io_uring_cqe, |