summaryrefslogtreecommitdiff
path: root/src/fstab-generator/fstab-generator.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-05-02 12:01:29 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-05-04 08:45:07 -0400
commit2e8522767e27d5686206794c69e0aa95da6e798b (patch)
tree33ff13a9602c6f2bec66bc35febfa63c54b75275 /src/fstab-generator/fstab-generator.c
parentbe3a09b7ffe62b52658e77ae4d6638d1b0dae654 (diff)
generators: rename add_{root,usr}_mount to add_{sysroot,sysroot_usr}_mount
This makes it obvious that those functions are only usable in the initramfs. Also, add a warning when noauto, nofail, or automount is used for the root fs, instead of silently ignoring. Using those options would be a sign of significant misconfiguration, and if we bother to check for them, than let's go all the way and complain. Other various small cleanups and reformattings elsewhere.
Diffstat (limited to 'src/fstab-generator/fstab-generator.c')
-rw-r--r--src/fstab-generator/fstab-generator.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 7aee3359e7..664ee2aa6f 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -176,6 +176,7 @@ static int write_idle_timeout(FILE *f, const char *where, const char *opts) {
return 0;
}
+
static int add_mount(
const char *what,
const char *where,
@@ -213,10 +214,14 @@ static int add_mount(
return 0;
if (path_equal(where, "/")) {
- /* The root disk is not an option */
- automount = false;
- noauto = false;
- nofail = false;
+ if (noauto)
+ log_warning("Ignoring \"noauto\" for root device");
+ if (nofail)
+ log_warning("Ignoring \"nofail\" for root device");
+ if (automount)
+ log_warning("Ignoring automount option for root device");
+
+ noauto = nofail = automount = false;
}
name = unit_name_from_path(where, ".mount");
@@ -419,7 +424,7 @@ static int parse_fstab(bool initrd) {
return r;
}
-static int add_root_mount(void) {
+static int add_sysroot_mount(void) {
_cleanup_free_ char *what = NULL;
const char *opts;
@@ -453,7 +458,7 @@ static int add_root_mount(void) {
"/proc/cmdline");
}
-static int add_usr_mount(void) {
+static int add_sysroot_usr_mount(void) {
_cleanup_free_ char *what = NULL;
const char *opts;
@@ -600,9 +605,9 @@ int main(int argc, char *argv[]) {
/* Always honour root= and usr= in the kernel command line if we are in an initrd */
if (in_initrd()) {
- r = add_root_mount();
+ r = add_sysroot_mount();
if (r == 0)
- r = add_usr_mount();
+ r = add_sysroot_usr_mount();
}
/* Honour /etc/fstab only when that's enabled */