Skip to content

Commit 6b91bfa

Browse files
Bill O'Donnellbrauner
authored andcommitted
qnx4: convert qnx4 to use the new mount api
Convert the qnx4 filesystem to use the new mount API. Tested mount, umount, and remount using a qnx4 boot image. Signed-off-by: Bill O'Donnell <bodonnel@redhat.com> Link: https://lore.kernel.org/r/20240229161649.800957-1-bodonnel@redhat.com Acked-by: Anders Larsen <al@alarsen.net> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 24a8b7b commit 6b91bfa

File tree

1 file changed

+30
-17
lines changed

1 file changed

+30
-17
lines changed

fs/qnx4/inode.c

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/buffer_head.h>
2222
#include <linux/writeback.h>
2323
#include <linux/statfs.h>
24+
#include <linux/fs_context.h>
2425
#include "qnx4.h"
2526

2627
#define QNX4_VERSION 4
@@ -30,28 +31,33 @@ static const struct super_operations qnx4_sops;
3031

3132
static struct inode *qnx4_alloc_inode(struct super_block *sb);
3233
static void qnx4_free_inode(struct inode *inode);
33-
static int qnx4_remount(struct super_block *sb, int *flags, char *data);
3434
static int qnx4_statfs(struct dentry *, struct kstatfs *);
35+
static int qnx4_get_tree(struct fs_context *fc);
3536

3637
static const struct super_operations qnx4_sops =
3738
{
3839
.alloc_inode = qnx4_alloc_inode,
3940
.free_inode = qnx4_free_inode,
4041
.statfs = qnx4_statfs,
41-
.remount_fs = qnx4_remount,
4242
};
4343

44-
static int qnx4_remount(struct super_block *sb, int *flags, char *data)
44+
static int qnx4_reconfigure(struct fs_context *fc)
4545
{
46+
struct super_block *sb = fc->root->d_sb;
4647
struct qnx4_sb_info *qs;
4748

4849
sync_filesystem(sb);
4950
qs = qnx4_sb(sb);
5051
qs->Version = QNX4_VERSION;
51-
*flags |= SB_RDONLY;
52+
fc->sb_flags |= SB_RDONLY;
5253
return 0;
5354
}
5455

56+
static const struct fs_context_operations qnx4_context_opts = {
57+
.get_tree = qnx4_get_tree,
58+
.reconfigure = qnx4_reconfigure,
59+
};
60+
5561
static int qnx4_get_block( struct inode *inode, sector_t iblock, struct buffer_head *bh, int create )
5662
{
5763
unsigned long phys;
@@ -183,12 +189,13 @@ static const char *qnx4_checkroot(struct super_block *sb,
183189
return "bitmap file not found.";
184190
}
185191

186-
static int qnx4_fill_super(struct super_block *s, void *data, int silent)
192+
static int qnx4_fill_super(struct super_block *s, struct fs_context *fc)
187193
{
188194
struct buffer_head *bh;
189195
struct inode *root;
190196
const char *errmsg;
191197
struct qnx4_sb_info *qs;
198+
int silent = fc->sb_flags & SB_SILENT;
192199

193200
qs = kzalloc(sizeof(struct qnx4_sb_info), GFP_KERNEL);
194201
if (!qs)
@@ -216,7 +223,7 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
216223
errmsg = qnx4_checkroot(s, (struct qnx4_super_block *) bh->b_data);
217224
brelse(bh);
218225
if (errmsg != NULL) {
219-
if (!silent)
226+
if (!silent)
220227
printk(KERN_ERR "qnx4: %s\n", errmsg);
221228
return -EINVAL;
222229
}
@@ -235,6 +242,18 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
235242
return 0;
236243
}
237244

245+
static int qnx4_get_tree(struct fs_context *fc)
246+
{
247+
return get_tree_bdev(fc, qnx4_fill_super);
248+
}
249+
250+
static int qnx4_init_fs_context(struct fs_context *fc)
251+
{
252+
fc->ops = &qnx4_context_opts;
253+
254+
return 0;
255+
}
256+
238257
static void qnx4_kill_sb(struct super_block *sb)
239258
{
240259
struct qnx4_sb_info *qs = qnx4_sb(sb);
@@ -376,18 +395,12 @@ static void destroy_inodecache(void)
376395
kmem_cache_destroy(qnx4_inode_cachep);
377396
}
378397

379-
static struct dentry *qnx4_mount(struct file_system_type *fs_type,
380-
int flags, const char *dev_name, void *data)
381-
{
382-
return mount_bdev(fs_type, flags, dev_name, data, qnx4_fill_super);
383-
}
384-
385398
static struct file_system_type qnx4_fs_type = {
386-
.owner = THIS_MODULE,
387-
.name = "qnx4",
388-
.mount = qnx4_mount,
389-
.kill_sb = qnx4_kill_sb,
390-
.fs_flags = FS_REQUIRES_DEV,
399+
.owner = THIS_MODULE,
400+
.name = "qnx4",
401+
.kill_sb = qnx4_kill_sb,
402+
.fs_flags = FS_REQUIRES_DEV,
403+
.init_fs_context = qnx4_init_fs_context,
391404
};
392405
MODULE_ALIAS_FS("qnx4");
393406

0 commit comments

Comments
 (0)