Skip to contentSkip to conversation

liburing uapi and manpage update

PATCH Applied Ammar Faizi 2 participants 4 messages Aug 23, 2022 io_uring

lore
Share & tools
lore
#0 lore raw

cover liburing uapi and manpage update

From: Ammar Faizi <[email protected]>

Hi Jens,

There are two patches in this series.

1) Sync the argument data type with man 2 renameat.

2) On top of io_uring series I just sent, copy uapi io_uring.h to liburing. Sync with the kernel.

---

Ammar Faizi (2):
liburing: Change the type of flags in io_uring_prep_renameat() to unsigned int
io_uring: uapi: Sync with the kernel

 man/io_uring_prep_renameat.3    |  4 +-
 src/include/liburing.h          |  2 +-
 src/include/liburing/io_uring.h | 66 ++++++++++++++++++++++++---------
 3 files changed, 51 insertions(+), 21 deletions(-)

base-commit: bf3fedba890e66d644692910964fe1d8cbf4fb1b

Signature · 1 line
Ammar Faizi
#1 lore raw

PATCH 1/2 liburing: Change the type of `flags` in `io_uring_prep_renameat()` to `unsigned int`

From: Ammar Faizi <[email protected]>

Sync with the declaration of renameat2() from the man page.

---
 man/io_uring_prep_renameat.3 | 4 ++--
 src/include/liburing.h       | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
man/io_uring_prep_renameat.3 +2 -2
index 1fc9e01..08d4a46 100644
@@ -16,12 +16,12 @@ io_uring_prep_renameat \- prepare a renameat request
 .BI "                            const char *" oldpath ","
 .BI "                            int " newdirfd ","
 .BI "                            const char *" newpath ","
-.BI "                            int " flags ");"
+.BI "                            unsigned int " flags ");"
 .PP
 .BI "void io_uring_prep_rename(struct io_uring_sqe *" sqe ","
 .BI "                          const char *" oldpath ","
 .BI "                          const char *" newpath ","
-.BI "                          int " flags ");"
+.BI "                          unsigned int " flags ");"
 .fi
 .SH DESCRIPTION
 .PP
src/include/liburing.h +1 -1
index 06f4a50..df748aa 100644
@@ -862,7 +862,7 @@ static inline void io_uring_prep_unlink(struct io_uring_sqe *sqe,
 
 static inline void io_uring_prep_renameat(struct io_uring_sqe *sqe, int olddfd,
 					  const char *oldpath, int newdfd,
-					  const char *newpath, int flags)
+					  const char *newpath, unsigned int flags)
 {
 	io_uring_prep_rw(IORING_OP_RENAMEAT, sqe, olddfd, oldpath,
 				(__u32) newdfd,
Signature · 1 line
Ammar Faizi
#2 lore raw

PATCH 2/2 io_uring: uapi: Sync with the kernel

In reply to Ammar Faizi

From: Ammar Faizi <[email protected]>

This is a full copy from the kernel tree without any modifition. Now this header is fully in sync with the kernel. Next time when changing this header from the kernel side, just copy the file directly to liburing, no need manual modification.

---
 src/include/liburing/io_uring.h | 66 ++++++++++++++++++++++++---------
 1 file changed, 48 insertions(+), 18 deletions(-)
src/include/liburing/io_uring.h +48 -18
index c923f5c..9e0b5c8 100644
@@ -10,6 +10,7 @@
 
 #include <linux/fs.h>
 #include <linux/types.h>
+#include <linux/time_types.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -54,6 +55,7 @@ struct io_uring_sqe {
 		__u32		unlink_flags;
 		__u32		hardlink_flags;
 		__u32		xattr_flags;
+		__u32		msg_ring_flags;
 	};
 	__u64	user_data;	/* data to be passed back at completion time */
 	/* pack this to avoid bogus arm OABI complaints */
@@ -148,7 +150,6 @@ enum {
  * IORING_SQ_TASKRUN in the sq ring flags. Not valid with COOP_TASKRUN.
  */
 #define IORING_SETUP_TASKRUN_FLAG	(1U << 9)
-
 #define IORING_SETUP_SQE128		(1U << 10) /* SQEs are 128 byte */
 #define IORING_SETUP_CQE32		(1U << 11) /* CQEs are 32 byte */
 /*
@@ -244,10 +245,13 @@ enum io_uring_op {
  *
  * IORING_POLL_UPDATE		Update existing poll request, matching
  *				sqe->addr as the old user_data field.
+ *
+ * IORING_POLL_LEVEL		Level triggered poll.
  */
 #define IORING_POLL_ADD_MULTI	(1U << 0)
 #define IORING_POLL_UPDATE_EVENTS	(1U << 1)
 #define IORING_POLL_UPDATE_USER_DATA	(1U << 2)
+#define IORING_POLL_ADD_LEVEL		(1U << 3)
 
 /*
  * ASYNC_CANCEL flags.
@@ -256,10 +260,12 @@ enum io_uring_op {
  * IORING_ASYNC_CANCEL_FD	Key off 'fd' for cancelation rather than the
  *				request 'user_data'
  * IORING_ASYNC_CANCEL_ANY	Match any request
+ * IORING_ASYNC_CANCEL_FD_FIXED	'fd' passed in is a fixed descriptor
  */
 #define IORING_ASYNC_CANCEL_ALL	(1U << 0)
 #define IORING_ASYNC_CANCEL_FD	(1U << 1)
-#define IORING_ASYNC_CANCEL_ANY (1U << 2)
+#define IORING_ASYNC_CANCEL_ANY	(1U << 2)
+#define IORING_ASYNC_CANCEL_FD_FIXED	(1U << 3)
 
 /*
  * send/sendmsg and recv/recvmsg flags (sqe->ioprio)
@@ -272,6 +278,12 @@ enum io_uring_op {
  * IORING_RECV_MULTISHOT	Multishot recv. Sets IORING_CQE_F_MORE if
  *				the handler will continue to report
  *				CQEs on behalf of the same SQE.
+ *
+ * IORING_RECVSEND_FIXED_BUF	Use registered buffers, the index is stored in
+ *				the buf_index field.
+ *
+ * IORING_RECVSEND_NOTIF_FLUSH	Flush a notification after a successful
+ *				successful. Only for zerocopy sends.
  */
 #define IORING_RECVSEND_POLL_FIRST	(1U << 0)
 #define IORING_RECV_MULTISHOT		(1U << 1)
@@ -283,6 +295,7 @@ enum io_uring_op {
  */
 #define IORING_ACCEPT_MULTISHOT	(1U << 0)
 
+
 /*
  * IORING_OP_RSRC_UPDATE flags
  */
@@ -291,6 +304,22 @@ enum {
 	IORING_RSRC_UPDATE_NOTIF,
 };
 
+/*
+ * IORING_OP_MSG_RING command types, stored in sqe->addr
+ */
+enum {
+	IORING_MSG_DATA,	/* pass sqe->len as 'res' and off as user_data */
+	IORING_MSG_SEND_FD,	/* send a registered fd to another ring */
+};
+
+/*
+ * IORING_OP_MSG_RING flags (sqe->msg_ring_flags)
+ *
+ * IORING_MSG_RING_CQE_SKIP	Don't post a CQE to the target ring. Not
+ *				applicable for IORING_MSG_DATA, obviously.
+ */
+#define IORING_MSG_RING_CQE_SKIP	(1U << 0)
+
 /*
  * IO completion data structure (Completion Queue Entry)
  */
@@ -456,6 +485,7 @@ enum {
 	/* register a range of fixed file slots for automatic slot allocation */
 	IORING_REGISTER_FILE_ALLOC_RANGE	= 25,
 
+	/* zerocopy notification API */
 	IORING_REGISTER_NOTIFIERS		= 26,
 	IORING_UNREGISTER_NOTIFIERS		= 27,
 
@@ -535,7 +565,7 @@ struct io_uring_probe {
 	__u8 ops_len;	/* length of ops[] array below */
 	__u16 resv;
 	__u32 resv2[3];
-	struct io_uring_probe_op ops[0];
+	struct io_uring_probe_op ops[];
 };
 
 struct io_uring_restriction {
@@ -581,15 +611,6 @@ struct io_uring_buf_reg {
 	__u64	resv[3];
 };
 
-/* argument for IORING_REGISTER_SYNC_CANCEL */
-struct io_uring_sync_cancel_reg {
-	__u64				addr;
-	__s32				fd;
-	__u32				flags;
-	struct __kernel_timespec	timeout;
-	__u64				pad[4];
-};
-
 /*
  * io_uring_restriction->opcode values
  */
@@ -616,8 +637,22 @@ struct io_uring_getevents_arg {
 	__u64	ts;
 };
 
+/*
+ * Argument for IORING_REGISTER_SYNC_CANCEL
+ */
+struct io_uring_sync_cancel_reg {
+	__u64				addr;
+	__s32				fd;
+	__u32				flags;
+	struct __kernel_timespec	timeout;
+	__u64				pad[4];
+};
+
+/*
+ * Argument for IORING_REGISTER_FILE_ALLOC_RANGE
+ * The range is specified as [off, off + len)
+ */
 struct io_uring_file_index_range {
-	/* [off, off + len) */
 	__u32	off;
 	__u32	len;
 	__u64	resv;
@@ -630,11 +665,6 @@ struct io_uring_recvmsg_out {
 	__u32 flags;
 };
 
-/*
- * accept flags stored in sqe->ioprio
- */
-#define IORING_ACCEPT_MULTISHOT	(1U << 0)
-
 #ifdef __cplusplus
 }
 #endif
Signature · 1 line
Ammar Faizi
maintainer Applied
#3 lore raw
In reply to Ammar Faizi
Quoted 10 lines · Ammar Faizi

From: Ammar Faizi <[email protected]>

Hi Jens,

There are two patches in this series.

1) Sync the argument data type with man 2 renameat.

2) On top of io_uring series I just sent, copy uapi io_uring.h to liburing. Sync with the kernel.

Applied, thanks.

Signature · 1 line
Jens Axboe