mount_root: convert to ulog() api
[project/fstools.git] / mount_root.c
index a8505fa..3c38a29 100644 (file)
@@ -15,6 +15,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <libubox/ulog.h>
+
 #include "libfstools/libfstools.h"
 #include "libfstools/volume.h"
 
 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 (!v) {
-               v = volume_find("rootfs");
-               volume_init(v);
-               fprintf(stderr, "mounting /dev/root\n");
+       if (!data) {
+               root = volume_find("rootfs");
+               volume_init(root);
+               ULOG_NOTE("mounting /dev/root\n");
                mount("/dev/root", "/", NULL, MS_NOATIME | MS_REMOUNT, 0);
-               return 0;
        }
 
        /*
@@ -45,12 +47,12 @@ start(int argc, char *argv[1])
         */
        extroot_prefix = "";
        if (!mount_extroot()) {
-               fprintf(stderr, "fs-state: switched to extroot\n");
+               ULOG_NOTE("switched to extroot\n");
                return 0;
        }
 
        /* 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:
                /*
@@ -62,11 +64,11 @@ start(int argc, char *argv[1])
 
        case FS_JFFS2:
        case FS_UBIFS:
-               mount_overlay(v);
+               mount_overlay(data);
                break;
 
        case FS_SNAPSHOT:
-               mount_snapshot(v);
+               mount_snapshot(data);
                break;
        }