blob: 57c6405b79763bd71b03f8e33e6b9c3bc7a095bd [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Christopher Ferris24f97eb2019-05-20 12:58:13 -07007#ifndef LINUX_IO_URING_H
8#define LINUX_IO_URING_H
9#include <linux/fs.h>
10#include <linux/types.h>
Christopher Ferris8b7fdc92023-02-21 13:36:32 -080011#ifndef UAPI_LINUX_IO_URING_H_SKIP_LINUX_TIME_TYPES_H
Christopher Ferris7447a1c2022-10-04 18:24:44 -070012#include <linux/time_types.h>
Christopher Ferris8b7fdc92023-02-21 13:36:32 -080013#endif
Christopher Ferris7447a1c2022-10-04 18:24:44 -070014#ifdef __cplusplus
15extern "C" {
16#endif
Christopher Ferris24f97eb2019-05-20 12:58:13 -070017struct io_uring_sqe {
18 __u8 opcode;
19 __u8 flags;
20 __u16 ioprio;
21 __s32 fd;
Christopher Ferrisd32ca142020-02-04 16:16:51 -080022 union {
23 __u64 off;
24 __u64 addr2;
Christopher Ferris80ae69d2022-08-02 16:32:21 -070025 struct {
26 __u32 cmd_op;
27 __u32 __pad1;
28 };
Christopher Ferrisd32ca142020-02-04 16:16:51 -080029 };
Christopher Ferrisaf09c702020-06-01 20:29:29 -070030 union {
31 __u64 addr;
32 __u64 splice_off_in;
Christopher Ferris0f795212024-01-17 14:17:28 -080033 struct {
34 __u32 level;
35 __u32 optname;
36 };
Christopher Ferrisaf09c702020-06-01 20:29:29 -070037 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -070038 __u32 len;
39 union {
40 __kernel_rwf_t rw_flags;
41 __u32 fsync_flags;
42 __u16 poll_events;
Christopher Ferris25c18d42020-10-14 17:42:58 -070043 __u32 poll32_events;
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070044 __u32 sync_range_flags;
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070045 __u32 msg_flags;
Christopher Ferris9584fa42019-12-09 15:36:13 -080046 __u32 timeout_flags;
Christopher Ferrisd32ca142020-02-04 16:16:51 -080047 __u32 accept_flags;
48 __u32 cancel_flags;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070049 __u32 open_flags;
50 __u32 statx_flags;
51 __u32 fadvise_advice;
Christopher Ferrisaf09c702020-06-01 20:29:29 -070052 __u32 splice_flags;
Christopher Ferris05667cd2021-02-16 16:01:34 -080053 __u32 rename_flags;
54 __u32 unlink_flags;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -070055 __u32 hardlink_flags;
Christopher Ferris80ae69d2022-08-02 16:32:21 -070056 __u32 xattr_flags;
Christopher Ferris7447a1c2022-10-04 18:24:44 -070057 __u32 msg_ring_flags;
Christopher Ferris6cd53a52022-12-12 23:39:16 +000058 __u32 uring_cmd_flags;
Christopher Ferris0f795212024-01-17 14:17:28 -080059 __u32 waitid_flags;
60 __u32 futex_flags;
Christopher Ferris24f97eb2019-05-20 12:58:13 -070061 };
62 __u64 user_data;
63 union {
Christopher Ferris3a39c0b2021-09-02 00:03:38 +000064 __u16 buf_index;
65 __u16 buf_group;
66 } __attribute__((packed));
67 __u16 personality;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -070068 union {
69 __s32 splice_fd_in;
70 __u32 file_index;
Christopher Ferris0f795212024-01-17 14:17:28 -080071 __u32 optlen;
Christopher Ferris7447a1c2022-10-04 18:24:44 -070072 struct {
73 __u16 addr_len;
74 __u16 __pad3[1];
75 };
Christopher Ferris2abfa9e2021-11-01 16:26:06 -070076 };
Christopher Ferris80ae69d2022-08-02 16:32:21 -070077 union {
78 struct {
79 __u64 addr3;
80 __u64 __pad2[1];
81 };
Christopher Ferris0f795212024-01-17 14:17:28 -080082 __u64 optval;
Christopher Ferris80ae69d2022-08-02 16:32:21 -070083 __u8 cmd[0];
84 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -070085};
Christopher Ferris80ae69d2022-08-02 16:32:21 -070086#define IORING_FILE_INDEX_ALLOC (~0U)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070087enum {
88 IOSQE_FIXED_FILE_BIT,
89 IOSQE_IO_DRAIN_BIT,
90 IOSQE_IO_LINK_BIT,
91 IOSQE_IO_HARDLINK_BIT,
92 IOSQE_ASYNC_BIT,
Christopher Ferrisaf09c702020-06-01 20:29:29 -070093 IOSQE_BUFFER_SELECT_BIT,
Christopher Ferris1ed55342022-03-22 16:06:25 -070094 IOSQE_CQE_SKIP_SUCCESS_BIT,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070095};
96#define IOSQE_FIXED_FILE (1U << IOSQE_FIXED_FILE_BIT)
97#define IOSQE_IO_DRAIN (1U << IOSQE_IO_DRAIN_BIT)
98#define IOSQE_IO_LINK (1U << IOSQE_IO_LINK_BIT)
99#define IOSQE_IO_HARDLINK (1U << IOSQE_IO_HARDLINK_BIT)
100#define IOSQE_ASYNC (1U << IOSQE_ASYNC_BIT)
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700101#define IOSQE_BUFFER_SELECT (1U << IOSQE_BUFFER_SELECT_BIT)
Christopher Ferris1ed55342022-03-22 16:06:25 -0700102#define IOSQE_CQE_SKIP_SUCCESS (1U << IOSQE_CQE_SKIP_SUCCESS_BIT)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700103#define IORING_SETUP_IOPOLL (1U << 0)
104#define IORING_SETUP_SQPOLL (1U << 1)
105#define IORING_SETUP_SQ_AFF (1U << 2)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800106#define IORING_SETUP_CQSIZE (1U << 3)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700107#define IORING_SETUP_CLAMP (1U << 4)
108#define IORING_SETUP_ATTACH_WQ (1U << 5)
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800109#define IORING_SETUP_R_DISABLED (1U << 6)
Christopher Ferris10a76e62022-06-08 13:31:52 -0700110#define IORING_SETUP_SUBMIT_ALL (1U << 7)
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700111#define IORING_SETUP_COOP_TASKRUN (1U << 8)
112#define IORING_SETUP_TASKRUN_FLAG (1U << 9)
113#define IORING_SETUP_SQE128 (1U << 10)
114#define IORING_SETUP_CQE32 (1U << 11)
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700115#define IORING_SETUP_SINGLE_ISSUER (1U << 12)
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000116#define IORING_SETUP_DEFER_TASKRUN (1U << 13)
Christopher Ferris8666d042023-09-06 14:55:31 -0700117#define IORING_SETUP_NO_MMAP (1U << 14)
118#define IORING_SETUP_REGISTERED_FD_ONLY (1U << 15)
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700119#define IORING_SETUP_NO_SQARRAY (1U << 16)
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700120enum io_uring_op {
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800121 IORING_OP_NOP,
122 IORING_OP_READV,
123 IORING_OP_WRITEV,
124 IORING_OP_FSYNC,
125 IORING_OP_READ_FIXED,
126 IORING_OP_WRITE_FIXED,
127 IORING_OP_POLL_ADD,
128 IORING_OP_POLL_REMOVE,
129 IORING_OP_SYNC_FILE_RANGE,
130 IORING_OP_SENDMSG,
131 IORING_OP_RECVMSG,
132 IORING_OP_TIMEOUT,
133 IORING_OP_TIMEOUT_REMOVE,
134 IORING_OP_ACCEPT,
135 IORING_OP_ASYNC_CANCEL,
136 IORING_OP_LINK_TIMEOUT,
137 IORING_OP_CONNECT,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700138 IORING_OP_FALLOCATE,
139 IORING_OP_OPENAT,
140 IORING_OP_CLOSE,
141 IORING_OP_FILES_UPDATE,
142 IORING_OP_STATX,
143 IORING_OP_READ,
144 IORING_OP_WRITE,
145 IORING_OP_FADVISE,
146 IORING_OP_MADVISE,
147 IORING_OP_SEND,
148 IORING_OP_RECV,
149 IORING_OP_OPENAT2,
150 IORING_OP_EPOLL_CTL,
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700151 IORING_OP_SPLICE,
152 IORING_OP_PROVIDE_BUFFERS,
153 IORING_OP_REMOVE_BUFFERS,
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700154 IORING_OP_TEE,
Christopher Ferris05667cd2021-02-16 16:01:34 -0800155 IORING_OP_SHUTDOWN,
156 IORING_OP_RENAMEAT,
157 IORING_OP_UNLINKAT,
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700158 IORING_OP_MKDIRAT,
159 IORING_OP_SYMLINKAT,
160 IORING_OP_LINKAT,
Christopher Ferris10a76e62022-06-08 13:31:52 -0700161 IORING_OP_MSG_RING,
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700162 IORING_OP_FSETXATTR,
163 IORING_OP_SETXATTR,
164 IORING_OP_FGETXATTR,
165 IORING_OP_GETXATTR,
166 IORING_OP_SOCKET,
167 IORING_OP_URING_CMD,
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700168 IORING_OP_SEND_ZC,
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000169 IORING_OP_SENDMSG_ZC,
Christopher Ferris0f795212024-01-17 14:17:28 -0800170 IORING_OP_READ_MULTISHOT,
171 IORING_OP_WAITID,
172 IORING_OP_FUTEX_WAIT,
173 IORING_OP_FUTEX_WAKE,
174 IORING_OP_FUTEX_WAITV,
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800175 IORING_OP_LAST,
176};
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000177#define IORING_URING_CMD_FIXED (1U << 0)
Christopher Ferris0f795212024-01-17 14:17:28 -0800178#define IORING_URING_CMD_MASK IORING_URING_CMD_FIXED
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700179#define IORING_FSYNC_DATASYNC (1U << 0)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800180#define IORING_TIMEOUT_ABS (1U << 0)
Christopher Ferris05667cd2021-02-16 16:01:34 -0800181#define IORING_TIMEOUT_UPDATE (1U << 1)
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700182#define IORING_TIMEOUT_BOOTTIME (1U << 2)
183#define IORING_TIMEOUT_REALTIME (1U << 3)
184#define IORING_LINK_TIMEOUT_UPDATE (1U << 4)
Christopher Ferrisa4792612022-01-10 13:51:15 -0800185#define IORING_TIMEOUT_ETIME_SUCCESS (1U << 5)
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700186#define IORING_TIMEOUT_MULTISHOT (1U << 6)
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700187#define IORING_TIMEOUT_CLOCK_MASK (IORING_TIMEOUT_BOOTTIME | IORING_TIMEOUT_REALTIME)
188#define IORING_TIMEOUT_UPDATE_MASK (IORING_TIMEOUT_UPDATE | IORING_LINK_TIMEOUT_UPDATE)
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700189#define SPLICE_F_FD_IN_FIXED (1U << 31)
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000190#define IORING_POLL_ADD_MULTI (1U << 0)
191#define IORING_POLL_UPDATE_EVENTS (1U << 1)
192#define IORING_POLL_UPDATE_USER_DATA (1U << 2)
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700193#define IORING_POLL_ADD_LEVEL (1U << 3)
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700194#define IORING_ASYNC_CANCEL_ALL (1U << 0)
195#define IORING_ASYNC_CANCEL_FD (1U << 1)
196#define IORING_ASYNC_CANCEL_ANY (1U << 2)
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700197#define IORING_ASYNC_CANCEL_FD_FIXED (1U << 3)
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700198#define IORING_ASYNC_CANCEL_USERDATA (1U << 4)
199#define IORING_ASYNC_CANCEL_OP (1U << 5)
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700200#define IORING_RECVSEND_POLL_FIRST (1U << 0)
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700201#define IORING_RECV_MULTISHOT (1U << 1)
202#define IORING_RECVSEND_FIXED_BUF (1U << 2)
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800203#define IORING_SEND_ZC_REPORT_USAGE (1U << 3)
204#define IORING_NOTIF_USAGE_ZC_COPIED (1U << 31)
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700205#define IORING_ACCEPT_MULTISHOT (1U << 0)
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700206enum {
207 IORING_MSG_DATA,
208 IORING_MSG_SEND_FD,
209};
210#define IORING_MSG_RING_CQE_SKIP (1U << 0)
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000211#define IORING_MSG_RING_FLAGS_PASS (1U << 1)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700212struct io_uring_cqe {
213 __u64 user_data;
214 __s32 res;
215 __u32 flags;
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700216 __u64 big_cqe[];
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700217};
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700218#define IORING_CQE_F_BUFFER (1U << 0)
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000219#define IORING_CQE_F_MORE (1U << 1)
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700220#define IORING_CQE_F_SOCK_NONEMPTY (1U << 2)
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700221#define IORING_CQE_F_NOTIF (1U << 3)
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700222enum {
223 IORING_CQE_BUFFER_SHIFT = 16,
224};
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700225#define IORING_OFF_SQ_RING 0ULL
226#define IORING_OFF_CQ_RING 0x8000000ULL
227#define IORING_OFF_SQES 0x10000000ULL
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700228#define IORING_OFF_PBUF_RING 0x80000000ULL
229#define IORING_OFF_PBUF_SHIFT 16
230#define IORING_OFF_MMAP_MASK 0xf8000000ULL
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700231struct io_sqring_offsets {
232 __u32 head;
233 __u32 tail;
234 __u32 ring_mask;
235 __u32 ring_entries;
236 __u32 flags;
237 __u32 dropped;
238 __u32 array;
239 __u32 resv1;
Christopher Ferris8666d042023-09-06 14:55:31 -0700240 __u64 user_addr;
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700241};
242#define IORING_SQ_NEED_WAKEUP (1U << 0)
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700243#define IORING_SQ_CQ_OVERFLOW (1U << 1)
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700244#define IORING_SQ_TASKRUN (1U << 2)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700245struct io_cqring_offsets {
246 __u32 head;
247 __u32 tail;
248 __u32 ring_mask;
249 __u32 ring_entries;
250 __u32 overflow;
251 __u32 cqes;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700252 __u32 flags;
253 __u32 resv1;
Christopher Ferris8666d042023-09-06 14:55:31 -0700254 __u64 user_addr;
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700255};
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700256#define IORING_CQ_EVENTFD_DISABLED (1U << 0)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700257#define IORING_ENTER_GETEVENTS (1U << 0)
258#define IORING_ENTER_SQ_WAKEUP (1U << 1)
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800259#define IORING_ENTER_SQ_WAIT (1U << 2)
Christopher Ferris05667cd2021-02-16 16:01:34 -0800260#define IORING_ENTER_EXT_ARG (1U << 3)
Christopher Ferris10a76e62022-06-08 13:31:52 -0700261#define IORING_ENTER_REGISTERED_RING (1U << 4)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700262struct io_uring_params {
263 __u32 sq_entries;
264 __u32 cq_entries;
265 __u32 flags;
266 __u32 sq_thread_cpu;
267 __u32 sq_thread_idle;
Christopher Ferris9584fa42019-12-09 15:36:13 -0800268 __u32 features;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700269 __u32 wq_fd;
270 __u32 resv[3];
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700271 struct io_sqring_offsets sq_off;
272 struct io_cqring_offsets cq_off;
273};
Christopher Ferris9584fa42019-12-09 15:36:13 -0800274#define IORING_FEAT_SINGLE_MMAP (1U << 0)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800275#define IORING_FEAT_NODROP (1U << 1)
276#define IORING_FEAT_SUBMIT_STABLE (1U << 2)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700277#define IORING_FEAT_RW_CUR_POS (1U << 3)
278#define IORING_FEAT_CUR_PERSONALITY (1U << 4)
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700279#define IORING_FEAT_FAST_POLL (1U << 5)
Christopher Ferris25c18d42020-10-14 17:42:58 -0700280#define IORING_FEAT_POLL_32BITS (1U << 6)
Christopher Ferris05667cd2021-02-16 16:01:34 -0800281#define IORING_FEAT_SQPOLL_NONFIXED (1U << 7)
282#define IORING_FEAT_EXT_ARG (1U << 8)
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700283#define IORING_FEAT_NATIVE_WORKERS (1U << 9)
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000284#define IORING_FEAT_RSRC_TAGS (1U << 10)
Christopher Ferris1ed55342022-03-22 16:06:25 -0700285#define IORING_FEAT_CQE_SKIP (1U << 11)
Christopher Ferris10a76e62022-06-08 13:31:52 -0700286#define IORING_FEAT_LINKED_FILE (1U << 12)
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000287#define IORING_FEAT_REG_REG_RING (1U << 13)
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800288enum {
289 IORING_REGISTER_BUFFERS = 0,
290 IORING_UNREGISTER_BUFFERS = 1,
291 IORING_REGISTER_FILES = 2,
292 IORING_UNREGISTER_FILES = 3,
293 IORING_REGISTER_EVENTFD = 4,
294 IORING_UNREGISTER_EVENTFD = 5,
295 IORING_REGISTER_FILES_UPDATE = 6,
296 IORING_REGISTER_EVENTFD_ASYNC = 7,
297 IORING_REGISTER_PROBE = 8,
298 IORING_REGISTER_PERSONALITY = 9,
299 IORING_UNREGISTER_PERSONALITY = 10,
300 IORING_REGISTER_RESTRICTIONS = 11,
301 IORING_REGISTER_ENABLE_RINGS = 12,
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000302 IORING_REGISTER_FILES2 = 13,
303 IORING_REGISTER_FILES_UPDATE2 = 14,
304 IORING_REGISTER_BUFFERS2 = 15,
305 IORING_REGISTER_BUFFERS_UPDATE = 16,
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000306 IORING_REGISTER_IOWQ_AFF = 17,
307 IORING_UNREGISTER_IOWQ_AFF = 18,
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700308 IORING_REGISTER_IOWQ_MAX_WORKERS = 19,
Christopher Ferris10a76e62022-06-08 13:31:52 -0700309 IORING_REGISTER_RING_FDS = 20,
310 IORING_UNREGISTER_RING_FDS = 21,
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700311 IORING_REGISTER_PBUF_RING = 22,
312 IORING_UNREGISTER_PBUF_RING = 23,
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700313 IORING_REGISTER_SYNC_CANCEL = 24,
314 IORING_REGISTER_FILE_ALLOC_RANGE = 25,
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000315 IORING_REGISTER_LAST,
316 IORING_REGISTER_USE_REGISTERED_RING = 1U << 31
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800317};
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700318enum {
319 IO_WQ_BOUND,
320 IO_WQ_UNBOUND,
321};
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800322struct io_uring_files_update {
323 __u32 offset;
324 __u32 resv;
325 __aligned_u64 fds;
326};
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700327#define IORING_RSRC_REGISTER_SPARSE (1U << 0)
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000328struct io_uring_rsrc_register {
329 __u32 nr;
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700330 __u32 flags;
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000331 __u64 resv2;
332 __aligned_u64 data;
333 __aligned_u64 tags;
334};
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700335struct io_uring_rsrc_update {
336 __u32 offset;
337 __u32 resv;
338 __aligned_u64 data;
339};
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000340struct io_uring_rsrc_update2 {
341 __u32 offset;
342 __u32 resv;
343 __aligned_u64 data;
344 __aligned_u64 tags;
345 __u32 nr;
346 __u32 resv2;
347};
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700348#define IORING_REGISTER_FILES_SKIP (- 2)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700349#define IO_URING_OP_SUPPORTED (1U << 0)
350struct io_uring_probe_op {
351 __u8 op;
352 __u8 resv;
353 __u16 flags;
354 __u32 resv2;
355};
356struct io_uring_probe {
357 __u8 last_op;
358 __u8 ops_len;
359 __u16 resv;
360 __u32 resv2[3];
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700361 struct io_uring_probe_op ops[];
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700362};
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800363struct io_uring_restriction {
364 __u16 opcode;
365 union {
366 __u8 register_op;
367 __u8 sqe_op;
368 __u8 sqe_flags;
369 };
370 __u8 resv;
371 __u32 resv2[3];
372};
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700373struct io_uring_buf {
374 __u64 addr;
375 __u32 len;
376 __u16 bid;
377 __u16 resv;
378};
379struct io_uring_buf_ring {
380 union {
381 struct {
382 __u64 resv1;
383 __u32 resv2;
384 __u16 resv3;
385 __u16 tail;
386 };
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000387 __DECLARE_FLEX_ARRAY(struct io_uring_buf, bufs);
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700388 };
389};
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700390enum {
391 IOU_PBUF_RING_MMAP = 1,
392};
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700393struct io_uring_buf_reg {
394 __u64 ring_addr;
395 __u32 ring_entries;
396 __u16 bgid;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700397 __u16 flags;
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700398 __u64 resv[3];
399};
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800400enum {
401 IORING_RESTRICTION_REGISTER_OP = 0,
402 IORING_RESTRICTION_SQE_OP = 1,
403 IORING_RESTRICTION_SQE_FLAGS_ALLOWED = 2,
404 IORING_RESTRICTION_SQE_FLAGS_REQUIRED = 3,
405 IORING_RESTRICTION_LAST
406};
Christopher Ferris05667cd2021-02-16 16:01:34 -0800407struct io_uring_getevents_arg {
408 __u64 sigmask;
409 __u32 sigmask_sz;
410 __u32 pad;
411 __u64 ts;
412};
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700413struct io_uring_sync_cancel_reg {
414 __u64 addr;
415 __s32 fd;
416 __u32 flags;
417 struct __kernel_timespec timeout;
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700418 __u8 opcode;
419 __u8 pad[7];
420 __u64 pad2[3];
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700421};
422struct io_uring_file_index_range {
423 __u32 off;
424 __u32 len;
425 __u64 resv;
426};
427struct io_uring_recvmsg_out {
428 __u32 namelen;
429 __u32 controllen;
430 __u32 payloadlen;
431 __u32 flags;
432};
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700433enum {
434 SOCKET_URING_OP_SIOCINQ = 0,
435 SOCKET_URING_OP_SIOCOUTQ,
Christopher Ferris0f795212024-01-17 14:17:28 -0800436 SOCKET_URING_OP_GETSOCKOPT,
437 SOCKET_URING_OP_SETSOCKOPT,
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700438};
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700439#ifdef __cplusplus
440}
441#endif
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700442#endif