Skip to content

Commit

Permalink
befs: Allow to use native UTF-8 mode
Browse files Browse the repository at this point in the history
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@kernel.org>
  • Loading branch information
pali authored and intel-lab-lkp committed Aug 8, 2021
1 parent bb094e4 commit 1f2cb15
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions fs/befs/linuxvfs.c
Expand Up @@ -770,15 +770,18 @@ 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",
from_kuid_munged(&init_user_ns, opts->uid));
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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1f2cb15

Please sign in to comment.