From patchwork Sun Aug 8 16:24:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12425003 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B874EC43216 for ; Sun, 8 Aug 2021 16:25:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9ED7861055 for ; Sun, 8 Aug 2021 16:25:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232243AbhHHQ0J (ORCPT ); Sun, 8 Aug 2021 12:26:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:47530 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231882AbhHHQZg (ORCPT ); Sun, 8 Aug 2021 12:25:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AC3B6610A1; Sun, 8 Aug 2021 16:25:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628439917; bh=s8/pegOQ7RYOq+lh3ThWZRo1NRJOC4wAYqGAubgRpOU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jvq5yzqR6RoEecl4y1TjillgIF7I6qPa74Gyb7EtLccaqf3UZZeDSACwA5V9YcoEM +0nDO8hc3r1SW4TEQzWPXRkwesbSyw+Tp6lRiTI9pOMSSoaXB3YY+TEAi5DSvdeJfn oSuaQ+hG8uRvT3ByMfTCH0Dfbyx8RQBKfp9pWCOVYY8Tvi1Gp82FIqIlJsk5jAGFSE kq29jYqwhS+AD9rFH//ptfRxG3SAKEvSWxWq2Br4+Vwo9L6m+a3n+d/HlC5mAsfCET BNC71n1V9DRYoFe0DnjEv2ZqNOoJpCawE4648iyrsqLn4a2m4twkzZpY9jCqLVn7AY 2RTQoRtOuv9rg== Received: by pali.im (Postfix) id 6E27613DC; Sun, 8 Aug 2021 18:25:17 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: linux-fsdevel@vger.kernel.org, linux-ntfs-dev@lists.sourceforge.net, linux-cifs@vger.kernel.org, jfs-discussion@lists.sourceforge.net, linux-kernel@vger.kernel.org, Alexander Viro , Jan Kara , OGAWA Hirofumi , "Theodore Y . Ts'o" , Luis de Bethencourt , Salah Triki , Andrew Morton , Dave Kleikamp , Anton Altaparmakov , Pavel Machek , =?utf-8?q?Marek_Beh=C3=BAn?= , Christoph Hellwig Subject: [RFC PATCH 10/20] befs: Allow to use native UTF-8 mode Date: Sun, 8 Aug 2021 18:24:43 +0200 Message-Id: <20210808162453.1653-11-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210808162453.1653-1-pali@kernel.org> References: <20210808162453.1653-1-pali@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org 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 --- 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);