Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 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; |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 28 | union { |
| 29 | __u64 off; |
| 30 | __u64 addr2; |
| 31 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 32 | __u64 addr; |
| 33 | __u32 len; |
| 34 | union { |
| 35 | __kernel_rwf_t rw_flags; |
| 36 | __u32 fsync_flags; |
| 37 | __u16 poll_events; |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 38 | __u32 sync_range_flags; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 39 | __u32 msg_flags; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 40 | __u32 timeout_flags; |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 41 | __u32 accept_flags; |
| 42 | __u32 cancel_flags; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame^] | 43 | __u32 open_flags; |
| 44 | __u32 statx_flags; |
| 45 | __u32 fadvise_advice; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 46 | }; |
| 47 | __u64 user_data; |
| 48 | union { |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame^] | 49 | struct { |
| 50 | __u16 buf_index; |
| 51 | __u16 personality; |
| 52 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 53 | __u64 __pad2[3]; |
| 54 | }; |
| 55 | }; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame^] | 56 | enum { |
| 57 | IOSQE_FIXED_FILE_BIT, |
| 58 | IOSQE_IO_DRAIN_BIT, |
| 59 | IOSQE_IO_LINK_BIT, |
| 60 | IOSQE_IO_HARDLINK_BIT, |
| 61 | IOSQE_ASYNC_BIT, |
| 62 | }; |
| 63 | #define IOSQE_FIXED_FILE (1U << IOSQE_FIXED_FILE_BIT) |
| 64 | #define IOSQE_IO_DRAIN (1U << IOSQE_IO_DRAIN_BIT) |
| 65 | #define IOSQE_IO_LINK (1U << IOSQE_IO_LINK_BIT) |
| 66 | #define IOSQE_IO_HARDLINK (1U << IOSQE_IO_HARDLINK_BIT) |
| 67 | #define IOSQE_ASYNC (1U << IOSQE_ASYNC_BIT) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 68 | #define IORING_SETUP_IOPOLL (1U << 0) |
| 69 | #define IORING_SETUP_SQPOLL (1U << 1) |
| 70 | #define IORING_SETUP_SQ_AFF (1U << 2) |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 71 | #define IORING_SETUP_CQSIZE (1U << 3) |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame^] | 72 | #define IORING_SETUP_CLAMP (1U << 4) |
| 73 | #define IORING_SETUP_ATTACH_WQ (1U << 5) |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 74 | enum { |
| 75 | IORING_OP_NOP, |
| 76 | IORING_OP_READV, |
| 77 | IORING_OP_WRITEV, |
| 78 | IORING_OP_FSYNC, |
| 79 | IORING_OP_READ_FIXED, |
| 80 | IORING_OP_WRITE_FIXED, |
| 81 | IORING_OP_POLL_ADD, |
| 82 | IORING_OP_POLL_REMOVE, |
| 83 | IORING_OP_SYNC_FILE_RANGE, |
| 84 | IORING_OP_SENDMSG, |
| 85 | IORING_OP_RECVMSG, |
| 86 | IORING_OP_TIMEOUT, |
| 87 | IORING_OP_TIMEOUT_REMOVE, |
| 88 | IORING_OP_ACCEPT, |
| 89 | IORING_OP_ASYNC_CANCEL, |
| 90 | IORING_OP_LINK_TIMEOUT, |
| 91 | IORING_OP_CONNECT, |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame^] | 92 | IORING_OP_FALLOCATE, |
| 93 | IORING_OP_OPENAT, |
| 94 | IORING_OP_CLOSE, |
| 95 | IORING_OP_FILES_UPDATE, |
| 96 | IORING_OP_STATX, |
| 97 | IORING_OP_READ, |
| 98 | IORING_OP_WRITE, |
| 99 | IORING_OP_FADVISE, |
| 100 | IORING_OP_MADVISE, |
| 101 | IORING_OP_SEND, |
| 102 | IORING_OP_RECV, |
| 103 | IORING_OP_OPENAT2, |
| 104 | IORING_OP_EPOLL_CTL, |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 105 | IORING_OP_LAST, |
| 106 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 107 | #define IORING_FSYNC_DATASYNC (1U << 0) |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 108 | #define IORING_TIMEOUT_ABS (1U << 0) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 109 | struct io_uring_cqe { |
| 110 | __u64 user_data; |
| 111 | __s32 res; |
| 112 | __u32 flags; |
| 113 | }; |
| 114 | #define IORING_OFF_SQ_RING 0ULL |
| 115 | #define IORING_OFF_CQ_RING 0x8000000ULL |
| 116 | #define IORING_OFF_SQES 0x10000000ULL |
| 117 | struct io_sqring_offsets { |
| 118 | __u32 head; |
| 119 | __u32 tail; |
| 120 | __u32 ring_mask; |
| 121 | __u32 ring_entries; |
| 122 | __u32 flags; |
| 123 | __u32 dropped; |
| 124 | __u32 array; |
| 125 | __u32 resv1; |
| 126 | __u64 resv2; |
| 127 | }; |
| 128 | #define IORING_SQ_NEED_WAKEUP (1U << 0) |
| 129 | struct io_cqring_offsets { |
| 130 | __u32 head; |
| 131 | __u32 tail; |
| 132 | __u32 ring_mask; |
| 133 | __u32 ring_entries; |
| 134 | __u32 overflow; |
| 135 | __u32 cqes; |
| 136 | __u64 resv[2]; |
| 137 | }; |
| 138 | #define IORING_ENTER_GETEVENTS (1U << 0) |
| 139 | #define IORING_ENTER_SQ_WAKEUP (1U << 1) |
| 140 | struct io_uring_params { |
| 141 | __u32 sq_entries; |
| 142 | __u32 cq_entries; |
| 143 | __u32 flags; |
| 144 | __u32 sq_thread_cpu; |
| 145 | __u32 sq_thread_idle; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 146 | __u32 features; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame^] | 147 | __u32 wq_fd; |
| 148 | __u32 resv[3]; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 149 | struct io_sqring_offsets sq_off; |
| 150 | struct io_cqring_offsets cq_off; |
| 151 | }; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 152 | #define IORING_FEAT_SINGLE_MMAP (1U << 0) |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 153 | #define IORING_FEAT_NODROP (1U << 1) |
| 154 | #define IORING_FEAT_SUBMIT_STABLE (1U << 2) |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame^] | 155 | #define IORING_FEAT_RW_CUR_POS (1U << 3) |
| 156 | #define IORING_FEAT_CUR_PERSONALITY (1U << 4) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 157 | #define IORING_REGISTER_BUFFERS 0 |
| 158 | #define IORING_UNREGISTER_BUFFERS 1 |
| 159 | #define IORING_REGISTER_FILES 2 |
| 160 | #define IORING_UNREGISTER_FILES 3 |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 161 | #define IORING_REGISTER_EVENTFD 4 |
| 162 | #define IORING_UNREGISTER_EVENTFD 5 |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 163 | #define IORING_REGISTER_FILES_UPDATE 6 |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame^] | 164 | #define IORING_REGISTER_EVENTFD_ASYNC 7 |
| 165 | #define IORING_REGISTER_PROBE 8 |
| 166 | #define IORING_REGISTER_PERSONALITY 9 |
| 167 | #define IORING_UNREGISTER_PERSONALITY 10 |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 168 | struct io_uring_files_update { |
| 169 | __u32 offset; |
| 170 | __u32 resv; |
| 171 | __aligned_u64 fds; |
| 172 | }; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame^] | 173 | #define IO_URING_OP_SUPPORTED (1U << 0) |
| 174 | struct io_uring_probe_op { |
| 175 | __u8 op; |
| 176 | __u8 resv; |
| 177 | __u16 flags; |
| 178 | __u32 resv2; |
| 179 | }; |
| 180 | struct io_uring_probe { |
| 181 | __u8 last_op; |
| 182 | __u8 ops_len; |
| 183 | __u16 resv; |
| 184 | __u32 resv2[3]; |
| 185 | struct io_uring_probe_op ops[0]; |
| 186 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 187 | #endif |