linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Kari Argillander <kari.argillander@gmail.com>
Cc: Christoph Hellwig <hch@lst.de>,
	Konstantin Komarov <almaz.alexandrovich@paragon-software.com>,
	ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org,
	Matthew Wilcox <willy@infradead.org>
Subject: Re: [RFC PATCH 1/4] fs/ntfs3: Use new api for mounting
Date: Mon, 16 Aug 2021 15:24:16 +0200	[thread overview]
Message-ID: <20210816132416.zk326rbhwe7eaj3i@pali> (raw)
In-Reply-To: <20210816131417.4mix6s2nzuxhkh53@kari-VirtualBox>

On Monday 16 August 2021 16:14:17 Kari Argillander wrote:
> > > + * Load nls table or if @nls is utf8 then return NULL because
> > > + * nls=utf8 is totally broken.
> > > + */
> > > +static struct nls_table *ntfs_load_nls(char *nls)
> > > +{
> > > +	struct nls_table *ret;
> > > +
> > > +	if (!nls)
> > > +		return ERR_PTR(-EINVAL);
> > > +	if (strcmp(nls, "utf8"))
> > > +		return NULL;
> > > +	if (strcmp(nls, CONFIG_NLS_DEFAULT))
> > > +		return load_nls_default();
> > > +
> > > +	ret = load_nls(nls);
> > > +	if (!ret)
> > > +		return ERR_PTR(-EINVAL);
> > > +
> > > +	return ret;
> > > +}
> > 
> > This looks like something quite generic and not file system specific.
> > But I haven't found time to look at the series from Pali how this all
> > fits together.
> 
> It is quite generic I agree. Pali's series not implemeted any new way
> doing this thing. In many cases Pali uses just load_nls and not
> load_nls_default. This function basically use that if possible. It seems
> that load_nls_default does not need error path so that's why it is nicer
> to use.

Yes, I'm using what is currently available. But providing some helper
function should be a nice cleanup.

> One though is to implement api function load_nls_or_utf8(). Then we do not
> need to test this utf8 stuff in all places.

Beware that there are more cases which can happen:

- iocharset is not specified
  --> then driver default behavior is used
      --> it is either some fixed encoding (e.g. iso8859-1, utf8) or
          CONFIG_NLS_DEFAULT (*); so it should behave like iocharset is
          set to that fixed encoding or CONFIG_NLS_DEFAULT
- iocharset is set to utf8
  --> then native utf8* functions should be used instead of nls
- iocharset is set to CONFIG_NLS_DEFAULT
  --> then load_nls_default() should be used which is IIRC guaranteed to
      not fail
- iocharset is not set to utf8, neither to CONFIG_NLS_DEFAULT
  --> then load_nls(iocharset) should be used; this may fail

(*) - it is pity that not all fs drivers are using CONFIG_NLS_DEFAULT
      and some are using some their own fixed encoding... it just
      increase mess and "user surprise"

  reply	other threads:[~2021-08-16 13:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16  2:46 Kari Argillander
2021-08-16  2:47 ` [RFC PATCH 1/4] fs/ntfs3: Use new api for mounting Kari Argillander
2021-08-16  3:23   ` Kari Argillander
2021-08-16 12:17     ` Christoph Hellwig
2021-08-16 13:19       ` Kari Argillander
2021-08-16 12:36   ` Christoph Hellwig
2021-08-16 13:14     ` Kari Argillander
2021-08-16 13:24       ` Pali Rohár [this message]
2021-08-16 13:40   ` Christian Brauner
2021-08-16 13:59     ` Kari Argillander
2021-08-16 14:21       ` Christian Brauner
2021-08-16  2:47 ` [RFC PATCH 2/4] fs/ntfs3: Remove unnecesarry mount option noatime Kari Argillander
2021-08-16 12:18   ` Christoph Hellwig
2021-08-16 12:45     ` Kari Argillander
2021-08-16  2:47 ` [RFC PATCH 3/4] fs/ntfs3: Make mount option nohidden more universal Kari Argillander
2021-08-16  2:47 ` [RFC PATCH 4/4] fs/ntfs3: Add iocharset= mount option as alias for nls= Kari Argillander
2021-08-16  3:03 ` [RFC PATCH 0/4] fs/ntfs3: Use new mount api and change some opts Kari Argillander
2021-08-16 12:27 ` your mail Christoph Hellwig
2021-08-16 12:48   ` [RFC PATCH 0/4] fs/ntfs3: Use new mount api and change some opts Kari Argillander

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=20210816132416.zk326rbhwe7eaj3i@pali \
    --to=pali@kernel.org \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=hch@lst.de \
    --cc=kari.argillander@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    --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).