RE: [PATCH v9 10/13] exfat: add nls operations

From: Namjae Jeon
Date: Fri Jan 03 2020 - 02:06:41 EST


> On Thursday 02 January 2020 16:20:33 Namjae Jeon wrote:
> > This adds the implementation of nls operations for exfat.
> >
> > Signed-off-by: Namjae Jeon <namjae.jeon@xxxxxxxxxxx>
> > Signed-off-by: Sungjong Seo <sj1557.seo@xxxxxxxxxxx>
> > ---
> > fs/exfat/nls.c | 809
> > +++++++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 809 insertions(+)
> > create mode 100644 fs/exfat/nls.c
> >
> > diff --git a/fs/exfat/nls.c b/fs/exfat/nls.c new file mode 100644
> > index 000000000000..af52328e28ff
> > --- /dev/null
> > +++ b/fs/exfat/nls.c
>
> ...
>
> > +int exfat_nls_uni16s_to_vfsname(struct super_block *sb,
> > + struct exfat_uni_name *uniname, unsigned char *p_cstring,
> > + int buflen)
> > +{
> > + if (EXFAT_SB(sb)->options.utf8)
> > + return __exfat_nls_utf16s_to_vfsname(sb, uniname, p_cstring,
> > + buflen);
> > + return __exfat_nls_uni16s_to_vfsname(sb, uniname, p_cstring,
> buflen);
> > +}
>
> Hello, I'm looking at this function and basically it do nothing.
> Or was it supposed that this function should do something more for UTF-8
> encoding?
>
> There is one if- statement, but in both branches is executed exactly
> same code.
>
> And executed function just pass same arguments as current callee
> function.
>
> So calls to exfat_nls_uni16s_to_vfsname() can be replaced by direct
> calls to __exfat_nls_uni16s_to_vfsname().
Ah, The function names are similar, but not same. see utf16s/uni16s.

Thanks!

>
> Or maybe better, rename __exfat_nls_uni16s_to_vfsname() function to
> exfat_nls_uni16s_to_vfsname().
>
> > +int exfat_nls_vfsname_to_uni16s(struct super_block *sb,
> > + const unsigned char *p_cstring, const int len,
> > + struct exfat_uni_name *uniname, int *p_lossy)
> > +{
> > + if (EXFAT_SB(sb)->options.utf8)
> > + return __exfat_nls_vfsname_to_utf16s(sb, p_cstring, len,
> > + uniname, p_lossy);
> > + return __exfat_nls_vfsname_to_uni16s(sb, p_cstring, len, uniname,
> > + p_lossy);
> > +}
>
> And same for this function.
>
> --
> Pali RohÃr
> pali.rohar@xxxxxxxxx