5
0
mirror of git://git.proxmox.com/git/pve-common.git synced 2025-01-25 18:03:33 +03:00

Tools: add new mount api wrappers

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-11-08 11:06:14 +01:00 committed by Thomas Lamprecht
parent 88c2babd16
commit 76c5fee814

View 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;