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 1882af89abdSPavel Begunkov /* 1892af89abdSPavel Begunkov * Removes indirection through the SQ index array. 1902af89abdSPavel Begunkov */ 1912af89abdSPavel Begunkov #define IORING_SETUP_NO_SQARRAY (1U << 16) 1922af89abdSPavel Begunkov 193cc51eaa8SDylan Yudaken enum io_uring_op { 1949e3aa61aSJens Axboe IORING_OP_NOP, 1959e3aa61aSJens Axboe IORING_OP_READV, 1969e3aa61aSJens Axboe IORING_OP_WRITEV, 1979e3aa61aSJens Axboe IORING_OP_FSYNC, 1989e3aa61aSJens Axboe IORING_OP_READ_FIXED, 1999e3aa61aSJens Axboe IORING_OP_WRITE_FIXED, 2009e3aa61aSJens Axboe IORING_OP_POLL_ADD, 2019e3aa61aSJens Axboe IORING_OP_POLL_REMOVE, 2029e3aa61aSJens Axboe IORING_OP_SYNC_FILE_RANGE, 2039e3aa61aSJens Axboe IORING_OP_SENDMSG, 2049e3aa61aSJens Axboe IORING_OP_RECVMSG, 2059e3aa61aSJens Axboe IORING_OP_TIMEOUT, 2069e3aa61aSJens Axboe IORING_OP_TIMEOUT_REMOVE, 2079e3aa61aSJens Axboe IORING_OP_ACCEPT, 2089e3aa61aSJens Axboe IORING_OP_ASYNC_CANCEL, 2099e3aa61aSJens Axboe IORING_OP_LINK_TIMEOUT, 2109e3aa61aSJens Axboe IORING_OP_CONNECT, 211d63d1b5eSJens Axboe IORING_OP_FALLOCATE, 21215b71abeSJens Axboe IORING_OP_OPENAT, 213b5dba59eSJens Axboe IORING_OP_CLOSE, 214d9808cebSPavel Begunkov IORING_OP_FILES_UPDATE, 215eddc7ef5SJens Axboe IORING_OP_STATX, 2163a6820f2SJens Axboe IORING_OP_READ, 2173a6820f2SJens Axboe IORING_OP_WRITE, 2184840e418SJens Axboe IORING_OP_FADVISE, 219c1ca757bSJens Axboe IORING_OP_MADVISE, 220fddafaceSJens Axboe IORING_OP_SEND, 221fddafaceSJens Axboe IORING_OP_RECV, 222cebdb986SJens Axboe IORING_OP_OPENAT2, 2233e4827b0SJens Axboe IORING_OP_EPOLL_CTL, 2247d67af2cSPavel Begunkov IORING_OP_SPLICE, 225ddf0322dSJens Axboe IORING_OP_PROVIDE_BUFFERS, 226067524e9SJens Axboe IORING_OP_REMOVE_BUFFERS, 227f2a8d5c7SPavel Begunkov IORING_OP_TEE, 22836f4fa68SJens Axboe IORING_OP_SHUTDOWN, 22980a261fdSJens Axboe IORING_OP_RENAMEAT, 23014a1143bSJens Axboe IORING_OP_UNLINKAT, 231e34a02dcSDmitry Kadashev IORING_OP_MKDIRAT, 2327a8721f8SDmitry Kadashev IORING_OP_SYMLINKAT, 233cf30da90SDmitry Kadashev IORING_OP_LINKAT, 2344f57f06cSJens Axboe IORING_OP_MSG_RING, 235e9621e2bSStefan Roesch IORING_OP_FSETXATTR, 236e9621e2bSStefan Roesch IORING_OP_SETXATTR, 237a56834e0SStefan Roesch IORING_OP_FGETXATTR, 238a56834e0SStefan Roesch IORING_OP_GETXATTR, 2391374e08eSJens Axboe IORING_OP_SOCKET, 240ee692a21SJens Axboe IORING_OP_URING_CMD, 241b48c312bSPavel Begunkov IORING_OP_SEND_ZC, 242493108d9SPavel Begunkov IORING_OP_SENDMSG_ZC, 243*fc68fcdaSJens Axboe IORING_OP_READ_MULTISHOT, 2449e3aa61aSJens Axboe 2459e3aa61aSJens Axboe /* this goes last, obviously */ 2469e3aa61aSJens Axboe IORING_OP_LAST, 2479e3aa61aSJens Axboe }; 248c992fe29SChristoph Hellwig 249c992fe29SChristoph Hellwig /* 2509cda70f6SAnuj Gupta * sqe->uring_cmd_flags 2516dcabcd3SJens Axboe * IORING_URING_CMD_FIXED use registered buffer; pass this flag 2529cda70f6SAnuj Gupta * along with setting sqe->buf_index. 2539408d8a3SKeith Busch * IORING_URING_CMD_POLLED driver use only 2549cda70f6SAnuj Gupta */ 2559cda70f6SAnuj Gupta #define IORING_URING_CMD_FIXED (1U << 0) 2569408d8a3SKeith Busch #define IORING_URING_CMD_POLLED (1U << 31) 2579cda70f6SAnuj Gupta 2589cda70f6SAnuj Gupta 2599cda70f6SAnuj Gupta /* 260c992fe29SChristoph Hellwig * sqe->fsync_flags 261c992fe29SChristoph Hellwig */ 262c992fe29SChristoph Hellwig #define IORING_FSYNC_DATASYNC (1U << 0) 2632b188cc1SJens Axboe 2642b188cc1SJens Axboe /* 265a41525abSJens Axboe * sqe->timeout_flags 266a41525abSJens Axboe */ 267a41525abSJens Axboe #define IORING_TIMEOUT_ABS (1U << 0) 2689c8e11b3SPavel Begunkov #define IORING_TIMEOUT_UPDATE (1U << 1) 26950c1df2bSJens Axboe #define IORING_TIMEOUT_BOOTTIME (1U << 2) 27050c1df2bSJens Axboe #define IORING_TIMEOUT_REALTIME (1U << 3) 271f1042b6cSPavel Begunkov #define IORING_LINK_TIMEOUT_UPDATE (1U << 4) 2726224590dSPavel Begunkov #define IORING_TIMEOUT_ETIME_SUCCESS (1U << 5) 273ea97f6c8SDavid Wei #define IORING_TIMEOUT_MULTISHOT (1U << 6) 27450c1df2bSJens Axboe #define IORING_TIMEOUT_CLOCK_MASK (IORING_TIMEOUT_BOOTTIME | IORING_TIMEOUT_REALTIME) 275f1042b6cSPavel Begunkov #define IORING_TIMEOUT_UPDATE_MASK (IORING_TIMEOUT_UPDATE | IORING_LINK_TIMEOUT_UPDATE) 276a41525abSJens Axboe /* 2777d67af2cSPavel Begunkov * sqe->splice_flags 2787d67af2cSPavel Begunkov * extends splice(2) flags 2797d67af2cSPavel Begunkov */ 2807d67af2cSPavel Begunkov #define SPLICE_F_FD_IN_FIXED (1U << 31) /* the last bit of __u32 */ 2817d67af2cSPavel Begunkov 2827d67af2cSPavel Begunkov /* 28388e41cf9SJens Axboe * POLL_ADD flags. Note that since sqe->poll_events is the flag space, the 28488e41cf9SJens Axboe * command flags for POLL_ADD are stored in sqe->len. 28588e41cf9SJens Axboe * 28688e41cf9SJens Axboe * IORING_POLL_ADD_MULTI Multishot poll. Sets IORING_CQE_F_MORE if 28788e41cf9SJens Axboe * the poll handler will continue to report 28888e41cf9SJens Axboe * CQEs on behalf of the same SQE. 289b69de288SJens Axboe * 290b69de288SJens Axboe * IORING_POLL_UPDATE Update existing poll request, matching 291b69de288SJens Axboe * sqe->addr as the old user_data field. 292b9ba8a44SJens Axboe * 293b9ba8a44SJens Axboe * IORING_POLL_LEVEL Level triggered poll. 29488e41cf9SJens Axboe */ 29588e41cf9SJens Axboe #define IORING_POLL_ADD_MULTI (1U << 0) 296b69de288SJens Axboe #define IORING_POLL_UPDATE_EVENTS (1U << 1) 297b69de288SJens Axboe #define IORING_POLL_UPDATE_USER_DATA (1U << 2) 298b9ba8a44SJens Axboe #define IORING_POLL_ADD_LEVEL (1U << 3) 29988e41cf9SJens Axboe 30088e41cf9SJens Axboe /* 3018e29da69SJens Axboe * ASYNC_CANCEL flags. 3028e29da69SJens Axboe * 3038e29da69SJens Axboe * IORING_ASYNC_CANCEL_ALL Cancel all requests that match the given key 3044bf94615SJens Axboe * IORING_ASYNC_CANCEL_FD Key off 'fd' for cancelation rather than the 3054bf94615SJens Axboe * request 'user_data' 306970f256eSJens Axboe * IORING_ASYNC_CANCEL_ANY Match any request 3077d8ca725SJens Axboe * IORING_ASYNC_CANCEL_FD_FIXED 'fd' passed in is a fixed descriptor 3088165b566SJens Axboe * IORING_ASYNC_CANCEL_USERDATA Match on user_data, default for no other key 309d7b8b079SJens Axboe * IORING_ASYNC_CANCEL_OP Match request based on opcode 3108e29da69SJens Axboe */ 3118e29da69SJens Axboe #define IORING_ASYNC_CANCEL_ALL (1U << 0) 3124bf94615SJens Axboe #define IORING_ASYNC_CANCEL_FD (1U << 1) 313970f256eSJens Axboe #define IORING_ASYNC_CANCEL_ANY (1U << 2) 3147d8ca725SJens Axboe #define IORING_ASYNC_CANCEL_FD_FIXED (1U << 3) 3158165b566SJens Axboe #define IORING_ASYNC_CANCEL_USERDATA (1U << 4) 316d7b8b079SJens Axboe #define IORING_ASYNC_CANCEL_OP (1U << 5) 3178e29da69SJens Axboe 3188e29da69SJens Axboe /* 31929c1ac23SPavel Begunkov * send/sendmsg and recv/recvmsg flags (sqe->ioprio) 3200455d4ccSJens Axboe * 3210455d4ccSJens Axboe * IORING_RECVSEND_POLL_FIRST If set, instead of first attempting to send 3220455d4ccSJens Axboe * or receive and arm poll if that yields an 3230455d4ccSJens Axboe * -EAGAIN result, arm poll upfront and skip 3240455d4ccSJens Axboe * the initial transfer attempt. 325b3fdea6eSDylan Yudaken * 326b3fdea6eSDylan Yudaken * IORING_RECV_MULTISHOT Multishot recv. Sets IORING_CQE_F_MORE if 327b3fdea6eSDylan Yudaken * the handler will continue to report 328b3fdea6eSDylan Yudaken * CQEs on behalf of the same SQE. 32910c7d33eSPavel Begunkov * 33010c7d33eSPavel Begunkov * IORING_RECVSEND_FIXED_BUF Use registered buffers, the index is stored in 33110c7d33eSPavel Begunkov * the buf_index field. 332e307e669SStefan Metzmacher * 333e307e669SStefan Metzmacher * IORING_SEND_ZC_REPORT_USAGE 334e307e669SStefan Metzmacher * If set, SEND[MSG]_ZC should report 335e307e669SStefan Metzmacher * the zerocopy usage in cqe.res 336e307e669SStefan Metzmacher * for the IORING_CQE_F_NOTIF cqe. 337e307e669SStefan Metzmacher * 0 is reported if zerocopy was actually possible. 338e307e669SStefan Metzmacher * IORING_NOTIF_USAGE_ZC_COPIED if data was copied 339e307e669SStefan Metzmacher * (at least partially). 3400455d4ccSJens Axboe */ 3410455d4ccSJens Axboe #define IORING_RECVSEND_POLL_FIRST (1U << 0) 342b3fdea6eSDylan Yudaken #define IORING_RECV_MULTISHOT (1U << 1) 34310c7d33eSPavel Begunkov #define IORING_RECVSEND_FIXED_BUF (1U << 2) 344e307e669SStefan Metzmacher #define IORING_SEND_ZC_REPORT_USAGE (1U << 3) 345e307e669SStefan Metzmacher 346e307e669SStefan Metzmacher /* 347e307e669SStefan Metzmacher * cqe.res for IORING_CQE_F_NOTIF if 348e307e669SStefan Metzmacher * IORING_SEND_ZC_REPORT_USAGE was requested 349e307e669SStefan Metzmacher * 350e307e669SStefan Metzmacher * It should be treated as a flag, all other 351e307e669SStefan Metzmacher * bits of cqe.res should be treated as reserved! 352e307e669SStefan Metzmacher */ 353e307e669SStefan Metzmacher #define IORING_NOTIF_USAGE_ZC_COPIED (1U << 31) 3540455d4ccSJens Axboe 3550455d4ccSJens Axboe /* 356390ed29bSHao Xu * accept flags stored in sqe->ioprio 357390ed29bSHao Xu */ 358390ed29bSHao Xu #define IORING_ACCEPT_MULTISHOT (1U << 0) 359390ed29bSHao Xu 360390ed29bSHao Xu /* 361e6130ebaSJens Axboe * IORING_OP_MSG_RING command types, stored in sqe->addr 362e6130ebaSJens Axboe */ 363e6130ebaSJens Axboe enum { 364e6130ebaSJens Axboe IORING_MSG_DATA, /* pass sqe->len as 'res' and off as user_data */ 365e6130ebaSJens Axboe IORING_MSG_SEND_FD, /* send a registered fd to another ring */ 366e6130ebaSJens Axboe }; 367e6130ebaSJens Axboe 368e6130ebaSJens Axboe /* 369e6130ebaSJens Axboe * IORING_OP_MSG_RING flags (sqe->msg_ring_flags) 370e6130ebaSJens Axboe * 371e6130ebaSJens Axboe * IORING_MSG_RING_CQE_SKIP Don't post a CQE to the target ring. Not 372e6130ebaSJens Axboe * applicable for IORING_MSG_DATA, obviously. 373e6130ebaSJens Axboe */ 374e6130ebaSJens Axboe #define IORING_MSG_RING_CQE_SKIP (1U << 0) 375cbeb47a7SBreno Leitao /* Pass through the flags from sqe->file_index to cqe->flags */ 376cbeb47a7SBreno Leitao #define IORING_MSG_RING_FLAGS_PASS (1U << 1) 377e6130ebaSJens Axboe 378e6130ebaSJens Axboe /* 3792b188cc1SJens Axboe * IO completion data structure (Completion Queue Entry) 3802b188cc1SJens Axboe */ 3812b188cc1SJens Axboe struct io_uring_cqe { 3822b188cc1SJens Axboe __u64 user_data; /* sqe->data submission passed back */ 3832b188cc1SJens Axboe __s32 res; /* result code for this event */ 3842b188cc1SJens Axboe __u32 flags; 3857a51e5b4SStefan Roesch 3867a51e5b4SStefan Roesch /* 3877a51e5b4SStefan Roesch * If the ring is initialized with IORING_SETUP_CQE32, then this field 3887a51e5b4SStefan Roesch * contains 16-bytes of padding, doubling the size of the CQE. 3897a51e5b4SStefan Roesch */ 3907a51e5b4SStefan Roesch __u64 big_cqe[]; 3912b188cc1SJens Axboe }; 3922b188cc1SJens Axboe 3932b188cc1SJens Axboe /* 394bcda7baaSJens Axboe * cqe->flags 395bcda7baaSJens Axboe * 396bcda7baaSJens Axboe * IORING_CQE_F_BUFFER If set, the upper 16 bits are the buffer ID 39788e41cf9SJens Axboe * IORING_CQE_F_MORE If set, parent SQE will generate more CQE entries 398f548a12eSJens Axboe * IORING_CQE_F_SOCK_NONEMPTY If set, more data to read after socket recv 399b48c312bSPavel Begunkov * IORING_CQE_F_NOTIF Set for notification CQEs. Can be used to distinct 400b48c312bSPavel Begunkov * them from sends. 401bcda7baaSJens Axboe */ 402bcda7baaSJens Axboe #define IORING_CQE_F_BUFFER (1U << 0) 40388e41cf9SJens Axboe #define IORING_CQE_F_MORE (1U << 1) 404f548a12eSJens Axboe #define IORING_CQE_F_SOCK_NONEMPTY (1U << 2) 405b48c312bSPavel Begunkov #define IORING_CQE_F_NOTIF (1U << 3) 406bcda7baaSJens Axboe 407bcda7baaSJens Axboe enum { 408bcda7baaSJens Axboe IORING_CQE_BUFFER_SHIFT = 16, 409bcda7baaSJens Axboe }; 410bcda7baaSJens Axboe 411bcda7baaSJens Axboe /* 4122b188cc1SJens Axboe * Magic offsets for the application to mmap the data it needs 4132b188cc1SJens Axboe */ 4142b188cc1SJens Axboe #define IORING_OFF_SQ_RING 0ULL 4152b188cc1SJens Axboe #define IORING_OFF_CQ_RING 0x8000000ULL 4162b188cc1SJens Axboe #define IORING_OFF_SQES 0x10000000ULL 417c56e022cSJens Axboe #define IORING_OFF_PBUF_RING 0x80000000ULL 418c56e022cSJens Axboe #define IORING_OFF_PBUF_SHIFT 16 419c56e022cSJens Axboe #define IORING_OFF_MMAP_MASK 0xf8000000ULL 4202b188cc1SJens Axboe 4212b188cc1SJens Axboe /* 4222b188cc1SJens Axboe * Filled with the offset for mmap(2) 4232b188cc1SJens Axboe */ 4242b188cc1SJens Axboe struct io_sqring_offsets { 4252b188cc1SJens Axboe __u32 head; 4262b188cc1SJens Axboe __u32 tail; 4272b188cc1SJens Axboe __u32 ring_mask; 4282b188cc1SJens Axboe __u32 ring_entries; 4292b188cc1SJens Axboe __u32 flags; 4302b188cc1SJens Axboe __u32 dropped; 4312b188cc1SJens Axboe __u32 array; 4322b188cc1SJens Axboe __u32 resv1; 43303d89a2dSJens Axboe __u64 user_addr; 4342b188cc1SJens Axboe }; 4352b188cc1SJens Axboe 4366c271ce2SJens Axboe /* 4376c271ce2SJens Axboe * sq_ring->flags 4386c271ce2SJens Axboe */ 4396c271ce2SJens Axboe #define IORING_SQ_NEED_WAKEUP (1U << 0) /* needs io_uring_enter wakeup */ 4406d5f9049SXiaoguang Wang #define IORING_SQ_CQ_OVERFLOW (1U << 1) /* CQ ring is overflown */ 441ef060ea9SJens Axboe #define IORING_SQ_TASKRUN (1U << 2) /* task should enter the kernel */ 4426c271ce2SJens Axboe 4432b188cc1SJens Axboe struct io_cqring_offsets { 4442b188cc1SJens Axboe __u32 head; 4452b188cc1SJens Axboe __u32 tail; 4462b188cc1SJens Axboe __u32 ring_mask; 4472b188cc1SJens Axboe __u32 ring_entries; 4482b188cc1SJens Axboe __u32 overflow; 4492b188cc1SJens Axboe __u32 cqes; 4500d9b5b3aSStefano Garzarella __u32 flags; 4510d9b5b3aSStefano Garzarella __u32 resv1; 45203d89a2dSJens Axboe __u64 user_addr; 4532b188cc1SJens Axboe }; 4542b188cc1SJens Axboe 4552b188cc1SJens Axboe /* 4567e55a19cSStefano Garzarella * cq_ring->flags 4577e55a19cSStefano Garzarella */ 4587e55a19cSStefano Garzarella 4597e55a19cSStefano Garzarella /* disable eventfd notifications */ 4607e55a19cSStefano Garzarella #define IORING_CQ_EVENTFD_DISABLED (1U << 0) 4617e55a19cSStefano Garzarella 4627e55a19cSStefano Garzarella /* 4632b188cc1SJens Axboe * io_uring_enter(2) flags 4642b188cc1SJens Axboe */ 4652b188cc1SJens Axboe #define IORING_ENTER_GETEVENTS (1U << 0) 4666c271ce2SJens Axboe #define IORING_ENTER_SQ_WAKEUP (1U << 1) 46790554200SJens Axboe #define IORING_ENTER_SQ_WAIT (1U << 2) 468c73ebb68SHao Xu #define IORING_ENTER_EXT_ARG (1U << 3) 469e7a6c00dSJens Axboe #define IORING_ENTER_REGISTERED_RING (1U << 4) 4702b188cc1SJens Axboe 4712b188cc1SJens Axboe /* 4722b188cc1SJens Axboe * Passed in for io_uring_setup(2). Copied back with updated info on success 4732b188cc1SJens Axboe */ 4742b188cc1SJens Axboe struct io_uring_params { 4752b188cc1SJens Axboe __u32 sq_entries; 4762b188cc1SJens Axboe __u32 cq_entries; 4772b188cc1SJens Axboe __u32 flags; 4786c271ce2SJens Axboe __u32 sq_thread_cpu; 4796c271ce2SJens Axboe __u32 sq_thread_idle; 480ac90f249SJens Axboe __u32 features; 48124369c2eSPavel Begunkov __u32 wq_fd; 48224369c2eSPavel Begunkov __u32 resv[3]; 4832b188cc1SJens Axboe struct io_sqring_offsets sq_off; 4842b188cc1SJens Axboe struct io_cqring_offsets cq_off; 4852b188cc1SJens Axboe }; 4862b188cc1SJens Axboe 487edafcceeSJens Axboe /* 488ac90f249SJens Axboe * io_uring_params->features flags 489ac90f249SJens Axboe */ 490ac90f249SJens Axboe #define IORING_FEAT_SINGLE_MMAP (1U << 0) 4911d7bb1d5SJens Axboe #define IORING_FEAT_NODROP (1U << 1) 492da8c9690SJens Axboe #define IORING_FEAT_SUBMIT_STABLE (1U << 2) 493ba04291eSJens Axboe #define IORING_FEAT_RW_CUR_POS (1U << 3) 494cccf0ee8SJens Axboe #define IORING_FEAT_CUR_PERSONALITY (1U << 4) 495d7718a9dSJens Axboe #define IORING_FEAT_FAST_POLL (1U << 5) 4965769a351SJiufei Xue #define IORING_FEAT_POLL_32BITS (1U << 6) 49728cea78aSJens Axboe #define IORING_FEAT_SQPOLL_NONFIXED (1U << 7) 498c73ebb68SHao Xu #define IORING_FEAT_EXT_ARG (1U << 8) 4991c0aa1faSJens Axboe #define IORING_FEAT_NATIVE_WORKERS (1U << 9) 5009690557eSPavel Begunkov #define IORING_FEAT_RSRC_TAGS (1U << 10) 50104c76b41SPavel Begunkov #define IORING_FEAT_CQE_SKIP (1U << 11) 502c4212f3eSJens Axboe #define IORING_FEAT_LINKED_FILE (1U << 12) 5037d3fd88dSJosh Triplett #define IORING_FEAT_REG_REG_RING (1U << 13) 504ac90f249SJens Axboe 505ac90f249SJens Axboe /* 506edafcceeSJens Axboe * io_uring_register(2) opcodes and arguments 507edafcceeSJens Axboe */ 5089d4a75efSStefano Garzarella enum { 5099d4a75efSStefano Garzarella IORING_REGISTER_BUFFERS = 0, 5109d4a75efSStefano Garzarella IORING_UNREGISTER_BUFFERS = 1, 5119d4a75efSStefano Garzarella IORING_REGISTER_FILES = 2, 5129d4a75efSStefano Garzarella IORING_UNREGISTER_FILES = 3, 5139d4a75efSStefano Garzarella IORING_REGISTER_EVENTFD = 4, 5149d4a75efSStefano Garzarella IORING_UNREGISTER_EVENTFD = 5, 5159d4a75efSStefano Garzarella IORING_REGISTER_FILES_UPDATE = 6, 5169d4a75efSStefano Garzarella IORING_REGISTER_EVENTFD_ASYNC = 7, 5179d4a75efSStefano Garzarella IORING_REGISTER_PROBE = 8, 5189d4a75efSStefano Garzarella IORING_REGISTER_PERSONALITY = 9, 5199d4a75efSStefano Garzarella IORING_UNREGISTER_PERSONALITY = 10, 52021b55dbcSStefano Garzarella IORING_REGISTER_RESTRICTIONS = 11, 5217e84e1c7SStefano Garzarella IORING_REGISTER_ENABLE_RINGS = 12, 522992da01aSPavel Begunkov 523992da01aSPavel Begunkov /* extended with tagging */ 524992da01aSPavel Begunkov IORING_REGISTER_FILES2 = 13, 525992da01aSPavel Begunkov IORING_REGISTER_FILES_UPDATE2 = 14, 526992da01aSPavel Begunkov IORING_REGISTER_BUFFERS2 = 15, 527992da01aSPavel Begunkov IORING_REGISTER_BUFFERS_UPDATE = 16, 5289d4a75efSStefano Garzarella 529fe76421dSJens Axboe /* set/clear io-wq thread affinities */ 530fe76421dSJens Axboe IORING_REGISTER_IOWQ_AFF = 17, 531fe76421dSJens Axboe IORING_UNREGISTER_IOWQ_AFF = 18, 532fe76421dSJens Axboe 533dd47c104SEugene Syromiatnikov /* set/get max number of io-wq workers */ 5342e480058SJens Axboe IORING_REGISTER_IOWQ_MAX_WORKERS = 19, 5352e480058SJens Axboe 536e7a6c00dSJens Axboe /* register/unregister io_uring fd with the ring */ 537e7a6c00dSJens Axboe IORING_REGISTER_RING_FDS = 20, 538e7a6c00dSJens Axboe IORING_UNREGISTER_RING_FDS = 21, 539e7a6c00dSJens Axboe 540c7fb1942SJens Axboe /* register ring based provide buffer group */ 541c7fb1942SJens Axboe IORING_REGISTER_PBUF_RING = 22, 542c7fb1942SJens Axboe IORING_UNREGISTER_PBUF_RING = 23, 543c7fb1942SJens Axboe 54478a861b9SJens Axboe /* sync cancelation API */ 54578a861b9SJens Axboe IORING_REGISTER_SYNC_CANCEL = 24, 54678a861b9SJens Axboe 5476e73dffbSPavel Begunkov /* register a range of fixed file slots for automatic slot allocation */ 5486e73dffbSPavel Begunkov IORING_REGISTER_FILE_ALLOC_RANGE = 25, 5496e73dffbSPavel Begunkov 5509d4a75efSStefano Garzarella /* this goes last */ 5517d3fd88dSJosh Triplett IORING_REGISTER_LAST, 5527d3fd88dSJosh Triplett 5537d3fd88dSJosh Triplett /* flag added to the opcode to use a registered ring fd */ 5547d3fd88dSJosh Triplett IORING_REGISTER_USE_REGISTERED_RING = 1U << 31 5559d4a75efSStefano Garzarella }; 556c3a31e60SJens Axboe 557dd47c104SEugene Syromiatnikov /* io-wq worker categories */ 558dd47c104SEugene Syromiatnikov enum { 559dd47c104SEugene Syromiatnikov IO_WQ_BOUND, 560dd47c104SEugene Syromiatnikov IO_WQ_UNBOUND, 561dd47c104SEugene Syromiatnikov }; 562dd47c104SEugene Syromiatnikov 563269bbe5fSBijan Mottahedeh /* deprecated, see struct io_uring_rsrc_update */ 564c3a31e60SJens Axboe struct io_uring_files_update { 565c3a31e60SJens Axboe __u32 offset; 5661292e972SEugene Syromiatnikov __u32 resv; 5671292e972SEugene Syromiatnikov __aligned_u64 /* __s32 * */ fds; 568c3a31e60SJens Axboe }; 569edafcceeSJens Axboe 570a8da73a3SJens Axboe /* 571a8da73a3SJens Axboe * Register a fully sparse file space, rather than pass in an array of all 572a8da73a3SJens Axboe * -1 file descriptors. 573a8da73a3SJens Axboe */ 574a8da73a3SJens Axboe #define IORING_RSRC_REGISTER_SPARSE (1U << 0) 575a8da73a3SJens Axboe 576792e3582SPavel Begunkov struct io_uring_rsrc_register { 577792e3582SPavel Begunkov __u32 nr; 578a8da73a3SJens Axboe __u32 flags; 579992da01aSPavel Begunkov __u64 resv2; 580792e3582SPavel Begunkov __aligned_u64 data; 581792e3582SPavel Begunkov __aligned_u64 tags; 582792e3582SPavel Begunkov }; 583792e3582SPavel Begunkov 584c3bdad02SPavel Begunkov struct io_uring_rsrc_update { 585c3bdad02SPavel Begunkov __u32 offset; 586c3bdad02SPavel Begunkov __u32 resv; 587c3bdad02SPavel Begunkov __aligned_u64 data; 588c3bdad02SPavel Begunkov }; 589c3bdad02SPavel Begunkov 590c3bdad02SPavel Begunkov struct io_uring_rsrc_update2 { 591c3bdad02SPavel Begunkov __u32 offset; 592c3bdad02SPavel Begunkov __u32 resv; 593c3bdad02SPavel Begunkov __aligned_u64 data; 594c3bdad02SPavel Begunkov __aligned_u64 tags; 595c3bdad02SPavel Begunkov __u32 nr; 596992da01aSPavel Begunkov __u32 resv2; 597c3bdad02SPavel Begunkov }; 598c3bdad02SPavel Begunkov 5994e0377a1Snoah /* Skip updating fd indexes set to this value in the fd table */ 6004e0377a1Snoah #define IORING_REGISTER_FILES_SKIP (-2) 6014e0377a1Snoah 60266f4af93SJens Axboe #define IO_URING_OP_SUPPORTED (1U << 0) 60366f4af93SJens Axboe 60466f4af93SJens Axboe struct io_uring_probe_op { 60566f4af93SJens Axboe __u8 op; 60666f4af93SJens Axboe __u8 resv; 60766f4af93SJens Axboe __u16 flags; /* IO_URING_OP_* flags */ 60866f4af93SJens Axboe __u32 resv2; 60966f4af93SJens Axboe }; 61066f4af93SJens Axboe 61166f4af93SJens Axboe struct io_uring_probe { 61266f4af93SJens Axboe __u8 last_op; /* last opcode supported */ 61366f4af93SJens Axboe __u8 ops_len; /* length of ops[] array below */ 61466f4af93SJens Axboe __u16 resv; 61566f4af93SJens Axboe __u32 resv2[3]; 6168fcf4c48SGustavo A. R. Silva struct io_uring_probe_op ops[]; 61766f4af93SJens Axboe }; 61866f4af93SJens Axboe 61921b55dbcSStefano Garzarella struct io_uring_restriction { 62021b55dbcSStefano Garzarella __u16 opcode; 62121b55dbcSStefano Garzarella union { 62221b55dbcSStefano Garzarella __u8 register_op; /* IORING_RESTRICTION_REGISTER_OP */ 62321b55dbcSStefano Garzarella __u8 sqe_op; /* IORING_RESTRICTION_SQE_OP */ 62421b55dbcSStefano Garzarella __u8 sqe_flags; /* IORING_RESTRICTION_SQE_FLAGS_* */ 62521b55dbcSStefano Garzarella }; 62621b55dbcSStefano Garzarella __u8 resv; 62721b55dbcSStefano Garzarella __u32 resv2[3]; 62821b55dbcSStefano Garzarella }; 62921b55dbcSStefano Garzarella 630c7fb1942SJens Axboe struct io_uring_buf { 631c7fb1942SJens Axboe __u64 addr; 632c7fb1942SJens Axboe __u32 len; 633c7fb1942SJens Axboe __u16 bid; 634c7fb1942SJens Axboe __u16 resv; 635c7fb1942SJens Axboe }; 636c7fb1942SJens Axboe 637c7fb1942SJens Axboe struct io_uring_buf_ring { 638c7fb1942SJens Axboe union { 639c7fb1942SJens Axboe /* 640c7fb1942SJens Axboe * To avoid spilling into more pages than we need to, the 641c7fb1942SJens Axboe * ring tail is overlaid with the io_uring_buf->resv field. 642c7fb1942SJens Axboe */ 643c7fb1942SJens Axboe struct { 644c7fb1942SJens Axboe __u64 resv1; 645c7fb1942SJens Axboe __u32 resv2; 646c7fb1942SJens Axboe __u16 resv3; 647c7fb1942SJens Axboe __u16 tail; 648c7fb1942SJens Axboe }; 64936632d06SKees Cook __DECLARE_FLEX_ARRAY(struct io_uring_buf, bufs); 650c7fb1942SJens Axboe }; 651c7fb1942SJens Axboe }; 652c7fb1942SJens Axboe 653c56e022cSJens Axboe /* 654c56e022cSJens Axboe * Flags for IORING_REGISTER_PBUF_RING. 655c56e022cSJens Axboe * 656c56e022cSJens Axboe * IOU_PBUF_RING_MMAP: If set, kernel will allocate the memory for the ring. 657c56e022cSJens Axboe * The application must not set a ring_addr in struct 658c56e022cSJens Axboe * io_uring_buf_reg, instead it must subsequently call 659c56e022cSJens Axboe * mmap(2) with the offset set as: 660c56e022cSJens Axboe * IORING_OFF_PBUF_RING | (bgid << IORING_OFF_PBUF_SHIFT) 661c56e022cSJens Axboe * to get a virtual mapping for the ring. 662c56e022cSJens Axboe */ 663c56e022cSJens Axboe enum { 664c56e022cSJens Axboe IOU_PBUF_RING_MMAP = 1, 665c56e022cSJens Axboe }; 666c56e022cSJens Axboe 667c7fb1942SJens Axboe /* argument for IORING_(UN)REGISTER_PBUF_RING */ 668c7fb1942SJens Axboe struct io_uring_buf_reg { 669c7fb1942SJens Axboe __u64 ring_addr; 670c7fb1942SJens Axboe __u32 ring_entries; 671c7fb1942SJens Axboe __u16 bgid; 67281cf17cdSJens Axboe __u16 flags; 673c7fb1942SJens Axboe __u64 resv[3]; 674c7fb1942SJens Axboe }; 675c7fb1942SJens Axboe 67621b55dbcSStefano Garzarella /* 67721b55dbcSStefano Garzarella * io_uring_restriction->opcode values 67821b55dbcSStefano Garzarella */ 67921b55dbcSStefano Garzarella enum { 68021b55dbcSStefano Garzarella /* Allow an io_uring_register(2) opcode */ 68121b55dbcSStefano Garzarella IORING_RESTRICTION_REGISTER_OP = 0, 68221b55dbcSStefano Garzarella 68321b55dbcSStefano Garzarella /* Allow an sqe opcode */ 68421b55dbcSStefano Garzarella IORING_RESTRICTION_SQE_OP = 1, 68521b55dbcSStefano Garzarella 68621b55dbcSStefano Garzarella /* Allow sqe flags */ 68721b55dbcSStefano Garzarella IORING_RESTRICTION_SQE_FLAGS_ALLOWED = 2, 68821b55dbcSStefano Garzarella 68921b55dbcSStefano Garzarella /* Require sqe flags (these flags must be set on each submission) */ 69021b55dbcSStefano Garzarella IORING_RESTRICTION_SQE_FLAGS_REQUIRED = 3, 69121b55dbcSStefano Garzarella 69221b55dbcSStefano Garzarella IORING_RESTRICTION_LAST 69321b55dbcSStefano Garzarella }; 69421b55dbcSStefano Garzarella 695c73ebb68SHao Xu struct io_uring_getevents_arg { 696c73ebb68SHao Xu __u64 sigmask; 697c73ebb68SHao Xu __u32 sigmask_sz; 698c73ebb68SHao Xu __u32 pad; 699c73ebb68SHao Xu __u64 ts; 700c73ebb68SHao Xu }; 701c73ebb68SHao Xu 70278a861b9SJens Axboe /* 70378a861b9SJens Axboe * Argument for IORING_REGISTER_SYNC_CANCEL 70478a861b9SJens Axboe */ 70578a861b9SJens Axboe struct io_uring_sync_cancel_reg { 70678a861b9SJens Axboe __u64 addr; 70778a861b9SJens Axboe __s32 fd; 70878a861b9SJens Axboe __u32 flags; 70978a861b9SJens Axboe struct __kernel_timespec timeout; 710f77569d2SJens Axboe __u8 opcode; 711f77569d2SJens Axboe __u8 pad[7]; 712f77569d2SJens Axboe __u64 pad2[3]; 71378a861b9SJens Axboe }; 71478a861b9SJens Axboe 7156e73dffbSPavel Begunkov /* 7166e73dffbSPavel Begunkov * Argument for IORING_REGISTER_FILE_ALLOC_RANGE 7176e73dffbSPavel Begunkov * The range is specified as [off, off + len) 7186e73dffbSPavel Begunkov */ 7196e73dffbSPavel Begunkov struct io_uring_file_index_range { 7206e73dffbSPavel Begunkov __u32 off; 7216e73dffbSPavel Begunkov __u32 len; 7226e73dffbSPavel Begunkov __u64 resv; 7236e73dffbSPavel Begunkov }; 7246e73dffbSPavel Begunkov 7259bb66906SDylan Yudaken struct io_uring_recvmsg_out { 7269bb66906SDylan Yudaken __u32 namelen; 7279bb66906SDylan Yudaken __u32 controllen; 7289bb66906SDylan Yudaken __u32 payloadlen; 7299bb66906SDylan Yudaken __u32 flags; 7309bb66906SDylan Yudaken }; 7319bb66906SDylan Yudaken 7328e9fad0eSBreno Leitao /* 7338e9fad0eSBreno Leitao * Argument for IORING_OP_URING_CMD when file is a socket 7348e9fad0eSBreno Leitao */ 7358e9fad0eSBreno Leitao enum { 7368e9fad0eSBreno Leitao SOCKET_URING_OP_SIOCINQ = 0, 7378e9fad0eSBreno Leitao SOCKET_URING_OP_SIOCOUTQ, 7388e9fad0eSBreno Leitao }; 7398e9fad0eSBreno Leitao 740e1d0c6d0SAmmar Faizi #ifdef __cplusplus 741e1d0c6d0SAmmar Faizi } 742e1d0c6d0SAmmar Faizi #endif 743e1d0c6d0SAmmar Faizi 7442b188cc1SJens Axboe #endif 745