blob: c5055ba6e5479fd5de7382b109e3cb920fdbe04f [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;
28 __u64 off;
29 __u64 addr;
30 __u32 len;
31 union {
32 __kernel_rwf_t rw_flags;
33 __u32 fsync_flags;
34 __u16 poll_events;
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070035 __u32 sync_range_flags;
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070036 __u32 msg_flags;
Christopher Ferris24f97eb2019-05-20 12:58:13 -070037 };
38 __u64 user_data;
39 union {
40 __u16 buf_index;
41 __u64 __pad2[3];
42 };
43};
44#define IOSQE_FIXED_FILE (1U << 0)
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070045#define IOSQE_IO_DRAIN (1U << 1)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070046#define IOSQE_IO_LINK (1U << 2)
Christopher Ferris24f97eb2019-05-20 12:58:13 -070047#define IORING_SETUP_IOPOLL (1U << 0)
48#define IORING_SETUP_SQPOLL (1U << 1)
49#define IORING_SETUP_SQ_AFF (1U << 2)
50#define IORING_OP_NOP 0
51#define IORING_OP_READV 1
52#define IORING_OP_WRITEV 2
53#define IORING_OP_FSYNC 3
54#define IORING_OP_READ_FIXED 4
55#define IORING_OP_WRITE_FIXED 5
56#define IORING_OP_POLL_ADD 6
57#define IORING_OP_POLL_REMOVE 7
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070058#define IORING_OP_SYNC_FILE_RANGE 8
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070059#define IORING_OP_SENDMSG 9
60#define IORING_OP_RECVMSG 10
Christopher Ferris24f97eb2019-05-20 12:58:13 -070061#define IORING_FSYNC_DATASYNC (1U << 0)
62struct io_uring_cqe {
63 __u64 user_data;
64 __s32 res;
65 __u32 flags;
66};
67#define IORING_OFF_SQ_RING 0ULL
68#define IORING_OFF_CQ_RING 0x8000000ULL
69#define IORING_OFF_SQES 0x10000000ULL
70struct io_sqring_offsets {
71 __u32 head;
72 __u32 tail;
73 __u32 ring_mask;
74 __u32 ring_entries;
75 __u32 flags;
76 __u32 dropped;
77 __u32 array;
78 __u32 resv1;
79 __u64 resv2;
80};
81#define IORING_SQ_NEED_WAKEUP (1U << 0)
82struct io_cqring_offsets {
83 __u32 head;
84 __u32 tail;
85 __u32 ring_mask;
86 __u32 ring_entries;
87 __u32 overflow;
88 __u32 cqes;
89 __u64 resv[2];
90};
91#define IORING_ENTER_GETEVENTS (1U << 0)
92#define IORING_ENTER_SQ_WAKEUP (1U << 1)
93struct io_uring_params {
94 __u32 sq_entries;
95 __u32 cq_entries;
96 __u32 flags;
97 __u32 sq_thread_cpu;
98 __u32 sq_thread_idle;
99 __u32 resv[5];
100 struct io_sqring_offsets sq_off;
101 struct io_cqring_offsets cq_off;
102};
103#define IORING_REGISTER_BUFFERS 0
104#define IORING_UNREGISTER_BUFFERS 1
105#define IORING_REGISTER_FILES 2
106#define IORING_UNREGISTER_FILES 3
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700107#define IORING_REGISTER_EVENTFD 4
108#define IORING_UNREGISTER_EVENTFD 5
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700109#endif