diff options
| author | Rob Landley <[email protected]> | 2013-09-11 14:26:10 -0700 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2013-09-11 15:59:37 -0700 |
| commit | 57f150a58c40cda598c31af8bceb8598f43c3e5f (patch) | |
| tree | fde3e7fc48c97f0db5b3975fd74e12773f423fe2 /init | |
| parent | 4bbee76bc986af326be0a84ad661000cf89b29f6 (diff) | |
initmpfs: move rootfs code from fs/ramfs/ to init/
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 <[email protected]>
Cc: Jeff Layton <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Stephen Warren <[email protected]>
Cc: Rusty Russell <[email protected]>
Cc: Jim Cromie <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Alexander Viro <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'init')
| -rw-r--r-- | init/do_mounts.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/init/do_mounts.c b/init/do_mounts.c index 816014c4627e..5d8d48fd0ee4 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -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; +} |