From d691ee7ce1d40007d182c243e08a02fdf6611caf Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 15 Nov 2024 21:42:40 +0000 Subject: [PATCH] Add struct and constants for mount_setattr syscall --- libc-test/semver/linux.txt | 13 +++++++++++++ src/unix/linux_like/linux/mod.rs | 24 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index acce49b096d50..013d02e850b22 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -1661,6 +1661,18 @@ MON_6 MON_7 MON_8 MON_9 +MOUNT_ATTR_IDMAP +MOUNT_ATTR_NOATIME +MOUNT_ATTR_NODEV +MOUNT_ATTR_NODIRATIME +MOUNT_ATTR_NOEXEC +MOUNT_ATTR_NOSUID +MOUNT_ATTR_NOSYMFOLLOW +MOUNT_ATTR_RDONLY +MOUNT_ATTR_RELATIME +MOUNT_ATTR_SIZE_VER0 +MOUNT_ATTR_STRICTATIME +MOUNT_ATTR__ATIME MREMAP_FIXED MREMAP_MAYMOVE MSC_CNT @@ -3818,6 +3830,7 @@ mmap64 mmsghdr mntent mount +mount_attr mq_attr mq_close mq_getattr diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 4094374280cae..0fc555f6c56eb 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -1217,6 +1217,15 @@ s! { pub csum_start: ::__u16, pub csum_offset: ::__u16, } + + // linux/mount.h + + pub struct mount_attr { + pub attr_set: ::__u64, + pub attr_clr: ::__u64, + pub propagation: ::__u64, + pub userns_fd: ::__u64, + } } cfg_if! { @@ -5635,6 +5644,21 @@ pub const XDP_TXMD_FLAGS_CHECKSUM: ::__u32 = 1 << 1; pub const XDP_TX_METADATA: ::__u32 = 1 << 1; +// linux/mount.h +pub const MOUNT_ATTR_RDONLY: ::__u64 = 0x00000001; +pub const MOUNT_ATTR_NOSUID: ::__u64 = 0x00000002; +pub const MOUNT_ATTR_NODEV: ::__u64 = 0x00000004; +pub const MOUNT_ATTR_NOEXEC: ::__u64 = 0x00000008; +pub const MOUNT_ATTR__ATIME: ::__u64 = 0x00000070; +pub const MOUNT_ATTR_RELATIME: ::__u64 = 0x00000000; +pub const MOUNT_ATTR_NOATIME: ::__u64 = 0x00000010; +pub const MOUNT_ATTR_STRICTATIME: ::__u64 = 0x00000020; +pub const MOUNT_ATTR_NODIRATIME: ::__u64 = 0x00000080; +pub const MOUNT_ATTR_IDMAP: ::__u64 = 0x00100000; +pub const MOUNT_ATTR_NOSYMFOLLOW: ::__u64 = 0x00200000; + +pub const MOUNT_ATTR_SIZE_VER0: ::c_int = 32; + // elf.h pub const NT_PRSTATUS: ::c_int = 1; pub const NT_PRFPREG: ::c_int = 2;