]>
git.ipfire.org Git - thirdparty/kernel/stable.git/blob - include/uapi/linux/io_uring.h
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
; /* IOSQE_ flags */
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
;
30 __u64 user_data
; /* data to be passed back at completion time */
32 __u16 buf_index
; /* index into fixed buffers, if used */
40 #define IOSQE_FIXED_FILE (1U << 0) /* use fixed fileset */
43 * io_uring_setup() flags
45 #define IORING_SETUP_IOPOLL (1U << 0) /* io_context is polled */
46 #define IORING_SETUP_SQPOLL (1U << 1) /* SQ poll thread */
47 #define IORING_SETUP_SQ_AFF (1U << 2) /* sq_thread_cpu is valid */
49 #define IORING_OP_NOP 0
50 #define IORING_OP_READV 1
51 #define IORING_OP_WRITEV 2
52 #define IORING_OP_FSYNC 3
53 #define IORING_OP_READ_FIXED 4
54 #define IORING_OP_WRITE_FIXED 5
55 #define IORING_OP_POLL_ADD 6
56 #define IORING_OP_POLL_REMOVE 7
61 #define IORING_FSYNC_DATASYNC (1U << 0)
64 * IO completion data structure (Completion Queue Entry)
67 __u64 user_data
; /* sqe->data submission passed back */
68 __s32 res
; /* result code for this event */
73 * Magic offsets for the application to mmap the data it needs
75 #define IORING_OFF_SQ_RING 0ULL
76 #define IORING_OFF_CQ_RING 0x8000000ULL
77 #define IORING_OFF_SQES 0x10000000ULL
80 * Filled with the offset for mmap(2)
82 struct io_sqring_offsets
{
97 #define IORING_SQ_NEED_WAKEUP (1U << 0) /* needs io_uring_enter wakeup */
99 struct io_cqring_offsets
{
110 * io_uring_enter(2) flags
112 #define IORING_ENTER_GETEVENTS (1U << 0)
113 #define IORING_ENTER_SQ_WAKEUP (1U << 1)
116 * Passed in for io_uring_setup(2). Copied back with updated info on success
118 struct io_uring_params
{
123 __u32 sq_thread_idle
;
125 struct io_sqring_offsets sq_off
;
126 struct io_cqring_offsets cq_off
;
130 * io_uring_register(2) opcodes and arguments
132 #define IORING_REGISTER_BUFFERS 0
133 #define IORING_UNREGISTER_BUFFERS 1
134 #define IORING_REGISTER_FILES 2
135 #define IORING_UNREGISTER_FILES 3