linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Laura Abbott <labbott@redhat.com>
Cc: David Howells <dhowells@redhat.com>,
	Jeremi Piotrowski <jeremi.piotrowski@gmail.com>,
	Linux FS Devel <linux-fsdevel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Phillip Lougher <phillip@squashfs.org.uk>,
	linux-kernel@vger.kernel.org, Ilya Dryomov <idryomov@gmail.com>
Subject: Re: [PATCH] vfs: Handle file systems without ->parse_params better
Date: Thu, 12 Dec 2019 21:47:24 +0000	[thread overview]
Message-ID: <20191212214724.GL4203@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20191212213604.19525-1-labbott@redhat.com>

On Thu, Dec 12, 2019 at 04:36:04PM -0500, Laura Abbott wrote:
> @@ -141,14 +191,19 @@ int vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param)
>  		 */
>  		return ret;
>  
> -	if (fc->ops->parse_param) {
> -		ret = fc->ops->parse_param(fc, param);
> -		if (ret != -ENOPARAM)
> -			return ret;
> -	}
> +	parse_param = fc->ops->parse_param;
> +	if (!parse_param)
> +		parse_param = fs_generic_parse_param;
> +
> +	ret = parse_param(fc, param);
> +	if (ret != -ENOPARAM)
> +		return ret;
>  
> -	/* If the filesystem doesn't take any arguments, give it the
> -	 * default handling of source.
> +	/*
> +	 * File systems may have a ->parse_param function but rely on
> +	 * the top level to parse the source function. File systems
> +	 * may have their own source parsing though so this needs
> +	 * to come after the call to parse_param above.
>  	 */
>  	if (strcmp(param->key, "source") == 0) {
>  		if (param->type != fs_value_is_string)
> -- 
> 2.21.0

No.  Please, get rid of the boilerplate.  About 80% of that thing
is an absolutely pointless dance around "but we need that to call
fs_parse()".  We do *NOT* need to call fs_parse() here.  We do
not need a struct fs_parameter_description instance.  We do not
need struct fs_parameter_spec instances.  We do not need a magical
global constant.  And I'm not entirely convinced that we need
to make fs_generic_parse_param() default - filesystems that
want this behaviour can easily ask for it.  A sane default is
to reject any bogus options.

I would call it ignore_unknowns_parse_param(), while we are at it.

  reply	other threads:[~2019-12-12 21:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12 21:36 [PATCH] vfs: Handle file systems without ->parse_params better Laura Abbott
2019-12-12 21:47 ` Al Viro [this message]
2019-12-12 22:32   ` Laura Abbott
2019-12-21 18:36 ` kbuild test robot
2019-12-21 18:36 ` [RFC PATCH] vfs: generic_fs_parameters can be static kbuild test robot

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=20191212214724.GL4203@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=dhowells@redhat.com \
    --cc=idryomov@gmail.com \
    --cc=jeremi.piotrowski@gmail.com \
    --cc=labbott@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=phillip@squashfs.org.uk \
    --cc=torvalds@linux-foundation.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).