summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-07-02 16:46:20 +0200
committerSimon Rettberg2019-07-02 16:46:20 +0200
commit7a96db56703b18139b19ba46ba7020a219d85541 (patch)
tree0b98df7c40d8f7b8b80b4ab2d7445e38f36a6cb1
parentExclude functions with wrong prefix; list available functions (diff)
downloadslx-tools-7a96db56703b18139b19ba46ba7020a219d85541.tar.gz
slx-tools-7a96db56703b18139b19ba46ba7020a219d85541.tar.xz
slx-tools-7a96db56703b18139b19ba46ba7020a219d85541.zip
Add fs_path_ismountpoint
-rw-r--r--modules/fs/path.inc6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/fs/path.inc b/modules/fs/path.inc
index f3a041b..c067049 100644
--- a/modules/fs/path.inc
+++ b/modules/fs/path.inc
@@ -32,6 +32,12 @@ fs_path_gettype() {
awk '$2 == "'"$_mp"'" {print $3}' '/proc/mounts'
}
+# Returns true if the given path is the root of a mount point
+# Does not normalize!
+fs_path_ismountpoint() {
+ grep -Fq " $1 " /proc/mounts
+}
+
# Helper to check whether given directory resides in RAM, either
# by being mounted as tmpfs or not mounted at all in which case
# we assume the same. Returns 0 if so, 1 if otherwise backed,