]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemd-mount: allow to specify an arbitrary string for arg_mount_what when vfs is... 6721/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 4 Sep 2017 01:55:51 +0000 (10:55 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 4 Sep 2017 01:55:51 +0000 (10:55 +0900)
Fixes #6591.

src/basic/mount-util.c
src/basic/mount-util.h
src/mount/mount-tool.c

index 7b9400b47cad450c347e0fb4c6ab0d58c287ea8d..cff44116c884aca2aadc144a91f534f4cc84176e 100644 (file)
@@ -552,6 +552,32 @@ bool fstype_is_network(const char *fstype) {
         return nulstr_contains(table, fstype);
 }
 
+bool fstype_is_api_vfs(const char *fstype) {
+        static const char table[] =
+                "autofs\0"
+                "bpf\0"
+                "cgroup\0"
+                "cgroup2\0"
+                "configfs\0"
+                "cpuset\0"
+                "debugfs\0"
+                "devpts\0"
+                "devtmpfs\0"
+                "efivarfs\0"
+                "hugetlbfs\0"
+                "mqueue\0"
+                "proc\0"
+                "pstore\0"
+                "ramfs\0"
+                "securityfs\0"
+                "sysfs\0"
+                "tmpfs\0"
+                "tracefs\0"
+                ;
+
+        return nulstr_contains(table, fstype);
+}
+
 int repeat_unmount(const char *path, int flags) {
         bool done = false;
 
index 2e24a184c5351fed13408eac725243a4893be365..70af11c2ff0a86da93f66ccade8bf60aefca5e70 100644 (file)
@@ -44,6 +44,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, endmntent);
 #define _cleanup_endmntent_ _cleanup_(endmntentp)
 
 bool fstype_is_network(const char *fstype);
+bool fstype_is_api_vfs(const char *fstype);
 
 union file_handle_union {
         struct file_handle handle;
index 10bb5dda63acd5a0f8549ff851afc656ad299099..3c974adddad84370e71096709c191533e1512e5e 100644 (file)
@@ -30,6 +30,7 @@
 #include "fd-util.h"
 #include "fileio.h"
 #include "fstab-util.h"
+#include "mount-util.h"
 #include "pager.h"
 #include "parse-util.h"
 #include "path-util.h"
@@ -330,7 +331,12 @@ static int parse_argv(int argc, char *argv[]) {
                         return -EINVAL;
                 }
 
-                if (arg_transport == BUS_TRANSPORT_LOCAL) {
+                if (arg_mount_type && (fstype_is_api_vfs(arg_mount_type) || fstype_is_network(arg_mount_type))) {
+                        arg_mount_what = strdup(argv[optind]);
+                        if (!arg_mount_what)
+                                return log_oom();
+
+                } else if (arg_transport == BUS_TRANSPORT_LOCAL) {
                         _cleanup_free_ char *u = NULL, *p = NULL;
 
                         u = fstab_node_to_udev_node(argv[optind]);