]> git.proxmox.com Git - pve-common.git/commitdiff
Tools: add new mount api wrappers
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 8 Nov 2019 10:06:14 +0000 (11:06 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 11 Nov 2019 16:09:56 +0000 (17:09 +0100)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/Tools.pm

index 801977d8678125e7df6e0320988a4400dbade7ef..02c28867f0c2d4ec038d0115063eb2895549372b 100644 (file)
@@ -1696,5 +1696,70 @@ sub array_intersect {
     return $return_arr;
 }
 
+sub open_tree($$$) {
+    my ($dfd, $pathname, $flags) = @_;
+    return PVE::Syscall::file_handle_result(syscall(
+       &PVE::Syscall::open_tree,
+       $dfd,
+       $pathname,
+       $flags,
+    ));
+}
+
+sub move_mount($$$$$) {
+    my ($from_dirfd, $from_pathname, $to_dirfd, $to_pathname, $flags) = @_;
+    return 0 == syscall(
+       &PVE::Syscall::move_mount,
+       $from_dirfd,
+       $from_pathname,
+       $to_dirfd,
+       $to_pathname,
+       $flags,
+    );
+}
+
+sub fsopen($$) {
+    my ($fsname, $flags) = @_;
+    return PVE::Syscall::file_handle_result(syscall(&PVE::Syscall::fsopen, $fsname, $flags));
+}
+
+sub fsmount($$$) {
+    my ($fd, $flags, $mount_attrs) = @_;
+    return PVE::Syscall::file_handle_result(syscall(
+       &PVE::Syscall::fsmount,
+       $fd,
+       $flags,
+       $mount_attrs,
+    ));
+}
+
+sub fspick($$$) {
+    my ($dirfd, $pathname, $flags) = @_;
+    return PVE::Syscall::file_handle_result(syscall(
+       &PVE::Syscall::fspick,
+       $dirfd,
+       $pathname,
+       $flags,
+    ));
+}
+
+sub fsconfig($$$$$) {
+    my ($fd, $command, $key, $value, $aux) = @_;
+    return 0 == syscall(&PVE::Syscall::fsconfig, $fd, $command, $key, $value, $aux);
+}
+
+# "raw" mount, old api, not for generic use (as it does not invoke any helpers).
+# use for lower level stuff such as bind/remount/... or simple tmpfs mounts
+sub mount($$$$$) {
+    my ($source, $target, $filesystemtype, $mountflags, $data) = @_;
+    return 0 == syscall(
+       &PVE::Syscall::mount,
+       $source,
+       $target,
+       $filesystemtype,
+       $mountflags,
+       $data,
+    );
+}
 
 1;