Skip to content

Commit 7cd7bfe

Browse files
Bill O'Donnellbrauner
authored andcommitted
minix: convert minix to use the new mount api
Convert the minix filesystem to use the new mount API. Tested using mount and remount on minix device. Signed-off-by: Bill O'Donnell <bodonnel@redhat.com> Link: https://lore.kernel.org/r/20240307163325.998723-1-bodonnel@redhat.com Acked-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 78ff640 commit 7cd7bfe

File tree

1 file changed

+30
-18
lines changed

1 file changed

+30
-18
lines changed

fs/minix/inode.c

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
#include <linux/mpage.h>
2121
#include <linux/vfs.h>
2222
#include <linux/writeback.h>
23+
#include <linux/fs_context.h>
2324

2425
static int minix_write_inode(struct inode *inode,
2526
struct writeback_control *wbc);
2627
static int minix_statfs(struct dentry *dentry, struct kstatfs *buf);
27-
static int minix_remount (struct super_block * sb, int * flags, char * data);
2828

2929
static void minix_evict_inode(struct inode *inode)
3030
{
@@ -111,19 +111,19 @@ static const struct super_operations minix_sops = {
111111
.evict_inode = minix_evict_inode,
112112
.put_super = minix_put_super,
113113
.statfs = minix_statfs,
114-
.remount_fs = minix_remount,
115114
};
116115

117-
static int minix_remount (struct super_block * sb, int * flags, char * data)
116+
static int minix_reconfigure(struct fs_context *fc)
118117
{
119-
struct minix_sb_info * sbi = minix_sb(sb);
120118
struct minix_super_block * ms;
119+
struct super_block *sb = fc->root->d_sb;
120+
struct minix_sb_info * sbi = sb->s_fs_info;
121121

122122
sync_filesystem(sb);
123123
ms = sbi->s_ms;
124-
if ((bool)(*flags & SB_RDONLY) == sb_rdonly(sb))
124+
if ((bool)(fc->sb_flags & SB_RDONLY) == sb_rdonly(sb))
125125
return 0;
126-
if (*flags & SB_RDONLY) {
126+
if (fc->sb_flags & SB_RDONLY) {
127127
if (ms->s_state & MINIX_VALID_FS ||
128128
!(sbi->s_mount_state & MINIX_VALID_FS))
129129
return 0;
@@ -170,7 +170,7 @@ static bool minix_check_superblock(struct super_block *sb)
170170
return true;
171171
}
172172

173-
static int minix_fill_super(struct super_block *s, void *data, int silent)
173+
static int minix_fill_super(struct super_block *s, struct fs_context *fc)
174174
{
175175
struct buffer_head *bh;
176176
struct buffer_head **map;
@@ -180,6 +180,7 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
180180
struct inode *root_inode;
181181
struct minix_sb_info *sbi;
182182
int ret = -EINVAL;
183+
int silent = fc->sb_flags & SB_SILENT;
183184

184185
sbi = kzalloc(sizeof(struct minix_sb_info), GFP_KERNEL);
185186
if (!sbi)
@@ -371,6 +372,23 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
371372
return ret;
372373
}
373374

375+
static int minix_get_tree(struct fs_context *fc)
376+
{
377+
return get_tree_bdev(fc, minix_fill_super);
378+
}
379+
380+
static const struct fs_context_operations minix_context_ops = {
381+
.get_tree = minix_get_tree,
382+
.reconfigure = minix_reconfigure,
383+
};
384+
385+
static int minix_init_fs_context(struct fs_context *fc)
386+
{
387+
fc->ops = &minix_context_ops;
388+
389+
return 0;
390+
}
391+
374392
static int minix_statfs(struct dentry *dentry, struct kstatfs *buf)
375393
{
376394
struct super_block *sb = dentry->d_sb;
@@ -680,18 +698,12 @@ void minix_truncate(struct inode * inode)
680698
V2_minix_truncate(inode);
681699
}
682700

683-
static struct dentry *minix_mount(struct file_system_type *fs_type,
684-
int flags, const char *dev_name, void *data)
685-
{
686-
return mount_bdev(fs_type, flags, dev_name, data, minix_fill_super);
687-
}
688-
689701
static struct file_system_type minix_fs_type = {
690-
.owner = THIS_MODULE,
691-
.name = "minix",
692-
.mount = minix_mount,
693-
.kill_sb = kill_block_super,
694-
.fs_flags = FS_REQUIRES_DEV,
702+
.owner = THIS_MODULE,
703+
.name = "minix",
704+
.kill_sb = kill_block_super,
705+
.fs_flags = FS_REQUIRES_DEV,
706+
.init_fs_context = minix_init_fs_context,
695707
};
696708
MODULE_ALIAS_FS("minix");
697709

0 commit comments

Comments
 (0)