[pve-devel] [PATCH] This function checks if a moutpoint is mounted

Wolfgang Link w.link at proxmox.com
Thu Sep 3 08:52:16 CEST 2015


---
 src/PVE/Tools.pm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index 4f7efd1..42318ce 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -40,6 +40,7 @@ safe_print
 trim
 extract_param
 read_proc_mounts
+is_mounted
 );
 
 my $pvelogdir = "/var/log/pve";
@@ -1130,4 +1131,16 @@ sub read_proc_mounts {
     return $data;
 }
 
+sub is_mounted {
+    my ($mountpoint) = @_;
+
+    my $mountdata = read_proc_mounts();
+
+    if ($mountdata =~ m/$mountpoint /) {
+	return 1;
+    } else {
+	return 0;
+    }
+}
+
 1;
-- 
2.1.4





More information about the pve-devel mailing list