diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
commit | c23a457e72abe608715ac76f076f47dc42af07a5 (patch) | |
tree | 2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /vendor/rustix/src/backend/libc/fs | |
parent | Releasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip |
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix/src/backend/libc/fs')
-rw-r--r-- | vendor/rustix/src/backend/libc/fs/inotify.rs | 31 | ||||
-rw-r--r-- | vendor/rustix/src/backend/libc/fs/makedev.rs | 12 | ||||
-rw-r--r-- | vendor/rustix/src/backend/libc/fs/mod.rs | 10 | ||||
-rw-r--r-- | vendor/rustix/src/backend/libc/fs/syscalls.rs | 111 | ||||
-rw-r--r-- | vendor/rustix/src/backend/libc/fs/types.rs | 97 |
5 files changed, 142 insertions, 119 deletions
diff --git a/vendor/rustix/src/backend/libc/fs/inotify.rs b/vendor/rustix/src/backend/libc/fs/inotify.rs index 05d4d904f..fea2fad06 100644 --- a/vendor/rustix/src/backend/libc/fs/inotify.rs +++ b/vendor/rustix/src/backend/libc/fs/inotify.rs @@ -17,6 +17,9 @@ bitflags! { const CLOEXEC = bitcast!(c::IN_CLOEXEC); /// `IN_NONBLOCK` const NONBLOCK = bitcast!(c::IN_NONBLOCK); + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -71,6 +74,9 @@ bitflags! { const ONESHOT = c::IN_ONESHOT; /// `IN_ONLYDIR` const ONLYDIR = c::IN_ONLYDIR; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -98,22 +104,23 @@ pub fn inotify_add_watch<P: crate::path::Arg>( path: P, flags: WatchFlags, ) -> io::Result<i32> { - let path = path.as_cow_c_str().unwrap(); - // SAFETY: The fd and path we are passing is guaranteed valid by the type - // system. - unsafe { - ret_c_int(c::inotify_add_watch( - borrowed_fd(inot), - c_str(&path), - flags.bits(), - )) - } + path.into_with_c_str(|path| { + // SAFETY: The fd and path we are passing is guaranteed valid by the type + // system. + unsafe { + ret_c_int(c::inotify_add_watch( + borrowed_fd(inot), + c_str(path), + flags.bits(), + )) + } + }) } /// `inotify_rm_watch(self, wd)`—Removes a watch from this inotify /// -/// The watch descriptor provided should have previously been returned -/// by [`inotify_add_watch`] and not previously have been removed. +/// The watch descriptor provided should have previously been returned by +/// [`inotify_add_watch`] and not previously have been removed. #[doc(alias = "inotify_rm_watch")] pub fn inotify_remove_watch(inot: BorrowedFd<'_>, wd: i32) -> io::Result<()> { // Android's `inotify_rm_watch` takes `u32` despite that diff --git a/vendor/rustix/src/backend/libc/fs/makedev.rs b/vendor/rustix/src/backend/libc/fs/makedev.rs index 640d5005b..aa1210283 100644 --- a/vendor/rustix/src/backend/libc/fs/makedev.rs +++ b/vendor/rustix/src/backend/libc/fs/makedev.rs @@ -30,8 +30,8 @@ pub(crate) fn makedev(maj: u32, min: u32) -> Dev { #[cfg(all(target_os = "android", target_pointer_width = "32"))] #[inline] pub(crate) fn makedev(maj: u32, min: u32) -> Dev { - // 32-bit Android's `dev_t` is 32-bit, but its `st_dev` is 64-bit, - // so we do it ourselves. + // 32-bit Android's `dev_t` is 32-bit, but its `st_dev` is 64-bit, so we do + // it ourselves. ((u64::from(maj) & 0xffff_f000_u64) << 32) | ((u64::from(maj) & 0x0000_0fff_u64) << 8) | ((u64::from(min) & 0xffff_ff00_u64) << 12) @@ -86,8 +86,8 @@ pub(crate) fn major(dev: Dev) -> u32 { #[cfg(all(target_os = "android", target_pointer_width = "32"))] #[inline] pub(crate) fn major(dev: Dev) -> u32 { - // 32-bit Android's `dev_t` is 32-bit, but its `st_dev` is 64-bit, - // so we do it ourselves. + // 32-bit Android's `dev_t` is 32-bit, but its `st_dev` is 64-bit, so we do + // it ourselves. (((dev >> 31 >> 1) & 0xffff_f000) | ((dev >> 8) & 0x0000_0fff)) as u32 } @@ -125,8 +125,8 @@ pub(crate) fn minor(dev: Dev) -> u32 { #[cfg(all(target_os = "android", target_pointer_width = "32"))] #[inline] pub(crate) fn minor(dev: Dev) -> u32 { - // 32-bit Android's `dev_t` is 32-bit, but its `st_dev` is 64-bit, - // so we do it ourselves. + // 32-bit Android's `dev_t` is 32-bit, but its `st_dev` is 64-bit, so we do + // it ourselves. (((dev >> 12) & 0xffff_ff00) | (dev & 0x0000_00ff)) as u32 } diff --git a/vendor/rustix/src/backend/libc/fs/mod.rs b/vendor/rustix/src/backend/libc/fs/mod.rs index 17b4da70f..9a0b1d3e5 100644 --- a/vendor/rustix/src/backend/libc/fs/mod.rs +++ b/vendor/rustix/src/backend/libc/fs/mod.rs @@ -1,4 +1,4 @@ -#[cfg(not(any(target_os = "espidf", target_os = "redox")))] +#[cfg(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))] pub(crate) mod dir; #[cfg(linux_kernel)] pub mod inotify; @@ -12,3 +12,11 @@ pub(crate) mod makedev; #[cfg(not(windows))] pub(crate) mod syscalls; pub(crate) mod types; + +// TODO: Fix linux-raw-sys to define ioctl codes for sparc. +#[cfg(all(linux_kernel, any(target_arch = "sparc", target_arch = "sparc64")))] +pub(crate) const EXT4_IOC_RESIZE_FS: crate::ioctl::RawOpcode = 0x8008_6610; + +#[cfg(all(linux_kernel, not(any(target_arch = "sparc", target_arch = "sparc64"))))] +pub(crate) const EXT4_IOC_RESIZE_FS: crate::ioctl::RawOpcode = + linux_raw_sys::ioctl::EXT4_IOC_RESIZE_FS as crate::ioctl::RawOpcode; diff --git a/vendor/rustix/src/backend/libc/fs/syscalls.rs b/vendor/rustix/src/backend/libc/fs/syscalls.rs index 698bf34ad..5df25daa9 100644 --- a/vendor/rustix/src/backend/libc/fs/syscalls.rs +++ b/vendor/rustix/src/backend/libc/fs/syscalls.rs @@ -1,9 +1,9 @@ //! libc syscalls supporting `rustix::fs`. use crate::backend::c; -use crate::backend::conv::{ - borrowed_fd, c_str, ret, ret_c_int, ret_off_t, ret_owned_fd, ret_usize, -}; +#[cfg(any(apple, linux_kernel, feature = "alloc"))] +use crate::backend::conv::ret_usize; +use crate::backend::conv::{borrowed_fd, c_str, ret, ret_c_int, ret_off_t, ret_owned_fd}; use crate::fd::{BorrowedFd, OwnedFd}; use crate::ffi::CStr; #[cfg(apple)] @@ -90,6 +90,7 @@ fn open_via_syscall(path: &CStr, oflags: OFlags, mode: Mode) -> io::Result<Owned target_arch = "aarch64", target_arch = "riscv32", target_arch = "riscv64", + target_arch = "csky", target_arch = "loongarch64" ))] { @@ -101,6 +102,7 @@ fn open_via_syscall(path: &CStr, oflags: OFlags, mode: Mode) -> io::Result<Owned target_arch = "aarch64", target_arch = "riscv32", target_arch = "riscv64", + target_arch = "csky", target_arch = "loongarch64" )))] unsafe { @@ -128,8 +130,8 @@ pub(crate) fn open(path: &CStr, oflags: OFlags, mode: Mode) -> io::Result<OwnedF return open_via_syscall(path, oflags, mode); } - // On these platforms, `mode_t` is `u16` and can't be passed directly to - // a variadic function. + // On these platforms, `mode_t` is `u16` and can't be passed directly to a + // variadic function. #[cfg(any( apple, freebsdlike, @@ -191,8 +193,8 @@ pub(crate) fn openat( return openat_via_syscall(dirfd, path, oflags, mode); } - // On these platforms, `mode_t` is `u16` and can't be passed directly to - // a variadic function. + // On these platforms, `mode_t` is `u16` and can't be passed directly to a + // variadic function. #[cfg(any( apple, freebsdlike, @@ -246,6 +248,7 @@ pub(crate) fn statvfs(filename: &CStr) -> io::Result<StatVfs> { } } +#[cfg(feature = "alloc")] #[inline] pub(crate) fn readlink(path: &CStr, buf: &mut [u8]) -> io::Result<usize> { unsafe { @@ -255,7 +258,7 @@ pub(crate) fn readlink(path: &CStr, buf: &mut [u8]) -> io::Result<usize> { } } -#[cfg(not(target_os = "redox"))] +#[cfg(all(feature = "alloc", not(target_os = "redox")))] #[inline] pub(crate) fn readlinkat( dirfd: BorrowedFd<'_>, @@ -615,7 +618,7 @@ pub(crate) fn lstat(path: &CStr) -> io::Result<Stat> { } } -#[cfg(not(any(target_os = "espidf", target_os = "redox")))] +#[cfg(not(any(target_os = "aix", target_os = "espidf", target_os = "redox")))] pub(crate) fn statat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result<Stat> { // See the comments in `fstat` about using `crate::fs::statx` here. #[cfg(all( @@ -785,9 +788,6 @@ pub(crate) fn utimensat( unsafe { use crate::utils::as_ptr; - // Assert that `Timestamps` has the expected layout. - let _ = core::mem::transmute::<Timestamps, [c::timespec; 2]>(times.clone()); - ret(c::utimensat( borrowed_fd(dirfd), c_str(path), @@ -823,9 +823,6 @@ pub(crate) fn utimensat( // If we have `utimensat`, use it. if let Some(have_utimensat) = utimensat.get() { - // Assert that `Timestamps` has the expected layout. - let _ = core::mem::transmute::<Timestamps, [c::timespec; 2]>(times.clone()); - return ret(have_utimensat( borrowed_fd(dirfd), c_str(path), @@ -1094,9 +1091,6 @@ pub(crate) fn copy_file_range( ) via SYS_copy_file_range -> c::ssize_t } - #[cfg(test)] - assert_eq_size!(c::loff_t, u64); - let mut off_in_val: c::loff_t = 0; let mut off_out_val: c::loff_t = 0; // Silently cast; we'll get `EINVAL` if the value is negative. @@ -1234,9 +1228,9 @@ pub(crate) fn seek(fd: BorrowedFd<'_>, pos: SeekFrom) -> io::Result<u64> { } SeekFrom::End(offset) => (c::SEEK_END, offset), SeekFrom::Current(offset) => (c::SEEK_CUR, offset), - #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))] + #[cfg(any(apple, freebsdlike, linux_kernel, solarish))] SeekFrom::Data(offset) => (c::SEEK_DATA, offset), - #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))] + #[cfg(any(apple, freebsdlike, linux_kernel, solarish))] SeekFrom::Hole(offset) => (c::SEEK_HOLE, offset), }; @@ -1273,6 +1267,14 @@ pub(crate) fn fchmod(fd: BorrowedFd<'_>, mode: Mode) -> io::Result<()> { unsafe { ret(fchmod(borrowed_fd(fd), mode.bits() as c::mode_t)) } } +#[cfg(not(target_os = "wasi"))] +pub(crate) fn chown(path: &CStr, owner: Option<Uid>, group: Option<Gid>) -> io::Result<()> { + unsafe { + let (ow, gr) = crate::ugid::translate_fchown_args(owner, group); + ret(c::chown(c_str(path), ow, gr)) + } +} + #[cfg(linux_kernel)] pub(crate) fn fchown(fd: BorrowedFd<'_>, owner: Option<Uid>, group: Option<Gid>) -> io::Result<()> { // Use `c::syscall` rather than `c::fchown` because some libc @@ -1420,7 +1422,10 @@ fn libc_statvfs_to_statvfs(from: c::statvfs) -> StatVfs { f_files: from.f_files as u64, f_ffree: from.f_ffree as u64, f_favail: from.f_ffree as u64, + #[cfg(not(target_os = "aix"))] f_fsid: from.f_fsid as u64, + #[cfg(target_os = "aix")] + f_fsid: ((from.f_fsid.val[0] as u64) << 32) | from.f_fsid.val[1], f_flag: StatVfsMountFlags::from_bits_retain(from.f_flag as u64), f_namemax: from.f_namemax as u64, } @@ -1453,9 +1458,6 @@ pub(crate) fn futimens(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()> unsafe { use crate::utils::as_ptr; - // Assert that `Timestamps` has the expected layout. - let _ = core::mem::transmute::<Timestamps, [c::timespec; 2]>(times.clone()); - ret(c::futimens(borrowed_fd(fd), as_ptr(times).cast())) } @@ -1480,9 +1482,6 @@ pub(crate) fn futimens(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()> // If we have `futimens`, use it. if let Some(have_futimens) = futimens.get() { - // Assert that `Timestamps` has the expected layout. - let _ = core::mem::transmute::<Timestamps, [c::timespec; 2]>(times.clone()); - return ret(have_futimens(borrowed_fd(fd), as_ptr(times).cast())); } @@ -2049,12 +2048,12 @@ pub(crate) fn fcntl_fullfsync(fd: BorrowedFd<'_>) -> io::Result<()> { } #[cfg(apple)] -pub(crate) fn fcntl_nocache(fd: BorrowedFd, value: bool) -> io::Result<()> { +pub(crate) fn fcntl_nocache(fd: BorrowedFd<'_>, value: bool) -> io::Result<()> { unsafe { ret(c::fcntl(borrowed_fd(fd), c::F_NOCACHE, value as c::c_int)) } } #[cfg(apple)] -pub(crate) fn fcntl_global_nocache(fd: BorrowedFd, value: bool) -> io::Result<()> { +pub(crate) fn fcntl_global_nocache(fd: BorrowedFd<'_>, value: bool) -> io::Result<()> { unsafe { ret(c::fcntl( borrowed_fd(fd), @@ -2420,51 +2419,15 @@ pub(crate) fn fremovexattr(fd: BorrowedFd<'_>, name: &CStr) -> io::Result<()> { } } -#[cfg(linux_kernel)] -#[inline] -pub(crate) fn ioctl_blksszget(fd: BorrowedFd) -> io::Result<u32> { - let mut result = MaybeUninit::<c::c_uint>::uninit(); - unsafe { - ret(c::ioctl(borrowed_fd(fd), c::BLKSSZGET, result.as_mut_ptr()))?; - Ok(result.assume_init() as u32) - } -} - -#[cfg(linux_kernel)] -#[inline] -pub(crate) fn ioctl_blkpbszget(fd: BorrowedFd) -> io::Result<u32> { - let mut result = MaybeUninit::<c::c_uint>::uninit(); - unsafe { - ret(c::ioctl( - borrowed_fd(fd), - c::BLKPBSZGET, - result.as_mut_ptr(), - ))?; - Ok(result.assume_init() as u32) - } -} - -// Sparc lacks `FICLONE`. -#[cfg(all(linux_kernel, not(any(target_arch = "sparc", target_arch = "sparc64"))))] -pub(crate) fn ioctl_ficlone(fd: BorrowedFd<'_>, src_fd: BorrowedFd<'_>) -> io::Result<()> { - unsafe { - ret(c::ioctl( - borrowed_fd(fd), - c::FICLONE as _, - borrowed_fd(src_fd), - )) - } -} - -#[cfg(linux_kernel)] -#[inline] -pub(crate) fn ext4_ioc_resize_fs(fd: BorrowedFd<'_>, blocks: u64) -> io::Result<()> { - // TODO: Fix linux-raw-sys to define ioctl codes for sparc. - #[cfg(any(target_arch = "sparc", target_arch = "sparc64"))] - const EXT4_IOC_RESIZE_FS: u32 = 0x8008_6610; - - #[cfg(not(any(target_arch = "sparc", target_arch = "sparc64")))] - use linux_raw_sys::ioctl::EXT4_IOC_RESIZE_FS; +#[test] +fn test_sizes() { + #[cfg(linux_kernel)] + assert_eq_size!(c::loff_t, u64); - unsafe { ret(c::ioctl(borrowed_fd(fd), EXT4_IOC_RESIZE_FS as _, &blocks)) } + // Assert that `Timestamps` has the expected layout. If we're not fixing + // y2038, libc's type should match ours. If we are, it's smaller. + #[cfg(not(fix_y2038))] + assert_eq_size!([c::timespec; 2], Timestamps); + #[cfg(fix_y2038)] + assert!(core::mem::size_of::<[c::timespec; 2]>() < core::mem::size_of::<Timestamps>()); } diff --git a/vendor/rustix/src/backend/libc/fs/types.rs b/vendor/rustix/src/backend/libc/fs/types.rs index 955bdaa29..cf86861dc 100644 --- a/vendor/rustix/src/backend/libc/fs/types.rs +++ b/vendor/rustix/src/backend/libc/fs/types.rs @@ -20,6 +20,9 @@ bitflags! { /// `F_OK` const EXISTS = c::F_OK; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -73,6 +76,9 @@ bitflags! { /// `AT_STATX_DONT_SYNC` #[cfg(all(target_os = "linux", target_env = "gnu"))] const STATX_DONT_SYNC = bitcast!(c::AT_STATX_DONT_SYNC); + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -86,64 +92,67 @@ bitflags! { #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] pub struct Mode: RawMode { /// `S_IRWXU` - #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(target_os = "espidf"))] const RWXU = c::S_IRWXU as RawMode; /// `S_IRUSR` - #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(target_os = "espidf"))] const RUSR = c::S_IRUSR as RawMode; /// `S_IWUSR` - #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(target_os = "espidf"))] const WUSR = c::S_IWUSR as RawMode; /// `S_IXUSR` - #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(target_os = "espidf"))] const XUSR = c::S_IXUSR as RawMode; /// `S_IRWXG` - #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(target_os = "espidf"))] const RWXG = c::S_IRWXG as RawMode; /// `S_IRGRP` - #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(target_os = "espidf"))] const RGRP = c::S_IRGRP as RawMode; /// `S_IWGRP` - #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(target_os = "espidf"))] const WGRP = c::S_IWGRP as RawMode; /// `S_IXGRP` - #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(target_os = "espidf"))] const XGRP = c::S_IXGRP as RawMode; /// `S_IRWXO` - #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(target_os = "espidf"))] const RWXO = c::S_IRWXO as RawMode; /// `S_IROTH` - #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(target_os = "espidf"))] const ROTH = c::S_IROTH as RawMode; /// `S_IWOTH` - #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(target_os = "espidf"))] const WOTH = c::S_IWOTH as RawMode; /// `S_IXOTH` - #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(target_os = "espidf"))] const XOTH = c::S_IXOTH as RawMode; /// `S_ISUID` - #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(target_os = "espidf"))] const SUID = c::S_ISUID as RawMode; /// `S_ISGID` - #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(target_os = "espidf"))] const SGID = c::S_ISGID as RawMode; /// `S_ISVTX` - #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(target_os = "espidf"))] const SVTX = c::S_ISVTX as RawMode; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -249,6 +258,8 @@ bitflags! { const WRONLY = bitcast!(c::O_WRONLY); /// `O_RDWR` + /// + /// This is not equal to `RDONLY | WRONLY`. It's a distinct flag. const RDWR = bitcast!(c::O_RDWR); /// `O_NOCTTY` @@ -316,6 +327,9 @@ bitflags! { /// `O_EMPTY_PATH` #[cfg(target_os = "freebsd")] const EMPTY_PATH = bitcast!(c::O_EMPTY_PATH); + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -332,6 +346,9 @@ bitflags! { /// `CLONE_NOOWNERCOPY` const NOOWNERCOPY = 2; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -374,6 +391,9 @@ bitflags! { /// `COPYFILE_ALL` const ALL = copyfile::ALL; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -402,6 +422,9 @@ bitflags! { /// `RESOLVE_CACHED` (since Linux 5.12) const CACHED = 0x20; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -421,6 +444,9 @@ bitflags! { /// `RENAME_WHITEOUT` const WHITEOUT = bitcast!(c::RENAME_WHITEOUT); + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -497,6 +523,7 @@ impl FileType { /// Construct a `FileType` from the `d_type` field of a `c::dirent`. #[cfg(not(any( solarish, + target_os = "aix", target_os = "espidf", target_os = "haiku", target_os = "nto", @@ -595,6 +622,9 @@ bitflags! { const HUGE_2GB = c::MFD_HUGE_2GB; /// `MFD_HUGE_16GB` const HUGE_16GB = c::MFD_HUGE_16GB; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -608,17 +638,20 @@ bitflags! { #[repr(transparent)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] pub struct SealFlags: u32 { - /// `F_SEAL_SEAL`. - const SEAL = bitcast!(c::F_SEAL_SEAL); - /// `F_SEAL_SHRINK`. - const SHRINK = bitcast!(c::F_SEAL_SHRINK); - /// `F_SEAL_GROW`. - const GROW = bitcast!(c::F_SEAL_GROW); - /// `F_SEAL_WRITE`. - const WRITE = bitcast!(c::F_SEAL_WRITE); - /// `F_SEAL_FUTURE_WRITE` (since Linux 5.1) - #[cfg(linux_kernel)] - const FUTURE_WRITE = bitcast!(c::F_SEAL_FUTURE_WRITE); + /// `F_SEAL_SEAL`. + const SEAL = bitcast!(c::F_SEAL_SEAL); + /// `F_SEAL_SHRINK`. + const SHRINK = bitcast!(c::F_SEAL_SHRINK); + /// `F_SEAL_GROW`. + const GROW = bitcast!(c::F_SEAL_GROW); + /// `F_SEAL_WRITE`. + const WRITE = bitcast!(c::F_SEAL_WRITE); + /// `F_SEAL_FUTURE_WRITE` (since Linux 5.1) + #[cfg(linux_kernel)] + const FUTURE_WRITE = bitcast!(c::F_SEAL_FUTURE_WRITE); + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -677,6 +710,9 @@ bitflags! { /// `STATX_ALL` const ALL = c::STATX_ALL; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -735,6 +771,9 @@ bitflags! { /// `STATX_ALL` const ALL = 0xfff; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -817,6 +856,9 @@ bitflags! { target_os = "wasi", )))] const UNSHARE_RANGE = bitcast!(c::FALLOC_FL_UNSHARE_RANGE); + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -866,6 +908,9 @@ bitflags! { /// `ST_SYNCHRONOUS` #[cfg(any(linux_kernel, target_os = "emscripten", target_os = "fuchsia"))] const SYNCHRONOUS = c::ST_SYNCHRONOUS as u64; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } |