Created
July 10, 2024 13:52
-
-
Save fadhil-riyanto/95799c76dc75d0a5091fe26d8355a915 to your computer and use it in GitHub Desktop.
linux raw io_uring struct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct io_uring_sqe { | |
__u8 opcode; // opcode field that describes the operation code, example: IORING_OP_READV | |
__u8 flags; // flags contains modifier flags | |
__u16 ioprio; // ioprio is the priority of this request, see ioprio_set(2) | |
__s32 fd; // fd is the file descriptor associated with the request | |
__u64 off; // off holds the offset at which the operation should take place | |
__u64 addr; // addr contains the address at which the operation should perform IO, if the op-code describes an operation that transfers data. If the | |
// operation is a vectored read/write of some sort, this will be a pointer | |
// to an struct iovec array, as used by preadv(2), for | |
// example. For a non-vectored IO transfer, | |
// addr must contain the address directly | |
__u32 len; // This carries into len, which is either a byte count for a non-vectored IO | |
// transfer, or a number of vectors described by | |
// addr for a vectored IO transfer | |
union { | |
__kernel_rwf_t rw_flags; // Next follows a union of flags that are specific to the op-code | |
__u32 fsync_flags; | |
__u16 poll_events; | |
__u32 sync_range_flags; | |
__u32 msg_flags; | |
}; | |
__u64 user_data; // untouched by the kernel | |
union { | |
__u16 buf_index; // buf_index will be described in the advanced use cases section | |
__u64 __pad2[3]; // unused, for future and padding in 64 | |
}; | |
}; | |
// passed to kernel | |
struct io_uring_params { | |
__u32 sq_entries; | |
__u32 cq_entries; | |
__u32 flags; | |
__u32 sq_thread_cpu; | |
__u32 sq_thread_idle; | |
__u32 resv[5]; | |
struct io_sqring_offsets sq_off; // i dont really trust this: https://github.com/torvalds/linux/blob/34afb82a3c67f869267a26f593b6f8fc6bf35905/include/uapi/linux/io_uring.h#L462 | |
struct io_cqring_offsets cq_off; // same: https://github.com/torvalds/linux/blob/34afb82a3c67f869267a26f593b6f8fc6bf35905/include/uapi/linux/io_uring.h#L481 | |
}; | |
struct io_sqring_offsets { | |
__u32 head; | |
__u32 tail; | |
__u32 ring_mask; | |
__u32 ring_entries; | |
__u32 flags; | |
__u32 dropped; | |
__u32 array; | |
__u32 resv1; | |
__u64 user_addr; | |
}; | |
struct io_cqring_offsets { | |
__u32 head; | |
__u32 tail; | |
__u32 ring_mask; | |
__u32 ring_entries; | |
__u32 overflow; | |
__u32 cqes; | |
__u32 flags; | |
__u32 resv1; | |
__u64 user_addr; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment