• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef UAPI_LINUX_IO_URING_H_SKIP_LINUX_TIME_TYPES_H
24 #include <linux/time_types.h>
25 #endif
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 struct io_uring_sqe {
30   __u8 opcode;
31   __u8 flags;
32   __u16 ioprio;
33   __s32 fd;
34   union {
35     __u64 off;
36     __u64 addr2;
37     struct {
38       __u32 cmd_op;
39       __u32 __pad1;
40     };
41   };
42   union {
43     __u64 addr;
44     __u64 splice_off_in;
45   };
46   __u32 len;
47   union {
48     __kernel_rwf_t rw_flags;
49     __u32 fsync_flags;
50     __u16 poll_events;
51     __u32 poll32_events;
52     __u32 sync_range_flags;
53     __u32 msg_flags;
54     __u32 timeout_flags;
55     __u32 accept_flags;
56     __u32 cancel_flags;
57     __u32 open_flags;
58     __u32 statx_flags;
59     __u32 fadvise_advice;
60     __u32 splice_flags;
61     __u32 rename_flags;
62     __u32 unlink_flags;
63     __u32 hardlink_flags;
64     __u32 xattr_flags;
65     __u32 msg_ring_flags;
66     __u32 uring_cmd_flags;
67   };
68   __u64 user_data;
69   union {
70     __u16 buf_index;
71     __u16 buf_group;
72   } __attribute__((packed));
73   __u16 personality;
74   union {
75     __s32 splice_fd_in;
76     __u32 file_index;
77     struct {
78       __u16 addr_len;
79       __u16 __pad3[1];
80     };
81   };
82   union {
83     struct {
84       __u64 addr3;
85       __u64 __pad2[1];
86     };
87     __u8 cmd[0];
88   };
89 };
90 #define IORING_FILE_INDEX_ALLOC (~0U)
91 enum {
92   IOSQE_FIXED_FILE_BIT,
93   IOSQE_IO_DRAIN_BIT,
94   IOSQE_IO_LINK_BIT,
95   IOSQE_IO_HARDLINK_BIT,
96   IOSQE_ASYNC_BIT,
97   IOSQE_BUFFER_SELECT_BIT,
98   IOSQE_CQE_SKIP_SUCCESS_BIT,
99 };
100 #define IOSQE_FIXED_FILE (1U << IOSQE_FIXED_FILE_BIT)
101 #define IOSQE_IO_DRAIN (1U << IOSQE_IO_DRAIN_BIT)
102 #define IOSQE_IO_LINK (1U << IOSQE_IO_LINK_BIT)
103 #define IOSQE_IO_HARDLINK (1U << IOSQE_IO_HARDLINK_BIT)
104 #define IOSQE_ASYNC (1U << IOSQE_ASYNC_BIT)
105 #define IOSQE_BUFFER_SELECT (1U << IOSQE_BUFFER_SELECT_BIT)
106 #define IOSQE_CQE_SKIP_SUCCESS (1U << IOSQE_CQE_SKIP_SUCCESS_BIT)
107 #define IORING_SETUP_IOPOLL (1U << 0)
108 #define IORING_SETUP_SQPOLL (1U << 1)
109 #define IORING_SETUP_SQ_AFF (1U << 2)
110 #define IORING_SETUP_CQSIZE (1U << 3)
111 #define IORING_SETUP_CLAMP (1U << 4)
112 #define IORING_SETUP_ATTACH_WQ (1U << 5)
113 #define IORING_SETUP_R_DISABLED (1U << 6)
114 #define IORING_SETUP_SUBMIT_ALL (1U << 7)
115 #define IORING_SETUP_COOP_TASKRUN (1U << 8)
116 #define IORING_SETUP_TASKRUN_FLAG (1U << 9)
117 #define IORING_SETUP_SQE128 (1U << 10)
118 #define IORING_SETUP_CQE32 (1U << 11)
119 #define IORING_SETUP_SINGLE_ISSUER (1U << 12)
120 #define IORING_SETUP_DEFER_TASKRUN (1U << 13)
121 enum io_uring_op {
122   IORING_OP_NOP,
123   IORING_OP_READV,
124   IORING_OP_WRITEV,
125   IORING_OP_FSYNC,
126   IORING_OP_READ_FIXED,
127   IORING_OP_WRITE_FIXED,
128   IORING_OP_POLL_ADD,
129   IORING_OP_POLL_REMOVE,
130   IORING_OP_SYNC_FILE_RANGE,
131   IORING_OP_SENDMSG,
132   IORING_OP_RECVMSG,
133   IORING_OP_TIMEOUT,
134   IORING_OP_TIMEOUT_REMOVE,
135   IORING_OP_ACCEPT,
136   IORING_OP_ASYNC_CANCEL,
137   IORING_OP_LINK_TIMEOUT,
138   IORING_OP_CONNECT,
139   IORING_OP_FALLOCATE,
140   IORING_OP_OPENAT,
141   IORING_OP_CLOSE,
142   IORING_OP_FILES_UPDATE,
143   IORING_OP_STATX,
144   IORING_OP_READ,
145   IORING_OP_WRITE,
146   IORING_OP_FADVISE,
147   IORING_OP_MADVISE,
148   IORING_OP_SEND,
149   IORING_OP_RECV,
150   IORING_OP_OPENAT2,
151   IORING_OP_EPOLL_CTL,
152   IORING_OP_SPLICE,
153   IORING_OP_PROVIDE_BUFFERS,
154   IORING_OP_REMOVE_BUFFERS,
155   IORING_OP_TEE,
156   IORING_OP_SHUTDOWN,
157   IORING_OP_RENAMEAT,
158   IORING_OP_UNLINKAT,
159   IORING_OP_MKDIRAT,
160   IORING_OP_SYMLINKAT,
161   IORING_OP_LINKAT,
162   IORING_OP_MSG_RING,
163   IORING_OP_FSETXATTR,
164   IORING_OP_SETXATTR,
165   IORING_OP_FGETXATTR,
166   IORING_OP_GETXATTR,
167   IORING_OP_SOCKET,
168   IORING_OP_URING_CMD,
169   IORING_OP_SEND_ZC,
170   IORING_OP_SENDMSG_ZC,
171   IORING_OP_LAST,
172 };
173 #define IORING_URING_CMD_FIXED (1U << 0)
174 #define IORING_FSYNC_DATASYNC (1U << 0)
175 #define IORING_TIMEOUT_ABS (1U << 0)
176 #define IORING_TIMEOUT_UPDATE (1U << 1)
177 #define IORING_TIMEOUT_BOOTTIME (1U << 2)
178 #define IORING_TIMEOUT_REALTIME (1U << 3)
179 #define IORING_LINK_TIMEOUT_UPDATE (1U << 4)
180 #define IORING_TIMEOUT_ETIME_SUCCESS (1U << 5)
181 #define IORING_TIMEOUT_CLOCK_MASK (IORING_TIMEOUT_BOOTTIME | IORING_TIMEOUT_REALTIME)
182 #define IORING_TIMEOUT_UPDATE_MASK (IORING_TIMEOUT_UPDATE | IORING_LINK_TIMEOUT_UPDATE)
183 #define SPLICE_F_FD_IN_FIXED (1U << 31)
184 #define IORING_POLL_ADD_MULTI (1U << 0)
185 #define IORING_POLL_UPDATE_EVENTS (1U << 1)
186 #define IORING_POLL_UPDATE_USER_DATA (1U << 2)
187 #define IORING_POLL_ADD_LEVEL (1U << 3)
188 #define IORING_ASYNC_CANCEL_ALL (1U << 0)
189 #define IORING_ASYNC_CANCEL_FD (1U << 1)
190 #define IORING_ASYNC_CANCEL_ANY (1U << 2)
191 #define IORING_ASYNC_CANCEL_FD_FIXED (1U << 3)
192 #define IORING_RECVSEND_POLL_FIRST (1U << 0)
193 #define IORING_RECV_MULTISHOT (1U << 1)
194 #define IORING_RECVSEND_FIXED_BUF (1U << 2)
195 #define IORING_SEND_ZC_REPORT_USAGE (1U << 3)
196 #define IORING_NOTIF_USAGE_ZC_COPIED (1U << 31)
197 #define IORING_ACCEPT_MULTISHOT (1U << 0)
198 enum {
199   IORING_MSG_DATA,
200   IORING_MSG_SEND_FD,
201 };
202 #define IORING_MSG_RING_CQE_SKIP (1U << 0)
203 struct io_uring_cqe {
204   __u64 user_data;
205   __s32 res;
206   __u32 flags;
207   __u64 big_cqe[];
208 };
209 #define IORING_CQE_F_BUFFER (1U << 0)
210 #define IORING_CQE_F_MORE (1U << 1)
211 #define IORING_CQE_F_SOCK_NONEMPTY (1U << 2)
212 #define IORING_CQE_F_NOTIF (1U << 3)
213 enum {
214   IORING_CQE_BUFFER_SHIFT = 16,
215 };
216 #define IORING_OFF_SQ_RING 0ULL
217 #define IORING_OFF_CQ_RING 0x8000000ULL
218 #define IORING_OFF_SQES 0x10000000ULL
219 struct io_sqring_offsets {
220   __u32 head;
221   __u32 tail;
222   __u32 ring_mask;
223   __u32 ring_entries;
224   __u32 flags;
225   __u32 dropped;
226   __u32 array;
227   __u32 resv1;
228   __u64 resv2;
229 };
230 #define IORING_SQ_NEED_WAKEUP (1U << 0)
231 #define IORING_SQ_CQ_OVERFLOW (1U << 1)
232 #define IORING_SQ_TASKRUN (1U << 2)
233 struct io_cqring_offsets {
234   __u32 head;
235   __u32 tail;
236   __u32 ring_mask;
237   __u32 ring_entries;
238   __u32 overflow;
239   __u32 cqes;
240   __u32 flags;
241   __u32 resv1;
242   __u64 resv2;
243 };
244 #define IORING_CQ_EVENTFD_DISABLED (1U << 0)
245 #define IORING_ENTER_GETEVENTS (1U << 0)
246 #define IORING_ENTER_SQ_WAKEUP (1U << 1)
247 #define IORING_ENTER_SQ_WAIT (1U << 2)
248 #define IORING_ENTER_EXT_ARG (1U << 3)
249 #define IORING_ENTER_REGISTERED_RING (1U << 4)
250 struct io_uring_params {
251   __u32 sq_entries;
252   __u32 cq_entries;
253   __u32 flags;
254   __u32 sq_thread_cpu;
255   __u32 sq_thread_idle;
256   __u32 features;
257   __u32 wq_fd;
258   __u32 resv[3];
259   struct io_sqring_offsets sq_off;
260   struct io_cqring_offsets cq_off;
261 };
262 #define IORING_FEAT_SINGLE_MMAP (1U << 0)
263 #define IORING_FEAT_NODROP (1U << 1)
264 #define IORING_FEAT_SUBMIT_STABLE (1U << 2)
265 #define IORING_FEAT_RW_CUR_POS (1U << 3)
266 #define IORING_FEAT_CUR_PERSONALITY (1U << 4)
267 #define IORING_FEAT_FAST_POLL (1U << 5)
268 #define IORING_FEAT_POLL_32BITS (1U << 6)
269 #define IORING_FEAT_SQPOLL_NONFIXED (1U << 7)
270 #define IORING_FEAT_EXT_ARG (1U << 8)
271 #define IORING_FEAT_NATIVE_WORKERS (1U << 9)
272 #define IORING_FEAT_RSRC_TAGS (1U << 10)
273 #define IORING_FEAT_CQE_SKIP (1U << 11)
274 #define IORING_FEAT_LINKED_FILE (1U << 12)
275 enum {
276   IORING_REGISTER_BUFFERS = 0,
277   IORING_UNREGISTER_BUFFERS = 1,
278   IORING_REGISTER_FILES = 2,
279   IORING_UNREGISTER_FILES = 3,
280   IORING_REGISTER_EVENTFD = 4,
281   IORING_UNREGISTER_EVENTFD = 5,
282   IORING_REGISTER_FILES_UPDATE = 6,
283   IORING_REGISTER_EVENTFD_ASYNC = 7,
284   IORING_REGISTER_PROBE = 8,
285   IORING_REGISTER_PERSONALITY = 9,
286   IORING_UNREGISTER_PERSONALITY = 10,
287   IORING_REGISTER_RESTRICTIONS = 11,
288   IORING_REGISTER_ENABLE_RINGS = 12,
289   IORING_REGISTER_FILES2 = 13,
290   IORING_REGISTER_FILES_UPDATE2 = 14,
291   IORING_REGISTER_BUFFERS2 = 15,
292   IORING_REGISTER_BUFFERS_UPDATE = 16,
293   IORING_REGISTER_IOWQ_AFF = 17,
294   IORING_UNREGISTER_IOWQ_AFF = 18,
295   IORING_REGISTER_IOWQ_MAX_WORKERS = 19,
296   IORING_REGISTER_RING_FDS = 20,
297   IORING_UNREGISTER_RING_FDS = 21,
298   IORING_REGISTER_PBUF_RING = 22,
299   IORING_UNREGISTER_PBUF_RING = 23,
300   IORING_REGISTER_SYNC_CANCEL = 24,
301   IORING_REGISTER_FILE_ALLOC_RANGE = 25,
302   IORING_REGISTER_LAST
303 };
304 enum {
305   IO_WQ_BOUND,
306   IO_WQ_UNBOUND,
307 };
308 struct io_uring_files_update {
309   __u32 offset;
310   __u32 resv;
311   __aligned_u64 fds;
312 };
313 #define IORING_RSRC_REGISTER_SPARSE (1U << 0)
314 struct io_uring_rsrc_register {
315   __u32 nr;
316   __u32 flags;
317   __u64 resv2;
318   __aligned_u64 data;
319   __aligned_u64 tags;
320 };
321 struct io_uring_rsrc_update {
322   __u32 offset;
323   __u32 resv;
324   __aligned_u64 data;
325 };
326 struct io_uring_rsrc_update2 {
327   __u32 offset;
328   __u32 resv;
329   __aligned_u64 data;
330   __aligned_u64 tags;
331   __u32 nr;
332   __u32 resv2;
333 };
334 struct io_uring_notification_slot {
335   __u64 tag;
336   __u64 resv[3];
337 };
338 struct io_uring_notification_register {
339   __u32 nr_slots;
340   __u32 resv;
341   __u64 resv2;
342   __u64 data;
343   __u64 resv3;
344 };
345 #define IORING_REGISTER_FILES_SKIP (- 2)
346 #define IO_URING_OP_SUPPORTED (1U << 0)
347 struct io_uring_probe_op {
348   __u8 op;
349   __u8 resv;
350   __u16 flags;
351   __u32 resv2;
352 };
353 struct io_uring_probe {
354   __u8 last_op;
355   __u8 ops_len;
356   __u16 resv;
357   __u32 resv2[3];
358   struct io_uring_probe_op ops[];
359 };
360 struct io_uring_restriction {
361   __u16 opcode;
362   union {
363     __u8 register_op;
364     __u8 sqe_op;
365     __u8 sqe_flags;
366   };
367   __u8 resv;
368   __u32 resv2[3];
369 };
370 struct io_uring_buf {
371   __u64 addr;
372   __u32 len;
373   __u16 bid;
374   __u16 resv;
375 };
376 struct io_uring_buf_ring {
377   union {
378     struct {
379       __u64 resv1;
380       __u32 resv2;
381       __u16 resv3;
382       __u16 tail;
383     };
384     struct io_uring_buf bufs[0];
385   };
386 };
387 struct io_uring_buf_reg {
388   __u64 ring_addr;
389   __u32 ring_entries;
390   __u16 bgid;
391   __u16 pad;
392   __u64 resv[3];
393 };
394 enum {
395   IORING_RESTRICTION_REGISTER_OP = 0,
396   IORING_RESTRICTION_SQE_OP = 1,
397   IORING_RESTRICTION_SQE_FLAGS_ALLOWED = 2,
398   IORING_RESTRICTION_SQE_FLAGS_REQUIRED = 3,
399   IORING_RESTRICTION_LAST
400 };
401 struct io_uring_getevents_arg {
402   __u64 sigmask;
403   __u32 sigmask_sz;
404   __u32 pad;
405   __u64 ts;
406 };
407 struct io_uring_sync_cancel_reg {
408   __u64 addr;
409   __s32 fd;
410   __u32 flags;
411   struct __kernel_timespec timeout;
412   __u64 pad[4];
413 };
414 struct io_uring_file_index_range {
415   __u32 off;
416   __u32 len;
417   __u64 resv;
418 };
419 struct io_uring_recvmsg_out {
420   __u32 namelen;
421   __u32 controllen;
422   __u32 payloadlen;
423   __u32 flags;
424 };
425 #ifdef __cplusplus
426 }
427 #endif
428 #endif
429