authorgravatar for joran@ronomon.comJoran Dirk Greef <joran@ronomon.com> 2020-09-21 11:09:37+02:00
committergravatar for joran@ronomon.comJoran Dirk Greef <joran@ronomon.com> 2020-09-21 11:09:37+02:00
log7719abbf5460c320b63f7fe10ee27b9e9b66a069
treec6306c8d9250f129cc783695d481c1143a88df18
parent57603fd26d2902d82a7fd5e9ec2529b38bd51344

Add flags to queue_fsync() signature as per liburing


1 files changed, 3 insertions(+), 2 deletions(-)

lib/std/os/linux/io_uring.zig+3-2
...@@ -369,10 +369,11 @@ pub const IO_Uring = struct {...@@ -369,10 +369,11 @@ pub const IO_Uring = struct {
369 /// apply to the write, since the fsync may complete before the write is issued to the disk.369 /// apply to the write, since the fsync may complete before the write is issued to the disk.
370 /// You should preferably use `link_with_next_sqe()` on a write's SQE to link it with an fsync,370 /// You should preferably use `link_with_next_sqe()` on a write's SQE to link it with an fsync,
371 /// or else insert a full write barrier using `drain_previous_sqes()` when queueing an fsync.371 /// or else insert a full write barrier using `drain_previous_sqes()` when queueing an fsync.
372 pub fn queue_fsync(self: *IO_Uring, user_data: u64, fd: os.fd_t) !*io_uring_sqe {372 pub fn queue_fsync(self: *IO_Uring, user_data: u64, fd: os.fd_t, flags: u32) !*io_uring_sqe {
373 const sqe = try self.get_sqe();373 const sqe = try self.get_sqe();
374 sqe.opcode = .FSYNC;374 sqe.opcode = .FSYNC;
375 sqe.fd = fd;375 sqe.fd = fd;
376 sqe.rw_flags = flags;
376 sqe.user_data = user_data;377 sqe.user_data = user_data;
377 return sqe;378 return sqe;
378 }379 }
...@@ -811,7 +812,7 @@ test "queue_writev/queue_fsync" {...@@ -811,7 +812,7 @@ test "queue_writev/queue_fsync" {
811 ring.link_with_next_sqe(sqe_writev);812 ring.link_with_next_sqe(sqe_writev);
812 testing.expectEqual(@as(u8, linux.IOSQE_IO_LINK), sqe_writev.flags);813 testing.expectEqual(@as(u8, linux.IOSQE_IO_LINK), sqe_writev.flags);
813 814
814 var sqe_fsync = try ring.queue_fsync(0xeeeeeeee, fd);815 var sqe_fsync = try ring.queue_fsync(0xeeeeeeee, fd, 0);
815 testing.expectEqual(fd, sqe_fsync.fd);816 testing.expectEqual(fd, sqe_fsync.fd);
816817
817 testing.expectEqual(@as(u32, 2), ring.sq_ready());818 testing.expectEqual(@as(u32, 2), ring.sq_ready());