blob: 9912405bfae6b6b9b9554debc1b567ebdc501a46 [file] [log] [blame]
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001/****************************************************************************
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>
23struct io_uring_sqe {
24 __u8 opcode;
25 __u8 flags;
26 __u16 ioprio;
27 __s32 fd;
Christopher Ferrisd32ca142020-02-04 16:16:51 -080028 union {
29 __u64 off;
30 __u64 addr2;
31 };
Christopher Ferrisaf09c702020-06-01 20:29:29 -070032 union {
33 __u64 addr;
34 __u64 splice_off_in;
35 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -070036 __u32 len;
37 union {
38 __kernel_rwf_t rw_flags;
39 __u32 fsync_flags;
40 __u16 poll_events;
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070041 __u32 sync_range_flags;
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070042 __u32 msg_flags;
Christopher Ferris9584fa42019-12-09 15:36:13 -080043 __u32 timeout_flags;
Christopher Ferrisd32ca142020-02-04 16:16:51 -080044 __u32 accept_flags;
45 __u32 cancel_flags;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070046 __u32 open_flags;
47 __u32 statx_flags;
48 __u32 fadvise_advice;
Christopher Ferrisaf09c702020-06-01 20:29:29 -070049 __u32 splice_flags;
Christopher Ferris24f97eb2019-05-20 12:58:13 -070050 };
51 __u64 user_data;
52 union {
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070053 struct {
Christopher Ferrisaf09c702020-06-01 20:29:29 -070054 union {
55 __u16 buf_index;
56 __u16 buf_group;
57 } __attribute__((packed));
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070058 __u16 personality;
Christopher Ferrisaf09c702020-06-01 20:29:29 -070059 __s32 splice_fd_in;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070060 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -070061 __u64 __pad2[3];
62 };
63};
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070064enum {
65 IOSQE_FIXED_FILE_BIT,
66 IOSQE_IO_DRAIN_BIT,
67 IOSQE_IO_LINK_BIT,
68 IOSQE_IO_HARDLINK_BIT,
69 IOSQE_ASYNC_BIT,
Christopher Ferrisaf09c702020-06-01 20:29:29 -070070 IOSQE_BUFFER_SELECT_BIT,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070071};
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)
Christopher Ferrisaf09c702020-06-01 20:29:29 -070077#define IOSQE_BUFFER_SELECT (1U << IOSQE_BUFFER_SELECT_BIT)
Christopher Ferris24f97eb2019-05-20 12:58:13 -070078#define IORING_SETUP_IOPOLL (1U << 0)
79#define IORING_SETUP_SQPOLL (1U << 1)
80#define IORING_SETUP_SQ_AFF (1U << 2)
Christopher Ferrisd32ca142020-02-04 16:16:51 -080081#define IORING_SETUP_CQSIZE (1U << 3)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070082#define IORING_SETUP_CLAMP (1U << 4)
83#define IORING_SETUP_ATTACH_WQ (1U << 5)
Christopher Ferrisd32ca142020-02-04 16:16:51 -080084enum {
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,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700102 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,
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700115 IORING_OP_SPLICE,
116 IORING_OP_PROVIDE_BUFFERS,
117 IORING_OP_REMOVE_BUFFERS,
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700118 IORING_OP_TEE,
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800119 IORING_OP_LAST,
120};
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700121#define IORING_FSYNC_DATASYNC (1U << 0)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800122#define IORING_TIMEOUT_ABS (1U << 0)
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700123#define SPLICE_F_FD_IN_FIXED (1U << 31)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700124struct io_uring_cqe {
125 __u64 user_data;
126 __s32 res;
127 __u32 flags;
128};
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700129#define IORING_CQE_F_BUFFER (1U << 0)
130enum {
131 IORING_CQE_BUFFER_SHIFT = 16,
132};
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700133#define IORING_OFF_SQ_RING 0ULL
134#define IORING_OFF_CQ_RING 0x8000000ULL
135#define IORING_OFF_SQES 0x10000000ULL
136struct io_sqring_offsets {
137 __u32 head;
138 __u32 tail;
139 __u32 ring_mask;
140 __u32 ring_entries;
141 __u32 flags;
142 __u32 dropped;
143 __u32 array;
144 __u32 resv1;
145 __u64 resv2;
146};
147#define IORING_SQ_NEED_WAKEUP (1U << 0)
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700148#define IORING_SQ_CQ_OVERFLOW (1U << 1)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700149struct io_cqring_offsets {
150 __u32 head;
151 __u32 tail;
152 __u32 ring_mask;
153 __u32 ring_entries;
154 __u32 overflow;
155 __u32 cqes;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700156 __u32 flags;
157 __u32 resv1;
158 __u64 resv2;
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700159};
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700160#define IORING_CQ_EVENTFD_DISABLED (1U << 0)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700161#define IORING_ENTER_GETEVENTS (1U << 0)
162#define IORING_ENTER_SQ_WAKEUP (1U << 1)
163struct io_uring_params {
164 __u32 sq_entries;
165 __u32 cq_entries;
166 __u32 flags;
167 __u32 sq_thread_cpu;
168 __u32 sq_thread_idle;
Christopher Ferris9584fa42019-12-09 15:36:13 -0800169 __u32 features;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700170 __u32 wq_fd;
171 __u32 resv[3];
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700172 struct io_sqring_offsets sq_off;
173 struct io_cqring_offsets cq_off;
174};
Christopher Ferris9584fa42019-12-09 15:36:13 -0800175#define IORING_FEAT_SINGLE_MMAP (1U << 0)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800176#define IORING_FEAT_NODROP (1U << 1)
177#define IORING_FEAT_SUBMIT_STABLE (1U << 2)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700178#define IORING_FEAT_RW_CUR_POS (1U << 3)
179#define IORING_FEAT_CUR_PERSONALITY (1U << 4)
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700180#define IORING_FEAT_FAST_POLL (1U << 5)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700181#define IORING_REGISTER_BUFFERS 0
182#define IORING_UNREGISTER_BUFFERS 1
183#define IORING_REGISTER_FILES 2
184#define IORING_UNREGISTER_FILES 3
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700185#define IORING_REGISTER_EVENTFD 4
186#define IORING_UNREGISTER_EVENTFD 5
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800187#define IORING_REGISTER_FILES_UPDATE 6
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700188#define IORING_REGISTER_EVENTFD_ASYNC 7
189#define IORING_REGISTER_PROBE 8
190#define IORING_REGISTER_PERSONALITY 9
191#define IORING_UNREGISTER_PERSONALITY 10
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800192struct io_uring_files_update {
193 __u32 offset;
194 __u32 resv;
195 __aligned_u64 fds;
196};
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700197#define IO_URING_OP_SUPPORTED (1U << 0)
198struct io_uring_probe_op {
199 __u8 op;
200 __u8 resv;
201 __u16 flags;
202 __u32 resv2;
203};
204struct io_uring_probe {
205 __u8 last_op;
206 __u8 ops_len;
207 __u16 resv;
208 __u32 resv2[3];
209 struct io_uring_probe_op ops[0];
210};
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700211#endif