1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
3 * Header file for the io_uring interface.
5 * Copyright (C) 2019 Jens Axboe
6 * Copyright (C) 2019 Christoph Hellwig
8 #ifndef LINUX_IO_URING_H
9 #define LINUX_IO_URING_H
12 #include <linux/types.h>
15 * IO submission data structure (Submission Queue Entry)
18 __u8 opcode; /* type of operation for this sqe */
19 __u8 flags; /* as of now unused */
20 __u16 ioprio; /* ioprio for the request */
21 __s32 fd; /* file descriptor to do IO on */
22 __u64 off; /* offset into file */
23 __u64 addr; /* pointer to buffer or iovecs */
24 __u32 len; /* buffer size or number of iovecs */
26 __kernel_rwf_t rw_flags;
29 __u64 user_data; /* data to be passed back at completion time */
33 #define IORING_OP_NOP 0
34 #define IORING_OP_READV 1
35 #define IORING_OP_WRITEV 2
38 * IO completion data structure (Completion Queue Entry)
41 __u64 user_data; /* sqe->data submission passed back */
42 __s32 res; /* result code for this event */
47 * Magic offsets for the application to mmap the data it needs
49 #define IORING_OFF_SQ_RING 0ULL
50 #define IORING_OFF_CQ_RING 0x8000000ULL
51 #define IORING_OFF_SQES 0x10000000ULL
54 * Filled with the offset for mmap(2)
56 struct io_sqring_offsets {
68 struct io_cqring_offsets {
79 * io_uring_enter(2) flags
81 #define IORING_ENTER_GETEVENTS (1U << 0)
84 * Passed in for io_uring_setup(2). Copied back with updated info on success
86 struct io_uring_params {
91 struct io_sqring_offsets sq_off;
92 struct io_cqring_offsets cq_off;