]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - init/initramfs.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile
[karo-tx-linux.git] / init / initramfs.c
index 981f286c1d16ab57dff10cb10099f573b62f07b9..8a532050043f5f804f06ddbf980e54965c9055de 100644 (file)
@@ -312,10 +312,10 @@ static int __init maybe_link(void)
 
 static void __init clean_path(char *path, umode_t fmode)
 {
-       struct stat st;
+       struct kstat st;
 
-       if (!sys_newlstat(path, &st) && (st.st_mode ^ fmode) & S_IFMT) {
-               if (S_ISDIR(st.st_mode))
+       if (!vfs_lstat(path, &st) && (st.mode ^ fmode) & S_IFMT) {
+               if (S_ISDIR(st.mode))
                        sys_rmdir(path);
                else
                        sys_unlink(path);
@@ -581,13 +581,13 @@ static void __init clean_rootfs(void)
        num = sys_getdents64(fd, dirp, BUF_SIZE);
        while (num > 0) {
                while (num > 0) {
-                       struct stat st;
+                       struct kstat st;
                        int ret;
 
-                       ret = sys_newlstat(dirp->d_name, &st);
+                       ret = vfs_lstat(dirp->d_name, &st);
                        WARN_ON_ONCE(ret);
                        if (!ret) {
-                               if (S_ISDIR(st.st_mode))
+                               if (S_ISDIR(st.mode))
                                        sys_rmdir(dirp->d_name);
                                else
                                        sys_unlink(dirp->d_name);
@@ -608,10 +608,12 @@ static void __init clean_rootfs(void)
 
 static int __init populate_rootfs(void)
 {
+       /* Load the built in initramfs */
        char *err = unpack_to_rootfs(__initramfs_start, __initramfs_size);
        if (err)
                panic("%s", err); /* Failed to decompress INTERNAL initramfs */
-       if (initrd_start) {
+       /* If available load the bootloader supplied initrd */
+       if (initrd_start && !IS_ENABLED(CONFIG_INITRAMFS_FORCE)) {
 #ifdef CONFIG_BLK_DEV_RAM
                int fd;
                printk(KERN_INFO "Trying to unpack rootfs image as initramfs...\n");
@@ -640,6 +642,7 @@ static int __init populate_rootfs(void)
                        free_initrd();
                }
        done:
+               /* empty statement */;
 #else
                printk(KERN_INFO "Unpacking initramfs...\n");
                err = unpack_to_rootfs((char *)initrd_start,
@@ -648,13 +651,14 @@ static int __init populate_rootfs(void)
                        printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err);
                free_initrd();
 #endif
-               flush_delayed_fput();
-               /*
-                * Try loading default modules from initramfs.  This gives
-                * us a chance to load before device_initcalls.
-                */
-               load_default_modules();
        }
+       flush_delayed_fput();
+       /*
+        * Try loading default modules from initramfs.  This gives
+        * us a chance to load before device_initcalls.
+        */
+       load_default_modules();
+
        return 0;
 }
 rootfs_initcall(populate_rootfs);