io_uring: let to set a range for file slot allocation
[linux-block.git] / include / uapi / linux / io_uring.h
index 0ad3da28d2fce870982d6a175de4086695bffbe0..cf95354198a3935a19deb5aa3df367aa0270fa11 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/fs.h>
 #include <linux/types.h>
+#include <linux/time_types.h>
 
 /*
  * IO submission data structure (Submission Queue Entry)
@@ -50,6 +51,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 */
@@ -140,9 +142,12 @@ 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 */
+/*
+ * Only one task is allowed to submit requests
+ */
+#define IORING_SETUP_SINGLE_ISSUER     (1U << 12)
 
 enum io_uring_op {
        IORING_OP_NOP,
@@ -229,10 +234,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.
@@ -241,10 +249,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_FD_FIXED   (1U << 3)
 
 /*
  * send/sendmsg and recv/recvmsg flags (sqe->ioprio)
@@ -261,6 +271,22 @@ enum io_uring_op {
  */
 #define IORING_ACCEPT_MULTISHOT        (1U << 0)
 
+/*
+ * 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)
  */
@@ -420,6 +446,12 @@ enum {
        IORING_REGISTER_PBUF_RING               = 22,
        IORING_UNREGISTER_PBUF_RING             = 23,
 
+       /* sync cancelation API */
+       IORING_REGISTER_SYNC_CANCEL             = 24,
+
+       /* register a range of fixed file slots for automatic slot allocation */
+       IORING_REGISTER_FILE_ALLOC_RANGE        = 25,
+
        /* this goes last */
        IORING_REGISTER_LAST
 };
@@ -483,7 +515,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 {
@@ -555,4 +587,25 @@ 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 {
+       __u32   off;
+       __u32   len;
+       __u64   resv;
+};
+
 #endif