aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ramfs/inode.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2013-09-11 17:26:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-11 18:59:37 -0400
commit57f150a58c40cda598c31af8bceb8598f43c3e5f (patch)
treefde3e7fc48c97f0db5b3975fd74e12773f423fe2 /fs/ramfs/inode.c
parent4bbee76bc986af326be0a84ad661000cf89b29f6 (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 'fs/ramfs/inode.c')
-rw-r--r--fs/ramfs/inode.c32
1 files changed, 1 insertions, 31 deletions
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index fb99863598be..39d14659a8d3 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -244,17 +244,6 @@ struct dentry *ramfs_mount(struct file_system_type *fs_type,
244 return mount_nodev(fs_type, flags, data, ramfs_fill_super); 244 return mount_nodev(fs_type, flags, data, ramfs_fill_super);
245} 245}
246 246
247static struct dentry *rootfs_mount(struct file_system_type *fs_type,
248 int flags, const char *dev_name, void *data)
249{
250 static unsigned long once;
251
252 if (test_and_set_bit(0, &once))
253 return ERR_PTR(-ENODEV);
254
255 return mount_nodev(fs_type, flags, data, ramfs_fill_super);
256}
257
258static void ramfs_kill_sb(struct super_block *sb) 247static void ramfs_kill_sb(struct super_block *sb)
259{ 248{
260 kfree(sb->s_fs_info); 249 kfree(sb->s_fs_info);
@@ -267,13 +256,8 @@ static struct file_system_type ramfs_fs_type = {
267 .kill_sb = ramfs_kill_sb, 256 .kill_sb = ramfs_kill_sb,
268 .fs_flags = FS_USERNS_MOUNT, 257 .fs_flags = FS_USERNS_MOUNT,
269}; 258};
270static struct file_system_type rootfs_fs_type = {
271 .name = "rootfs",
272 .mount = rootfs_mount,
273 .kill_sb = kill_litter_super,
274};
275 259
276static int __init init_ramfs_fs(void) 260int __init init_ramfs_fs(void)
277{ 261{
278 static unsigned long once; 262 static unsigned long once;
279 int err; 263 int err;
@@ -292,17 +276,3 @@ static int __init init_ramfs_fs(void)
292 return err; 276 return err;
293} 277}
294module_init(init_ramfs_fs) 278module_init(init_ramfs_fs)
295
296int __init init_rootfs(void)
297{
298 int err = register_filesystem(&rootfs_fs_type);
299
300 if (err)
301 return err;
302
303 err = init_ramfs_fs();
304 if (err)
305 unregister_filesystem(&rootfs_fs_type);
306
307 return err;
308}