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