[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <948ac894450d494ea15496c2e5b8c906@paragon-software.com>
Date: Fri, 11 Sep 2020 16:59:34 +0000
From: Konstantin Komarov <almaz.alexandrovich@...agon-software.com>
To: Pali Rohár <pali@...nel.org>
CC: "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"dsterba@...e.cz" <dsterba@...e.cz>,
"aaptel@...e.com" <aaptel@...e.com>,
"willy@...radead.org" <willy@...radead.org>,
"rdunlap@...radead.org" <rdunlap@...radead.org>,
"joe@...ches.com" <joe@...ches.com>,
"mark@...mstone.com" <mark@...mstone.com>
Subject: RE: [PATCH v3 02/10] fs/ntfs3: Add initialization of super block
From: linux-fsdevel-owner@...r.kernel.org <linux-fsdevel-owner@...r.kernel.org> On Behalf Of Pali Rohar
Sent: Friday, September 4, 2020 3:06 PM
>
> Hello Konstantin!
>
> On Friday 28 August 2020 07:39:30 Konstantin Komarov wrote:
> > + if (nls_name[0]) {
> > + sbi->nls = load_nls(nls_name);
> > + if (!sbi->nls) {
> > + ntfs_printk(sb, KERN_ERR "failed to load \"%s\"",
> > + nls_name);
> > + return -EINVAL;
> > + }
> > + } else {
> > + sbi->nls = load_nls_default();
> > + if (!sbi->nls) {
> > + ntfs_printk(sb, KERN_ERR "failed to load default nls");
> > + return -EINVAL;
> > + }
> > + }
> > +
> > + if (!strcmp(sbi->nls->charset, "utf8")) {
> > + /*use utf16s_to_utf8s/utf8s_to_utf16s instead of nls*/
> > + unload_nls(sbi->nls);
> > + sbi->nls = NULL;
> > + }
>
> You can slightly simplify this code to omit calling load_nls() for UTF-8. E.g.:
>
> if (strcmp(nls_name[0] ? nls_name : CONFIG_NLS_DEFAULT, "utf8") == 0) {
> /* For UTF-8 use utf16s_to_utf8s/utf8s_to_utf16s instead of nls */
> sbi->nls = NULL;
> } else if (nls_name) {
> sbi->nls = load_nls(nls_name);
> if (!sbi->nls) {
> /* handle error */
> }
> } else {
> sbi->nls = load_nls_default();
> if (!sbi->nls) {
> /* handle error */
> }
> }
Hi Pali! Thanks! Applied, check out the v5 please.
Best regards
Powered by blists - more mailing lists