]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
initmpfs: move rootfs code from fs/ramfs/ to init/
authorRob Landley <rob@landley.net>
Wed, 11 Sep 2013 21:26:10 +0000 (14:26 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Sep 2013 22:59:37 +0000 (15:59 -0700)
When the rootfs code was a wrapper around ramfs, having them in the same
file made sense.  Now that it can wrap another filesystem type, move it in
with the init code instead.

This also allows a subsequent patch to access rootfstype= command line
arg.

Signed-off-by: Rob Landley <rob@landley.net>
Cc: Jeff Layton <jlayton@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Jim Cromie <jim.cromie@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/namespace.c
fs/ramfs/inode.c
include/linux/init.h
include/linux/ramfs.h
init/do_mounts.c

index 25845d1b300b33d84cdd1eb19edc173298c7f168..da5c494834306178dc9efd3b3826d1b7f0e0d17b 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/security.h>
 #include <linux/idr.h>
 #include <linux/acct.h>                /* acct_auto_close_mnt */
-#include <linux/ramfs.h>       /* init_rootfs */
+#include <linux/init.h>                /* init_rootfs */
 #include <linux/fs_struct.h>   /* get_fs_root et.al. */
 #include <linux/fsnotify.h>    /* fsnotify_vfsmount_delete */
 #include <linux/uaccess.h>
index fb99863598be230b53a12a27dc898271fb1c906e..39d14659a8d3e47b8171f5e1d840d574802edba0 100644 (file)
@@ -244,17 +244,6 @@ struct dentry *ramfs_mount(struct file_system_type *fs_type,
        return mount_nodev(fs_type, flags, data, ramfs_fill_super);
 }
 
-static struct dentry *rootfs_mount(struct file_system_type *fs_type,
-       int flags, const char *dev_name, void *data)
-{
-       static unsigned long once;
-
-       if (test_and_set_bit(0, &once))
-               return ERR_PTR(-ENODEV);
-
-       return mount_nodev(fs_type, flags, data, ramfs_fill_super);
-}
-
 static void ramfs_kill_sb(struct super_block *sb)
 {
        kfree(sb->s_fs_info);
@@ -267,13 +256,8 @@ static struct file_system_type ramfs_fs_type = {
        .kill_sb        = ramfs_kill_sb,
        .fs_flags       = FS_USERNS_MOUNT,
 };
-static struct file_system_type rootfs_fs_type = {
-       .name           = "rootfs",
-       .mount          = rootfs_mount,
-       .kill_sb        = kill_litter_super,
-};
 
-static int __init init_ramfs_fs(void)
+int __init init_ramfs_fs(void)
 {
        static unsigned long once;
        int err;
@@ -292,17 +276,3 @@ static int __init init_ramfs_fs(void)
        return err;
 }
 module_init(init_ramfs_fs)
-
-int __init init_rootfs(void)
-{
-       int err = register_filesystem(&rootfs_fs_type);
-
-       if (err)
-               return err;
-
-       err = init_ramfs_fs();
-       if (err)
-               unregister_filesystem(&rootfs_fs_type);
-
-       return err;
-}
index e73f2b708525d06046811febe8ca490e93d6ab31..f1c27a71d03c9ee03754f882cd738d90d58ac25b 100644 (file)
@@ -153,6 +153,7 @@ extern unsigned int reset_devices;
 void setup_arch(char **);
 void prepare_namespace(void);
 void __init load_default_modules(void);
+int __init init_rootfs(void);
 
 extern void (*late_time_init)(void);
 
index 69e37c2d1ea556fb990f5d1c8cebd9fee39f8ca7..753207c8ce204fe11eab92f43d6c04b25e5ee753 100644 (file)
@@ -25,7 +25,7 @@ extern int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma);
 
 extern const struct file_operations ramfs_file_operations;
 extern const struct vm_operations_struct generic_file_vm_ops;
-extern int __init init_rootfs(void);
+extern int __init init_ramfs_fs(void);
 
 int ramfs_fill_super(struct super_block *sb, void *data, int silent);
 
index 816014c4627ee2f4adb7c8cf7ef53e6083de16fc..5d8d48fd0ee4cd792ae5accbad76d5804831511c 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/async.h>
 #include <linux/fs_struct.h>
 #include <linux/slab.h>
+#include <linux/ramfs.h>
 
 #include <linux/nfs_fs.h>
 #include <linux/nfs_fs_sb.h>
@@ -588,3 +589,34 @@ out:
        sys_mount(".", "/", NULL, MS_MOVE, NULL);
        sys_chroot(".");
 }
+
+static struct dentry *rootfs_mount(struct file_system_type *fs_type,
+       int flags, const char *dev_name, void *data)
+{
+       static unsigned long once;
+
+       if (test_and_set_bit(0, &once))
+               return ERR_PTR(-ENODEV);
+
+       return mount_nodev(fs_type, flags, data, ramfs_fill_super);
+}
+
+static struct file_system_type rootfs_fs_type = {
+       .name           = "rootfs",
+       .mount          = rootfs_mount,
+       .kill_sb        = kill_litter_super,
+};
+
+int __init init_rootfs(void)
+{
+       int err = register_filesystem(&rootfs_fs_type);
+
+       if (err)
+               return err;
+
+       err = init_ramfs_fs();
+       if (err)
+               unregister_filesystem(&rootfs_fs_type);
+
+       return err;
+}