blob: 434b24bfacf0a0d91b2558001399776bc02ec2f3 [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 Ferris24f97eb2019-05-20 12:58:13 -070036 };
37 __u64 user_data;
38 union {
39 __u16 buf_index;
40 __u64 __pad2[3];
41 };
42};
43#define IOSQE_FIXED_FILE (1U << 0)
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070044#define IOSQE_IO_DRAIN (1U << 1)
Christopher Ferris24f97eb2019-05-20 12:58:13 -070045#define IORING_SETUP_IOPOLL (1U << 0)
46#define IORING_SETUP_SQPOLL (1U << 1)
47#define IORING_SETUP_SQ_AFF (1U << 2)
48#define IORING_OP_NOP 0
49#define IORING_OP_READV 1
50#define IORING_OP_WRITEV 2
51#define IORING_OP_FSYNC 3
52#define IORING_OP_READ_FIXED 4
53#define IORING_OP_WRITE_FIXED 5
54#define IORING_OP_POLL_ADD 6
55#define IORING_OP_POLL_REMOVE 7
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -070056#define IORING_OP_SYNC_FILE_RANGE 8
Christopher Ferris24f97eb2019-05-20 12:58:13 -070057#define IORING_FSYNC_DATASYNC (1U << 0)
58struct io_uring_cqe {
59 __u64 user_data;
60 __s32 res;
61 __u32 flags;
62};
63#define IORING_OFF_SQ_RING 0ULL
64#define IORING_OFF_CQ_RING 0x8000000ULL
65#define IORING_OFF_SQES 0x10000000ULL
66struct io_sqring_offsets {
67 __u32 head;
68 __u32 tail;
69 __u32 ring_mask;
70 __u32 ring_entries;
71 __u32 flags;
72 __u32 dropped;
73 __u32 array;
74 __u32 resv1;
75 __u64 resv2;
76};
77#define IORING_SQ_NEED_WAKEUP (1U << 0)
78struct io_cqring_offsets {
79 __u32 head;
80 __u32 tail;
81 __u32 ring_mask;
82 __u32 ring_entries;
83 __u32 overflow;
84 __u32 cqes;
85 __u64 resv[2];
86};
87#define IORING_ENTER_GETEVENTS (1U << 0)
88#define IORING_ENTER_SQ_WAKEUP (1U << 1)
89struct io_uring_params {
90 __u32 sq_entries;
91 __u32 cq_entries;
92 __u32 flags;
93 __u32 sq_thread_cpu;
94 __u32 sq_thread_idle;
95 __u32 resv[5];
96 struct io_sqring_offsets sq_off;
97 struct io_cqring_offsets cq_off;
98};
99#define IORING_REGISTER_BUFFERS 0
100#define IORING_UNREGISTER_BUFFERS 1
101#define IORING_REGISTER_FILES 2
102#define IORING_UNREGISTER_FILES 3
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700103#define IORING_REGISTER_EVENTFD 4
104#define IORING_UNREGISTER_EVENTFD 5
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700105#endif