Skip to content

Commit f82d03b

Browse files
authored
Fix some todos. (#1298)
Use constants in libc and linux_raw_sys that are now upstream. Rename `splice_fd_in_or_file_index_union` to `splice_fd_in_or_file_index_or_addr_len_union`.
1 parent 1f58116 commit f82d03b

5 files changed

Lines changed: 19 additions & 21 deletions

File tree

src/backend/libc/c.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ pub(crate) const O_LARGEFILE: c_int = linux_raw_sys::general::O_LARGEFILE as _;
9797
#[cfg(solarish)]
9898
pub(crate) const O_LARGEFILE: c_int = 0x2000;
9999

100-
// TODO: This is new in Linux 6.11; remove when linux-raw-sys is updated.
101-
#[cfg(linux_kernel)]
102-
pub(crate) const MAP_DROPPABLE: u32 = 0x8;
103-
104100
// On PowerPC, the regular `termios` has the `termios2` fields and there is no
105101
// `termios2`, so we define aliases.
106102
#[cfg(all(
@@ -513,3 +509,7 @@ pub(crate) use statx_flags::*;
513509
#[cfg(feature = "fs")]
514510
#[cfg(target_os = "android")]
515511
pub(crate) use libc::__fsid_t as fsid_t;
512+
513+
#[cfg(feature = "mm")]
514+
#[cfg(target_os = "android")]
515+
pub(crate) const MAP_DROPPABLE: c_int = bitcast!(linux_raw_sys::general::MAP_DROPPABLE);

src/backend/linux_raw/c.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,6 @@ mod reboot_symbols {
321321
#[cfg(feature = "system")]
322322
pub(crate) use reboot_symbols::*;
323323

324-
// TODO: This is new in Linux 6.11; remove when linux-raw-sys is updated.
325-
pub(crate) const MAP_DROPPABLE: u32 = 0x8;
326-
327-
// TODO: This is new in Linux 6.5; remove when linux-raw-sys is updated.
328-
pub(crate) const MOVE_MOUNT_BENEATH: u32 = 0x200;
329-
330324
#[cfg(any(
331325
feature = "fs",
332326
all(

src/backend/linux_raw/mm/types.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use crate::backend::c;
21
use crate::ffi;
32
use bitflags::bitflags;
43

@@ -107,7 +106,7 @@ bitflags! {
107106
#[cfg(not(any(target_arch = "mips", target_arch = "mips32r6", target_arch = "mips64", target_arch = "mips64r6")))]
108107
const UNINITIALIZED = linux_raw_sys::general::MAP_UNINITIALIZED;
109108
/// `MAP_DROPPABLE`
110-
const DROPPABLE = c::MAP_DROPPABLE;
109+
const DROPPABLE = linux_raw_sys::general::MAP_DROPPABLE;
111110

112111
/// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
113112
const _ = !0;

src/backend/linux_raw/mount/types.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use crate::backend::c;
21
use crate::ffi;
32
use bitflags::bitflags;
43

@@ -228,7 +227,7 @@ bitflags! {
228227
const MOVE_MOUNT_SET_GROUP = linux_raw_sys::general::MOVE_MOUNT_SET_GROUP;
229228

230229
/// `MOVE_MOUNT_BENEATH` (since Linux 6.5)
231-
const MOVE_MOUNT_BENEATH = c::MOVE_MOUNT_BENEATH;
230+
const MOVE_MOUNT_BENEATH = linux_raw_sys::general::MOVE_MOUNT_BENEATH;
232231

233232
/// `MOVE_MOUNT__MASK`
234233
const MOVE_MOUNT__MASK = linux_raw_sys::general::MOVE_MOUNT__MASK;

src/io_uring/mod.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ pub struct io_uring_sqe {
10501050
pub user_data: io_uring_user_data,
10511051
pub buf: buf_union,
10521052
pub personality: u16,
1053-
pub splice_fd_in_or_file_index: splice_fd_in_or_file_index_union,
1053+
pub splice_fd_in_or_file_index_or_addr_len: splice_fd_in_or_file_index_or_addr_len_union,
10541054
pub addr3_or_cmd: addr3_or_cmd_union,
10551055
}
10561056

@@ -1157,11 +1157,10 @@ pub union buf_union {
11571157
pub buf_group: u16,
11581158
}
11591159

1160-
// TODO: Rename this to include `addr_len` when we have a semver bump?
11611160
#[allow(missing_docs)]
11621161
#[repr(C)]
11631162
#[derive(Copy, Clone)]
1164-
pub union splice_fd_in_or_file_index_union {
1163+
pub union splice_fd_in_or_file_index_or_addr_len_union {
11651164
pub splice_fd_in: i32,
11661165
pub file_index: u32,
11671166
pub addr_len: addr_len_struct,
@@ -1496,10 +1495,10 @@ impl Default for buf_union {
14961495
}
14971496
}
14981497

1499-
impl Default for splice_fd_in_or_file_index_union {
1498+
impl Default for splice_fd_in_or_file_index_or_addr_len_union {
15001499
#[inline]
15011500
fn default() -> Self {
1502-
default_union!(splice_fd_in_or_file_index_union, splice_fd_in)
1501+
default_union!(splice_fd_in_or_file_index_or_addr_len_union, splice_fd_in)
15031502
}
15041503
}
15051504

@@ -1527,7 +1526,10 @@ mod tests {
15271526
check_renamed_type!(addr3_or_cmd_union, io_uring_sqe__bindgen_ty_6);
15281527
check_renamed_type!(op_flags_union, io_uring_sqe__bindgen_ty_3);
15291528
check_renamed_type!(buf_union, io_uring_sqe__bindgen_ty_4);
1530-
check_renamed_type!(splice_fd_in_or_file_index_union, io_uring_sqe__bindgen_ty_5);
1529+
check_renamed_type!(
1530+
splice_fd_in_or_file_index_or_addr_len_union,
1531+
io_uring_sqe__bindgen_ty_5
1532+
);
15311533
check_renamed_type!(addr_len_struct, io_uring_sqe__bindgen_ty_5__bindgen_ty_1);
15321534
check_renamed_type!(
15331535
register_or_sqe_op_or_sqe_flags_union,
@@ -1549,7 +1551,11 @@ mod tests {
15491551
check_struct_field!(io_uring_sqe, user_data);
15501552
check_struct_renamed_field!(io_uring_sqe, buf, __bindgen_anon_4);
15511553
check_struct_field!(io_uring_sqe, personality);
1552-
check_struct_renamed_field!(io_uring_sqe, splice_fd_in_or_file_index, __bindgen_anon_5);
1554+
check_struct_renamed_field!(
1555+
io_uring_sqe,
1556+
splice_fd_in_or_file_index_or_addr_len,
1557+
__bindgen_anon_5
1558+
);
15531559
check_struct_renamed_field!(io_uring_sqe, addr3_or_cmd, __bindgen_anon_6);
15541560

15551561
check_type!(io_uring_restriction);

0 commit comments

Comments
 (0)