diff options
author | Eric Sandeen <sandeen@redhat.com> | 2024-03-02 00:04:31 +0100 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2024-03-26 09:04:53 +0100 |
commit | b01e1a6359df16d432bfdfb31b04da78236f45b8 (patch) | |
tree | 2135fecb56eef87082a0eb0940ae3aa3379e78e5 /fs/freevxfs | |
parent | qnx6: convert qnx6 to use the new mount api (diff) | |
download | linux-b01e1a6359df16d432bfdfb31b04da78236f45b8.tar.xz linux-b01e1a6359df16d432bfdfb31b04da78236f45b8.zip |
freevxfs: Convert freevxfs to the new mount API.
Convert the freevxfs filesystem to the new mount API.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Link: https://lore.kernel.org/r/b0d1a423-4b8e-4bc1-a021-a1078aee915f@redhat.com
Tested-by: Krzysztof Błaszkowski <kb@sysmikro.com.pl>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/freevxfs')
-rw-r--r-- | fs/freevxfs/vxfs_super.c | 69 |
1 files changed, 40 insertions, 29 deletions
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c index 42e03b6b1cc7..fabe60778658 100644 --- a/fs/freevxfs/vxfs_super.c +++ b/fs/freevxfs/vxfs_super.c @@ -17,7 +17,7 @@ #include <linux/slab.h> #include <linux/stat.h> #include <linux/vfs.h> -#include <linux/mount.h> +#include <linux/fs_context.h> #include "vxfs.h" #include "vxfs_extern.h" @@ -91,10 +91,10 @@ vxfs_statfs(struct dentry *dentry, struct kstatfs *bufp) return 0; } -static int vxfs_remount(struct super_block *sb, int *flags, char *data) +static int vxfs_reconfigure(struct fs_context *fc) { - sync_filesystem(sb); - *flags |= SB_RDONLY; + sync_filesystem(fc->root->d_sb); + fc->sb_flags |= SB_RDONLY; return 0; } @@ -120,24 +120,24 @@ static const struct super_operations vxfs_super_ops = { .evict_inode = vxfs_evict_inode, .put_super = vxfs_put_super, .statfs = vxfs_statfs, - .remount_fs = vxfs_remount, }; -static int vxfs_try_sb_magic(struct super_block *sbp, int silent, +static int vxfs_try_sb_magic(struct super_block *sbp, struct fs_context *fc, unsigned blk, __fs32 magic) { struct buffer_head *bp; struct vxfs_sb *rsbp; struct vxfs_sb_info *infp = VXFS_SBI(sbp); + int silent = fc->sb_flags & SB_SILENT; int rc = -ENOMEM; bp = sb_bread(sbp, blk); do { if (!bp || !buffer_mapped(bp)) { if (!silent) { - printk(KERN_WARNING - "vxfs: unable to read disk superblock at %u\n", - blk); + warnf(fc, + "vxfs: unable to read disk superblock at %u", + blk); } break; } @@ -146,9 +146,9 @@ static int vxfs_try_sb_magic(struct super_block *sbp, int silent, rsbp = (struct vxfs_sb *)bp->b_data; if (rsbp->vs_magic != magic) { if (!silent) - printk(KERN_NOTICE - "vxfs: WRONG superblock magic %08x at %u\n", - rsbp->vs_magic, blk); + infof(fc, + "vxfs: WRONG superblock magic %08x at %u", + rsbp->vs_magic, blk); break; } @@ -169,8 +169,7 @@ static int vxfs_try_sb_magic(struct super_block *sbp, int silent, /** * vxfs_fill_super - read superblock into memory and initialize filesystem * @sbp: VFS superblock (to fill) - * @dp: fs private mount data - * @silent: do not complain loudly when sth is wrong + * @fc: filesytem context * * Description: * We are called on the first mount of a filesystem to read the @@ -182,26 +181,27 @@ static int vxfs_try_sb_magic(struct super_block *sbp, int silent, * Locking: * We are under @sbp->s_lock. */ -static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) +static int vxfs_fill_super(struct super_block *sbp, struct fs_context *fc) { struct vxfs_sb_info *infp; struct vxfs_sb *rsbp; u_long bsize; struct inode *root; int ret = -EINVAL; + int silent = fc->sb_flags & SB_SILENT; u32 j; sbp->s_flags |= SB_RDONLY; infp = kzalloc(sizeof(*infp), GFP_KERNEL); if (!infp) { - printk(KERN_WARNING "vxfs: unable to allocate incore superblock\n"); + warnf(fc, "vxfs: unable to allocate incore superblock"); return -ENOMEM; } bsize = sb_min_blocksize(sbp, BLOCK_SIZE); if (!bsize) { - printk(KERN_WARNING "vxfs: unable to set blocksize\n"); + warnf(fc, "vxfs: unable to set blocksize"); goto out; } @@ -210,24 +210,24 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) sbp->s_time_min = 0; sbp->s_time_max = U32_MAX; - if (!vxfs_try_sb_magic(sbp, silent, 1, + if (!vxfs_try_sb_magic(sbp, fc, 1, (__force __fs32)cpu_to_le32(VXFS_SUPER_MAGIC))) { /* Unixware, x86 */ infp->byte_order = VXFS_BO_LE; - } else if (!vxfs_try_sb_magic(sbp, silent, 8, + } else if (!vxfs_try_sb_magic(sbp, fc, 8, (__force __fs32)cpu_to_be32(VXFS_SUPER_MAGIC))) { /* HP-UX, parisc */ infp->byte_order = VXFS_BO_BE; } else { if (!silent) - printk(KERN_NOTICE "vxfs: can't find superblock.\n"); + infof(fc, "vxfs: can't find superblock."); goto out; } rsbp = infp->vsi_raw; j = fs32_to_cpu(infp, rsbp->vs_version); if ((j < 2 || j > 4) && !silent) { - printk(KERN_NOTICE "vxfs: unsupported VxFS version (%d)\n", j); + infof(fc, "vxfs: unsupported VxFS version (%d)", j); goto out; } @@ -244,17 +244,17 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) j = fs32_to_cpu(infp, rsbp->vs_bsize); if (!sb_set_blocksize(sbp, j)) { - printk(KERN_WARNING "vxfs: unable to set final block size\n"); + warnf(fc, "vxfs: unable to set final block size"); goto out; } if (vxfs_read_olt(sbp, bsize)) { - printk(KERN_WARNING "vxfs: unable to read olt\n"); + warnf(fc, "vxfs: unable to read olt"); goto out; } if (vxfs_read_fshead(sbp)) { - printk(KERN_WARNING "vxfs: unable to read fshead\n"); + warnf(fc, "vxfs: unable to read fshead"); goto out; } @@ -265,7 +265,7 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) } sbp->s_root = d_make_root(root); if (!sbp->s_root) { - printk(KERN_WARNING "vxfs: unable to get root dentry.\n"); + warnf(fc, "vxfs: unable to get root dentry."); goto out_free_ilist; } @@ -284,18 +284,29 @@ out: /* * The usual module blurb. */ -static struct dentry *vxfs_mount(struct file_system_type *fs_type, - int flags, const char *dev_name, void *data) +static int vxfs_get_tree(struct fs_context *fc) { - return mount_bdev(fs_type, flags, dev_name, data, vxfs_fill_super); + return get_tree_bdev(fc, vxfs_fill_super); +} + +static const struct fs_context_operations vxfs_context_ops = { + .get_tree = vxfs_get_tree, + .reconfigure = vxfs_reconfigure, +}; + +static int vxfs_init_fs_context(struct fs_context *fc) +{ + fc->ops = &vxfs_context_ops; + + return 0; } static struct file_system_type vxfs_fs_type = { .owner = THIS_MODULE, .name = "vxfs", - .mount = vxfs_mount, .kill_sb = kill_block_super, .fs_flags = FS_REQUIRES_DEV, + .init_fs_context = vxfs_init_fs_context, }; MODULE_ALIAS_FS("vxfs"); /* makes mount -t vxfs autoload the module */ MODULE_ALIAS("vxfs"); |