linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: "Pali Rohár" <pali@kernel.org>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dsterba@suse.cz" <dsterba@suse.cz>,
	"aaptel@suse.com" <aaptel@suse.com>,
	"willy@infradead.org" <willy@infradead.org>,
	"rdunlap@infradead.org" <rdunlap@infradead.org>,
	"joe@perches.com" <joe@perches.com>,
	"mark@harmstone.com" <mark@harmstone.com>
Subject: RE: [PATCH v3 02/10] fs/ntfs3: Add initialization of super block
Date: Fri, 11 Sep 2020 16:59:34 +0000	[thread overview]
Message-ID: <948ac894450d494ea15496c2e5b8c906@paragon-software.com> (raw)
In-Reply-To: <20200904120625.2af76ebfnacbzwug@pali>

From: linux-fsdevel-owner@vger.kernel.org <linux-fsdevel-owner@vger.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

  reply	other threads:[~2020-09-11 17:00 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-28 14:39 [PATCH v3 00/10] NTFS read-write driver GPL implementation by Paragon Software Konstantin Komarov
2020-08-28 14:39 ` [PATCH v3 01/10] fs/ntfs3: Add headers and misc files Konstantin Komarov
2020-08-28 14:39 ` [PATCH v3 02/10] fs/ntfs3: Add initialization of super block Konstantin Komarov
2020-09-04 12:06   ` Pali Rohár
2020-09-11 16:59     ` Konstantin Komarov [this message]
2020-08-28 14:39 ` [PATCH v3 03/10] fs/ntfs3: Add bitmap Konstantin Komarov
2020-08-28 14:39 ` [PATCH v3 04/10] fs/ntfs3: Add file operations and implementation Konstantin Komarov
2020-08-28 15:45   ` Al Viro
2020-09-04 12:41     ` Konstantin Komarov
2020-08-28 15:55   ` Al Viro
2020-09-04 12:49     ` Konstantin Komarov
2020-09-04 11:50   ` Pali Rohár
2020-09-11 16:52     ` Konstantin Komarov
2020-09-21 13:36       ` Pali Rohár
2020-09-22 10:26         ` Aurélien Aptel
2020-09-25 16:39         ` Konstantin Komarov
2020-08-28 14:39 ` [PATCH v3 05/10] fs/ntfs3: Add attrib operations Konstantin Komarov
2020-08-28 16:14   ` Mark Harmstone
2020-08-28 14:39 ` [PATCH v3 06/10] fs/ntfs3: Add compression Konstantin Komarov
2020-08-28 14:39 ` [PATCH v3 07/10] fs/ntfs3: Add NTFS journal Konstantin Komarov
2020-08-28 14:39 ` [PATCH v3 08/10] fs/ntfs3: Add Kconfig, Makefile and doc Konstantin Komarov
2020-08-28 14:39 ` [PATCH v3 09/10] fs/ntfs3: Add NTFS3 in fs/Kconfig and fs/Makefile Konstantin Komarov
2020-09-01  0:37   ` kernel test robot
2020-09-01  4:45   ` kernel test robot
2020-08-28 14:39 ` [PATCH v3 10/10] fs/ntfs3: Add MAINTAINERS Konstantin Komarov
2020-08-29 11:31 ` [PATCH v3 00/10] NTFS read-write driver GPL implementation by Paragon Software Nikolay Borisov
2020-09-04 12:55   ` Konstantin Komarov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=948ac894450d494ea15496c2e5b8c906@paragon-software.com \
    --to=almaz.alexandrovich@paragon-software.com \
    --cc=aaptel@suse.com \
    --cc=dsterba@suse.cz \
    --cc=joe@perches.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@harmstone.com \
    --cc=pali@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).