blob: 58853127385fae713bc81659fc725e055f17cc6c [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 Ferris24f97eb2019-05-20 12:58:13 -070032 __u64 addr;
33 __u32 len;
34 union {
35 __kernel_rwf_t rw_flags;
36 __u32 fsync_flags;
37 __u16 poll_events;
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070038 __u32 sync_range_flags;
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070039 __u32 msg_flags;
Christopher Ferris9584fa42019-12-09 15:36:13 -080040 __u32 timeout_flags;
Christopher Ferrisd32ca142020-02-04 16:16:51 -080041 __u32 accept_flags;
42 __u32 cancel_flags;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070043 __u32 open_flags;
44 __u32 statx_flags;
45 __u32 fadvise_advice;
Christopher Ferris24f97eb2019-05-20 12:58:13 -070046 };
47 __u64 user_data;
48 union {
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070049 struct {
50 __u16 buf_index;
51 __u16 personality;
52 };
Christopher Ferris24f97eb2019-05-20 12:58:13 -070053 __u64 __pad2[3];
54 };
55};
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070056enum {
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 Ferris24f97eb2019-05-20 12:58:13 -070068#define IORING_SETUP_IOPOLL (1U << 0)
69#define IORING_SETUP_SQPOLL (1U << 1)
70#define IORING_SETUP_SQ_AFF (1U << 2)
Christopher Ferrisd32ca142020-02-04 16:16:51 -080071#define IORING_SETUP_CQSIZE (1U << 3)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070072#define IORING_SETUP_CLAMP (1U << 4)
73#define IORING_SETUP_ATTACH_WQ (1U << 5)
Christopher Ferrisd32ca142020-02-04 16:16:51 -080074enum {
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 Ferrisbb9fcb42020-04-06 11:38:04 -070092 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 Ferrisd32ca142020-02-04 16:16:51 -0800105 IORING_OP_LAST,
106};
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700107#define IORING_FSYNC_DATASYNC (1U << 0)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800108#define IORING_TIMEOUT_ABS (1U << 0)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700109struct 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
117struct 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)
129struct 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)
140struct 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 Ferris9584fa42019-12-09 15:36:13 -0800146 __u32 features;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700147 __u32 wq_fd;
148 __u32 resv[3];
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700149 struct io_sqring_offsets sq_off;
150 struct io_cqring_offsets cq_off;
151};
Christopher Ferris9584fa42019-12-09 15:36:13 -0800152#define IORING_FEAT_SINGLE_MMAP (1U << 0)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800153#define IORING_FEAT_NODROP (1U << 1)
154#define IORING_FEAT_SUBMIT_STABLE (1U << 2)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700155#define IORING_FEAT_RW_CUR_POS (1U << 3)
156#define IORING_FEAT_CUR_PERSONALITY (1U << 4)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700157#define IORING_REGISTER_BUFFERS 0
158#define IORING_UNREGISTER_BUFFERS 1
159#define IORING_REGISTER_FILES 2
160#define IORING_UNREGISTER_FILES 3
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700161#define IORING_REGISTER_EVENTFD 4
162#define IORING_UNREGISTER_EVENTFD 5
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800163#define IORING_REGISTER_FILES_UPDATE 6
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700164#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 Ferrisd32ca142020-02-04 16:16:51 -0800168struct io_uring_files_update {
169 __u32 offset;
170 __u32 resv;
171 __aligned_u64 fds;
172};
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700173#define IO_URING_OP_SUPPORTED (1U << 0)
174struct io_uring_probe_op {
175 __u8 op;
176 __u8 resv;
177 __u16 flags;
178 __u32 resv2;
179};
180struct 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 Ferris24f97eb2019-05-20 12:58:13 -0700187#endif