• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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   union {
29     __u64 off;
30     __u64 addr2;
31   };
32   __u64 addr;
33   __u32 len;
34   union {
35     __kernel_rwf_t rw_flags;
36     __u32 fsync_flags;
37     __u16 poll_events;
38     __u32 sync_range_flags;
39     __u32 msg_flags;
40     __u32 timeout_flags;
41     __u32 accept_flags;
42     __u32 cancel_flags;
43   };
44   __u64 user_data;
45   union {
46     __u16 buf_index;
47     __u64 __pad2[3];
48   };
49 };
50 #define IOSQE_FIXED_FILE (1U << 0)
51 #define IOSQE_IO_DRAIN (1U << 1)
52 #define IOSQE_IO_LINK (1U << 2)
53 #define IOSQE_IO_HARDLINK (1U << 3)
54 #define IORING_SETUP_IOPOLL (1U << 0)
55 #define IORING_SETUP_SQPOLL (1U << 1)
56 #define IORING_SETUP_SQ_AFF (1U << 2)
57 #define IORING_SETUP_CQSIZE (1U << 3)
58 enum {
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 };
78 #define IORING_FSYNC_DATASYNC (1U << 0)
79 #define IORING_TIMEOUT_ABS (1U << 0)
80 struct 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
88 struct 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)
100 struct 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)
111 struct io_uring_params {
112   __u32 sq_entries;
113   __u32 cq_entries;
114   __u32 flags;
115   __u32 sq_thread_cpu;
116   __u32 sq_thread_idle;
117   __u32 features;
118   __u32 resv[4];
119   struct io_sqring_offsets sq_off;
120   struct io_cqring_offsets cq_off;
121 };
122 #define IORING_FEAT_SINGLE_MMAP (1U << 0)
123 #define IORING_FEAT_NODROP (1U << 1)
124 #define IORING_FEAT_SUBMIT_STABLE (1U << 2)
125 #define IORING_REGISTER_BUFFERS 0
126 #define IORING_UNREGISTER_BUFFERS 1
127 #define IORING_REGISTER_FILES 2
128 #define IORING_UNREGISTER_FILES 3
129 #define IORING_REGISTER_EVENTFD 4
130 #define IORING_UNREGISTER_EVENTFD 5
131 #define IORING_REGISTER_FILES_UPDATE 6
132 struct io_uring_files_update {
133   __u32 offset;
134   __u32 resv;
135   __aligned_u64 fds;
136 };
137 #endif
138