Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2040880pxt; Sun, 8 Aug 2021 09:28:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz546erU8/nVbQ4MazcM0jyyNObvVtt2grLsw7rfecgEtUrmCiGXp34cNff2VYYdFkF2Iye X-Received: by 2002:a17:906:4894:: with SMTP id v20mr18509788ejq.207.1628440137424; Sun, 08 Aug 2021 09:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628440137; cv=none; d=google.com; s=arc-20160816; b=JuToQ71HecokIwfLm4+fM0VhznI3eUFWBWdD6HMsFxFMLhtRtJMTmWfq7Pub8jWi6p XPkpd6TTUInI6/FAABfmaC4G6JdG2woN2ntPedgXOccMubwjVlhb+RpoEL7wb4q2H07l wnan/T5wg6gfzxKipCiKP6PymFjY1NdP+Y9OPacVC3AXwtxa/Eh0/JH1rvY5DtVtEoFc m7/fBG/uEjb+ObT3Js2o96hlhpRGgCg9do3uR2rW1y3rwyIF2LNs4qaxNS51P56uYvQu fh6sWOFLlOa5+jRUV1MX+dqnw/BjqQL6BWhayurzIRL3/DgXxvg+WCAOfrSnwt2nbFLH 1LjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=j0viVAOrpRaH0noDcoSw/E/IT4i0YRSKfR9mjzxJ2Bg=; b=Y3vwkUqpSo5X/utecFq8M010EBC2n1R9dMoLacNBp/l34B/e0o2BYEBC+7R/ovmpmS dAxLl0rEnhTMOkgwDwsOSZnG1NGx87eK8Cxu4eaoUbwxBibe3JUy2q0jiL8UBeL64Tts IkIXLIU7LNzfNnwKvhs8WOHz36qp8ieKOGhyc0efphmify4JlDbn83cY8k/XXqmmxFQR j11yTnjuDrnt2Pa2WkLi6dic/lgii8/EpL0CbOtEYvYQnexsl+D1EQO5uK9snC8h9v3p cdq5GhYqWdBf4L0s/9gBRdRoTCTPan3xxSlLB/IfO0gnEsEM0qmVbsCsJSiXs2XmgIw1 dT9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jvq5yzqR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p5si13923547ejb.656.2021.08.08.09.28.34; Sun, 08 Aug 2021 09:28:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jvq5yzqR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232579AbhHHQ0R (ORCPT + 99 others); Sun, 8 Aug 2021 12:26:17 -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=20Roh=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=20Beh=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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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); -- 2.20.1