diff --git a/src/opcode.rs b/src/opcode.rs index 6fe5b348..05cb62d7 100644 --- a/src/opcode.rs +++ b/src/opcode.rs @@ -1482,6 +1482,9 @@ opcode! { fd: { impl sealed::UseFixed }, cmd_op: { u32 }, ;; + /// The `buf_index` is an index into an array of fixed buffers, + /// and is only valid if fixed buffers were registered. + buf_index: Option = None, /// Arbitrary command data. cmd: [u8; 16] = [0u8; 16] } @@ -1489,13 +1492,19 @@ opcode! { pub const CODE = sys::IORING_OP_URING_CMD; pub fn build(self) -> Entry { - let UringCmd16 { fd, cmd_op, cmd } = self; + let UringCmd16 { fd, cmd_op, cmd, buf_index } = self; let mut sqe = sqe_zeroed(); sqe.opcode = Self::CODE; assign_fd!(sqe.fd = fd); sqe.__bindgen_anon_1.__bindgen_anon_1.cmd_op = cmd_op; unsafe { *sqe.__bindgen_anon_6.cmd.as_mut().as_mut_ptr().cast::<[u8; 16]>() = cmd }; + if let Some(buf_index) = buf_index { + sqe.__bindgen_anon_4.buf_index = buf_index; + unsafe { + sqe.__bindgen_anon_3.uring_cmd_flags |= sys::IORING_URING_CMD_FIXED; + } + } Entry(sqe) } } @@ -1506,6 +1515,9 @@ opcode! { fd: { impl sealed::UseFixed }, cmd_op: { u32 }, ;; + /// The `buf_index` is an index into an array of fixed buffers, + /// and is only valid if fixed buffers were registered. + buf_index: Option = None, /// Arbitrary command data. cmd: [u8; 80] = [0u8; 80] } @@ -1513,7 +1525,7 @@ opcode! { pub const CODE = sys::IORING_OP_URING_CMD; pub fn build(self) -> Entry128 { - let UringCmd80 { fd, cmd_op, cmd } = self; + let UringCmd80 { fd, cmd_op, cmd, buf_index } = self; let cmd1 = cmd[..16].try_into().unwrap(); let cmd2 = cmd[16..].try_into().unwrap(); @@ -1523,6 +1535,12 @@ opcode! { assign_fd!(sqe.fd = fd); sqe.__bindgen_anon_1.__bindgen_anon_1.cmd_op = cmd_op; unsafe { *sqe.__bindgen_anon_6.cmd.as_mut().as_mut_ptr().cast::<[u8; 16]>() = cmd1 }; + if let Some(buf_index) = buf_index { + sqe.__bindgen_anon_4.buf_index = buf_index; + unsafe { + sqe.__bindgen_anon_3.uring_cmd_flags |= sys::IORING_URING_CMD_FIXED; + } + } Entry128(Entry(sqe), cmd2) } }