summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYmrDtnJu <YmrDtnJu@users.noreply.github.com>2020-06-06 12:42:01 +0200
committerYmrDtnJu <YmrDtnJu@users.noreply.github.com>2020-06-08 19:36:42 +0200
commitac2474e4ffea1927a24d0cec878d93cb854e80b0 (patch)
treeb16a4906536064511ba077d2eba452a7c23bace0
parent639375e0b6bfaf20923560c767f1b9eab79e9401 (diff)
downloadsystemd-ac2474e4ffea1927a24d0cec878d93cb854e80b0.tar.gz
basic: New function fstype_is_blockdev_backed for fstypes that need a blockdev
The function returns true if the specified filesystem requires a block device.
-rw-r--r--src/basic/mountpoint-util.c10
-rw-r--r--src/basic/mountpoint-util.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c
index 0b3587ff55..d4a621c7ae 100644
--- a/src/basic/mountpoint-util.c
+++ b/src/basic/mountpoint-util.c
@@ -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,
diff --git a/src/basic/mountpoint-util.h b/src/basic/mountpoint-util.h
index 5398836fed..ab4ed19394 100644
--- a/src/basic/mountpoint-util.h
+++ b/src/basic/mountpoint-util.h
@@ -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);