commit fca24717bd6ad632f19cfebb435005d9658fcd47
parent cf284bdc34feea0e94432c23b3b5beb42b68507f
Author: Drew DeVault <sir@cmpwn.com>
Date: Tue, 18 May 2021 17:22:26 -0400
linux::io_uring: add fsync
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 14 insertions(+), 0 deletions(-)
diff --git a/linux/io_uring/sqe.ha b/linux/io_uring/sqe.ha
@@ -109,3 +109,17 @@ export fn write_fixed(
preprw(sqe, op::WRITE_FIXED, fd, buf, count: u32, 0, flags...);
sqe.buf_index = index;
};
+
+// Prepares an fsync operation for an [[sqe]]. Note that operations are executed
+// in parallel and not are completed in submission order, so an fsync submitted
+// after a write may not cause the write to be accounted for by the fsync unless
+// [[sqe_flags::IO_LINK]] is used.
+export fn fsync(
+ sqe: *sqe,
+ fd: int,
+ fsync_flags: fsync_flags,
+ flags: sqe_flags...
+) void = {
+ preprw(sqe, op::FSYNC, fd, null, 0, 0, flags...);
+ sqe.fsync_flags = fsync_flags;
+};