Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vfs: Convert romfs to use the new mount API

Convert the romfs filesystem to the new internal mount API as the old
one will be obsoleted and removed. This allows greater flexibility in
communication of mount parameters between userspace, the VFS and the
filesystem.

See Documentation/filesystems/mount_api.txt for more information.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-mtd@lists.infradead.org
cc: linux-block@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by

David Howells and committed by
Al Viro
b9417599 43ce4c1f

+28 -18
+28 -18
fs/romfs/super.c
··· 65 65 #include <linux/slab.h> 66 66 #include <linux/init.h> 67 67 #include <linux/blkdev.h> 68 - #include <linux/parser.h> 68 + #include <linux/fs_context.h> 69 69 #include <linux/mount.h> 70 70 #include <linux/namei.h> 71 71 #include <linux/statfs.h> ··· 423 423 /* 424 424 * remounting must involve read-only 425 425 */ 426 - static int romfs_remount(struct super_block *sb, int *flags, char *data) 426 + static int romfs_reconfigure(struct fs_context *fc) 427 427 { 428 - sync_filesystem(sb); 429 - *flags |= SB_RDONLY; 428 + sync_filesystem(fc->root->d_sb); 429 + fc->sb_flags |= SB_RDONLY; 430 430 return 0; 431 431 } 432 432 ··· 434 434 .alloc_inode = romfs_alloc_inode, 435 435 .free_inode = romfs_free_inode, 436 436 .statfs = romfs_statfs, 437 - .remount_fs = romfs_remount, 438 437 }; 439 438 440 439 /* ··· 456 457 /* 457 458 * fill in the superblock 458 459 */ 459 - static int romfs_fill_super(struct super_block *sb, void *data, int silent) 460 + static int romfs_fill_super(struct super_block *sb, struct fs_context *fc) 460 461 { 461 462 struct romfs_super_block *rsb; 462 463 struct inode *root; ··· 503 504 504 505 if (rsb->word0 != ROMSB_WORD0 || rsb->word1 != ROMSB_WORD1 || 505 506 img_size < ROMFH_SIZE) { 506 - if (!silent) 507 - pr_warn("VFS: Can't find a romfs filesystem on dev %s.\n", 507 + if (!(fc->sb_flags & SB_SILENT)) 508 + errorf(fc, "VFS: Can't find a romfs filesystem on dev %s.\n", 508 509 sb->s_id); 509 510 goto error_rsb_inval; 510 511 } ··· 517 518 storage = sb->s_mtd ? "MTD" : "the block layer"; 518 519 519 520 len = strnlen(rsb->name, ROMFS_MAXFN); 520 - if (!silent) 521 + if (!(fc->sb_flags & SB_SILENT)) 521 522 pr_notice("Mounting image '%*.*s' through %s\n", 522 523 (unsigned) len, (unsigned) len, rsb->name, storage); 523 524 ··· 547 548 /* 548 549 * get a superblock for mounting 549 550 */ 550 - static struct dentry *romfs_mount(struct file_system_type *fs_type, 551 - int flags, const char *dev_name, 552 - void *data) 551 + static int romfs_get_tree(struct fs_context *fc) 553 552 { 554 - struct dentry *ret = ERR_PTR(-EINVAL); 553 + int ret = -EINVAL; 555 554 556 555 #ifdef CONFIG_ROMFS_ON_MTD 557 - ret = mount_mtd(fs_type, flags, dev_name, data, romfs_fill_super); 556 + ret = get_tree_mtd(fc, romfs_fill_super); 558 557 #endif 559 558 #ifdef CONFIG_ROMFS_ON_BLOCK 560 - if (ret == ERR_PTR(-EINVAL)) 561 - ret = mount_bdev(fs_type, flags, dev_name, data, 562 - romfs_fill_super); 559 + if (ret == -EINVAL) 560 + ret = get_tree_bdev(fc, romfs_fill_super); 563 561 #endif 564 562 return ret; 563 + } 564 + 565 + static const struct fs_context_operations romfs_context_ops = { 566 + .get_tree = romfs_get_tree, 567 + .reconfigure = romfs_reconfigure, 568 + }; 569 + 570 + /* 571 + * Set up the filesystem mount context. 572 + */ 573 + static int romfs_init_fs_context(struct fs_context *fc) 574 + { 575 + fc->ops = &romfs_context_ops; 576 + return 0; 565 577 } 566 578 567 579 /* ··· 597 587 static struct file_system_type romfs_fs_type = { 598 588 .owner = THIS_MODULE, 599 589 .name = "romfs", 600 - .mount = romfs_mount, 590 + .init_fs_context = romfs_init_fs_context, 601 591 .kill_sb = romfs_kill_sb, 602 592 .fs_flags = FS_REQUIRES_DEV, 603 593 };