[Concept,14/21] inode.c: Remove Linux module and fs_context code

Message ID 20260416165733.2923423-15-sjg@u-boot.org
State New
Headers
Series fs: Add ISO 9660 filesystem driver ported from Linux |

Commit Message

Simon Glass April 16, 2026, 4:57 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

U-Boot does not use the Linux kernel's module or fs_context
infrastructure. Filesystem mounting is handled by the U-Boot
integration layer (interface.c) instead.

Remove the mount option parsing (isofs_parse_param), /proc/mounts
display (isofs_show_options), reconfigure support, fs_context
operations, filesystem type registration, and module init/exit
code. Also remove the forward declaration and sops entry for
isofs_show_options.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 fs/isofs/inode.c | 308 +----------------------------------------------
 1 file changed, 1 insertion(+), 307 deletions(-)
  

Patch

diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index e50664b29e9..fdb5702120e 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -49,8 +49,7 @@  static void isofs_put_super(struct super_block *sb)
 }
 
 static int isofs_read_inode(struct inode *, int relocated);
-static int isofs_statfs (struct dentry *, struct kstatfs *);
-static int isofs_show_options(struct seq_file *, struct dentry *);
+static int isofs_statfs(struct dentry *, struct kstatfs *);
 
 static struct kmem_cache *isofs_inode_cachep;
 
@@ -97,20 +96,11 @@  static void destroy_inodecache(void)
 	kmem_cache_destroy(isofs_inode_cachep);
 }
 
-static int isofs_reconfigure(struct fs_context *fc)
-{
-	sync_filesystem(fc->root->d_sb);
-	if (!(fc->sb_flags & SB_RDONLY))
-		return -EROFS;
-	return 0;
-}
-
 static const struct super_operations isofs_sops = {
 	.alloc_inode	= isofs_alloc_inode,
 	.free_inode	= isofs_free_inode,
 	.put_super	= isofs_put_super,
 	.statfs		= isofs_statfs,
-	.show_options	= isofs_show_options,
 };
 
 
@@ -253,200 +243,6 @@  isofs_dentry_cmpi_ms(const struct dentry *dentry,
 }
 #endif
 
-enum {
-	Opt_block, Opt_check, Opt_cruft, Opt_gid, Opt_ignore, Opt_iocharset,
-	Opt_map, Opt_mode, Opt_nojoliet, Opt_norock, Opt_sb, Opt_session,
-	Opt_uid, Opt_unhide, Opt_utf8, Opt_err, Opt_nocompress, Opt_hide,
-	Opt_showassoc, Opt_dmode, Opt_overriderockperm,
-};
-
-static const struct constant_table isofs_param_map[] = {
-	{"acorn",	'a'},
-	{"a",		'a'},
-	{"normal",	'n'},
-	{"n",		'n'},
-	{"off",		'o'},
-	{"o",		'o'},
-	{}
-};
-
-static const struct constant_table isofs_param_check[] = {
-	{"relaxed",	'r'},
-	{"r",		'r'},
-	{"strict",	's'},
-	{"s",		's'},
-	{}
-};
-
-static const struct fs_parameter_spec isofs_param_spec[] = {
-	fsparam_flag	("norock",		Opt_norock),
-	fsparam_flag	("nojoliet",		Opt_nojoliet),
-	fsparam_flag	("unhide",		Opt_unhide),
-	fsparam_flag	("hide",		Opt_hide),
-	fsparam_flag	("showassoc",		Opt_showassoc),
-	fsparam_flag	("cruft",		Opt_cruft),
-	fsparam_flag	("utf8",		Opt_utf8),
-	fsparam_string	("iocharset",		Opt_iocharset),
-	fsparam_enum	("map",			Opt_map, isofs_param_map),
-	fsparam_u32	("session",		Opt_session),
-	fsparam_u32	("sbsector",		Opt_sb),
-	fsparam_enum	("check",		Opt_check, isofs_param_check),
-	fsparam_uid	("uid",			Opt_uid),
-	fsparam_gid	("gid",			Opt_gid),
-	/* Note: mode/dmode historically accepted %u not strictly %o */
-	fsparam_u32	("mode",		Opt_mode),
-	fsparam_u32	("dmode",		Opt_dmode),
-	fsparam_flag	("overriderockperm",	Opt_overriderockperm),
-	fsparam_u32	("block",		Opt_block),
-	fsparam_string	("conv",		Opt_ignore),
-	fsparam_flag	("nocompress",		Opt_nocompress),
-	{}
-};
-
-static int isofs_parse_param(struct fs_context *fc,
-			       struct fs_parameter *param)
-{
-	struct isofs_options *popt = fc->fs_private;
-	struct fs_parse_result result;
-	int opt;
-	unsigned int n;
-
-	/* There are no remountable options */
-	if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE)
-		return 0;
-
-	opt = fs_parse(fc, isofs_param_spec, param, &result);
-	if (opt < 0)
-		return opt;
-
-	switch (opt) {
-	case Opt_norock:
-		popt->rock = 0;
-		break;
-	case Opt_nojoliet:
-		popt->joliet = 0;
-		break;
-	case Opt_hide:
-		popt->hide = 1;
-		break;
-	case Opt_unhide:
-	case Opt_showassoc:
-		popt->showassoc = 1;
-		break;
-	case Opt_cruft:
-		popt->cruft = 1;
-		break;
-#ifdef CONFIG_JOLIET
-	case Opt_utf8:
-		kfree(popt->iocharset);
-		popt->iocharset = kstrdup("utf8", GFP_KERNEL);
-		if (!popt->iocharset)
-			return -ENOMEM;
-		break;
-	case Opt_iocharset:
-		kfree(popt->iocharset);
-		popt->iocharset = kstrdup(param->string, GFP_KERNEL);
-		if (!popt->iocharset)
-			return -ENOMEM;
-		break;
-#endif
-	case Opt_map:
-		popt->map = result.uint_32;
-		break;
-	case Opt_session:
-		n = result.uint_32;
-		/*
-		 * Track numbers are supposed to be in range 1-99, the
-		 * mount option starts indexing at 0.
-		 */
-		if (n >= 99)
-			return -EINVAL;
-		popt->session = n + 1;
-		break;
-	case Opt_sb:
-		popt->sbsector = result.uint_32;
-		break;
-	case Opt_check:
-		popt->check = result.uint_32;
-		break;
-	case Opt_ignore:
-		break;
-	case Opt_uid:
-		popt->uid = result.uid;
-		popt->uid_set = 1;
-		break;
-	case Opt_gid:
-		popt->gid = result.gid;
-		popt->gid_set = 1;
-		break;
-	case Opt_mode:
-		popt->fmode = result.uint_32;
-		break;
-	case Opt_dmode:
-		popt->dmode = result.uint_32;
-		break;
-	case Opt_overriderockperm:
-		popt->overriderockperm = 1;
-		break;
-	case Opt_block:
-		n = result.uint_32;
-		if (n != 512 && n != 1024 && n != 2048)
-			return -EINVAL;
-		popt->blocksize = n;
-		break;
-	case Opt_nocompress:
-		popt->nocompress = 1;
-		break;
-	default:
-		return -EINVAL;
-	}
-	return 0;
-}
-
-/*
- * Display the mount options in /proc/mounts.
- */
-static int isofs_show_options(struct seq_file *m, struct dentry *root)
-{
-	struct isofs_sb_info *sbi = ISOFS_SB(root->d_sb);
-
-	if (!sbi->s_rock)		seq_puts(m, ",norock");
-	else if (!sbi->s_joliet_level)	seq_puts(m, ",nojoliet");
-	if (sbi->s_cruft)		seq_puts(m, ",cruft");
-	if (sbi->s_hide)		seq_puts(m, ",hide");
-	if (sbi->s_nocompress)		seq_puts(m, ",nocompress");
-	if (sbi->s_overriderockperm)	seq_puts(m, ",overriderockperm");
-	if (sbi->s_showassoc)		seq_puts(m, ",showassoc");
-
-	if (sbi->s_check)		seq_printf(m, ",check=%c", sbi->s_check);
-	if (sbi->s_mapping)		seq_printf(m, ",map=%c", sbi->s_mapping);
-	if (sbi->s_session != 255)	seq_printf(m, ",session=%u", sbi->s_session - 1);
-	if (sbi->s_sbsector != -1)	seq_printf(m, ",sbsector=%u", sbi->s_sbsector);
-
-	if (root->d_sb->s_blocksize != 1024)
-		seq_printf(m, ",blocksize=%lu", root->d_sb->s_blocksize);
-
-	if (sbi->s_uid_set)
-		seq_printf(m, ",uid=%u",
-			   from_kuid_munged(&init_user_ns, sbi->s_uid));
-	if (sbi->s_gid_set)
-		seq_printf(m, ",gid=%u",
-			   from_kgid_munged(&init_user_ns, sbi->s_gid));
-
-	if (sbi->s_dmode != ISOFS_INVALID_MODE)
-		seq_printf(m, ",dmode=%o", sbi->s_dmode);
-	if (sbi->s_fmode != ISOFS_INVALID_MODE)
-		seq_printf(m, ",fmode=%o", sbi->s_fmode);
-
-#ifdef CONFIG_JOLIET
-	if (sbi->s_nls_iocharset)
-		seq_printf(m, ",iocharset=%s", sbi->s_nls_iocharset->charset);
-	else
-		seq_puts(m, ",iocharset=utf8");
-#endif
-	return 0;
-}
-
 /*
  * look if the driver can tell the multi session redirection value
  *
@@ -1497,105 +1293,3 @@  struct inode *__isofs_iget(struct super_block *sb,
 
 	return inode;
 }
-
-static int isofs_get_tree(struct fs_context *fc)
-{
-	return get_tree_bdev(fc, isofs_fill_super);
-}
-
-static void isofs_free_fc(struct fs_context *fc)
-{
-	struct isofs_options *opt = fc->fs_private;
-
-	kfree(opt->iocharset);
-	kfree(opt);
-}
-
-static const struct fs_context_operations isofs_context_ops = {
-	.parse_param	= isofs_parse_param,
-	.get_tree	= isofs_get_tree,
-	.reconfigure	= isofs_reconfigure,
-	.free		= isofs_free_fc,
-};
-
-static int isofs_init_fs_context(struct fs_context *fc)
-{
-	struct isofs_options *opt;
-
-	opt = kzalloc_obj(*opt);
-	if (!opt)
-		return -ENOMEM;
-
-	opt->map = 'n';
-	opt->rock = 1;
-	opt->joliet = 1;
-	opt->cruft = 0;
-	opt->hide = 0;
-	opt->showassoc = 0;
-	opt->check = 'u';		/* unset */
-	opt->nocompress = 0;
-	opt->blocksize = 1024;
-	opt->fmode = opt->dmode = ISOFS_INVALID_MODE;
-	opt->uid_set = 0;
-	opt->gid_set = 0;
-	opt->gid = GLOBAL_ROOT_GID;
-	opt->uid = GLOBAL_ROOT_UID;
-	opt->iocharset = NULL;
-	opt->overriderockperm = 0;
-	opt->session = -1;
-	opt->sbsector = -1;
-
-	fc->fs_private = opt;
-	fc->ops = &isofs_context_ops;
-
-	return 0;
-}
-
-static struct file_system_type iso9660_fs_type = {
-	.owner		= THIS_MODULE,
-	.name		= "iso9660",
-	.kill_sb	= kill_block_super,
-	.fs_flags	= FS_REQUIRES_DEV,
-	.init_fs_context = isofs_init_fs_context,
-	.parameters	= isofs_param_spec,
-};
-MODULE_ALIAS_FS("iso9660");
-MODULE_ALIAS("iso9660");
-
-static int __init init_iso9660_fs(void)
-{
-	int err = init_inodecache();
-	if (err)
-		goto out;
-#ifdef CONFIG_ZISOFS
-	err = zisofs_init();
-	if (err)
-		goto out1;
-#endif
-	err = register_filesystem(&iso9660_fs_type);
-	if (err)
-		goto out2;
-	return 0;
-out2:
-#ifdef CONFIG_ZISOFS
-	zisofs_cleanup();
-out1:
-#endif
-	destroy_inodecache();
-out:
-	return err;
-}
-
-static void __exit exit_iso9660_fs(void)
-{
-        unregister_filesystem(&iso9660_fs_type);
-#ifdef CONFIG_ZISOFS
-	zisofs_cleanup();
-#endif
-	destroy_inodecache();
-}
-
-module_init(init_iso9660_fs)
-module_exit(exit_iso9660_fs)
-MODULE_DESCRIPTION("ISO 9660 CDROM file system support");
-MODULE_LICENSE("GPL");