Skip to content

Commit 9d5c8dc

Browse files
preichlbrauner
authored andcommitted
bfs: convert bfs to use the new mount api
Convert the bfs filesystem to use the new mount API. Tested using mount and simple writes & reads on ro/rw bfs devices. Signed-off-by: Pavel Reichl <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Carlos Maiolino <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 0af2f6b commit 9d5c8dc

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

fs/bfs/inode.c

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/writeback.h>
1818
#include <linux/uio.h>
1919
#include <linux/uaccess.h>
20+
#include <linux/fs_context.h>
2021
#include "bfs.h"
2122

2223
MODULE_AUTHOR("Tigran Aivazian <[email protected]>");
@@ -305,7 +306,7 @@ void bfs_dump_imap(const char *prefix, struct super_block *s)
305306
#endif
306307
}
307308

308-
static int bfs_fill_super(struct super_block *s, void *data, int silent)
309+
static int bfs_fill_super(struct super_block *s, struct fs_context *fc)
309310
{
310311
struct buffer_head *bh, *sbh;
311312
struct bfs_super_block *bfs_sb;
@@ -314,6 +315,7 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
314315
struct bfs_sb_info *info;
315316
int ret = -EINVAL;
316317
unsigned long i_sblock, i_eblock, i_eoff, s_size;
318+
int silent = fc->sb_flags & SB_SILENT;
317319

318320
info = kzalloc(sizeof(*info), GFP_KERNEL);
319321
if (!info)
@@ -446,18 +448,28 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
446448
return ret;
447449
}
448450

449-
static struct dentry *bfs_mount(struct file_system_type *fs_type,
450-
int flags, const char *dev_name, void *data)
451+
static int bfs_get_tree(struct fs_context *fc)
451452
{
452-
return mount_bdev(fs_type, flags, dev_name, data, bfs_fill_super);
453+
return get_tree_bdev(fc, bfs_fill_super);
454+
}
455+
456+
static const struct fs_context_operations bfs_context_ops = {
457+
.get_tree = bfs_get_tree,
458+
};
459+
460+
static int bfs_init_fs_context(struct fs_context *fc)
461+
{
462+
fc->ops = &bfs_context_ops;
463+
464+
return 0;
453465
}
454466

455467
static struct file_system_type bfs_fs_type = {
456-
.owner = THIS_MODULE,
457-
.name = "bfs",
458-
.mount = bfs_mount,
459-
.kill_sb = kill_block_super,
460-
.fs_flags = FS_REQUIRES_DEV,
468+
.owner = THIS_MODULE,
469+
.name = "bfs",
470+
.init_fs_context = bfs_init_fs_context,
471+
.kill_sb = kill_block_super,
472+
.fs_flags = FS_REQUIRES_DEV,
461473
};
462474
MODULE_ALIAS_FS("bfs");
463475

0 commit comments

Comments
 (0)