xref: /linux-6.15/include/uapi/linux/io_uring.h (revision 9408d8a3)
19f5834c8SLukas Bulwahn /* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT */
22b188cc1SJens Axboe /*
32b188cc1SJens Axboe  * Header file for the io_uring interface.
42b188cc1SJens Axboe  *
52b188cc1SJens Axboe  * Copyright (C) 2019 Jens Axboe
62b188cc1SJens Axboe  * Copyright (C) 2019 Christoph Hellwig
72b188cc1SJens Axboe  */
82b188cc1SJens Axboe #ifndef LINUX_IO_URING_H
92b188cc1SJens Axboe #define LINUX_IO_URING_H
102b188cc1SJens Axboe 
112b188cc1SJens Axboe #include <linux/fs.h>
122b188cc1SJens Axboe #include <linux/types.h>
139eb80340SStefan Metzmacher /*
149eb80340SStefan Metzmacher  * this file is shared with liburing and that has to autodetect
159eb80340SStefan Metzmacher  * if linux/time_types.h is available or not, it can
169eb80340SStefan Metzmacher  * define UAPI_LINUX_IO_URING_H_SKIP_LINUX_TIME_TYPES_H
179eb80340SStefan Metzmacher  * if linux/time_types.h is not available
189eb80340SStefan Metzmacher  */
199eb80340SStefan Metzmacher #ifndef UAPI_LINUX_IO_URING_H_SKIP_LINUX_TIME_TYPES_H
2078a861b9SJens Axboe #include <linux/time_types.h>
219eb80340SStefan Metzmacher #endif
222b188cc1SJens Axboe 
23e1d0c6d0SAmmar Faizi #ifdef __cplusplus
24e1d0c6d0SAmmar Faizi extern "C" {
25e1d0c6d0SAmmar Faizi #endif
26e1d0c6d0SAmmar Faizi 
272b188cc1SJens Axboe /*
282b188cc1SJens Axboe  * IO submission data structure (Submission Queue Entry)
292b188cc1SJens Axboe  */
302b188cc1SJens Axboe struct io_uring_sqe {
312b188cc1SJens Axboe 	__u8	opcode;		/* type of operation for this sqe */
326b06314cSJens Axboe 	__u8	flags;		/* IOSQE_ flags */
332b188cc1SJens Axboe 	__u16	ioprio;		/* ioprio for the request */
342b188cc1SJens Axboe 	__s32	fd;		/* file descriptor to do IO on */
3517f2fe35SJens Axboe 	union {
362b188cc1SJens Axboe 		__u64	off;	/* offset into file */
3717f2fe35SJens Axboe 		__u64	addr2;
38bdb2c48eSPavel Begunkov 		struct {
39ee692a21SJens Axboe 			__u32	cmd_op;
40bdb2c48eSPavel Begunkov 			__u32	__pad1;
41bdb2c48eSPavel Begunkov 		};
4217f2fe35SJens Axboe 	};
437d67af2cSPavel Begunkov 	union {
442b188cc1SJens Axboe 		__u64	addr;	/* pointer to buffer or iovecs */
457d67af2cSPavel Begunkov 		__u64	splice_off_in;
467d67af2cSPavel Begunkov 	};
472b188cc1SJens Axboe 	__u32	len;		/* buffer size or number of iovecs */
482b188cc1SJens Axboe 	union {
492b188cc1SJens Axboe 		__kernel_rwf_t	rw_flags;
50c992fe29SChristoph Hellwig 		__u32		fsync_flags;
515769a351SJiufei Xue 		__u16		poll_events;	/* compatibility */
525769a351SJiufei Xue 		__u32		poll32_events;	/* word-reversed for BE */
535d17b4a4SJens Axboe 		__u32		sync_range_flags;
540fa03c62SJens Axboe 		__u32		msg_flags;
555262f567SJens Axboe 		__u32		timeout_flags;
5617f2fe35SJens Axboe 		__u32		accept_flags;
5762755e35SJens Axboe 		__u32		cancel_flags;
5815b71abeSJens Axboe 		__u32		open_flags;
59eddc7ef5SJens Axboe 		__u32		statx_flags;
604840e418SJens Axboe 		__u32		fadvise_advice;
617d67af2cSPavel Begunkov 		__u32		splice_flags;
6280a261fdSJens Axboe 		__u32		rename_flags;
6314a1143bSJens Axboe 		__u32		unlink_flags;
64cf30da90SDmitry Kadashev 		__u32		hardlink_flags;
65e9621e2bSStefan Roesch 		__u32		xattr_flags;
66e6130ebaSJens Axboe 		__u32		msg_ring_flags;
679cda70f6SAnuj Gupta 		__u32		uring_cmd_flags;
682b188cc1SJens Axboe 	};
692b188cc1SJens Axboe 	__u64	user_data;	/* data to be passed back at completion time */
70ddf0322dSJens Axboe 	/* pack this to avoid bogus arm OABI complaints */
71ddf0322dSJens Axboe 	union {
7275c6a039SJens Axboe 		/* index into fixed buffers, if used */
7375c6a039SJens Axboe 		__u16	buf_index;
74ddf0322dSJens Axboe 		/* for grouped buffer selection */
75ddf0322dSJens Axboe 		__u16	buf_group;
76ddf0322dSJens Axboe 	} __attribute__((packed));
7775c6a039SJens Axboe 	/* personality to use, if used */
7875c6a039SJens Axboe 	__u16	personality;
79b9445598SPavel Begunkov 	union {
807d67af2cSPavel Begunkov 		__s32	splice_fd_in;
81b9445598SPavel Begunkov 		__u32	file_index;
8206a5464bSPavel Begunkov 		struct {
83092aeedbSPavel Begunkov 			__u16	addr_len;
84b48c312bSPavel Begunkov 			__u16	__pad3[1];
8506a5464bSPavel Begunkov 		};
86b9445598SPavel Begunkov 	};
87ee692a21SJens Axboe 	union {
88ee692a21SJens Axboe 		struct {
89e9621e2bSStefan Roesch 			__u64	addr3;
90e9621e2bSStefan Roesch 			__u64	__pad2[1];
91edafcceeSJens Axboe 		};
92ebdeb7c0SJens Axboe 		/*
93ee692a21SJens Axboe 		 * If the ring is initialized with IORING_SETUP_SQE128, then
94ee692a21SJens Axboe 		 * this field is used for 80 bytes of arbitrary command data
95ebdeb7c0SJens Axboe 		 */
96ee692a21SJens Axboe 		__u8	cmd[0];
97ee692a21SJens Axboe 	};
982b188cc1SJens Axboe };
992b188cc1SJens Axboe 
1001339f24bSJens Axboe /*
1011339f24bSJens Axboe  * If sqe->file_index is set to this for opcodes that instantiate a new
1021339f24bSJens Axboe  * direct descriptor (like openat/openat2/accept), then io_uring will allocate
1031339f24bSJens Axboe  * an available direct descriptor instead of having the application pass one
1041339f24bSJens Axboe  * in. The picked direct descriptor will be returned in cqe->res, or -ENFILE
1051339f24bSJens Axboe  * if the space is full.
1061339f24bSJens Axboe  */
1071339f24bSJens Axboe #define IORING_FILE_INDEX_ALLOC		(~0U)
1081339f24bSJens Axboe 
1096b47ee6eSPavel Begunkov enum {
1106b47ee6eSPavel Begunkov 	IOSQE_FIXED_FILE_BIT,
1116b47ee6eSPavel Begunkov 	IOSQE_IO_DRAIN_BIT,
1126b47ee6eSPavel Begunkov 	IOSQE_IO_LINK_BIT,
1136b47ee6eSPavel Begunkov 	IOSQE_IO_HARDLINK_BIT,
1146b47ee6eSPavel Begunkov 	IOSQE_ASYNC_BIT,
115bcda7baaSJens Axboe 	IOSQE_BUFFER_SELECT_BIT,
11604c76b41SPavel Begunkov 	IOSQE_CQE_SKIP_SUCCESS_BIT,
1176b47ee6eSPavel Begunkov };
1186b47ee6eSPavel Begunkov 
119def596e9SJens Axboe /*
1206b06314cSJens Axboe  * sqe->flags
1216b06314cSJens Axboe  */
1226b47ee6eSPavel Begunkov /* use fixed fileset */
1236b47ee6eSPavel Begunkov #define IOSQE_FIXED_FILE	(1U << IOSQE_FIXED_FILE_BIT)
1246b47ee6eSPavel Begunkov /* issue after inflight IO */
1256b47ee6eSPavel Begunkov #define IOSQE_IO_DRAIN		(1U << IOSQE_IO_DRAIN_BIT)
1266b47ee6eSPavel Begunkov /* links next sqe */
1276b47ee6eSPavel Begunkov #define IOSQE_IO_LINK		(1U << IOSQE_IO_LINK_BIT)
1286b47ee6eSPavel Begunkov /* like LINK, but stronger */
1296b47ee6eSPavel Begunkov #define IOSQE_IO_HARDLINK	(1U << IOSQE_IO_HARDLINK_BIT)
1306b47ee6eSPavel Begunkov /* always go async */
1316b47ee6eSPavel Begunkov #define IOSQE_ASYNC		(1U << IOSQE_ASYNC_BIT)
132bcda7baaSJens Axboe /* select buffer from sqe->buf_group */
133bcda7baaSJens Axboe #define IOSQE_BUFFER_SELECT	(1U << IOSQE_BUFFER_SELECT_BIT)
13404c76b41SPavel Begunkov /* don't post CQE if request succeeded */
13504c76b41SPavel Begunkov #define IOSQE_CQE_SKIP_SUCCESS	(1U << IOSQE_CQE_SKIP_SUCCESS_BIT)
1366b06314cSJens Axboe 
1376b06314cSJens Axboe /*
138def596e9SJens Axboe  * io_uring_setup() flags
139def596e9SJens Axboe  */
140def596e9SJens Axboe #define IORING_SETUP_IOPOLL	(1U << 0)	/* io_context is polled */
1416c271ce2SJens Axboe #define IORING_SETUP_SQPOLL	(1U << 1)	/* SQ poll thread */
1426c271ce2SJens Axboe #define IORING_SETUP_SQ_AFF	(1U << 2)	/* sq_thread_cpu is valid */
14333a107f0SJens Axboe #define IORING_SETUP_CQSIZE	(1U << 3)	/* app defines CQ size */
1448110c1a6SJens Axboe #define IORING_SETUP_CLAMP	(1U << 4)	/* clamp SQ/CQ ring sizes */
14524369c2eSPavel Begunkov #define IORING_SETUP_ATTACH_WQ	(1U << 5)	/* attach to existing wq */
1467e84e1c7SStefano Garzarella #define IORING_SETUP_R_DISABLED	(1U << 6)	/* start with ring disabled */
147bcbb7bf6SJens Axboe #define IORING_SETUP_SUBMIT_ALL	(1U << 7)	/* continue submit on error */
148e1169f06SJens Axboe /*
149e1169f06SJens Axboe  * Cooperative task running. When requests complete, they often require
150e1169f06SJens Axboe  * forcing the submitter to transition to the kernel to complete. If this
151e1169f06SJens Axboe  * flag is set, work will be done when the task transitions anyway, rather
152e1169f06SJens Axboe  * than force an inter-processor interrupt reschedule. This avoids interrupting
153e1169f06SJens Axboe  * a task running in userspace, and saves an IPI.
154e1169f06SJens Axboe  */
155e1169f06SJens Axboe #define IORING_SETUP_COOP_TASKRUN	(1U << 8)
156ef060ea9SJens Axboe /*
157ef060ea9SJens Axboe  * If COOP_TASKRUN is set, get notified if task work is available for
158ef060ea9SJens Axboe  * running and a kernel transition would be needed to run it. This sets
159ef060ea9SJens Axboe  * IORING_SQ_TASKRUN in the sq ring flags. Not valid with COOP_TASKRUN.
160ef060ea9SJens Axboe  */
161ef060ea9SJens Axboe #define IORING_SETUP_TASKRUN_FLAG	(1U << 9)
162ebdeb7c0SJens Axboe #define IORING_SETUP_SQE128		(1U << 10) /* SQEs are 128 byte */
1637a51e5b4SStefan Roesch #define IORING_SETUP_CQE32		(1U << 11) /* CQEs are 32 byte */
16497bbdc06SPavel Begunkov /*
16597bbdc06SPavel Begunkov  * Only one task is allowed to submit requests
16697bbdc06SPavel Begunkov  */
16797bbdc06SPavel Begunkov #define IORING_SETUP_SINGLE_ISSUER	(1U << 12)
168ebdeb7c0SJens Axboe 
169c0e0d6baSDylan Yudaken /*
170c0e0d6baSDylan Yudaken  * Defer running task work to get events.
171c0e0d6baSDylan Yudaken  * Rather than running bits of task work whenever the task transitions
172c0e0d6baSDylan Yudaken  * try to do it just before it is needed.
173c0e0d6baSDylan Yudaken  */
174c0e0d6baSDylan Yudaken #define IORING_SETUP_DEFER_TASKRUN	(1U << 13)
175c0e0d6baSDylan Yudaken 
17603d89a2dSJens Axboe /*
17703d89a2dSJens Axboe  * Application provides the memory for the rings
17803d89a2dSJens Axboe  */
17903d89a2dSJens Axboe #define IORING_SETUP_NO_MMAP		(1U << 14)
18003d89a2dSJens Axboe 
1816e76ac59SJosh Triplett /*
1826e76ac59SJosh Triplett  * Register the ring fd in itself for use with
1836e76ac59SJosh Triplett  * IORING_REGISTER_USE_REGISTERED_RING; return a registered fd index rather
1846e76ac59SJosh Triplett  * than an fd.
1856e76ac59SJosh Triplett  */
1866e76ac59SJosh Triplett #define IORING_SETUP_REGISTERED_FD_ONLY	(1U << 15)
1876e76ac59SJosh Triplett 
188cc51eaa8SDylan Yudaken enum io_uring_op {
1899e3aa61aSJens Axboe 	IORING_OP_NOP,
1909e3aa61aSJens Axboe 	IORING_OP_READV,
1919e3aa61aSJens Axboe 	IORING_OP_WRITEV,
1929e3aa61aSJens Axboe 	IORING_OP_FSYNC,
1939e3aa61aSJens Axboe 	IORING_OP_READ_FIXED,
1949e3aa61aSJens Axboe 	IORING_OP_WRITE_FIXED,
1959e3aa61aSJens Axboe 	IORING_OP_POLL_ADD,
1969e3aa61aSJens Axboe 	IORING_OP_POLL_REMOVE,
1979e3aa61aSJens Axboe 	IORING_OP_SYNC_FILE_RANGE,
1989e3aa61aSJens Axboe 	IORING_OP_SENDMSG,
1999e3aa61aSJens Axboe 	IORING_OP_RECVMSG,
2009e3aa61aSJens Axboe 	IORING_OP_TIMEOUT,
2019e3aa61aSJens Axboe 	IORING_OP_TIMEOUT_REMOVE,
2029e3aa61aSJens Axboe 	IORING_OP_ACCEPT,
2039e3aa61aSJens Axboe 	IORING_OP_ASYNC_CANCEL,
2049e3aa61aSJens Axboe 	IORING_OP_LINK_TIMEOUT,
2059e3aa61aSJens Axboe 	IORING_OP_CONNECT,
206d63d1b5eSJens Axboe 	IORING_OP_FALLOCATE,
20715b71abeSJens Axboe 	IORING_OP_OPENAT,
208b5dba59eSJens Axboe 	IORING_OP_CLOSE,
209d9808cebSPavel Begunkov 	IORING_OP_FILES_UPDATE,
210eddc7ef5SJens Axboe 	IORING_OP_STATX,
2113a6820f2SJens Axboe 	IORING_OP_READ,
2123a6820f2SJens Axboe 	IORING_OP_WRITE,
2134840e418SJens Axboe 	IORING_OP_FADVISE,
214c1ca757bSJens Axboe 	IORING_OP_MADVISE,
215fddafaceSJens Axboe 	IORING_OP_SEND,
216fddafaceSJens Axboe 	IORING_OP_RECV,
217cebdb986SJens Axboe 	IORING_OP_OPENAT2,
2183e4827b0SJens Axboe 	IORING_OP_EPOLL_CTL,
2197d67af2cSPavel Begunkov 	IORING_OP_SPLICE,
220ddf0322dSJens Axboe 	IORING_OP_PROVIDE_BUFFERS,
221067524e9SJens Axboe 	IORING_OP_REMOVE_BUFFERS,
222f2a8d5c7SPavel Begunkov 	IORING_OP_TEE,
22336f4fa68SJens Axboe 	IORING_OP_SHUTDOWN,
22480a261fdSJens Axboe 	IORING_OP_RENAMEAT,
22514a1143bSJens Axboe 	IORING_OP_UNLINKAT,
226e34a02dcSDmitry Kadashev 	IORING_OP_MKDIRAT,
2277a8721f8SDmitry Kadashev 	IORING_OP_SYMLINKAT,
228cf30da90SDmitry Kadashev 	IORING_OP_LINKAT,
2294f57f06cSJens Axboe 	IORING_OP_MSG_RING,
230e9621e2bSStefan Roesch 	IORING_OP_FSETXATTR,
231e9621e2bSStefan Roesch 	IORING_OP_SETXATTR,
232a56834e0SStefan Roesch 	IORING_OP_FGETXATTR,
233a56834e0SStefan Roesch 	IORING_OP_GETXATTR,
2341374e08eSJens Axboe 	IORING_OP_SOCKET,
235ee692a21SJens Axboe 	IORING_OP_URING_CMD,
236b48c312bSPavel Begunkov 	IORING_OP_SEND_ZC,
237493108d9SPavel Begunkov 	IORING_OP_SENDMSG_ZC,
2389e3aa61aSJens Axboe 
2399e3aa61aSJens Axboe 	/* this goes last, obviously */
2409e3aa61aSJens Axboe 	IORING_OP_LAST,
2419e3aa61aSJens Axboe };
242c992fe29SChristoph Hellwig 
243c992fe29SChristoph Hellwig /*
2449cda70f6SAnuj Gupta  * sqe->uring_cmd_flags
2456dcabcd3SJens Axboe  * IORING_URING_CMD_FIXED	use registered buffer; pass this flag
2469cda70f6SAnuj Gupta  *				along with setting sqe->buf_index.
247*9408d8a3SKeith Busch  * IORING_URING_CMD_POLLED	driver use only
2489cda70f6SAnuj Gupta  */
2499cda70f6SAnuj Gupta #define IORING_URING_CMD_FIXED	(1U << 0)
250*9408d8a3SKeith Busch #define IORING_URING_CMD_POLLED	(1U << 31)
2519cda70f6SAnuj Gupta 
2529cda70f6SAnuj Gupta 
2539cda70f6SAnuj Gupta /*
254c992fe29SChristoph Hellwig  * sqe->fsync_flags
255c992fe29SChristoph Hellwig  */
256c992fe29SChristoph Hellwig #define IORING_FSYNC_DATASYNC	(1U << 0)
2572b188cc1SJens Axboe 
2582b188cc1SJens Axboe /*
259a41525abSJens Axboe  * sqe->timeout_flags
260a41525abSJens Axboe  */
261a41525abSJens Axboe #define IORING_TIMEOUT_ABS		(1U << 0)
2629c8e11b3SPavel Begunkov #define IORING_TIMEOUT_UPDATE		(1U << 1)
26350c1df2bSJens Axboe #define IORING_TIMEOUT_BOOTTIME		(1U << 2)
26450c1df2bSJens Axboe #define IORING_TIMEOUT_REALTIME		(1U << 3)
265f1042b6cSPavel Begunkov #define IORING_LINK_TIMEOUT_UPDATE	(1U << 4)
2666224590dSPavel Begunkov #define IORING_TIMEOUT_ETIME_SUCCESS	(1U << 5)
267ea97f6c8SDavid Wei #define IORING_TIMEOUT_MULTISHOT	(1U << 6)
26850c1df2bSJens Axboe #define IORING_TIMEOUT_CLOCK_MASK	(IORING_TIMEOUT_BOOTTIME | IORING_TIMEOUT_REALTIME)
269f1042b6cSPavel Begunkov #define IORING_TIMEOUT_UPDATE_MASK	(IORING_TIMEOUT_UPDATE | IORING_LINK_TIMEOUT_UPDATE)
270a41525abSJens Axboe /*
2717d67af2cSPavel Begunkov  * sqe->splice_flags
2727d67af2cSPavel Begunkov  * extends splice(2) flags
2737d67af2cSPavel Begunkov  */
2747d67af2cSPavel Begunkov #define SPLICE_F_FD_IN_FIXED	(1U << 31) /* the last bit of __u32 */
2757d67af2cSPavel Begunkov 
2767d67af2cSPavel Begunkov /*
27788e41cf9SJens Axboe  * POLL_ADD flags. Note that since sqe->poll_events is the flag space, the
27888e41cf9SJens Axboe  * command flags for POLL_ADD are stored in sqe->len.
27988e41cf9SJens Axboe  *
28088e41cf9SJens Axboe  * IORING_POLL_ADD_MULTI	Multishot poll. Sets IORING_CQE_F_MORE if
28188e41cf9SJens Axboe  *				the poll handler will continue to report
28288e41cf9SJens Axboe  *				CQEs on behalf of the same SQE.
283b69de288SJens Axboe  *
284b69de288SJens Axboe  * IORING_POLL_UPDATE		Update existing poll request, matching
285b69de288SJens Axboe  *				sqe->addr as the old user_data field.
286b9ba8a44SJens Axboe  *
287b9ba8a44SJens Axboe  * IORING_POLL_LEVEL		Level triggered poll.
28888e41cf9SJens Axboe  */
28988e41cf9SJens Axboe #define IORING_POLL_ADD_MULTI	(1U << 0)
290b69de288SJens Axboe #define IORING_POLL_UPDATE_EVENTS	(1U << 1)
291b69de288SJens Axboe #define IORING_POLL_UPDATE_USER_DATA	(1U << 2)
292b9ba8a44SJens Axboe #define IORING_POLL_ADD_LEVEL		(1U << 3)
29388e41cf9SJens Axboe 
29488e41cf9SJens Axboe /*
2958e29da69SJens Axboe  * ASYNC_CANCEL flags.
2968e29da69SJens Axboe  *
2978e29da69SJens Axboe  * IORING_ASYNC_CANCEL_ALL	Cancel all requests that match the given key
2984bf94615SJens Axboe  * IORING_ASYNC_CANCEL_FD	Key off 'fd' for cancelation rather than the
2994bf94615SJens Axboe  *				request 'user_data'
300970f256eSJens Axboe  * IORING_ASYNC_CANCEL_ANY	Match any request
3017d8ca725SJens Axboe  * IORING_ASYNC_CANCEL_FD_FIXED	'fd' passed in is a fixed descriptor
3028e29da69SJens Axboe  */
3038e29da69SJens Axboe #define IORING_ASYNC_CANCEL_ALL	(1U << 0)
3044bf94615SJens Axboe #define IORING_ASYNC_CANCEL_FD	(1U << 1)
305970f256eSJens Axboe #define IORING_ASYNC_CANCEL_ANY	(1U << 2)
3067d8ca725SJens Axboe #define IORING_ASYNC_CANCEL_FD_FIXED	(1U << 3)
3078e29da69SJens Axboe 
3088e29da69SJens Axboe /*
30929c1ac23SPavel Begunkov  * send/sendmsg and recv/recvmsg flags (sqe->ioprio)
3100455d4ccSJens Axboe  *
3110455d4ccSJens Axboe  * IORING_RECVSEND_POLL_FIRST	If set, instead of first attempting to send
3120455d4ccSJens Axboe  *				or receive and arm poll if that yields an
3130455d4ccSJens Axboe  *				-EAGAIN result, arm poll upfront and skip
3140455d4ccSJens Axboe  *				the initial transfer attempt.
315b3fdea6eSDylan Yudaken  *
316b3fdea6eSDylan Yudaken  * IORING_RECV_MULTISHOT	Multishot recv. Sets IORING_CQE_F_MORE if
317b3fdea6eSDylan Yudaken  *				the handler will continue to report
318b3fdea6eSDylan Yudaken  *				CQEs on behalf of the same SQE.
31910c7d33eSPavel Begunkov  *
32010c7d33eSPavel Begunkov  * IORING_RECVSEND_FIXED_BUF	Use registered buffers, the index is stored in
32110c7d33eSPavel Begunkov  *				the buf_index field.
322e307e669SStefan Metzmacher  *
323e307e669SStefan Metzmacher  * IORING_SEND_ZC_REPORT_USAGE
324e307e669SStefan Metzmacher  *				If set, SEND[MSG]_ZC should report
325e307e669SStefan Metzmacher  *				the zerocopy usage in cqe.res
326e307e669SStefan Metzmacher  *				for the IORING_CQE_F_NOTIF cqe.
327e307e669SStefan Metzmacher  *				0 is reported if zerocopy was actually possible.
328e307e669SStefan Metzmacher  *				IORING_NOTIF_USAGE_ZC_COPIED if data was copied
329e307e669SStefan Metzmacher  *				(at least partially).
3300455d4ccSJens Axboe  */
3310455d4ccSJens Axboe #define IORING_RECVSEND_POLL_FIRST	(1U << 0)
332b3fdea6eSDylan Yudaken #define IORING_RECV_MULTISHOT		(1U << 1)
33310c7d33eSPavel Begunkov #define IORING_RECVSEND_FIXED_BUF	(1U << 2)
334e307e669SStefan Metzmacher #define IORING_SEND_ZC_REPORT_USAGE	(1U << 3)
335e307e669SStefan Metzmacher 
336e307e669SStefan Metzmacher /*
337e307e669SStefan Metzmacher  * cqe.res for IORING_CQE_F_NOTIF if
338e307e669SStefan Metzmacher  * IORING_SEND_ZC_REPORT_USAGE was requested
339e307e669SStefan Metzmacher  *
340e307e669SStefan Metzmacher  * It should be treated as a flag, all other
341e307e669SStefan Metzmacher  * bits of cqe.res should be treated as reserved!
342e307e669SStefan Metzmacher  */
343e307e669SStefan Metzmacher #define IORING_NOTIF_USAGE_ZC_COPIED    (1U << 31)
3440455d4ccSJens Axboe 
3450455d4ccSJens Axboe /*
346390ed29bSHao Xu  * accept flags stored in sqe->ioprio
347390ed29bSHao Xu  */
348390ed29bSHao Xu #define IORING_ACCEPT_MULTISHOT	(1U << 0)
349390ed29bSHao Xu 
350390ed29bSHao Xu /*
351e6130ebaSJens Axboe  * IORING_OP_MSG_RING command types, stored in sqe->addr
352e6130ebaSJens Axboe  */
353e6130ebaSJens Axboe enum {
354e6130ebaSJens Axboe 	IORING_MSG_DATA,	/* pass sqe->len as 'res' and off as user_data */
355e6130ebaSJens Axboe 	IORING_MSG_SEND_FD,	/* send a registered fd to another ring */
356e6130ebaSJens Axboe };
357e6130ebaSJens Axboe 
358e6130ebaSJens Axboe /*
359e6130ebaSJens Axboe  * IORING_OP_MSG_RING flags (sqe->msg_ring_flags)
360e6130ebaSJens Axboe  *
361e6130ebaSJens Axboe  * IORING_MSG_RING_CQE_SKIP	Don't post a CQE to the target ring. Not
362e6130ebaSJens Axboe  *				applicable for IORING_MSG_DATA, obviously.
363e6130ebaSJens Axboe  */
364e6130ebaSJens Axboe #define IORING_MSG_RING_CQE_SKIP	(1U << 0)
365cbeb47a7SBreno Leitao /* Pass through the flags from sqe->file_index to cqe->flags */
366cbeb47a7SBreno Leitao #define IORING_MSG_RING_FLAGS_PASS	(1U << 1)
367e6130ebaSJens Axboe 
368e6130ebaSJens Axboe /*
3692b188cc1SJens Axboe  * IO completion data structure (Completion Queue Entry)
3702b188cc1SJens Axboe  */
3712b188cc1SJens Axboe struct io_uring_cqe {
3722b188cc1SJens Axboe 	__u64	user_data;	/* sqe->data submission passed back */
3732b188cc1SJens Axboe 	__s32	res;		/* result code for this event */
3742b188cc1SJens Axboe 	__u32	flags;
3757a51e5b4SStefan Roesch 
3767a51e5b4SStefan Roesch 	/*
3777a51e5b4SStefan Roesch 	 * If the ring is initialized with IORING_SETUP_CQE32, then this field
3787a51e5b4SStefan Roesch 	 * contains 16-bytes of padding, doubling the size of the CQE.
3797a51e5b4SStefan Roesch 	 */
3807a51e5b4SStefan Roesch 	__u64 big_cqe[];
3812b188cc1SJens Axboe };
3822b188cc1SJens Axboe 
3832b188cc1SJens Axboe /*
384bcda7baaSJens Axboe  * cqe->flags
385bcda7baaSJens Axboe  *
386bcda7baaSJens Axboe  * IORING_CQE_F_BUFFER	If set, the upper 16 bits are the buffer ID
38788e41cf9SJens Axboe  * IORING_CQE_F_MORE	If set, parent SQE will generate more CQE entries
388f548a12eSJens Axboe  * IORING_CQE_F_SOCK_NONEMPTY	If set, more data to read after socket recv
389b48c312bSPavel Begunkov  * IORING_CQE_F_NOTIF	Set for notification CQEs. Can be used to distinct
390b48c312bSPavel Begunkov  * 			them from sends.
391bcda7baaSJens Axboe  */
392bcda7baaSJens Axboe #define IORING_CQE_F_BUFFER		(1U << 0)
39388e41cf9SJens Axboe #define IORING_CQE_F_MORE		(1U << 1)
394f548a12eSJens Axboe #define IORING_CQE_F_SOCK_NONEMPTY	(1U << 2)
395b48c312bSPavel Begunkov #define IORING_CQE_F_NOTIF		(1U << 3)
396bcda7baaSJens Axboe 
397bcda7baaSJens Axboe enum {
398bcda7baaSJens Axboe 	IORING_CQE_BUFFER_SHIFT		= 16,
399bcda7baaSJens Axboe };
400bcda7baaSJens Axboe 
401bcda7baaSJens Axboe /*
4022b188cc1SJens Axboe  * Magic offsets for the application to mmap the data it needs
4032b188cc1SJens Axboe  */
4042b188cc1SJens Axboe #define IORING_OFF_SQ_RING		0ULL
4052b188cc1SJens Axboe #define IORING_OFF_CQ_RING		0x8000000ULL
4062b188cc1SJens Axboe #define IORING_OFF_SQES			0x10000000ULL
407c56e022cSJens Axboe #define IORING_OFF_PBUF_RING		0x80000000ULL
408c56e022cSJens Axboe #define IORING_OFF_PBUF_SHIFT		16
409c56e022cSJens Axboe #define IORING_OFF_MMAP_MASK		0xf8000000ULL
4102b188cc1SJens Axboe 
4112b188cc1SJens Axboe /*
4122b188cc1SJens Axboe  * Filled with the offset for mmap(2)
4132b188cc1SJens Axboe  */
4142b188cc1SJens Axboe struct io_sqring_offsets {
4152b188cc1SJens Axboe 	__u32 head;
4162b188cc1SJens Axboe 	__u32 tail;
4172b188cc1SJens Axboe 	__u32 ring_mask;
4182b188cc1SJens Axboe 	__u32 ring_entries;
4192b188cc1SJens Axboe 	__u32 flags;
4202b188cc1SJens Axboe 	__u32 dropped;
4212b188cc1SJens Axboe 	__u32 array;
4222b188cc1SJens Axboe 	__u32 resv1;
42303d89a2dSJens Axboe 	__u64 user_addr;
4242b188cc1SJens Axboe };
4252b188cc1SJens Axboe 
4266c271ce2SJens Axboe /*
4276c271ce2SJens Axboe  * sq_ring->flags
4286c271ce2SJens Axboe  */
4296c271ce2SJens Axboe #define IORING_SQ_NEED_WAKEUP	(1U << 0) /* needs io_uring_enter wakeup */
4306d5f9049SXiaoguang Wang #define IORING_SQ_CQ_OVERFLOW	(1U << 1) /* CQ ring is overflown */
431ef060ea9SJens Axboe #define IORING_SQ_TASKRUN	(1U << 2) /* task should enter the kernel */
4326c271ce2SJens Axboe 
4332b188cc1SJens Axboe struct io_cqring_offsets {
4342b188cc1SJens Axboe 	__u32 head;
4352b188cc1SJens Axboe 	__u32 tail;
4362b188cc1SJens Axboe 	__u32 ring_mask;
4372b188cc1SJens Axboe 	__u32 ring_entries;
4382b188cc1SJens Axboe 	__u32 overflow;
4392b188cc1SJens Axboe 	__u32 cqes;
4400d9b5b3aSStefano Garzarella 	__u32 flags;
4410d9b5b3aSStefano Garzarella 	__u32 resv1;
44203d89a2dSJens Axboe 	__u64 user_addr;
4432b188cc1SJens Axboe };
4442b188cc1SJens Axboe 
4452b188cc1SJens Axboe /*
4467e55a19cSStefano Garzarella  * cq_ring->flags
4477e55a19cSStefano Garzarella  */
4487e55a19cSStefano Garzarella 
4497e55a19cSStefano Garzarella /* disable eventfd notifications */
4507e55a19cSStefano Garzarella #define IORING_CQ_EVENTFD_DISABLED	(1U << 0)
4517e55a19cSStefano Garzarella 
4527e55a19cSStefano Garzarella /*
4532b188cc1SJens Axboe  * io_uring_enter(2) flags
4542b188cc1SJens Axboe  */
4552b188cc1SJens Axboe #define IORING_ENTER_GETEVENTS		(1U << 0)
4566c271ce2SJens Axboe #define IORING_ENTER_SQ_WAKEUP		(1U << 1)
45790554200SJens Axboe #define IORING_ENTER_SQ_WAIT		(1U << 2)
458c73ebb68SHao Xu #define IORING_ENTER_EXT_ARG		(1U << 3)
459e7a6c00dSJens Axboe #define IORING_ENTER_REGISTERED_RING	(1U << 4)
4602b188cc1SJens Axboe 
4612b188cc1SJens Axboe /*
4622b188cc1SJens Axboe  * Passed in for io_uring_setup(2). Copied back with updated info on success
4632b188cc1SJens Axboe  */
4642b188cc1SJens Axboe struct io_uring_params {
4652b188cc1SJens Axboe 	__u32 sq_entries;
4662b188cc1SJens Axboe 	__u32 cq_entries;
4672b188cc1SJens Axboe 	__u32 flags;
4686c271ce2SJens Axboe 	__u32 sq_thread_cpu;
4696c271ce2SJens Axboe 	__u32 sq_thread_idle;
470ac90f249SJens Axboe 	__u32 features;
47124369c2eSPavel Begunkov 	__u32 wq_fd;
47224369c2eSPavel Begunkov 	__u32 resv[3];
4732b188cc1SJens Axboe 	struct io_sqring_offsets sq_off;
4742b188cc1SJens Axboe 	struct io_cqring_offsets cq_off;
4752b188cc1SJens Axboe };
4762b188cc1SJens Axboe 
477edafcceeSJens Axboe /*
478ac90f249SJens Axboe  * io_uring_params->features flags
479ac90f249SJens Axboe  */
480ac90f249SJens Axboe #define IORING_FEAT_SINGLE_MMAP		(1U << 0)
4811d7bb1d5SJens Axboe #define IORING_FEAT_NODROP		(1U << 1)
482da8c9690SJens Axboe #define IORING_FEAT_SUBMIT_STABLE	(1U << 2)
483ba04291eSJens Axboe #define IORING_FEAT_RW_CUR_POS		(1U << 3)
484cccf0ee8SJens Axboe #define IORING_FEAT_CUR_PERSONALITY	(1U << 4)
485d7718a9dSJens Axboe #define IORING_FEAT_FAST_POLL		(1U << 5)
4865769a351SJiufei Xue #define IORING_FEAT_POLL_32BITS 	(1U << 6)
48728cea78aSJens Axboe #define IORING_FEAT_SQPOLL_NONFIXED	(1U << 7)
488c73ebb68SHao Xu #define IORING_FEAT_EXT_ARG		(1U << 8)
4891c0aa1faSJens Axboe #define IORING_FEAT_NATIVE_WORKERS	(1U << 9)
4909690557eSPavel Begunkov #define IORING_FEAT_RSRC_TAGS		(1U << 10)
49104c76b41SPavel Begunkov #define IORING_FEAT_CQE_SKIP		(1U << 11)
492c4212f3eSJens Axboe #define IORING_FEAT_LINKED_FILE		(1U << 12)
4937d3fd88dSJosh Triplett #define IORING_FEAT_REG_REG_RING	(1U << 13)
494ac90f249SJens Axboe 
495ac90f249SJens Axboe /*
496edafcceeSJens Axboe  * io_uring_register(2) opcodes and arguments
497edafcceeSJens Axboe  */
4989d4a75efSStefano Garzarella enum {
4999d4a75efSStefano Garzarella 	IORING_REGISTER_BUFFERS			= 0,
5009d4a75efSStefano Garzarella 	IORING_UNREGISTER_BUFFERS		= 1,
5019d4a75efSStefano Garzarella 	IORING_REGISTER_FILES			= 2,
5029d4a75efSStefano Garzarella 	IORING_UNREGISTER_FILES			= 3,
5039d4a75efSStefano Garzarella 	IORING_REGISTER_EVENTFD			= 4,
5049d4a75efSStefano Garzarella 	IORING_UNREGISTER_EVENTFD		= 5,
5059d4a75efSStefano Garzarella 	IORING_REGISTER_FILES_UPDATE		= 6,
5069d4a75efSStefano Garzarella 	IORING_REGISTER_EVENTFD_ASYNC		= 7,
5079d4a75efSStefano Garzarella 	IORING_REGISTER_PROBE			= 8,
5089d4a75efSStefano Garzarella 	IORING_REGISTER_PERSONALITY		= 9,
5099d4a75efSStefano Garzarella 	IORING_UNREGISTER_PERSONALITY		= 10,
51021b55dbcSStefano Garzarella 	IORING_REGISTER_RESTRICTIONS		= 11,
5117e84e1c7SStefano Garzarella 	IORING_REGISTER_ENABLE_RINGS		= 12,
512992da01aSPavel Begunkov 
513992da01aSPavel Begunkov 	/* extended with tagging */
514992da01aSPavel Begunkov 	IORING_REGISTER_FILES2			= 13,
515992da01aSPavel Begunkov 	IORING_REGISTER_FILES_UPDATE2		= 14,
516992da01aSPavel Begunkov 	IORING_REGISTER_BUFFERS2		= 15,
517992da01aSPavel Begunkov 	IORING_REGISTER_BUFFERS_UPDATE		= 16,
5189d4a75efSStefano Garzarella 
519fe76421dSJens Axboe 	/* set/clear io-wq thread affinities */
520fe76421dSJens Axboe 	IORING_REGISTER_IOWQ_AFF		= 17,
521fe76421dSJens Axboe 	IORING_UNREGISTER_IOWQ_AFF		= 18,
522fe76421dSJens Axboe 
523dd47c104SEugene Syromiatnikov 	/* set/get max number of io-wq workers */
5242e480058SJens Axboe 	IORING_REGISTER_IOWQ_MAX_WORKERS	= 19,
5252e480058SJens Axboe 
526e7a6c00dSJens Axboe 	/* register/unregister io_uring fd with the ring */
527e7a6c00dSJens Axboe 	IORING_REGISTER_RING_FDS		= 20,
528e7a6c00dSJens Axboe 	IORING_UNREGISTER_RING_FDS		= 21,
529e7a6c00dSJens Axboe 
530c7fb1942SJens Axboe 	/* register ring based provide buffer group */
531c7fb1942SJens Axboe 	IORING_REGISTER_PBUF_RING		= 22,
532c7fb1942SJens Axboe 	IORING_UNREGISTER_PBUF_RING		= 23,
533c7fb1942SJens Axboe 
53478a861b9SJens Axboe 	/* sync cancelation API */
53578a861b9SJens Axboe 	IORING_REGISTER_SYNC_CANCEL		= 24,
53678a861b9SJens Axboe 
5376e73dffbSPavel Begunkov 	/* register a range of fixed file slots for automatic slot allocation */
5386e73dffbSPavel Begunkov 	IORING_REGISTER_FILE_ALLOC_RANGE	= 25,
5396e73dffbSPavel Begunkov 
5409d4a75efSStefano Garzarella 	/* this goes last */
5417d3fd88dSJosh Triplett 	IORING_REGISTER_LAST,
5427d3fd88dSJosh Triplett 
5437d3fd88dSJosh Triplett 	/* flag added to the opcode to use a registered ring fd */
5447d3fd88dSJosh Triplett 	IORING_REGISTER_USE_REGISTERED_RING	= 1U << 31
5459d4a75efSStefano Garzarella };
546c3a31e60SJens Axboe 
547dd47c104SEugene Syromiatnikov /* io-wq worker categories */
548dd47c104SEugene Syromiatnikov enum {
549dd47c104SEugene Syromiatnikov 	IO_WQ_BOUND,
550dd47c104SEugene Syromiatnikov 	IO_WQ_UNBOUND,
551dd47c104SEugene Syromiatnikov };
552dd47c104SEugene Syromiatnikov 
553269bbe5fSBijan Mottahedeh /* deprecated, see struct io_uring_rsrc_update */
554c3a31e60SJens Axboe struct io_uring_files_update {
555c3a31e60SJens Axboe 	__u32 offset;
5561292e972SEugene Syromiatnikov 	__u32 resv;
5571292e972SEugene Syromiatnikov 	__aligned_u64 /* __s32 * */ fds;
558c3a31e60SJens Axboe };
559edafcceeSJens Axboe 
560a8da73a3SJens Axboe /*
561a8da73a3SJens Axboe  * Register a fully sparse file space, rather than pass in an array of all
562a8da73a3SJens Axboe  * -1 file descriptors.
563a8da73a3SJens Axboe  */
564a8da73a3SJens Axboe #define IORING_RSRC_REGISTER_SPARSE	(1U << 0)
565a8da73a3SJens Axboe 
566792e3582SPavel Begunkov struct io_uring_rsrc_register {
567792e3582SPavel Begunkov 	__u32 nr;
568a8da73a3SJens Axboe 	__u32 flags;
569992da01aSPavel Begunkov 	__u64 resv2;
570792e3582SPavel Begunkov 	__aligned_u64 data;
571792e3582SPavel Begunkov 	__aligned_u64 tags;
572792e3582SPavel Begunkov };
573792e3582SPavel Begunkov 
574c3bdad02SPavel Begunkov struct io_uring_rsrc_update {
575c3bdad02SPavel Begunkov 	__u32 offset;
576c3bdad02SPavel Begunkov 	__u32 resv;
577c3bdad02SPavel Begunkov 	__aligned_u64 data;
578c3bdad02SPavel Begunkov };
579c3bdad02SPavel Begunkov 
580c3bdad02SPavel Begunkov struct io_uring_rsrc_update2 {
581c3bdad02SPavel Begunkov 	__u32 offset;
582c3bdad02SPavel Begunkov 	__u32 resv;
583c3bdad02SPavel Begunkov 	__aligned_u64 data;
584c3bdad02SPavel Begunkov 	__aligned_u64 tags;
585c3bdad02SPavel Begunkov 	__u32 nr;
586992da01aSPavel Begunkov 	__u32 resv2;
587c3bdad02SPavel Begunkov };
588c3bdad02SPavel Begunkov 
5894e0377a1Snoah /* Skip updating fd indexes set to this value in the fd table */
5904e0377a1Snoah #define IORING_REGISTER_FILES_SKIP	(-2)
5914e0377a1Snoah 
59266f4af93SJens Axboe #define IO_URING_OP_SUPPORTED	(1U << 0)
59366f4af93SJens Axboe 
59466f4af93SJens Axboe struct io_uring_probe_op {
59566f4af93SJens Axboe 	__u8 op;
59666f4af93SJens Axboe 	__u8 resv;
59766f4af93SJens Axboe 	__u16 flags;	/* IO_URING_OP_* flags */
59866f4af93SJens Axboe 	__u32 resv2;
59966f4af93SJens Axboe };
60066f4af93SJens Axboe 
60166f4af93SJens Axboe struct io_uring_probe {
60266f4af93SJens Axboe 	__u8 last_op;	/* last opcode supported */
60366f4af93SJens Axboe 	__u8 ops_len;	/* length of ops[] array below */
60466f4af93SJens Axboe 	__u16 resv;
60566f4af93SJens Axboe 	__u32 resv2[3];
6068fcf4c48SGustavo A. R. Silva 	struct io_uring_probe_op ops[];
60766f4af93SJens Axboe };
60866f4af93SJens Axboe 
60921b55dbcSStefano Garzarella struct io_uring_restriction {
61021b55dbcSStefano Garzarella 	__u16 opcode;
61121b55dbcSStefano Garzarella 	union {
61221b55dbcSStefano Garzarella 		__u8 register_op; /* IORING_RESTRICTION_REGISTER_OP */
61321b55dbcSStefano Garzarella 		__u8 sqe_op;      /* IORING_RESTRICTION_SQE_OP */
61421b55dbcSStefano Garzarella 		__u8 sqe_flags;   /* IORING_RESTRICTION_SQE_FLAGS_* */
61521b55dbcSStefano Garzarella 	};
61621b55dbcSStefano Garzarella 	__u8 resv;
61721b55dbcSStefano Garzarella 	__u32 resv2[3];
61821b55dbcSStefano Garzarella };
61921b55dbcSStefano Garzarella 
620c7fb1942SJens Axboe struct io_uring_buf {
621c7fb1942SJens Axboe 	__u64	addr;
622c7fb1942SJens Axboe 	__u32	len;
623c7fb1942SJens Axboe 	__u16	bid;
624c7fb1942SJens Axboe 	__u16	resv;
625c7fb1942SJens Axboe };
626c7fb1942SJens Axboe 
627c7fb1942SJens Axboe struct io_uring_buf_ring {
628c7fb1942SJens Axboe 	union {
629c7fb1942SJens Axboe 		/*
630c7fb1942SJens Axboe 		 * To avoid spilling into more pages than we need to, the
631c7fb1942SJens Axboe 		 * ring tail is overlaid with the io_uring_buf->resv field.
632c7fb1942SJens Axboe 		 */
633c7fb1942SJens Axboe 		struct {
634c7fb1942SJens Axboe 			__u64	resv1;
635c7fb1942SJens Axboe 			__u32	resv2;
636c7fb1942SJens Axboe 			__u16	resv3;
637c7fb1942SJens Axboe 			__u16	tail;
638c7fb1942SJens Axboe 		};
63936632d06SKees Cook 		__DECLARE_FLEX_ARRAY(struct io_uring_buf, bufs);
640c7fb1942SJens Axboe 	};
641c7fb1942SJens Axboe };
642c7fb1942SJens Axboe 
643c56e022cSJens Axboe /*
644c56e022cSJens Axboe  * Flags for IORING_REGISTER_PBUF_RING.
645c56e022cSJens Axboe  *
646c56e022cSJens Axboe  * IOU_PBUF_RING_MMAP:	If set, kernel will allocate the memory for the ring.
647c56e022cSJens Axboe  *			The application must not set a ring_addr in struct
648c56e022cSJens Axboe  *			io_uring_buf_reg, instead it must subsequently call
649c56e022cSJens Axboe  *			mmap(2) with the offset set as:
650c56e022cSJens Axboe  *			IORING_OFF_PBUF_RING | (bgid << IORING_OFF_PBUF_SHIFT)
651c56e022cSJens Axboe  *			to get a virtual mapping for the ring.
652c56e022cSJens Axboe  */
653c56e022cSJens Axboe enum {
654c56e022cSJens Axboe 	IOU_PBUF_RING_MMAP	= 1,
655c56e022cSJens Axboe };
656c56e022cSJens Axboe 
657c7fb1942SJens Axboe /* argument for IORING_(UN)REGISTER_PBUF_RING */
658c7fb1942SJens Axboe struct io_uring_buf_reg {
659c7fb1942SJens Axboe 	__u64	ring_addr;
660c7fb1942SJens Axboe 	__u32	ring_entries;
661c7fb1942SJens Axboe 	__u16	bgid;
66281cf17cdSJens Axboe 	__u16	flags;
663c7fb1942SJens Axboe 	__u64	resv[3];
664c7fb1942SJens Axboe };
665c7fb1942SJens Axboe 
66621b55dbcSStefano Garzarella /*
66721b55dbcSStefano Garzarella  * io_uring_restriction->opcode values
66821b55dbcSStefano Garzarella  */
66921b55dbcSStefano Garzarella enum {
67021b55dbcSStefano Garzarella 	/* Allow an io_uring_register(2) opcode */
67121b55dbcSStefano Garzarella 	IORING_RESTRICTION_REGISTER_OP		= 0,
67221b55dbcSStefano Garzarella 
67321b55dbcSStefano Garzarella 	/* Allow an sqe opcode */
67421b55dbcSStefano Garzarella 	IORING_RESTRICTION_SQE_OP		= 1,
67521b55dbcSStefano Garzarella 
67621b55dbcSStefano Garzarella 	/* Allow sqe flags */
67721b55dbcSStefano Garzarella 	IORING_RESTRICTION_SQE_FLAGS_ALLOWED	= 2,
67821b55dbcSStefano Garzarella 
67921b55dbcSStefano Garzarella 	/* Require sqe flags (these flags must be set on each submission) */
68021b55dbcSStefano Garzarella 	IORING_RESTRICTION_SQE_FLAGS_REQUIRED	= 3,
68121b55dbcSStefano Garzarella 
68221b55dbcSStefano Garzarella 	IORING_RESTRICTION_LAST
68321b55dbcSStefano Garzarella };
68421b55dbcSStefano Garzarella 
685c73ebb68SHao Xu struct io_uring_getevents_arg {
686c73ebb68SHao Xu 	__u64	sigmask;
687c73ebb68SHao Xu 	__u32	sigmask_sz;
688c73ebb68SHao Xu 	__u32	pad;
689c73ebb68SHao Xu 	__u64	ts;
690c73ebb68SHao Xu };
691c73ebb68SHao Xu 
69278a861b9SJens Axboe /*
69378a861b9SJens Axboe  * Argument for IORING_REGISTER_SYNC_CANCEL
69478a861b9SJens Axboe  */
69578a861b9SJens Axboe struct io_uring_sync_cancel_reg {
69678a861b9SJens Axboe 	__u64				addr;
69778a861b9SJens Axboe 	__s32				fd;
69878a861b9SJens Axboe 	__u32				flags;
69978a861b9SJens Axboe 	struct __kernel_timespec	timeout;
70078a861b9SJens Axboe 	__u64				pad[4];
70178a861b9SJens Axboe };
70278a861b9SJens Axboe 
7036e73dffbSPavel Begunkov /*
7046e73dffbSPavel Begunkov  * Argument for IORING_REGISTER_FILE_ALLOC_RANGE
7056e73dffbSPavel Begunkov  * The range is specified as [off, off + len)
7066e73dffbSPavel Begunkov  */
7076e73dffbSPavel Begunkov struct io_uring_file_index_range {
7086e73dffbSPavel Begunkov 	__u32	off;
7096e73dffbSPavel Begunkov 	__u32	len;
7106e73dffbSPavel Begunkov 	__u64	resv;
7116e73dffbSPavel Begunkov };
7126e73dffbSPavel Begunkov 
7139bb66906SDylan Yudaken struct io_uring_recvmsg_out {
7149bb66906SDylan Yudaken 	__u32 namelen;
7159bb66906SDylan Yudaken 	__u32 controllen;
7169bb66906SDylan Yudaken 	__u32 payloadlen;
7179bb66906SDylan Yudaken 	__u32 flags;
7189bb66906SDylan Yudaken };
7199bb66906SDylan Yudaken 
720e1d0c6d0SAmmar Faizi #ifdef __cplusplus
721e1d0c6d0SAmmar Faizi }
722e1d0c6d0SAmmar Faizi #endif
723e1d0c6d0SAmmar Faizi 
7242b188cc1SJens Axboe #endif
725