blob: 5d5409009a557c0bb462a2548d5e1c0ccaf4f3f3 [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 Ferris25c18d42020-10-14 17:42:58 -070041 __u32 poll32_events;
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070042 __u32 sync_range_flags;
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070043 __u32 msg_flags;
Christopher Ferris9584fa42019-12-09 15:36:13 -080044 __u32 timeout_flags;
Christopher Ferrisd32ca142020-02-04 16:16:51 -080045 __u32 accept_flags;
46 __u32 cancel_flags;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070047 __u32 open_flags;
48 __u32 statx_flags;
49 __u32 fadvise_advice;
Christopher Ferrisaf09c702020-06-01 20:29:29 -070050 __u32 splice_flags;
Christopher Ferris24f97eb2019-05-20 12:58:13 -070051 };
52 __u64 user_data;
53 union {
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070054 struct {
Christopher Ferrisaf09c702020-06-01 20:29:29 -070055 union {
56 __u16 buf_index;
57 __u16 buf_group;
58 } __attribute__((packed));
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070059 __u16 personality;
Christopher Ferrisaf09c702020-06-01 20:29:29 -070060 __s32 splice_fd_in;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070061 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -070062 __u64 __pad2[3];
63 };
64};
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070065enum {
66 IOSQE_FIXED_FILE_BIT,
67 IOSQE_IO_DRAIN_BIT,
68 IOSQE_IO_LINK_BIT,
69 IOSQE_IO_HARDLINK_BIT,
70 IOSQE_ASYNC_BIT,
Christopher Ferrisaf09c702020-06-01 20:29:29 -070071 IOSQE_BUFFER_SELECT_BIT,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070072};
73#define IOSQE_FIXED_FILE (1U << IOSQE_FIXED_FILE_BIT)
74#define IOSQE_IO_DRAIN (1U << IOSQE_IO_DRAIN_BIT)
75#define IOSQE_IO_LINK (1U << IOSQE_IO_LINK_BIT)
76#define IOSQE_IO_HARDLINK (1U << IOSQE_IO_HARDLINK_BIT)
77#define IOSQE_ASYNC (1U << IOSQE_ASYNC_BIT)
Christopher Ferrisaf09c702020-06-01 20:29:29 -070078#define IOSQE_BUFFER_SELECT (1U << IOSQE_BUFFER_SELECT_BIT)
Christopher Ferris24f97eb2019-05-20 12:58:13 -070079#define IORING_SETUP_IOPOLL (1U << 0)
80#define IORING_SETUP_SQPOLL (1U << 1)
81#define IORING_SETUP_SQ_AFF (1U << 2)
Christopher Ferrisd32ca142020-02-04 16:16:51 -080082#define IORING_SETUP_CQSIZE (1U << 3)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070083#define IORING_SETUP_CLAMP (1U << 4)
84#define IORING_SETUP_ATTACH_WQ (1U << 5)
Christopher Ferrisd32ca142020-02-04 16:16:51 -080085enum {
86 IORING_OP_NOP,
87 IORING_OP_READV,
88 IORING_OP_WRITEV,
89 IORING_OP_FSYNC,
90 IORING_OP_READ_FIXED,
91 IORING_OP_WRITE_FIXED,
92 IORING_OP_POLL_ADD,
93 IORING_OP_POLL_REMOVE,
94 IORING_OP_SYNC_FILE_RANGE,
95 IORING_OP_SENDMSG,
96 IORING_OP_RECVMSG,
97 IORING_OP_TIMEOUT,
98 IORING_OP_TIMEOUT_REMOVE,
99 IORING_OP_ACCEPT,
100 IORING_OP_ASYNC_CANCEL,
101 IORING_OP_LINK_TIMEOUT,
102 IORING_OP_CONNECT,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700103 IORING_OP_FALLOCATE,
104 IORING_OP_OPENAT,
105 IORING_OP_CLOSE,
106 IORING_OP_FILES_UPDATE,
107 IORING_OP_STATX,
108 IORING_OP_READ,
109 IORING_OP_WRITE,
110 IORING_OP_FADVISE,
111 IORING_OP_MADVISE,
112 IORING_OP_SEND,
113 IORING_OP_RECV,
114 IORING_OP_OPENAT2,
115 IORING_OP_EPOLL_CTL,
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700116 IORING_OP_SPLICE,
117 IORING_OP_PROVIDE_BUFFERS,
118 IORING_OP_REMOVE_BUFFERS,
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700119 IORING_OP_TEE,
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800120 IORING_OP_LAST,
121};
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700122#define IORING_FSYNC_DATASYNC (1U << 0)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800123#define IORING_TIMEOUT_ABS (1U << 0)
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700124#define SPLICE_F_FD_IN_FIXED (1U << 31)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700125struct io_uring_cqe {
126 __u64 user_data;
127 __s32 res;
128 __u32 flags;
129};
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700130#define IORING_CQE_F_BUFFER (1U << 0)
131enum {
132 IORING_CQE_BUFFER_SHIFT = 16,
133};
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700134#define IORING_OFF_SQ_RING 0ULL
135#define IORING_OFF_CQ_RING 0x8000000ULL
136#define IORING_OFF_SQES 0x10000000ULL
137struct io_sqring_offsets {
138 __u32 head;
139 __u32 tail;
140 __u32 ring_mask;
141 __u32 ring_entries;
142 __u32 flags;
143 __u32 dropped;
144 __u32 array;
145 __u32 resv1;
146 __u64 resv2;
147};
148#define IORING_SQ_NEED_WAKEUP (1U << 0)
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700149#define IORING_SQ_CQ_OVERFLOW (1U << 1)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700150struct io_cqring_offsets {
151 __u32 head;
152 __u32 tail;
153 __u32 ring_mask;
154 __u32 ring_entries;
155 __u32 overflow;
156 __u32 cqes;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700157 __u32 flags;
158 __u32 resv1;
159 __u64 resv2;
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700160};
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700161#define IORING_CQ_EVENTFD_DISABLED (1U << 0)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700162#define IORING_ENTER_GETEVENTS (1U << 0)
163#define IORING_ENTER_SQ_WAKEUP (1U << 1)
164struct io_uring_params {
165 __u32 sq_entries;
166 __u32 cq_entries;
167 __u32 flags;
168 __u32 sq_thread_cpu;
169 __u32 sq_thread_idle;
Christopher Ferris9584fa42019-12-09 15:36:13 -0800170 __u32 features;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700171 __u32 wq_fd;
172 __u32 resv[3];
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700173 struct io_sqring_offsets sq_off;
174 struct io_cqring_offsets cq_off;
175};
Christopher Ferris9584fa42019-12-09 15:36:13 -0800176#define IORING_FEAT_SINGLE_MMAP (1U << 0)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800177#define IORING_FEAT_NODROP (1U << 1)
178#define IORING_FEAT_SUBMIT_STABLE (1U << 2)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700179#define IORING_FEAT_RW_CUR_POS (1U << 3)
180#define IORING_FEAT_CUR_PERSONALITY (1U << 4)
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700181#define IORING_FEAT_FAST_POLL (1U << 5)
Christopher Ferris25c18d42020-10-14 17:42:58 -0700182#define IORING_FEAT_POLL_32BITS (1U << 6)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700183#define IORING_REGISTER_BUFFERS 0
184#define IORING_UNREGISTER_BUFFERS 1
185#define IORING_REGISTER_FILES 2
186#define IORING_UNREGISTER_FILES 3
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700187#define IORING_REGISTER_EVENTFD 4
188#define IORING_UNREGISTER_EVENTFD 5
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800189#define IORING_REGISTER_FILES_UPDATE 6
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700190#define IORING_REGISTER_EVENTFD_ASYNC 7
191#define IORING_REGISTER_PROBE 8
192#define IORING_REGISTER_PERSONALITY 9
193#define IORING_UNREGISTER_PERSONALITY 10
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800194struct io_uring_files_update {
195 __u32 offset;
196 __u32 resv;
197 __aligned_u64 fds;
198};
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700199#define IO_URING_OP_SUPPORTED (1U << 0)
200struct io_uring_probe_op {
201 __u8 op;
202 __u8 resv;
203 __u16 flags;
204 __u32 resv2;
205};
206struct io_uring_probe {
207 __u8 last_op;
208 __u8 ops_len;
209 __u16 resv;
210 __u32 resv2[3];
211 struct io_uring_probe_op ops[0];
212};
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700213#endif