[RFC PATCH 10/20] befs: Allow to use native UTF-8 mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



befs driver already has a code which avoids usage of NLS when befs_sb->nls
is not set.

But befs_fill_super() always set befs_sb->nls, so activating native UTF-8
is not possible.

Fix it by not setting befs_sb->nls when iocharset is set to utf8. So now
after this cgange mount option iocharset=utf8 activates usage of native
UTF-8 code path in befs driver.

Signed-off-by: Pali Rohár <pali@xxxxxxxxxx>
---
 fs/befs/linuxvfs.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 963da3e9ab5d..000f946b92b6 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -770,6 +770,7 @@ static int befs_show_options(struct seq_file *m, struct dentry *root)
 {
 	struct befs_sb_info *befs_sb = BEFS_SB(root->d_sb);
 	struct befs_mount_options *opts = &befs_sb->mount_opts;
+	struct nls_table *nls = befs_sb->nls;
 
 	if (!uid_eq(opts->uid, GLOBAL_ROOT_UID))
 		seq_printf(m, ",uid=%u",
@@ -777,8 +778,10 @@ static int befs_show_options(struct seq_file *m, struct dentry *root)
 	if (!gid_eq(opts->gid, GLOBAL_ROOT_GID))
 		seq_printf(m, ",gid=%u",
 			   from_kgid_munged(&init_user_ns, opts->gid));
-	if (opts->iocharset)
-		seq_printf(m, ",iocharset=%s", opts->iocharset);
+	if (nls)
+		seq_printf(m, ",iocharset=%s", nls->charset);
+	else
+		seq_puts(m, ",iocharset=utf8");
 	if (opts->debug)
 		seq_puts(m, ",debug");
 	return 0;
@@ -908,8 +911,10 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
 		goto unacquire_priv_sbp;
 	}
 
+	if (strcmp(opt.iocharset ? opt.iocharset : CONFIG_NLS_DEFAULT, "utf8") == 0) {
+		befs_debug(sb, "Using native UTF-8 without nls");
 	/* load nls library */
-	if (befs_sb->mount_opts.iocharset) {
+	} else if (befs_sb->mount_opts.iocharset) {
 		befs_debug(sb, "Loading nls: %s",
 			   befs_sb->mount_opts.iocharset);
 		befs_sb->nls = load_nls(befs_sb->mount_opts.iocharset);
-- 
2.20.1




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux