mount_root: try extroot even without mtd volume
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 17 Feb 2015 18:18:27 +0000 (19:18 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 17 Feb 2015 18:18:29 +0000 (19:18 +0100)
This is a precondition for supporting external overlays on ext4 root fs.
Also rename volume pointer variables for better clarity.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
mount_root.c

index a8505fa..cc39b44 100644 (file)
 static int
 start(int argc, char *argv[1])
 {
 static int
 start(int argc, char *argv[1])
 {
-       struct volume *v = volume_find("rootfs_data");
+       struct volume *root;
+       struct volume *data = volume_find("rootfs_data");
 
        if (!getenv("PREINIT"))
                return -1;
 
 
        if (!getenv("PREINIT"))
                return -1;
 
-       if (!v) {
-               v = volume_find("rootfs");
-               volume_init(v);
+       if (!data) {
+               root = volume_find("rootfs");
+               volume_init(root);
                fprintf(stderr, "mounting /dev/root\n");
                mount("/dev/root", "/", NULL, MS_NOATIME | MS_REMOUNT, 0);
                fprintf(stderr, "mounting /dev/root\n");
                mount("/dev/root", "/", NULL, MS_NOATIME | MS_REMOUNT, 0);
-               return 0;
        }
 
        /*
        }
 
        /*
@@ -50,7 +50,7 @@ start(int argc, char *argv[1])
        }
 
        /* There isn't extroot, so just try to mount "rootfs_data" */
        }
 
        /* There isn't extroot, so just try to mount "rootfs_data" */
-       switch (volume_identify(v)) {
+       switch (volume_identify(data)) {
        case FS_NONE:
        case FS_DEADCODE:
                /*
        case FS_NONE:
        case FS_DEADCODE:
                /*
@@ -62,11 +62,11 @@ start(int argc, char *argv[1])
 
        case FS_JFFS2:
        case FS_UBIFS:
 
        case FS_JFFS2:
        case FS_UBIFS:
-               mount_overlay(v);
+               mount_overlay(data);
                break;
 
        case FS_SNAPSHOT:
                break;
 
        case FS_SNAPSHOT:
-               mount_snapshot(v);
+               mount_snapshot(data);
                break;
        }
 
                break;
        }