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>
This commit is contained in:
committed by
Linus Torvalds
parent
4bbee76bc9
commit
57f150a58c
@@ -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 @@ void __init prepare_namespace(void)
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user