blob: 0639a80037214953429f1c2475e8ab8cbe9d6bfb [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 Ferris24f97eb2019-05-20 12:58:13 -070043 };
44 __u64 user_data;
45 union {
46 __u16 buf_index;
47 __u64 __pad2[3];
48 };
49};
50#define IOSQE_FIXED_FILE (1U << 0)
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070051#define IOSQE_IO_DRAIN (1U << 1)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070052#define IOSQE_IO_LINK (1U << 2)
Christopher Ferrisd32ca142020-02-04 16:16:51 -080053#define IOSQE_IO_HARDLINK (1U << 3)
Christopher Ferris24f97eb2019-05-20 12:58:13 -070054#define IORING_SETUP_IOPOLL (1U << 0)
55#define IORING_SETUP_SQPOLL (1U << 1)
56#define IORING_SETUP_SQ_AFF (1U << 2)
Christopher Ferrisd32ca142020-02-04 16:16:51 -080057#define IORING_SETUP_CQSIZE (1U << 3)
58enum {
59 IORING_OP_NOP,
60 IORING_OP_READV,
61 IORING_OP_WRITEV,
62 IORING_OP_FSYNC,
63 IORING_OP_READ_FIXED,
64 IORING_OP_WRITE_FIXED,
65 IORING_OP_POLL_ADD,
66 IORING_OP_POLL_REMOVE,
67 IORING_OP_SYNC_FILE_RANGE,
68 IORING_OP_SENDMSG,
69 IORING_OP_RECVMSG,
70 IORING_OP_TIMEOUT,
71 IORING_OP_TIMEOUT_REMOVE,
72 IORING_OP_ACCEPT,
73 IORING_OP_ASYNC_CANCEL,
74 IORING_OP_LINK_TIMEOUT,
75 IORING_OP_CONNECT,
76 IORING_OP_LAST,
77};
Christopher Ferris24f97eb2019-05-20 12:58:13 -070078#define IORING_FSYNC_DATASYNC (1U << 0)
Christopher Ferrisd32ca142020-02-04 16:16:51 -080079#define IORING_TIMEOUT_ABS (1U << 0)
Christopher Ferris24f97eb2019-05-20 12:58:13 -070080struct io_uring_cqe {
81 __u64 user_data;
82 __s32 res;
83 __u32 flags;
84};
85#define IORING_OFF_SQ_RING 0ULL
86#define IORING_OFF_CQ_RING 0x8000000ULL
87#define IORING_OFF_SQES 0x10000000ULL
88struct io_sqring_offsets {
89 __u32 head;
90 __u32 tail;
91 __u32 ring_mask;
92 __u32 ring_entries;
93 __u32 flags;
94 __u32 dropped;
95 __u32 array;
96 __u32 resv1;
97 __u64 resv2;
98};
99#define IORING_SQ_NEED_WAKEUP (1U << 0)
100struct io_cqring_offsets {
101 __u32 head;
102 __u32 tail;
103 __u32 ring_mask;
104 __u32 ring_entries;
105 __u32 overflow;
106 __u32 cqes;
107 __u64 resv[2];
108};
109#define IORING_ENTER_GETEVENTS (1U << 0)
110#define IORING_ENTER_SQ_WAKEUP (1U << 1)
111struct io_uring_params {
112 __u32 sq_entries;
113 __u32 cq_entries;
114 __u32 flags;
115 __u32 sq_thread_cpu;
116 __u32 sq_thread_idle;
Christopher Ferris9584fa42019-12-09 15:36:13 -0800117 __u32 features;
118 __u32 resv[4];
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700119 struct io_sqring_offsets sq_off;
120 struct io_cqring_offsets cq_off;
121};
Christopher Ferris9584fa42019-12-09 15:36:13 -0800122#define IORING_FEAT_SINGLE_MMAP (1U << 0)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800123#define IORING_FEAT_NODROP (1U << 1)
124#define IORING_FEAT_SUBMIT_STABLE (1U << 2)
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700125#define IORING_REGISTER_BUFFERS 0
126#define IORING_UNREGISTER_BUFFERS 1
127#define IORING_REGISTER_FILES 2
128#define IORING_UNREGISTER_FILES 3
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700129#define IORING_REGISTER_EVENTFD 4
130#define IORING_UNREGISTER_EVENTFD 5
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800131#define IORING_REGISTER_FILES_UPDATE 6
132struct io_uring_files_update {
133 __u32 offset;
134 __u32 resv;
135 __aligned_u64 fds;
136};
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700137#endif