linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: linux-fsdevel@vger.kernel.org
Cc: Jan Kara <jack@suse.cz>, Christian Brauner <brauner@kernel.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH] sysv: convert sysv to use the new mount api
Date: Wed, 5 Feb 2025 16:30:09 -0600	[thread overview]
Message-ID: <be08b1c1-c6d7-4e82-b457-87116879bdac@redhat.com> (raw)

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 <sandeen@redhat.com>
---
 fs/sysv/super.c | 57 +++++++++++++++++++++++++++++++++----------------
 1 file changed, 39 insertions(+), 18 deletions(-)

I understand that sysv has been discussed for removal, and that's fine.

There seemed to be a little pushback so I figured I'd throw this
out there just in case removal gets deferred. Feel free to take it or
leave it, there's minimal time investment here.

With sysv done (or removed) we'll be down to just ext2, f2fs, bfs,
9p and omfs for remaining (un-sent) conversions. (orangefs seems to
be in a black hole for now though.)

diff --git a/fs/sysv/super.c b/fs/sysv/super.c
index 5c0d07ddbda2..03be9f1b7802 100644
--- a/fs/sysv/super.c
+++ b/fs/sysv/super.c
@@ -25,6 +25,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/buffer_head.h>
+#include <linux/fs_context.h>
 #include "sysv.h"
 
 /*
@@ -349,12 +350,13 @@ static int complete_read_super(struct super_block *sb, int silent, int size)
 	return 1;
 }
 
-static int sysv_fill_super(struct super_block *sb, void *data, int silent)
+static int sysv_fill_super(struct super_block *sb, struct fs_context *fc)
 {
 	struct buffer_head *bh1, *bh = NULL;
 	struct sysv_sb_info *sbi;
 	unsigned long blocknr;
 	int size = 0, i;
+	int silent = fc->sb_flags & SB_SILENT;
 	
 	BUILD_BUG_ON(1024 != sizeof (struct xenix_super_block));
 	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)
 	return 1;
 }
 
-static int v7_fill_super(struct super_block *sb, void *data, int silent)
+static int v7_fill_super(struct super_block *sb, struct fs_context *fc)
 {
 	struct sysv_sb_info *sbi;
 	struct buffer_head *bh;
+	int silent = fc->sb_flags & SB_SILENT;
 
 	BUILD_BUG_ON(sizeof(struct v7_super_block) != 440);
 	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)
 
 /* Every kernel module contains stuff like this. */
 
-static struct dentry *sysv_mount(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+static int sysv_get_tree(struct fs_context *fc)
 {
-	return mount_bdev(fs_type, flags, dev_name, data, sysv_fill_super);
+	return get_tree_bdev(fc, sysv_fill_super);
 }
 
-static struct dentry *v7_mount(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+static int v7_get_tree(struct fs_context *fc)
 {
-	return mount_bdev(fs_type, flags, dev_name, data, v7_fill_super);
+	return get_tree_bdev(fc, v7_fill_super);
+}
+
+static const struct fs_context_operations sysv_context_ops = {
+	.get_tree	= sysv_get_tree,
+};
+
+static const struct fs_context_operations v7_context_ops = {
+	.get_tree	= v7_get_tree,
+};
+
+static int sysv_init_fs_context(struct fs_context *fc)
+{
+	fc->ops = &sysv_context_ops;
+	return 0;
+}
+
+static int v7_init_fs_context(struct fs_context *fc)
+{
+	fc->ops = &v7_context_ops;
+	return 0;
 }
 
 static struct file_system_type sysv_fs_type = {
-	.owner		= THIS_MODULE,
-	.name		= "sysv",
-	.mount		= sysv_mount,
-	.kill_sb	= kill_block_super,
-	.fs_flags	= FS_REQUIRES_DEV,
+	.owner			= THIS_MODULE,
+	.name			= "sysv",
+	.kill_sb		= kill_block_super,
+	.fs_flags		= FS_REQUIRES_DEV,
+	.init_fs_context	= sysv_init_fs_context,
 };
 MODULE_ALIAS_FS("sysv");
 
 static struct file_system_type v7_fs_type = {
-	.owner		= THIS_MODULE,
-	.name		= "v7",
-	.mount		= v7_mount,
-	.kill_sb	= kill_block_super,
-	.fs_flags	= FS_REQUIRES_DEV,
+	.owner			= THIS_MODULE,
+	.name			= "v7",
+	.kill_sb		= kill_block_super,
+	.fs_flags		= FS_REQUIRES_DEV,
+	.init_fs_context	= v7_init_fs_context,
 };
 MODULE_ALIAS_FS("v7");
 MODULE_ALIAS("v7");
-- 
2.48.0


             reply	other threads:[~2025-02-05 22:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05 22:30 Eric Sandeen [this message]
2025-02-06 14:27 ` [PATCH] sysv: convert sysv to use the new mount api Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=be08b1c1-c6d7-4e82-b457-87116879bdac@redhat.com \
    --to=sandeen@redhat.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).