diff options
author | Rob Landley <rob@landley.net> | 2013-09-11 17:26:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-11 18:59:37 -0400 |
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 <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>
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 @@ | |||
26 | #include <linux/async.h> | 26 | #include <linux/async.h> |
27 | #include <linux/fs_struct.h> | 27 | #include <linux/fs_struct.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/ramfs.h> | ||
29 | 30 | ||
30 | #include <linux/nfs_fs.h> | 31 | #include <linux/nfs_fs.h> |
31 | #include <linux/nfs_fs_sb.h> | 32 | #include <linux/nfs_fs_sb.h> |
@@ -588,3 +589,34 @@ out: | |||
588 | sys_mount(".", "/", NULL, MS_MOVE, NULL); | 589 | sys_mount(".", "/", NULL, MS_MOVE, NULL); |
589 | sys_chroot("."); | 590 | sys_chroot("."); |
590 | } | 591 | } |
592 | |||
593 | static struct dentry *rootfs_mount(struct file_system_type *fs_type, | ||
594 | int flags, const char *dev_name, void *data) | ||
595 | { | ||
596 | static unsigned long once; | ||
597 | |||
598 | if (test_and_set_bit(0, &once)) | ||
599 | return ERR_PTR(-ENODEV); | ||
600 | |||
601 | return mount_nodev(fs_type, flags, data, ramfs_fill_super); | ||
602 | } | ||
603 | |||
604 | static struct file_system_type rootfs_fs_type = { | ||
605 | .name = "rootfs", | ||
606 | .mount = rootfs_mount, | ||
607 | .kill_sb = kill_litter_super, | ||
608 | }; | ||
609 | |||
610 | int __init init_rootfs(void) | ||
611 | { | ||
612 | int err = register_filesystem(&rootfs_fs_type); | ||
613 | |||
614 | if (err) | ||
615 | return err; | ||
616 | |||
617 | err = init_ramfs_fs(); | ||
618 | if (err) | ||
619 | unregister_filesystem(&rootfs_fs_type); | ||
620 | |||
621 | return err; | ||
622 | } | ||