The mount_setattr syscall can change attributes of an existing mount.

Signed-off-by: Filip Schauer <[email protected]>
---
 src/PVE/Syscall.pm | 1 +
 src/PVE/Tools.pm   | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/src/PVE/Syscall.pm b/src/PVE/Syscall.pm
index a5753d9..53e0f4b 100644
--- a/src/PVE/Syscall.pm
+++ b/src/PVE/Syscall.pm
@@ -27,6 +27,7 @@ BEGIN {
         renameat2 => &SYS_renameat2,
         open_tree => &SYS_open_tree,
         move_mount => &SYS_move_mount,
+        mount_setattr => &SYS_mount_setattr,
         fsopen => &SYS_fsopen,
         fsconfig => &SYS_fsconfig,
         fsmount => &SYS_fsmount,
diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index d226fb6..5b15874 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -1682,6 +1682,15 @@ sub move_mount($$$$$) {
     );
 }
 
+sub mount_setattr($$$$$$$) {
+    my ($dirfd, $path, $flags, $attr_set, $attr_clr, $propagation, $userns_fd) 
= @_;
+
+    my $attr = pack("Q4", $attr_set, $attr_clr, $propagation, $userns_fd);
+    return 0 ==
+        syscall(&PVE::Syscall::mount_setattr, int($dirfd), $path, int($flags), 
$attr,
+            length($attr));
+}
+
 sub fsopen($$) {
     my ($fsname, $flags) = @_;
     return PVE::Syscall::file_handle_result(syscall(&PVE::Syscall::fsopen, 
$fsname, int($flags)));
-- 
2.47.3




Reply via email to