Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751190AbcCHSJA (ORCPT ); Tue, 8 Mar 2016 13:09:00 -0500 Received: from mail.parknet.co.jp ([210.171.160.6]:55954 "EHLO mail.parknet.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750702AbcCHSIw (ORCPT ); Tue, 8 Mar 2016 13:08:52 -0500 From: OGAWA Hirofumi To: "Maciej S. Szmigiero" , Andrew Morton Cc: Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel Subject: Re: [PATCHv2] fat: add config option to set UTF-8 mount option by default References: <56DED942.3060900@maciej.szmigiero.name> Date: Wed, 09 Mar 2016 03:08:47 +0900 In-Reply-To: <56DED942.3060900@maciej.szmigiero.name> (Maciej S. Szmigiero's message of "Tue, 08 Mar 2016 14:53:06 +0100") Message-ID: <87twkg4zbk.fsf@mail.parknet.co.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4089 Lines: 103 "Maciej S. Szmigiero" writes: > FAT has long supported its own default file name encoding > config setting, separate from CONFIG_NLS_DEFAULT. > > However, if UTF-8 encoded file names are desired FAT > character set should not be set to utf8 since this would > make file names case sensitive even if case insensitive > matching is requested. > Instead, "utf8" mount options should be provided to enable > UTF-8 file names in FAT file system. > > Unfortunately, there was no possibility to set the default > value of this option so on UTF-8 system "utf8" mount option > had to be added manually to most FAT mounts. > > This patch adds config option to set such default value. > > Signed-off-by: Maciej S. Szmigiero Acked-by: OGAWA Hirofumi > --- > Changes from v1: use IS_ENABLED() macro to simplify code > > Documentation/filesystems/vfat.txt | 7 ++++--- > fs/fat/Kconfig | 18 +++++++++++++++++- > fs/fat/inode.c | 4 +++- > 3 files changed, 24 insertions(+), 5 deletions(-) > > diff --git a/Documentation/filesystems/vfat.txt b/Documentation/filesystems/vfat.txt > index 223c32171dcc..cf51360e3a9f 100644 > --- a/Documentation/filesystems/vfat.txt > +++ b/Documentation/filesystems/vfat.txt > @@ -56,9 +56,10 @@ iocharset= -- Character set to use for converting between the > you should consider the following option instead. > > utf8= -- UTF-8 is the filesystem safe version of Unicode that > - is used by the console. It can be enabled for the > - filesystem with this option. If 'uni_xlate' gets set, > - UTF-8 gets disabled. > + is used by the console. It can be enabled or disabled > + for the filesystem with this option. > + If 'uni_xlate' gets set, UTF-8 gets disabled. > + By default, FAT_DEFAULT_UTF8 setting is used. > > uni_xlate= -- Translate unhandled Unicode characters to special > escaped sequences. This would let you backup and > diff --git a/fs/fat/Kconfig b/fs/fat/Kconfig > index 182f9ffe2b51..3ff1772f612e 100644 > --- a/fs/fat/Kconfig > +++ b/fs/fat/Kconfig > @@ -93,8 +93,24 @@ config FAT_DEFAULT_IOCHARSET > that most of your FAT filesystems use, and can be overridden > with the "iocharset" mount option for FAT filesystems. > Note that "utf8" is not recommended for FAT filesystems. > - If unsure, you shouldn't set "utf8" here. > + If unsure, you shouldn't set "utf8" here - select the next option > + instead if you would like to use UTF-8 encoded file names by default. > See for more information. > > Enable any character sets you need in File Systems/Native Language > Support. > + > +config FAT_DEFAULT_UTF8 > + bool "Enable FAT UTF-8 option by default" > + depends on VFAT_FS > + default n > + help > + Set this if you would like to have "utf8" mount option set > + by default when mounting FAT filesystems. > + > + Even if you say Y here can always disable UTF-8 for > + particular mount by adding "utf8=0" to mount options. > + > + Say Y if you use UTF-8 encoding for file names, N otherwise. > + > + See for more information. > diff --git a/fs/fat/inode.c b/fs/fat/inode.c > index a5599052116c..226281068a46 100644 > --- a/fs/fat/inode.c > +++ b/fs/fat/inode.c > @@ -1127,7 +1127,7 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat, > } > opts->name_check = 'n'; > opts->quiet = opts->showexec = opts->sys_immutable = opts->dotsOK = 0; > - opts->utf8 = opts->unicode_xlate = 0; > + opts->unicode_xlate = 0; > opts->numtail = 1; > opts->usefree = opts->nocase = 0; > opts->tz_set = 0; > @@ -1135,6 +1135,8 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat, > opts->errors = FAT_ERRORS_RO; > *debug = 0; > > + opts->utf8 = IS_ENABLED(CONFIG_FAT_DEFAULT_UTF8) && is_vfat; > + > if (!options) > goto out; > -- OGAWA Hirofumi