[PATCH 3/7] Revert "mount.nfs: merge in vers= and nfsvers= options"

NeilBrown
2020-12-16T04:44:29Z

This reverts commit 8110103404b35d9e86057ef0764f8aa87585f455.

Using mnt_alias_tab[] to handle options which are synonyms isn't really
a good fit. This sort-of works, but in part only because 'strstr()'
is used for matching so "vers=" is found when "nfsvers=" is present.
This doesn't handle other version-setting options like v2, v3, v4.x.

So remove this commit to make room for a better solution.

Signed-off-by: NeilBrown <neilb@suse.de>
---
utils/mount/configfile.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c
index 2470bc6a8bf6..e20aa73739fc 100644
--- a/utils/mount/configfile.c
+++ b/utils/mount/configfile.c
@@ -70,7 +70,6 @@ struct mnt_alias {
{"background", "bg", MNT_NOARG},
{"foreground", "fg", MNT_NOARG},
{"sloppy", "sloppy", MNT_NOARG},
- {"nfsvers", "vers", MNT_UNSET},
};
int mnt_alias_sz = (sizeof(mnt_alias_tab)/sizeof(mnt_alias_tab[0]));

@@ -296,21 +295,20 @@ conf_parse_mntopts(char *section, char *arg, char *opts)

list = conf_get_tag_list(section, arg);
TAILQ_FOREACH(node, &list->fields, link) {
- /* check first if this is an alias for another option */
- field = mountopts_alias(node->field, &argtype);
/*
* Do not overwrite options if already exists
*/
- snprintf(buf, BUFSIZ, "%s=", field);
+ snprintf(buf, BUFSIZ, "%s=", node->field);
if (opts && strcasestr(opts, buf) != NULL)
continue;

- if (lookup_entry(field) != NULL)
+ if (lookup_entry(node->field) != NULL)
continue;
buf[0] = '\0';
value = conf_get_section(section, arg, node->field);
if (value == NULL)
continue;
+ field = mountopts_alias(node->field, &argtype);
if (strcasecmp(value, "false") == 0) {
if (argtype != MNT_NOARG)
snprintf(buf, BUFSIZ, "no%s", field);