Skip to content

Commit 00dac02

Browse files
Eric Sandeenbrauner
authored andcommitted
sysv: convert sysv to use the new mount api
Convert the sysv filesystem to use the new mount API. Tested by mounting some old sysv & v7 images I found in archives; there are no mount options, and no remount op, so this conversion is trivial. Signed-off-by: Eric Sandeen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent e8fe0d4 commit 00dac02

File tree

1 file changed

+39
-18
lines changed

1 file changed

+39
-18
lines changed

fs/sysv/super.c

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/init.h>
2626
#include <linux/slab.h>
2727
#include <linux/buffer_head.h>
28+
#include <linux/fs_context.h>
2829
#include "sysv.h"
2930

3031
/*
@@ -349,12 +350,13 @@ static int complete_read_super(struct super_block *sb, int silent, int size)
349350
return 1;
350351
}
351352

352-
static int sysv_fill_super(struct super_block *sb, void *data, int silent)
353+
static int sysv_fill_super(struct super_block *sb, struct fs_context *fc)
353354
{
354355
struct buffer_head *bh1, *bh = NULL;
355356
struct sysv_sb_info *sbi;
356357
unsigned long blocknr;
357358
int size = 0, i;
359+
int silent = fc->sb_flags & SB_SILENT;
358360

359361
BUILD_BUG_ON(1024 != sizeof (struct xenix_super_block));
360362
BUILD_BUG_ON(512 != sizeof (struct sysv4_super_block));
@@ -471,10 +473,11 @@ static int v7_sanity_check(struct super_block *sb, struct buffer_head *bh)
471473
return 1;
472474
}
473475

474-
static int v7_fill_super(struct super_block *sb, void *data, int silent)
476+
static int v7_fill_super(struct super_block *sb, struct fs_context *fc)
475477
{
476478
struct sysv_sb_info *sbi;
477479
struct buffer_head *bh;
480+
int silent = fc->sb_flags & SB_SILENT;
478481

479482
BUILD_BUG_ON(sizeof(struct v7_super_block) != 440);
480483
BUILD_BUG_ON(sizeof(struct sysv_inode) != 64);
@@ -528,33 +531,51 @@ static int v7_fill_super(struct super_block *sb, void *data, int silent)
528531

529532
/* Every kernel module contains stuff like this. */
530533

531-
static struct dentry *sysv_mount(struct file_system_type *fs_type,
532-
int flags, const char *dev_name, void *data)
534+
static int sysv_get_tree(struct fs_context *fc)
533535
{
534-
return mount_bdev(fs_type, flags, dev_name, data, sysv_fill_super);
536+
return get_tree_bdev(fc, sysv_fill_super);
535537
}
536538

537-
static struct dentry *v7_mount(struct file_system_type *fs_type,
538-
int flags, const char *dev_name, void *data)
539+
static int v7_get_tree(struct fs_context *fc)
539540
{
540-
return mount_bdev(fs_type, flags, dev_name, data, v7_fill_super);
541+
return get_tree_bdev(fc, v7_fill_super);
542+
}
543+
544+
static const struct fs_context_operations sysv_context_ops = {
545+
.get_tree = sysv_get_tree,
546+
};
547+
548+
static const struct fs_context_operations v7_context_ops = {
549+
.get_tree = v7_get_tree,
550+
};
551+
552+
static int sysv_init_fs_context(struct fs_context *fc)
553+
{
554+
fc->ops = &sysv_context_ops;
555+
return 0;
556+
}
557+
558+
static int v7_init_fs_context(struct fs_context *fc)
559+
{
560+
fc->ops = &v7_context_ops;
561+
return 0;
541562
}
542563

543564
static struct file_system_type sysv_fs_type = {
544-
.owner = THIS_MODULE,
545-
.name = "sysv",
546-
.mount = sysv_mount,
547-
.kill_sb = kill_block_super,
548-
.fs_flags = FS_REQUIRES_DEV,
565+
.owner = THIS_MODULE,
566+
.name = "sysv",
567+
.kill_sb = kill_block_super,
568+
.fs_flags = FS_REQUIRES_DEV,
569+
.init_fs_context = sysv_init_fs_context,
549570
};
550571
MODULE_ALIAS_FS("sysv");
551572

552573
static struct file_system_type v7_fs_type = {
553-
.owner = THIS_MODULE,
554-
.name = "v7",
555-
.mount = v7_mount,
556-
.kill_sb = kill_block_super,
557-
.fs_flags = FS_REQUIRES_DEV,
574+
.owner = THIS_MODULE,
575+
.name = "v7",
576+
.kill_sb = kill_block_super,
577+
.fs_flags = FS_REQUIRES_DEV,
578+
.init_fs_context = v7_init_fs_context,
558579
};
559580
MODULE_ALIAS_FS("v7");
560581
MODULE_ALIAS("v7");

0 commit comments

Comments
 (0)