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.