Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1904436rwl; Mon, 26 Dec 2022 06:24:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXt0E8j329GGctV0r9GjKlsWWAs2WbbrcEfVJNOAi+gDmelniHB64REQrwfkVB3VPOWiKCKe X-Received: by 2002:a05:6a00:13a4:b0:57f:f7a4:511a with SMTP id t36-20020a056a0013a400b0057ff7a4511amr26052190pfg.2.1672064680543; Mon, 26 Dec 2022 06:24:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672064680; cv=none; d=google.com; s=arc-20160816; b=ThO9lW7YyQPZ6LuSFDKlONsx3oTBs4Vwkx2lHYU8KDf12Yfv9DcUPQy0VgYk5X4n9i J+9ODAGhrN00sfhnAyttTVYQZhsDtOEJn5XZOk2fIdFBSTpeH+XxvZh1vM4i/DDzmfzY P7V8eLDRUIWCaHZXJ4K9oa6Y6LC+59QoI/T+2V9Un4/QCZ3HeL4Clhr6RTyweBb9u4jN soHNeXKZdMTbQ/Z0RwRQn/p++ayQLbe4Yhu6CUW/nV1Ghf6OttALZVhEeOcgSjW5mkDE F2YBLF6ek7yn31TZVwXJTo3P5Rft7C3YQpJbWsGNyL5fN6euMopsJ1uUUXF3CLjoeKiM BdAw== 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=rlNb/H2YpHsECRI7gjFepw+qr8opoFiXmh8kD2T2QDk=; b=wfVw11yOH/tfoYj3CNSnY/cnyHFglKfPyezNuyJZyTjlwCWzeWxuOlKSV9A4oF2ItP JrxQH/1P5/R9ve6YhC4eNhuT+nyYHMOny8C4ZNtcZkuwhVTbja+doScqFfBO/t2fDA7W HhKSM3ESj+bbIR/GXxOOPssmtbdQOZemL820JcX9XnGVhfz6eY+eECdWRO4tLkQZ/h/o cYMU6/oTh4WsRHp1w2iUWxL7LEV5j1VJcz/0yAKixGD4fSN8AL6dsA8WXwtkh1Pyagud GOCzPFFugeBDcqzbQp46qFZuicfhSfE8Jg+nQR5E4va+ZyTe7KKUa0DLtBu/ZUuC5Mt/ 84tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="eN/lw5Dn"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j3-20020a056a00174300b005787fd98b5fsi10776916pfc.274.2022.12.26.06.24.31; Mon, 26 Dec 2022 06:24:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="eN/lw5Dn"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232258AbiLZOW6 (ORCPT + 66 others); Mon, 26 Dec 2022 09:22:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230358AbiLZOWj (ORCPT ); Mon, 26 Dec 2022 09:22:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66E336387; Mon, 26 Dec 2022 06:22:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 24AA1B80D41; Mon, 26 Dec 2022 14:22:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C373CC433D2; Mon, 26 Dec 2022 14:22:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672064529; bh=7SbfW9t2WEOzR8seGOYlZoIpmGQJDZj+robHHxNPvMg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eN/lw5DnxdvYfY0ODuXLEVKk8TMiNQffzO157TNdgCyeYz3E1NQeWT+hcL+xZUwli 7SaS/CIG27kC5rvFtpnF69r70+2rhebnA/a8xvi6+a6ET8vR3BlMzqv+nd79m4Ctk5 HluUDpyMZ/J5cqCFLcLt005Koh/fhIIR1w+zSYRYBAFX2LeYqEqktySGVlYvhbiTeF 8qgaOW5dCRQkxY1QtcIyHGzT9NubIRCv3O2rPBzyhOLN2rbzxWVeKrAuX03CQzt6Qh Py1b9O3qYmaPBWcXE3fFmfng/+yEamTujxOXSUaKLvSHoolgw/axd9uTisp+6frJ3S SOqSEAybfSZCg== Received: by pali.im (Postfix) id 7E7D49D7; Mon, 26 Dec 2022 15:22:09 +0100 (CET) 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 , "Theodore Y . Ts'o" , Anton Altaparmakov , OGAWA Hirofumi , Luis de Bethencourt , Salah Triki , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Dave Kleikamp , Andrew Morton , Pavel Machek , Christoph Hellwig , Kari Argillander , Viacheslav Dubeyko Subject: [RFC PATCH v2 08/18] befs: Allow to use native UTF-8 mode Date: Mon, 26 Dec 2022 15:21:40 +0100 Message-Id: <20221226142150.13324-9-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221226142150.13324-1-pali@kernel.org> References: <20221226142150.13324-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 8d2954e3afd6..e5400123d33f 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -769,6 +769,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", @@ -776,8 +777,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; @@ -815,6 +818,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent) const unsigned long sb_block = 0; const off_t x86_sb_off = 512; int blocksize; + const char *p; sb->s_fs_info = kzalloc(sizeof(*befs_sb), GFP_KERNEL); if (sb->s_fs_info == NULL) @@ -907,8 +911,11 @@ befs_fill_super(struct super_block *sb, void *data, int silent) goto unacquire_priv_sbp; } + p = befs_sb->mount_opts.iocharset ? befs_sb->mount_opts.iocharset : CONFIG_NLS_DEFAULT; + if (strcmp(p, "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