Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | **************************************************************************** |
| 3 | *** |
| 4 | *** This header was automatically generated from a Linux kernel header |
| 5 | *** of the same name, to make information necessary for userspace to |
| 6 | *** call into the kernel available to libc. It contains only constants, |
| 7 | *** structures, and macros generated from the original header, and thus, |
| 8 | *** contains no copyrightable information. |
| 9 | *** |
| 10 | *** To edit the content of this header, modify the corresponding |
| 11 | *** source file (e.g. under external/kernel-headers/original/) then |
| 12 | *** run bionic/libc/kernel/tools/update_all.py |
| 13 | *** |
| 14 | *** Any manual change here will be lost the next time this script will |
| 15 | *** be run. You've been warned! |
| 16 | *** |
| 17 | **************************************************************************** |
| 18 | ****************************************************************************/ |
| 19 | #ifndef LINUX_IO_URING_H |
| 20 | #define LINUX_IO_URING_H |
| 21 | #include <linux/fs.h> |
| 22 | #include <linux/types.h> |
| 23 | struct io_uring_sqe { |
| 24 | __u8 opcode; |
| 25 | __u8 flags; |
| 26 | __u16 ioprio; |
| 27 | __s32 fd; |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 28 | union { |
| 29 | __u64 off; |
| 30 | __u64 addr2; |
| 31 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 32 | union { |
| 33 | __u64 addr; |
| 34 | __u64 splice_off_in; |
| 35 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 36 | __u32 len; |
| 37 | union { |
| 38 | __kernel_rwf_t rw_flags; |
| 39 | __u32 fsync_flags; |
| 40 | __u16 poll_events; |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 41 | __u32 poll32_events; |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 42 | __u32 sync_range_flags; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 43 | __u32 msg_flags; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 44 | __u32 timeout_flags; |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 45 | __u32 accept_flags; |
| 46 | __u32 cancel_flags; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 47 | __u32 open_flags; |
| 48 | __u32 statx_flags; |
| 49 | __u32 fadvise_advice; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 50 | __u32 splice_flags; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 51 | }; |
| 52 | __u64 user_data; |
| 53 | union { |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 54 | struct { |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 55 | union { |
| 56 | __u16 buf_index; |
| 57 | __u16 buf_group; |
| 58 | } __attribute__((packed)); |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 59 | __u16 personality; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 60 | __s32 splice_fd_in; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 61 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 62 | __u64 __pad2[3]; |
| 63 | }; |
| 64 | }; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 65 | enum { |
| 66 | IOSQE_FIXED_FILE_BIT, |
| 67 | IOSQE_IO_DRAIN_BIT, |
| 68 | IOSQE_IO_LINK_BIT, |
| 69 | IOSQE_IO_HARDLINK_BIT, |
| 70 | IOSQE_ASYNC_BIT, |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 71 | IOSQE_BUFFER_SELECT_BIT, |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 72 | }; |
| 73 | #define IOSQE_FIXED_FILE (1U << IOSQE_FIXED_FILE_BIT) |
| 74 | #define IOSQE_IO_DRAIN (1U << IOSQE_IO_DRAIN_BIT) |
| 75 | #define IOSQE_IO_LINK (1U << IOSQE_IO_LINK_BIT) |
| 76 | #define IOSQE_IO_HARDLINK (1U << IOSQE_IO_HARDLINK_BIT) |
| 77 | #define IOSQE_ASYNC (1U << IOSQE_ASYNC_BIT) |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 78 | #define IOSQE_BUFFER_SELECT (1U << IOSQE_BUFFER_SELECT_BIT) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 79 | #define IORING_SETUP_IOPOLL (1U << 0) |
| 80 | #define IORING_SETUP_SQPOLL (1U << 1) |
| 81 | #define IORING_SETUP_SQ_AFF (1U << 2) |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 82 | #define IORING_SETUP_CQSIZE (1U << 3) |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 83 | #define IORING_SETUP_CLAMP (1U << 4) |
| 84 | #define IORING_SETUP_ATTACH_WQ (1U << 5) |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame^] | 85 | #define IORING_SETUP_R_DISABLED (1U << 6) |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 86 | enum { |
| 87 | IORING_OP_NOP, |
| 88 | IORING_OP_READV, |
| 89 | IORING_OP_WRITEV, |
| 90 | IORING_OP_FSYNC, |
| 91 | IORING_OP_READ_FIXED, |
| 92 | IORING_OP_WRITE_FIXED, |
| 93 | IORING_OP_POLL_ADD, |
| 94 | IORING_OP_POLL_REMOVE, |
| 95 | IORING_OP_SYNC_FILE_RANGE, |
| 96 | IORING_OP_SENDMSG, |
| 97 | IORING_OP_RECVMSG, |
| 98 | IORING_OP_TIMEOUT, |
| 99 | IORING_OP_TIMEOUT_REMOVE, |
| 100 | IORING_OP_ACCEPT, |
| 101 | IORING_OP_ASYNC_CANCEL, |
| 102 | IORING_OP_LINK_TIMEOUT, |
| 103 | IORING_OP_CONNECT, |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 104 | IORING_OP_FALLOCATE, |
| 105 | IORING_OP_OPENAT, |
| 106 | IORING_OP_CLOSE, |
| 107 | IORING_OP_FILES_UPDATE, |
| 108 | IORING_OP_STATX, |
| 109 | IORING_OP_READ, |
| 110 | IORING_OP_WRITE, |
| 111 | IORING_OP_FADVISE, |
| 112 | IORING_OP_MADVISE, |
| 113 | IORING_OP_SEND, |
| 114 | IORING_OP_RECV, |
| 115 | IORING_OP_OPENAT2, |
| 116 | IORING_OP_EPOLL_CTL, |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 117 | IORING_OP_SPLICE, |
| 118 | IORING_OP_PROVIDE_BUFFERS, |
| 119 | IORING_OP_REMOVE_BUFFERS, |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 120 | IORING_OP_TEE, |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 121 | IORING_OP_LAST, |
| 122 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 123 | #define IORING_FSYNC_DATASYNC (1U << 0) |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 124 | #define IORING_TIMEOUT_ABS (1U << 0) |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 125 | #define SPLICE_F_FD_IN_FIXED (1U << 31) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 126 | struct io_uring_cqe { |
| 127 | __u64 user_data; |
| 128 | __s32 res; |
| 129 | __u32 flags; |
| 130 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 131 | #define IORING_CQE_F_BUFFER (1U << 0) |
| 132 | enum { |
| 133 | IORING_CQE_BUFFER_SHIFT = 16, |
| 134 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 135 | #define IORING_OFF_SQ_RING 0ULL |
| 136 | #define IORING_OFF_CQ_RING 0x8000000ULL |
| 137 | #define IORING_OFF_SQES 0x10000000ULL |
| 138 | struct io_sqring_offsets { |
| 139 | __u32 head; |
| 140 | __u32 tail; |
| 141 | __u32 ring_mask; |
| 142 | __u32 ring_entries; |
| 143 | __u32 flags; |
| 144 | __u32 dropped; |
| 145 | __u32 array; |
| 146 | __u32 resv1; |
| 147 | __u64 resv2; |
| 148 | }; |
| 149 | #define IORING_SQ_NEED_WAKEUP (1U << 0) |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 150 | #define IORING_SQ_CQ_OVERFLOW (1U << 1) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 151 | struct io_cqring_offsets { |
| 152 | __u32 head; |
| 153 | __u32 tail; |
| 154 | __u32 ring_mask; |
| 155 | __u32 ring_entries; |
| 156 | __u32 overflow; |
| 157 | __u32 cqes; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 158 | __u32 flags; |
| 159 | __u32 resv1; |
| 160 | __u64 resv2; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 161 | }; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 162 | #define IORING_CQ_EVENTFD_DISABLED (1U << 0) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 163 | #define IORING_ENTER_GETEVENTS (1U << 0) |
| 164 | #define IORING_ENTER_SQ_WAKEUP (1U << 1) |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame^] | 165 | #define IORING_ENTER_SQ_WAIT (1U << 2) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 166 | struct io_uring_params { |
| 167 | __u32 sq_entries; |
| 168 | __u32 cq_entries; |
| 169 | __u32 flags; |
| 170 | __u32 sq_thread_cpu; |
| 171 | __u32 sq_thread_idle; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 172 | __u32 features; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 173 | __u32 wq_fd; |
| 174 | __u32 resv[3]; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 175 | struct io_sqring_offsets sq_off; |
| 176 | struct io_cqring_offsets cq_off; |
| 177 | }; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 178 | #define IORING_FEAT_SINGLE_MMAP (1U << 0) |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 179 | #define IORING_FEAT_NODROP (1U << 1) |
| 180 | #define IORING_FEAT_SUBMIT_STABLE (1U << 2) |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 181 | #define IORING_FEAT_RW_CUR_POS (1U << 3) |
| 182 | #define IORING_FEAT_CUR_PERSONALITY (1U << 4) |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 183 | #define IORING_FEAT_FAST_POLL (1U << 5) |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 184 | #define IORING_FEAT_POLL_32BITS (1U << 6) |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame^] | 185 | enum { |
| 186 | IORING_REGISTER_BUFFERS = 0, |
| 187 | IORING_UNREGISTER_BUFFERS = 1, |
| 188 | IORING_REGISTER_FILES = 2, |
| 189 | IORING_UNREGISTER_FILES = 3, |
| 190 | IORING_REGISTER_EVENTFD = 4, |
| 191 | IORING_UNREGISTER_EVENTFD = 5, |
| 192 | IORING_REGISTER_FILES_UPDATE = 6, |
| 193 | IORING_REGISTER_EVENTFD_ASYNC = 7, |
| 194 | IORING_REGISTER_PROBE = 8, |
| 195 | IORING_REGISTER_PERSONALITY = 9, |
| 196 | IORING_UNREGISTER_PERSONALITY = 10, |
| 197 | IORING_REGISTER_RESTRICTIONS = 11, |
| 198 | IORING_REGISTER_ENABLE_RINGS = 12, |
| 199 | IORING_REGISTER_LAST |
| 200 | }; |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 201 | struct io_uring_files_update { |
| 202 | __u32 offset; |
| 203 | __u32 resv; |
| 204 | __aligned_u64 fds; |
| 205 | }; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 206 | #define IO_URING_OP_SUPPORTED (1U << 0) |
| 207 | struct io_uring_probe_op { |
| 208 | __u8 op; |
| 209 | __u8 resv; |
| 210 | __u16 flags; |
| 211 | __u32 resv2; |
| 212 | }; |
| 213 | struct io_uring_probe { |
| 214 | __u8 last_op; |
| 215 | __u8 ops_len; |
| 216 | __u16 resv; |
| 217 | __u32 resv2[3]; |
| 218 | struct io_uring_probe_op ops[0]; |
| 219 | }; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame^] | 220 | struct io_uring_restriction { |
| 221 | __u16 opcode; |
| 222 | union { |
| 223 | __u8 register_op; |
| 224 | __u8 sqe_op; |
| 225 | __u8 sqe_flags; |
| 226 | }; |
| 227 | __u8 resv; |
| 228 | __u32 resv2[3]; |
| 229 | }; |
| 230 | enum { |
| 231 | IORING_RESTRICTION_REGISTER_OP = 0, |
| 232 | IORING_RESTRICTION_SQE_OP = 1, |
| 233 | IORING_RESTRICTION_SQE_FLAGS_ALLOWED = 2, |
| 234 | IORING_RESTRICTION_SQE_FLAGS_REQUIRED = 3, |
| 235 | IORING_RESTRICTION_LAST |
| 236 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 237 | #endif |