Skip to content

Commit bb1478d

Browse files
authored
Add #[non_exhaustive] to io_uring structs with padding (#1281)
Padding fields may be repurposed by future Linux versions, so in an attempt to be somewhat more future-proof, mark io_uring structs padding fields as `#[doc(hidden)]` and their structs as `#[non_exhaustive]`.
1 parent 332c9a0 commit bb1478d

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/io_uring/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,7 @@ pub const IORING_NOTIF_USAGE_ZC_COPIED: i32 = sys::IORING_NOTIF_USAGE_ZC_COPIED
929929
/// pointers are narrower than 64 bits, this requires additional padding.
930930
#[repr(C)]
931931
#[derive(Copy, Clone)]
932+
#[non_exhaustive]
932933
pub struct io_uring_ptr {
933934
#[cfg(all(target_pointer_width = "32", target_endian = "big"))]
934935
#[doc(hidden)]
@@ -1083,8 +1084,10 @@ pub union addr3_or_cmd_union {
10831084
#[allow(missing_docs)]
10841085
#[repr(C)]
10851086
#[derive(Copy, Clone, Default)]
1087+
#[non_exhaustive]
10861088
pub struct addr3_struct {
10871089
pub addr3: u64,
1090+
#[doc(hidden)]
10881091
pub __pad2: [u64; 1],
10891092
}
10901093

@@ -1101,8 +1104,10 @@ pub union off_or_addr2_union {
11011104
#[allow(missing_docs)]
11021105
#[repr(C)]
11031106
#[derive(Copy, Clone)]
1107+
#[non_exhaustive]
11041108
pub struct cmd_op_struct {
11051109
pub cmd_op: u32,
1110+
#[doc(hidden)]
11061111
pub __pad1: u32,
11071112
}
11081113

@@ -1166,21 +1171,26 @@ pub union splice_fd_in_or_file_index_union {
11661171
#[allow(missing_docs)]
11671172
#[repr(C)]
11681173
#[derive(Copy, Clone)]
1174+
#[non_exhaustive]
11691175
pub struct addr_len_struct {
11701176
pub addr_len: u16,
1177+
#[doc(hidden)]
11711178
pub __pad3: [u16; 1],
11721179
}
11731180

11741181
#[allow(missing_docs)]
11751182
#[repr(C)]
11761183
#[derive(Copy, Clone)]
1184+
#[non_exhaustive]
11771185
pub struct io_uring_sync_cancel_reg {
11781186
pub addr: u64,
11791187
pub fd: i32,
11801188
pub flags: IoringAsyncCancelFlags,
11811189
pub timeout: Timespec,
11821190
pub opcode: u8,
1191+
#[doc(hidden)]
11831192
pub pad: [u8; 7],
1193+
#[doc(hidden)]
11841194
pub pad2: [u64; 3],
11851195
}
11861196

0 commit comments

Comments
 (0)