diff mbox series

[RFC,02/20] hfsplus: Add iocharset= mount option as alias for nls=

Message ID 20210808162453.1653-3-pali@kernel.org (mailing list archive)
State New, archived
Headers show
Series fs: Remove usage of broken nls_utf8 and drop it | expand

Commit Message

Pali Rohár Aug. 8, 2021, 4:24 p.m. UTC
Other fs drivers are using iocharset= mount option for specifying charset.
So add it also for hfsplus and mark old nls= mount option as deprecated.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 fs/hfsplus/options.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Viacheslav Dubeyko Aug. 9, 2021, 5:51 p.m. UTC | #1
> On Aug 8, 2021, at 9:24 AM, Pali Rohár <pali@kernel.org> wrote:
> 
> Other fs drivers are using iocharset= mount option for specifying charset.
> So add it also for hfsplus and mark old nls= mount option as deprecated.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
> fs/hfsplus/options.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/hfsplus/options.c b/fs/hfsplus/options.c
> index 047e05c57560..a975548f6b91 100644
> --- a/fs/hfsplus/options.c
> +++ b/fs/hfsplus/options.c
> @@ -23,6 +23,7 @@ enum {
> 	opt_creator, opt_type,
> 	opt_umask, opt_uid, opt_gid,
> 	opt_part, opt_session, opt_nls,
> +	opt_iocharset,
> 	opt_nodecompose, opt_decompose,
> 	opt_barrier, opt_nobarrier,
> 	opt_force, opt_err
> @@ -37,6 +38,7 @@ static const match_table_t tokens = {
> 	{ opt_part, "part=%u" },
> 	{ opt_session, "session=%u" },
> 	{ opt_nls, "nls=%s" },
> +	{ opt_iocharset, "iocharset=%s" },
> 	{ opt_decompose, "decompose" },
> 	{ opt_nodecompose, "nodecompose" },
> 	{ opt_barrier, "barrier" },
> @@ -166,6 +168,9 @@ int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi)
> 			}
> 			break;
> 		case opt_nls:
> +			pr_warn("option nls= is deprecated, use iocharset=\n");
> +			/* fallthrough */
> +		case opt_iocharset:
> 			if (sbi->nls) {
> 				pr_err("unable to change nls mapping\n");
> 				return 0;
> @@ -230,7 +235,7 @@ int hfsplus_show_options(struct seq_file *seq, struct dentry *root)
> 	if (sbi->session >= 0)
> 		seq_printf(seq, ",session=%u", sbi->session);
> 	if (sbi->nls)
> -		seq_printf(seq, ",nls=%s", sbi->nls->charset);
> +		seq_printf(seq, ",iocharset=%s", sbi->nls->charset);
> 	if (test_bit(HFSPLUS_SB_NODECOMPOSE, &sbi->flags))
> 		seq_puts(seq, ",nodecompose");
> 	if (test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags))
> -- 
> 2.20.1
> 

Looks reasonable. But I would like to be sure that the code has been reasonably tested.

Thanks,
Slava.
Kari Argillander Aug. 9, 2021, 8:49 p.m. UTC | #2
On Sun, Aug 08, 2021 at 06:24:35PM +0200, Pali Rohár wrote:
> Other fs drivers are using iocharset= mount option for specifying charset.
> So add it also for hfsplus and mark old nls= mount option as deprecated.

It would be good to also update Documentation/filesystems/hfsplus.rst.
Pali Rohár Aug. 9, 2021, 9:25 p.m. UTC | #3
On Monday 09 August 2021 23:49:21 Kari Argillander wrote:
> On Sun, Aug 08, 2021 at 06:24:35PM +0200, Pali Rohár wrote:
> > Other fs drivers are using iocharset= mount option for specifying charset.
> > So add it also for hfsplus and mark old nls= mount option as deprecated.
> 
> It would be good to also update Documentation/filesystems/hfsplus.rst.

Good point! I'm making a note.
diff mbox series

Patch

diff --git a/fs/hfsplus/options.c b/fs/hfsplus/options.c
index 047e05c57560..a975548f6b91 100644
--- a/fs/hfsplus/options.c
+++ b/fs/hfsplus/options.c
@@ -23,6 +23,7 @@  enum {
 	opt_creator, opt_type,
 	opt_umask, opt_uid, opt_gid,
 	opt_part, opt_session, opt_nls,
+	opt_iocharset,
 	opt_nodecompose, opt_decompose,
 	opt_barrier, opt_nobarrier,
 	opt_force, opt_err
@@ -37,6 +38,7 @@  static const match_table_t tokens = {
 	{ opt_part, "part=%u" },
 	{ opt_session, "session=%u" },
 	{ opt_nls, "nls=%s" },
+	{ opt_iocharset, "iocharset=%s" },
 	{ opt_decompose, "decompose" },
 	{ opt_nodecompose, "nodecompose" },
 	{ opt_barrier, "barrier" },
@@ -166,6 +168,9 @@  int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi)
 			}
 			break;
 		case opt_nls:
+			pr_warn("option nls= is deprecated, use iocharset=\n");
+			/* fallthrough */
+		case opt_iocharset:
 			if (sbi->nls) {
 				pr_err("unable to change nls mapping\n");
 				return 0;
@@ -230,7 +235,7 @@  int hfsplus_show_options(struct seq_file *seq, struct dentry *root)
 	if (sbi->session >= 0)
 		seq_printf(seq, ",session=%u", sbi->session);
 	if (sbi->nls)
-		seq_printf(seq, ",nls=%s", sbi->nls->charset);
+		seq_printf(seq, ",iocharset=%s", sbi->nls->charset);
 	if (test_bit(HFSPLUS_SB_NODECOMPOSE, &sbi->flags))
 		seq_puts(seq, ",nodecompose");
 	if (test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags))