Skip to content

Commit 560b2e8

Browse files
authored
Remove redundant checks for linux_kernel in the linux_raw backend. (#922)
As noted in #920, `cfg(linux_kernel` is redundant within src/backend/linux_raw.
1 parent 81d8744 commit 560b2e8

File tree

5 files changed

+3
-8
lines changed

5 files changed

+3
-8
lines changed

src/backend/linux_raw/conv.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,6 @@ impl<'a, Num: ArgNumber> From<crate::backend::mm::types::MlockFlags> for ArgReg<
622622
}
623623

624624
#[cfg(feature = "mm")]
625-
#[cfg(any(linux_kernel, freebsdlike, netbsdlike))]
626625
impl<'a, Num: ArgNumber> From<crate::backend::mm::types::MlockAllFlags> for ArgReg<'a, Num> {
627626
#[inline]
628627
fn from(flags: crate::backend::mm::types::MlockAllFlags) -> Self {

src/backend/linux_raw/fs/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ pub(crate) mod syscalls;
66
pub(crate) mod types;
77

88
// TODO: Fix linux-raw-sys to define ioctl codes for sparc.
9-
#[cfg(all(linux_kernel, any(target_arch = "sparc", target_arch = "sparc64")))]
9+
#[cfg(any(target_arch = "sparc", target_arch = "sparc64"))]
1010
pub(crate) const EXT4_IOC_RESIZE_FS: u32 = 0x8008_6610;
1111

12-
#[cfg(all(linux_kernel, not(any(target_arch = "sparc", target_arch = "sparc64"))))]
12+
#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64")))]
1313
pub(crate) use linux_raw_sys::ioctl::EXT4_IOC_RESIZE_FS;

src/backend/linux_raw/fs/syscalls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ pub(crate) fn readlink(path: &CStr, buf: &mut [u8]) -> io::Result<usize> {
961961
}
962962
}
963963

964-
#[cfg(any(feature = "alloc", all(linux_kernel, feature = "procfs")))]
964+
#[cfg(any(feature = "alloc", feature = "procfs"))]
965965
#[inline]
966966
pub(crate) fn readlinkat(
967967
dirfd: BorrowedFd<'_>,

src/backend/linux_raw/mm/syscalls.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#![allow(unsafe_code)]
77
#![allow(clippy::undocumented_unsafe_blocks)]
88

9-
#[cfg(any(linux_kernel, freebsdlike, netbsdlike))]
109
use super::types::MlockAllFlags;
1110
use super::types::{
1211
Advice, MapFlags, MlockFlags, MprotectFlags, MremapFlags, MsyncFlags, ProtFlags,
@@ -221,7 +220,6 @@ pub(crate) unsafe fn userfaultfd(flags: UserfaultfdFlags) -> io::Result<OwnedFd>
221220
/// returns successfully; the pages are guaranteed to stay in RAM until later
222221
/// unlocked.
223222
#[inline]
224-
#[cfg(any(linux_kernel, freebsdlike, netbsdlike))]
225223
pub(crate) fn mlockall(flags: MlockAllFlags) -> io::Result<()> {
226224
// When `mlockall` is used with `MCL_ONFAULT | MCL_FUTURE`, the ordering
227225
// of `mlockall` with respect to arbitrary loads may be significant,
@@ -235,7 +233,6 @@ pub(crate) fn mlockall(flags: MlockAllFlags) -> io::Result<()> {
235233

236234
/// Unlocks all pages mapped into the address space of the calling process.
237235
#[inline]
238-
#[cfg(any(linux_kernel, freebsdlike, netbsdlike))]
239236
pub(crate) fn munlockall() -> io::Result<()> {
240237
unsafe { ret(syscall_readonly!(__NR_munlockall)) }
241238
}

src/backend/linux_raw/mm/types.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ bitflags! {
263263
}
264264
}
265265

266-
#[cfg(any(linux_kernel, freebsdlike, netbsdlike))]
267266
bitflags! {
268267
/// `MCL_*` flags for use with [`mlockall`].
269268
///

0 commit comments

Comments
 (0)