Re: [PATCH v8 02/13] exfat: add super block operations

From: Pali RohÃr
Date: Thu Jan 02 2020 - 09:13:37 EST


On Thursday 02 January 2020 22:41:40 Namjae Jeon wrote:
> 2020-01-02 22:16 GMT+09:00, Pali RohÃr <pali.rohar@xxxxxxxxx>:
> > On Thursday 02 January 2020 09:30:29 Pali RohÃr wrote:
> >> On Thursday 02 January 2020 15:06:16 Namjae Jeon wrote:
> >> > > > +static const struct fs_parameter_spec exfat_param_specs[] = {
> >> > > > + fsparam_u32("uid", Opt_uid),
> >> > > > + fsparam_u32("gid", Opt_gid),
> >> > > > + fsparam_u32oct("umask", Opt_umask),
> >> > > > + fsparam_u32oct("dmask", Opt_dmask),
> >> > > > + fsparam_u32oct("fmask", Opt_fmask),
> >> > > > + fsparam_u32oct("allow_utime", Opt_allow_utime),
> >> > > > + fsparam_string("iocharset", Opt_charset),
> >> > > > + fsparam_flag("utf8", Opt_utf8),
> >> > >
> >> > > Hello! What is the purpose of having extra special "utf8" mount
> >> > > option?
> >> > > Is not one "iocharset=utf8" option enough?
> >> > utf8 nls_table supports utf8<->utf32 conversion and does not support
> >> > surrogate character conversion.
> >>
> >> So in other words, this is just subset of UTF-8 just to 3 byte long
> >> sequences (for Unicode code points up to the U+FFFF).
> >
> > Anyway, this is limitation of kernel's NLS framework? Or limitation in
> > current exfat driver implementation?
> This is not exfat driver issue. Please check fatfs, cifs, etc..
> >
> > Because if it is in kernel's NLS framework then all kernel drivers would
> > be affected by this limitation, and not only exfat.
> Yes, FATfs also has two options and There seems to be
> CONFIG_FAT_DEFAULT_UTF8 option to avoid the issue you said.
>
> 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.

I know that VFAT has two options for it, but I think this is historic
relict (backward compatibility). There are also other suspicious options
which today do nothing (e.g. cvf_format). So I would rather do not
compare it with 20 years old fat code...

But I have already looked at kernel's NLS implementation and it is
really limited to Unicode code points up to the U+FFFF. Kernel's wchar_t
type is is just for Plane-0 (u16) and all NLS encodings works with
wchar_t.

For "full Unicode" there is kernel type unicode_t.

And there is another thing, utf8 NLS encoding does not have defined
charset2upper/charset2lower tables.

So for iocharset=utf8 you really do not want to use utf8 NLS module.

But seem that above limitation for Plane-0 in kernel's NLS is not a
problem as all encodings (except utf8) fit into Plane-0. So only UTF-8
needs special handling, other encodings can use kernel's NLS tables.

> But the way you suggested looks better.
>
> Thanks!

--
Pali RohÃr
pali.rohar@xxxxxxxxx