diff --git a/io-uring-test/src/main.rs b/io-uring-test/src/main.rs index 1e1912b..13edb61 100644 --- a/io-uring-test/src/main.rs +++ b/io-uring-test/src/main.rs @@ -166,6 +166,9 @@ fn test( tests::poll::test_eventfd_poll_remove_failed(&mut ring, &test)?; tests::poll::test_eventfd_poll_multi(&mut ring, &test)?; + // pipe + tests::pipe::test_pipe(&mut ring, &test)?; + // futex tests::futex::test_futex_wait(&mut ring, &test)?; tests::futex::test_futex_wake(&mut ring, &test)?; diff --git a/io-uring-test/src/tests/mod.rs b/io-uring-test/src/tests/mod.rs index 04b1693..ffda0eb 100644 --- a/io-uring-test/src/tests/mod.rs +++ b/io-uring-test/src/tests/mod.rs @@ -4,6 +4,7 @@ pub mod fs; pub mod futex; pub mod net; pub mod os; +pub mod pipe; pub mod poll; pub mod queue; pub mod register; diff --git a/io-uring-test/src/tests/pipe.rs b/io-uring-test/src/tests/pipe.rs new file mode 100644 index 0000000..7d65c60 --- /dev/null +++ b/io-uring-test/src/tests/pipe.rs @@ -0,0 +1,65 @@ +use crate::Test; +use io_uring::{cqueue, opcode, squeue, IoUring}; +use std::{ + io::{PipeReader, PipeWriter, Read, Write}, + os::fd::FromRawFd, +}; + +pub fn test_pipe( + ring: &mut IoUring, + test: &Test, +) -> anyhow::Result<()> { + require!( + test; + test.probe.is_supported(opcode::Pipe::CODE); + ); + + println!("test pipe"); + + const REQ_TYPE_PIPE: u64 = 1; + const DATA: &[u8] = b"foo"; + + // Setup placeholder fds to be assigned on op completion. + let mut fds = [-1, -1]; + + // Submit pipe op. + let sqe = opcode::Pipe::new(fds.as_mut_ptr()) + .build() + .user_data(REQ_TYPE_PIPE) + .into(); + unsafe { ring.submission().push(&sqe) }?; + ring.submit_and_wait(1)?; + + // Process pipe op. + let cqe = ring + .completion() + .map(Into::::into) + .next() + .unwrap(); + assert!(cqe.result() >= 0); + assert_eq!(cqe.user_data(), REQ_TYPE_PIPE); + + // Ensure the fds were assigned. + assert_ne!(fds[0], -1); + assert_ne!(fds[1], -1); + + // Wrap the raw fds. + let mut rx = unsafe { PipeReader::from_raw_fd(fds[0]) }; + let mut tx = unsafe { PipeWriter::from_raw_fd(fds[1]) }; + + // Write data to the pipe. + for _ in 0..1024 { + tx.write_all(DATA).unwrap(); + } + + // Read data from the pipe. + let mut buf = [0u8; DATA.len() * 1024]; + rx.read_exact(&mut buf).unwrap(); + + // Check the read data matches what was sent. + for chunk in buf.chunks(DATA.len()) { + assert_eq!(chunk, DATA); + } + + Ok(()) +} diff --git a/src/opcode.rs b/src/opcode.rs index a1fc0b1..4e0d009 100644 --- a/src/opcode.rs +++ b/src/opcode.rs @@ -2356,3 +2356,31 @@ opcode! { Entry(sqe) } } + +// === 6.16 === + +opcode! { + // Create a pipe, equivalent to `pipe(2)`. + pub struct Pipe { + fds: { *mut RawFd }, + ;; + flags: u32 = 0, + file_index: Option = None, + } + + pub const CODE = sys::IORING_OP_PIPE; + + pub fn build(self) -> Entry { + let Self { fds, flags, file_index } = self; + + let mut sqe = sqe_zeroed(); + sqe.opcode = Self::CODE; + sqe.fd = 0; + sqe.__bindgen_anon_2.addr = fds as _; + sqe.__bindgen_anon_3.pipe_flags = flags; + if let Some(dest) = file_index { + sqe.__bindgen_anon_5.file_index = dest.kernel_index_arg(); + } + Entry(sqe) + } +} diff --git a/src/sys/sys_aarch64.rs b/src/sys/sys_aarch64.rs index 5d58bbf..54eb5b2 100644 --- a/src/sys/sys_aarch64.rs +++ b/src/sys/sys_aarch64.rs @@ -523,6 +523,7 @@ pub union io_uring_sqe__bindgen_ty_3 { pub futex_flags: __u32, pub install_fd_flags: __u32, pub nop_flags: __u32, + pub pipe_flags: __u32, } #[test] fn bindgen_test_layout_io_uring_sqe__bindgen_ty_3() { @@ -769,6 +770,16 @@ fn bindgen_test_layout_io_uring_sqe__bindgen_ty_3() { stringify!(nop_flags) ) ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).pipe_flags) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(io_uring_sqe__bindgen_ty_3), + "::", + stringify!(pipe_flags) + ) + ); } impl Default for io_uring_sqe__bindgen_ty_3 { fn default() -> Self { @@ -838,6 +849,7 @@ pub union io_uring_sqe__bindgen_ty_5 { pub zcrx_ifq_idx: __u32, pub optlen: __u32, pub __bindgen_anon_1: io_uring_sqe__bindgen_ty_5__bindgen_ty_1, + pub __bindgen_anon_2: io_uring_sqe__bindgen_ty_5__bindgen_ty_2, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -887,6 +899,54 @@ fn bindgen_test_layout_io_uring_sqe__bindgen_ty_5__bindgen_ty_1() { ) ); } +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct io_uring_sqe__bindgen_ty_5__bindgen_ty_2 { + pub write_stream: __u8, + pub __pad4: [__u8; 3usize], +} +#[test] +fn bindgen_test_layout_io_uring_sqe__bindgen_ty_5__bindgen_ty_2() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2) + ) + ); + assert_eq!( + ::core::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).write_stream) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2), + "::", + stringify!(write_stream) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).__pad4) as usize - ptr as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2), + "::", + stringify!(__pad4) + ) + ); +} #[test] fn bindgen_test_layout_io_uring_sqe__bindgen_ty_5() { const UNINIT: ::core::mem::MaybeUninit = @@ -1350,7 +1410,8 @@ pub const IORING_OP_RECV_ZC: io_uring_op = 58; pub const IORING_OP_EPOLL_WAIT: io_uring_op = 59; pub const IORING_OP_READV_FIXED: io_uring_op = 60; pub const IORING_OP_WRITEV_FIXED: io_uring_op = 61; -pub const IORING_OP_LAST: io_uring_op = 62; +pub const IORING_OP_PIPE: io_uring_op = 62; +pub const IORING_OP_LAST: io_uring_op = 63; pub type io_uring_op = libc::c_uint; pub const IORING_MSG_DATA: io_uring_msg_ring_flags = 0; pub const IORING_MSG_SEND_FD: io_uring_msg_ring_flags = 1; @@ -3662,6 +3723,8 @@ fn bindgen_test_layout_io_uring_zcrx_offsets() { ) ); } +pub const IORING_ZCRX_AREA_DMABUF: io_uring_zcrx_area_flags = 1; +pub type io_uring_zcrx_area_flags = libc::c_uint; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct io_uring_zcrx_area_reg { @@ -3669,7 +3732,7 @@ pub struct io_uring_zcrx_area_reg { pub len: __u64, pub rq_area_token: __u64, pub flags: __u32, - pub __resv1: __u32, + pub dmabuf_fd: __u32, pub __resv2: [__u64; 2usize], } #[test] @@ -3728,13 +3791,13 @@ fn bindgen_test_layout_io_uring_zcrx_area_reg() { ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).__resv1) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).dmabuf_fd) as usize - ptr as usize }, 28usize, concat!( "Offset of field: ", stringify!(io_uring_zcrx_area_reg), "::", - stringify!(__resv1) + stringify!(dmabuf_fd) ) ); assert_eq!( diff --git a/src/sys/sys_loongarch64.rs b/src/sys/sys_loongarch64.rs index 15bad2f..54eb5b2 100644 --- a/src/sys/sys_loongarch64.rs +++ b/src/sys/sys_loongarch64.rs @@ -523,6 +523,7 @@ pub union io_uring_sqe__bindgen_ty_3 { pub futex_flags: __u32, pub install_fd_flags: __u32, pub nop_flags: __u32, + pub pipe_flags: __u32, } #[test] fn bindgen_test_layout_io_uring_sqe__bindgen_ty_3() { @@ -769,6 +770,16 @@ fn bindgen_test_layout_io_uring_sqe__bindgen_ty_3() { stringify!(nop_flags) ) ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).pipe_flags) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(io_uring_sqe__bindgen_ty_3), + "::", + stringify!(pipe_flags) + ) + ); } impl Default for io_uring_sqe__bindgen_ty_3 { fn default() -> Self { @@ -838,6 +849,7 @@ pub union io_uring_sqe__bindgen_ty_5 { pub zcrx_ifq_idx: __u32, pub optlen: __u32, pub __bindgen_anon_1: io_uring_sqe__bindgen_ty_5__bindgen_ty_1, + pub __bindgen_anon_2: io_uring_sqe__bindgen_ty_5__bindgen_ty_2, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -887,6 +899,54 @@ fn bindgen_test_layout_io_uring_sqe__bindgen_ty_5__bindgen_ty_1() { ) ); } +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct io_uring_sqe__bindgen_ty_5__bindgen_ty_2 { + pub write_stream: __u8, + pub __pad4: [__u8; 3usize], +} +#[test] +fn bindgen_test_layout_io_uring_sqe__bindgen_ty_5__bindgen_ty_2() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2) + ) + ); + assert_eq!( + ::core::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).write_stream) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2), + "::", + stringify!(write_stream) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).__pad4) as usize - ptr as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2), + "::", + stringify!(__pad4) + ) + ); +} #[test] fn bindgen_test_layout_io_uring_sqe__bindgen_ty_5() { const UNINIT: ::core::mem::MaybeUninit = @@ -1350,7 +1410,8 @@ pub const IORING_OP_RECV_ZC: io_uring_op = 58; pub const IORING_OP_EPOLL_WAIT: io_uring_op = 59; pub const IORING_OP_READV_FIXED: io_uring_op = 60; pub const IORING_OP_WRITEV_FIXED: io_uring_op = 61; -pub const IORING_OP_LAST: io_uring_op = 62; +pub const IORING_OP_PIPE: io_uring_op = 62; +pub const IORING_OP_LAST: io_uring_op = 63; pub type io_uring_op = libc::c_uint; pub const IORING_MSG_DATA: io_uring_msg_ring_flags = 0; pub const IORING_MSG_SEND_FD: io_uring_msg_ring_flags = 1; @@ -3662,6 +3723,8 @@ fn bindgen_test_layout_io_uring_zcrx_offsets() { ) ); } +pub const IORING_ZCRX_AREA_DMABUF: io_uring_zcrx_area_flags = 1; +pub type io_uring_zcrx_area_flags = libc::c_uint; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct io_uring_zcrx_area_reg { @@ -3669,7 +3732,7 @@ pub struct io_uring_zcrx_area_reg { pub len: __u64, pub rq_area_token: __u64, pub flags: __u32, - pub __resv1: __u32, + pub dmabuf_fd: __u32, pub __resv2: [__u64; 2usize], } #[test] @@ -3728,13 +3791,13 @@ fn bindgen_test_layout_io_uring_zcrx_area_reg() { ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).__resv1) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).dmabuf_fd) as usize - ptr as usize }, 28usize, concat!( "Offset of field: ", stringify!(io_uring_zcrx_area_reg), "::", - stringify!(__resv1) + stringify!(dmabuf_fd) ) ); assert_eq!( @@ -3878,6 +3941,7 @@ fn bindgen_test_layout_io_uring_zcrx_ifq_reg() { ) ); } +#[doc = " struct futex_waitv - A waiter for vectorized wait\n @val:\tExpected value at uaddr\n @uaddr:\tUser address to wait on\n @flags:\tFlags for this waiter\n @__reserved:\tReserved member to preserve data alignment. Should be 0."] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct futex_waitv { diff --git a/src/sys/sys_powerpc64.rs b/src/sys/sys_powerpc64.rs index f5a1422..0dde454 100644 --- a/src/sys/sys_powerpc64.rs +++ b/src/sys/sys_powerpc64.rs @@ -523,6 +523,7 @@ pub union io_uring_sqe__bindgen_ty_3 { pub futex_flags: __u32, pub install_fd_flags: __u32, pub nop_flags: __u32, + pub pipe_flags: __u32, } #[test] fn bindgen_test_layout_io_uring_sqe__bindgen_ty_3() { @@ -769,6 +770,16 @@ fn bindgen_test_layout_io_uring_sqe__bindgen_ty_3() { stringify!(nop_flags) ) ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).pipe_flags) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(io_uring_sqe__bindgen_ty_3), + "::", + stringify!(pipe_flags) + ) + ); } impl Default for io_uring_sqe__bindgen_ty_3 { fn default() -> Self { @@ -838,6 +849,7 @@ pub union io_uring_sqe__bindgen_ty_5 { pub zcrx_ifq_idx: __u32, pub optlen: __u32, pub __bindgen_anon_1: io_uring_sqe__bindgen_ty_5__bindgen_ty_1, + pub __bindgen_anon_2: io_uring_sqe__bindgen_ty_5__bindgen_ty_2, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -887,6 +899,54 @@ fn bindgen_test_layout_io_uring_sqe__bindgen_ty_5__bindgen_ty_1() { ) ); } +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct io_uring_sqe__bindgen_ty_5__bindgen_ty_2 { + pub write_stream: __u8, + pub __pad4: [__u8; 3usize], +} +#[test] +fn bindgen_test_layout_io_uring_sqe__bindgen_ty_5__bindgen_ty_2() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2) + ) + ); + assert_eq!( + ::core::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).write_stream) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2), + "::", + stringify!(write_stream) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).__pad4) as usize - ptr as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2), + "::", + stringify!(__pad4) + ) + ); +} #[test] fn bindgen_test_layout_io_uring_sqe__bindgen_ty_5() { const UNINIT: ::core::mem::MaybeUninit = @@ -1350,7 +1410,8 @@ pub const IORING_OP_RECV_ZC: io_uring_op = 58; pub const IORING_OP_EPOLL_WAIT: io_uring_op = 59; pub const IORING_OP_READV_FIXED: io_uring_op = 60; pub const IORING_OP_WRITEV_FIXED: io_uring_op = 61; -pub const IORING_OP_LAST: io_uring_op = 62; +pub const IORING_OP_PIPE: io_uring_op = 62; +pub const IORING_OP_LAST: io_uring_op = 63; pub type io_uring_op = libc::c_uint; pub const IORING_MSG_DATA: io_uring_msg_ring_flags = 0; pub const IORING_MSG_SEND_FD: io_uring_msg_ring_flags = 1; @@ -3662,6 +3723,8 @@ fn bindgen_test_layout_io_uring_zcrx_offsets() { ) ); } +pub const IORING_ZCRX_AREA_DMABUF: io_uring_zcrx_area_flags = 1; +pub type io_uring_zcrx_area_flags = libc::c_uint; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct io_uring_zcrx_area_reg { @@ -3669,7 +3732,7 @@ pub struct io_uring_zcrx_area_reg { pub len: __u64, pub rq_area_token: __u64, pub flags: __u32, - pub __resv1: __u32, + pub dmabuf_fd: __u32, pub __resv2: [__u64; 2usize], } #[test] @@ -3728,13 +3791,13 @@ fn bindgen_test_layout_io_uring_zcrx_area_reg() { ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).__resv1) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).dmabuf_fd) as usize - ptr as usize }, 28usize, concat!( "Offset of field: ", stringify!(io_uring_zcrx_area_reg), "::", - stringify!(__resv1) + stringify!(dmabuf_fd) ) ); assert_eq!( diff --git a/src/sys/sys_riscv64.rs b/src/sys/sys_riscv64.rs index 5d58bbf..54eb5b2 100644 --- a/src/sys/sys_riscv64.rs +++ b/src/sys/sys_riscv64.rs @@ -523,6 +523,7 @@ pub union io_uring_sqe__bindgen_ty_3 { pub futex_flags: __u32, pub install_fd_flags: __u32, pub nop_flags: __u32, + pub pipe_flags: __u32, } #[test] fn bindgen_test_layout_io_uring_sqe__bindgen_ty_3() { @@ -769,6 +770,16 @@ fn bindgen_test_layout_io_uring_sqe__bindgen_ty_3() { stringify!(nop_flags) ) ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).pipe_flags) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(io_uring_sqe__bindgen_ty_3), + "::", + stringify!(pipe_flags) + ) + ); } impl Default for io_uring_sqe__bindgen_ty_3 { fn default() -> Self { @@ -838,6 +849,7 @@ pub union io_uring_sqe__bindgen_ty_5 { pub zcrx_ifq_idx: __u32, pub optlen: __u32, pub __bindgen_anon_1: io_uring_sqe__bindgen_ty_5__bindgen_ty_1, + pub __bindgen_anon_2: io_uring_sqe__bindgen_ty_5__bindgen_ty_2, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -887,6 +899,54 @@ fn bindgen_test_layout_io_uring_sqe__bindgen_ty_5__bindgen_ty_1() { ) ); } +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct io_uring_sqe__bindgen_ty_5__bindgen_ty_2 { + pub write_stream: __u8, + pub __pad4: [__u8; 3usize], +} +#[test] +fn bindgen_test_layout_io_uring_sqe__bindgen_ty_5__bindgen_ty_2() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2) + ) + ); + assert_eq!( + ::core::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).write_stream) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2), + "::", + stringify!(write_stream) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).__pad4) as usize - ptr as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2), + "::", + stringify!(__pad4) + ) + ); +} #[test] fn bindgen_test_layout_io_uring_sqe__bindgen_ty_5() { const UNINIT: ::core::mem::MaybeUninit = @@ -1350,7 +1410,8 @@ pub const IORING_OP_RECV_ZC: io_uring_op = 58; pub const IORING_OP_EPOLL_WAIT: io_uring_op = 59; pub const IORING_OP_READV_FIXED: io_uring_op = 60; pub const IORING_OP_WRITEV_FIXED: io_uring_op = 61; -pub const IORING_OP_LAST: io_uring_op = 62; +pub const IORING_OP_PIPE: io_uring_op = 62; +pub const IORING_OP_LAST: io_uring_op = 63; pub type io_uring_op = libc::c_uint; pub const IORING_MSG_DATA: io_uring_msg_ring_flags = 0; pub const IORING_MSG_SEND_FD: io_uring_msg_ring_flags = 1; @@ -3662,6 +3723,8 @@ fn bindgen_test_layout_io_uring_zcrx_offsets() { ) ); } +pub const IORING_ZCRX_AREA_DMABUF: io_uring_zcrx_area_flags = 1; +pub type io_uring_zcrx_area_flags = libc::c_uint; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct io_uring_zcrx_area_reg { @@ -3669,7 +3732,7 @@ pub struct io_uring_zcrx_area_reg { pub len: __u64, pub rq_area_token: __u64, pub flags: __u32, - pub __resv1: __u32, + pub dmabuf_fd: __u32, pub __resv2: [__u64; 2usize], } #[test] @@ -3728,13 +3791,13 @@ fn bindgen_test_layout_io_uring_zcrx_area_reg() { ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).__resv1) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).dmabuf_fd) as usize - ptr as usize }, 28usize, concat!( "Offset of field: ", stringify!(io_uring_zcrx_area_reg), "::", - stringify!(__resv1) + stringify!(dmabuf_fd) ) ); assert_eq!( diff --git a/src/sys/sys_x86_64.rs b/src/sys/sys_x86_64.rs index 5d58bbf..54eb5b2 100644 --- a/src/sys/sys_x86_64.rs +++ b/src/sys/sys_x86_64.rs @@ -523,6 +523,7 @@ pub union io_uring_sqe__bindgen_ty_3 { pub futex_flags: __u32, pub install_fd_flags: __u32, pub nop_flags: __u32, + pub pipe_flags: __u32, } #[test] fn bindgen_test_layout_io_uring_sqe__bindgen_ty_3() { @@ -769,6 +770,16 @@ fn bindgen_test_layout_io_uring_sqe__bindgen_ty_3() { stringify!(nop_flags) ) ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).pipe_flags) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(io_uring_sqe__bindgen_ty_3), + "::", + stringify!(pipe_flags) + ) + ); } impl Default for io_uring_sqe__bindgen_ty_3 { fn default() -> Self { @@ -838,6 +849,7 @@ pub union io_uring_sqe__bindgen_ty_5 { pub zcrx_ifq_idx: __u32, pub optlen: __u32, pub __bindgen_anon_1: io_uring_sqe__bindgen_ty_5__bindgen_ty_1, + pub __bindgen_anon_2: io_uring_sqe__bindgen_ty_5__bindgen_ty_2, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -887,6 +899,54 @@ fn bindgen_test_layout_io_uring_sqe__bindgen_ty_5__bindgen_ty_1() { ) ); } +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct io_uring_sqe__bindgen_ty_5__bindgen_ty_2 { + pub write_stream: __u8, + pub __pad4: [__u8; 3usize], +} +#[test] +fn bindgen_test_layout_io_uring_sqe__bindgen_ty_5__bindgen_ty_2() { + const UNINIT: ::core::mem::MaybeUninit = + ::core::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::core::mem::size_of::(), + 4usize, + concat!( + "Size of: ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2) + ) + ); + assert_eq!( + ::core::mem::align_of::(), + 1usize, + concat!( + "Alignment of ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).write_stream) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2), + "::", + stringify!(write_stream) + ) + ); + assert_eq!( + unsafe { ::core::ptr::addr_of!((*ptr).__pad4) as usize - ptr as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(io_uring_sqe__bindgen_ty_5__bindgen_ty_2), + "::", + stringify!(__pad4) + ) + ); +} #[test] fn bindgen_test_layout_io_uring_sqe__bindgen_ty_5() { const UNINIT: ::core::mem::MaybeUninit = @@ -1350,7 +1410,8 @@ pub const IORING_OP_RECV_ZC: io_uring_op = 58; pub const IORING_OP_EPOLL_WAIT: io_uring_op = 59; pub const IORING_OP_READV_FIXED: io_uring_op = 60; pub const IORING_OP_WRITEV_FIXED: io_uring_op = 61; -pub const IORING_OP_LAST: io_uring_op = 62; +pub const IORING_OP_PIPE: io_uring_op = 62; +pub const IORING_OP_LAST: io_uring_op = 63; pub type io_uring_op = libc::c_uint; pub const IORING_MSG_DATA: io_uring_msg_ring_flags = 0; pub const IORING_MSG_SEND_FD: io_uring_msg_ring_flags = 1; @@ -3662,6 +3723,8 @@ fn bindgen_test_layout_io_uring_zcrx_offsets() { ) ); } +pub const IORING_ZCRX_AREA_DMABUF: io_uring_zcrx_area_flags = 1; +pub type io_uring_zcrx_area_flags = libc::c_uint; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct io_uring_zcrx_area_reg { @@ -3669,7 +3732,7 @@ pub struct io_uring_zcrx_area_reg { pub len: __u64, pub rq_area_token: __u64, pub flags: __u32, - pub __resv1: __u32, + pub dmabuf_fd: __u32, pub __resv2: [__u64; 2usize], } #[test] @@ -3728,13 +3791,13 @@ fn bindgen_test_layout_io_uring_zcrx_area_reg() { ) ); assert_eq!( - unsafe { ::core::ptr::addr_of!((*ptr).__resv1) as usize - ptr as usize }, + unsafe { ::core::ptr::addr_of!((*ptr).dmabuf_fd) as usize - ptr as usize }, 28usize, concat!( "Offset of field: ", stringify!(io_uring_zcrx_area_reg), "::", - stringify!(__resv1) + stringify!(dmabuf_fd) ) ); assert_eq!(