From af1aa36c617d72e80ff6b268bf927b6642d90823 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Fri, 24 Jun 2022 16:59:19 -0300 Subject: linux: Add mount_setattr It was added on Linux 5.12 (2a1867219c7b27f928e2545782b86daaf9ad50bd) to allow change the properties of a mount or a mount tree using file descriptors which the new mount api is based on. Checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell --- sysdeps/unix/sysv/linux/sys/mount.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'sysdeps/unix/sysv/linux/sys/mount.h') diff --git a/sysdeps/unix/sysv/linux/sys/mount.h b/sysdeps/unix/sysv/linux/sys/mount.h index 534d05b3f5..f965986ba8 100644 --- a/sysdeps/unix/sysv/linux/sys/mount.h +++ b/sysdeps/unix/sysv/linux/sys/mount.h @@ -23,6 +23,8 @@ #include #include +#include +#include #include #define BLOCK_SIZE 1024 @@ -155,6 +157,17 @@ enum #define MOUNT_ATTR_NOSYMFOLLOW 0x00200000 /* Do not follow symlinks. */ +/* For mount_setattr. */ +struct mount_attr +{ + uint64_t attr_set; + uint64_t attr_clr; + uint64_t propagation; + uint64_t userns_fd; +}; + +#define MOUNT_ATTR_SIZE_VER0 32 /* sizeof first published struct */ + /* move_mount flags. */ #define MOVE_MOUNT_F_SYMLINKS 0x00000001 /* Follow symlinks on from path */ #define MOVE_MOUNT_F_AUTOMOUNTS 0x00000002 /* Follow automounts on from path */ @@ -240,6 +253,15 @@ extern int fspick (int __dfd, const char *__path, unsigned int __flags) extern int open_tree (int __dfd, const char *__filename, unsigned int __flags) __THROW; +/* Change the mount properties of the mount or an entire mount tree. If + PATH is a relative pathname, then it is interpreted relative to the + directory referred to by the file descriptor dirfd. Otherwise if DFD is + the special value AT_FDCWD then PATH is interpreted relative to the current + working directory of the calling process. */ +extern int mount_setattr (int __dfd, const char *__path, unsigned int __flags, + struct mount_attr *__uattr, size_t __usize) + __THROW; + __END_DECLS #endif /* _SYS_MOUNT_H */ -- cgit v1.2.3-70-g09d2