Skip to content

io_uring cleanups and updates for new flags in Linux 6.2 #553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 32 additions & 5 deletions src/io_uring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,10 @@ bitflags::bitflags! {
const TASKRUN_FLAG = sys::IORING_SETUP_TASKRUN_FLAG;

/// `IORING_SETUP_SINGLE_ISSUER`
const SETUP_SINGLE_ISSUER = sys::IORING_SETUP_SINGLE_ISSUER;
const SINGLE_ISSUER = sys::IORING_SETUP_SINGLE_ISSUER;

/// `IORING_SETUP_DEFER_TASKRUN`
const SETUP_DEFER_TASKRUN = sys::IORING_SETUP_DEFER_TASKRUN;
const DEFER_TASKRUN = sys::IORING_SETUP_DEFER_TASKRUN;
}
}

Expand Down Expand Up @@ -673,16 +673,39 @@ bitflags::bitflags! {
}

bitflags::bitflags! {
/// send/sendmsg & recv/recvmsg flags (`sqe.ioprio`)
/// send/sendmsg flags (`sqe.ioprio`)
#[derive(Default)]
pub struct IoringRecvsendFlags: u16 {
pub struct IoringSendFlags: u16 {
/// `IORING_RECVSEND_POLL_FIRST`.
///
/// See also [`IoringRecvFlags::POLL_FIRST`].
const POLL_FIRST = sys::IORING_RECVSEND_POLL_FIRST as _;

/// `IORING_RECVSEND_FIXED_BUF`
///
/// See also [`IoringRecvFlags::FIXED_BUF`].
const FIXED_BUF = sys::IORING_RECVSEND_FIXED_BUF as _;

/// `IORING_SEND_ZC_REPORT_USAGE`
const ZC_REPORT_USAGE = sys::IORING_SEND_ZC_REPORT_USAGE as _;
}
}

bitflags::bitflags! {
/// recv/recvmsg flags (`sqe.ioprio`)
#[derive(Default)]
pub struct IoringRecvFlags: u16 {
/// `IORING_RECVSEND_POLL_FIRST`
///
/// See also [`IoringSendFlags::POLL_FIRST`].
const POLL_FIRST = sys::IORING_RECVSEND_POLL_FIRST as _;

/// `IORING_RECV_MULTISHOT`
const MULTISHOT = sys::IORING_RECV_MULTISHOT as _;

/// `IORING_RECVSEND_FIXED_BUF`
///
/// See also [`IoringSendFlags::FIXED_BUF`].
const FIXED_BUF = sys::IORING_RECVSEND_FIXED_BUF as _;
}
}
Expand Down Expand Up @@ -742,6 +765,9 @@ pub const fn io_uring_register_files_skip() -> BorrowedFd<'static> {
unsafe { BorrowedFd::<'static>::borrow_raw(files_skip) }
}

/// `IORING_NOTIF_USAGE_ZC_COPIED`
pub const IORING_NOTIF_USAGE_ZC_COPIED: i32 = sys::IORING_NOTIF_USAGE_ZC_COPIED as _;

/// A pointer in the io_uring API.
///
/// `io_uring`'s native API represents pointers as `u64` values. In order to
Expand Down Expand Up @@ -878,7 +904,8 @@ pub struct io_uring_sqe {
#[repr(C)]
#[derive(Copy, Clone)]
pub union ioprio_union {
pub recvsend_flags: IoringRecvsendFlags,
pub recv_flags: IoringRecvFlags,
pub send_flags: IoringSendFlags,
pub accept_flags: IoringAcceptFlags,
pub ioprio: u16,
}
Expand Down