]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
basic: New function fstype_is_blockdev_backed for fstypes that need a blockdev
authorYmrDtnJu <YmrDtnJu@users.noreply.github.com>
Sat, 6 Jun 2020 10:42:01 +0000 (12:42 +0200)
committerYmrDtnJu <YmrDtnJu@users.noreply.github.com>
Mon, 8 Jun 2020 17:36:42 +0000 (19:36 +0200)
The function returns true if the specified filesystem requires a block device.

src/basic/mountpoint-util.c
src/basic/mountpoint-util.h

index 0b3587ff5535037c0283feee909542988305fcf4..d4a621c7ae81be32e5a103b976163c7ee61da4e6 100644 (file)
@@ -338,6 +338,16 @@ bool fstype_is_api_vfs(const char *fstype) {
                           "tracefs");
 }
 
+bool fstype_is_blockdev_backed(const char *fstype) {
+        const char *x;
+
+        x = startswith(fstype, "fuse.");
+        if (x)
+                fstype = x;
+
+        return !streq(fstype, "9p") && !fstype_is_network(fstype) && !fstype_is_api_vfs(fstype);
+}
+
 bool fstype_is_ro(const char *fstype) {
         /* All Linux file systems that are necessarily read-only */
         return STR_IN_SET(fstype,
index 5398836fed4642f0d49095723075397d4c7a776f..ab4ed193945c74ecad9d55559e75744db71647ee 100644 (file)
@@ -14,6 +14,7 @@ int path_is_mount_point(const char *path, const char *root, int flags);
 
 bool fstype_is_network(const char *fstype);
 bool fstype_is_api_vfs(const char *fstype);
+bool fstype_is_blockdev_backed(const char *fstype);
 bool fstype_is_ro(const char *fsype);
 bool fstype_can_discard(const char *fstype);
 bool fstype_can_uid_gid(const char *fstype);