chiark / gitweb /
fstab-generator: don't accept missing root=, but accept root=none
authorTobias Hunger <tobias.hunger@gmail.com>
Tue, 24 Mar 2015 23:05:38 +0000 (00:05 +0100)
committerTom Gundersen <teg@jklm.no>
Tue, 24 Mar 2015 23:00:46 +0000 (00:00 +0100)
And other non-device entries (like fstab does).

Mount whatever the user asked to be mounted on / on the kernel
command line. Do less sanity check and do *not* bail out
when the mount device looks strange or does not exist.

This basically makes the changes for deviceless filesystems
from yesterday unnecessary and is in line with what we do for
filesystems set up in fstab.

Remove some code that is now dead (reverting fb02a2775a65 and
b0438462).

[tomegun:
  - change patch title/description a bit.
  - don't touch the /usr logic, that would be a separate change and
    we don't currently have a convincing use-case for that.
  - don't bail out on /sys ro. This only makes sense in containers,
    where we would not be doing this anyway. If there is a use-case
    we could consider that as a separate patch.]

src/fstab-generator/fstab-generator.c
src/shared/generator.c
src/shared/util.c
src/shared/util.h

index 77c97fdb2970b3878cc4d4cd45326a8997b3e075..cd1478e54dcaa70e48fe88c3220c68952bf81d0c 100644 (file)
@@ -397,22 +397,15 @@ static int add_root_mount(void) {
         _cleanup_free_ char *what = NULL;
         const char *opts;
 
         _cleanup_free_ char *what = NULL;
         const char *opts;
 
-        if (fstype_is_deviceless(arg_root_fstype)) {
-                if (free_and_strdup(&what, arg_root_what) < 0)
-                        return log_oom();
-        } else {
-                if (isempty(arg_root_what)) {
-                        log_debug("Could not find a root= entry on the kernel command line.");
-                        return 0;
-                }
-
-                what = fstab_node_to_udev_node(arg_root_what);
-                if (!path_is_absolute(what)) {
-                        log_debug("Skipping entry what=%s where=/sysroot type=%s", what, strna(arg_root_fstype));
-                        return 0;
-                }
+        if (isempty(arg_root_what)) {
+                log_debug("Could not find a root= entry on the kernel command line.");
+                return 0;
         }
 
         }
 
+        what = fstab_node_to_udev_node(arg_root_what);
+        if (!what)
+                log_oom();
+
         if (!arg_root_options)
                 opts = arg_root_rw > 0 ? "rw" : "ro";
         else if (arg_root_rw >= 0 ||
         if (!arg_root_options)
                 opts = arg_root_rw > 0 ? "rw" : "ro";
         else if (arg_root_rw >= 0 ||
@@ -426,7 +419,7 @@ static int add_root_mount(void) {
                          "/sysroot",
                          arg_root_fstype,
                          opts,
                          "/sysroot",
                          arg_root_fstype,
                          opts,
-                         1,
+                         is_device_path(what) ? 1 : 0,
                          false,
                          false,
                          false,
                          false,
                          false,
                          false,
index c348ca2e04ed8189369a40ffaaaa531ce9d6bd37..569b25bb7c882ded2e3863ec6b7fd4a0d2826f98 100644 (file)
@@ -42,11 +42,6 @@ int generator_write_fsck_deps(
         assert(what);
         assert(where);
 
         assert(what);
         assert(where);
 
-        if (fstype_is_deviceless(fstype)) {
-                log_debug("Not checking deviceless filesystem \"%s\".", fstype);
-                return 0;
-        }
-
         if (!is_device_path(what)) {
                 log_warning("Checking was requested for \"%s\", but it is not a device.", what);
                 return 0;
         if (!is_device_path(what)) {
                 log_warning("Checking was requested for \"%s\", but it is not a device.", what);
                 return 0;
index 2d50f73dc42ff23af2b9a71e7c246cc6d8d6b9c1..ad548da82ab7663d0cda69b3e5d291c8acefb712 100644 (file)
@@ -1713,35 +1713,6 @@ bool fstype_is_network(const char *fstype) {
         return nulstr_contains(table, fstype);
 }
 
         return nulstr_contains(table, fstype);
 }
 
-bool fstype_is_deviceless(const char *fstype) {
-        static const char table[] =
-                "autofs\0"
-                "bdev\0"
-                "cgroup\0"
-                "configfs\0"
-                "cpuset\0"
-                "debugfs\0"
-                "devpts\0"
-                "devtmpfs\0"
-                "efivarfs\0"
-                "hugetlbfs\0"
-                "mqueue\0"
-                "overlayfs\0"
-                "pipefs\0"
-                "proc\0"
-                "pstore\0"
-                "ramfs\0"
-                "rootfs\0"
-                "rpc_pipefs\0"
-                "securityfs\0"
-                "sockfs\0"
-                "sysfs\0"
-                "tmpfs\0";
-
-        return !isempty(fstype) && (
-                nulstr_contains(table, fstype) || fstype_is_network(fstype));
-}
-
 int chvt(int vt) {
         _cleanup_close_ int fd;
 
 int chvt(int vt) {
         _cleanup_close_ int fd;
 
index b5f44b8a1fbb5ecbccad7db3c45ef2e1678cb09d..29e85bb7e14fb7a2dcb56d520b2173fedcd8764a 100644 (file)
@@ -409,7 +409,6 @@ int fd_cloexec(int fd, bool cloexec);
 int close_all_fds(const int except[], unsigned n_except);
 
 bool fstype_is_network(const char *fstype);
 int close_all_fds(const int except[], unsigned n_except);
 
 bool fstype_is_network(const char *fstype);
-bool fstype_is_deviceless(const char *fstype);
 
 int chvt(int vt);
 
 
 int chvt(int vt);