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; |
| 28 | __u64 off; |
| 29 | __u64 addr; |
| 30 | __u32 len; |
| 31 | union { |
| 32 | __kernel_rwf_t rw_flags; |
| 33 | __u32 fsync_flags; |
| 34 | __u16 poll_events; |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 35 | __u32 sync_range_flags; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 36 | __u32 msg_flags; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame^] | 37 | __u32 timeout_flags; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 38 | }; |
| 39 | __u64 user_data; |
| 40 | union { |
| 41 | __u16 buf_index; |
| 42 | __u64 __pad2[3]; |
| 43 | }; |
| 44 | }; |
| 45 | #define IOSQE_FIXED_FILE (1U << 0) |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 46 | #define IOSQE_IO_DRAIN (1U << 1) |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 47 | #define IOSQE_IO_LINK (1U << 2) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 48 | #define IORING_SETUP_IOPOLL (1U << 0) |
| 49 | #define IORING_SETUP_SQPOLL (1U << 1) |
| 50 | #define IORING_SETUP_SQ_AFF (1U << 2) |
| 51 | #define IORING_OP_NOP 0 |
| 52 | #define IORING_OP_READV 1 |
| 53 | #define IORING_OP_WRITEV 2 |
| 54 | #define IORING_OP_FSYNC 3 |
| 55 | #define IORING_OP_READ_FIXED 4 |
| 56 | #define IORING_OP_WRITE_FIXED 5 |
| 57 | #define IORING_OP_POLL_ADD 6 |
| 58 | #define IORING_OP_POLL_REMOVE 7 |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 59 | #define IORING_OP_SYNC_FILE_RANGE 8 |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 60 | #define IORING_OP_SENDMSG 9 |
| 61 | #define IORING_OP_RECVMSG 10 |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame^] | 62 | #define IORING_OP_TIMEOUT 11 |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 63 | #define IORING_FSYNC_DATASYNC (1U << 0) |
| 64 | struct io_uring_cqe { |
| 65 | __u64 user_data; |
| 66 | __s32 res; |
| 67 | __u32 flags; |
| 68 | }; |
| 69 | #define IORING_OFF_SQ_RING 0ULL |
| 70 | #define IORING_OFF_CQ_RING 0x8000000ULL |
| 71 | #define IORING_OFF_SQES 0x10000000ULL |
| 72 | struct io_sqring_offsets { |
| 73 | __u32 head; |
| 74 | __u32 tail; |
| 75 | __u32 ring_mask; |
| 76 | __u32 ring_entries; |
| 77 | __u32 flags; |
| 78 | __u32 dropped; |
| 79 | __u32 array; |
| 80 | __u32 resv1; |
| 81 | __u64 resv2; |
| 82 | }; |
| 83 | #define IORING_SQ_NEED_WAKEUP (1U << 0) |
| 84 | struct io_cqring_offsets { |
| 85 | __u32 head; |
| 86 | __u32 tail; |
| 87 | __u32 ring_mask; |
| 88 | __u32 ring_entries; |
| 89 | __u32 overflow; |
| 90 | __u32 cqes; |
| 91 | __u64 resv[2]; |
| 92 | }; |
| 93 | #define IORING_ENTER_GETEVENTS (1U << 0) |
| 94 | #define IORING_ENTER_SQ_WAKEUP (1U << 1) |
| 95 | struct io_uring_params { |
| 96 | __u32 sq_entries; |
| 97 | __u32 cq_entries; |
| 98 | __u32 flags; |
| 99 | __u32 sq_thread_cpu; |
| 100 | __u32 sq_thread_idle; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame^] | 101 | __u32 features; |
| 102 | __u32 resv[4]; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 103 | struct io_sqring_offsets sq_off; |
| 104 | struct io_cqring_offsets cq_off; |
| 105 | }; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame^] | 106 | #define IORING_FEAT_SINGLE_MMAP (1U << 0) |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 107 | #define IORING_REGISTER_BUFFERS 0 |
| 108 | #define IORING_UNREGISTER_BUFFERS 1 |
| 109 | #define IORING_REGISTER_FILES 2 |
| 110 | #define IORING_UNREGISTER_FILES 3 |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 111 | #define IORING_REGISTER_EVENTFD 4 |
| 112 | #define IORING_UNREGISTER_EVENTFD 5 |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 113 | #endif |