Commit 9b273166 authored by Ian Kent's avatar Ian Kent Committed by Christian Brauner

autofs: refactor parse_options()

Seperate out parts of parse_options() that will match better the
individual option processing used in the mount API to further simplify
the upcoming conversion.
Signed-off-by: default avatarIan Kent <raven@themaw.net>
Reviewed-by: default avatarBill O'Donnell <bodonnel@redhat.com>
Message-Id: <20230922041215.13675-6-raven@themaw.net>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 7efd93ea
......@@ -167,31 +167,19 @@ static int autofs_parse_fd(struct autofs_sb_info *sbi, int fd)
return 0;
}
static int parse_options(char *options,
struct inode *root, int *pgrp, bool *pgrp_set,
static int autofs_parse_param(char *optstr, struct inode *root,
int *pgrp, bool *pgrp_set,
struct autofs_sb_info *sbi)
{
char *p;
substring_t args[MAX_OPT_ARGS];
int option;
int pipefd = -1;
kuid_t uid;
kgid_t gid;
int ret;
root->i_uid = current_uid();
root->i_gid = current_gid();
if (!options)
return 1;
while ((p = strsep(&options, ",")) != NULL) {
int token;
int ret;
if (!*p)
continue;
token = match_token(p, tokens, args);
token = match_token(optstr, tokens, args);
switch (token) {
case Opt_fd:
if (match_int(args, &pipefd))
......@@ -246,11 +234,31 @@ static int parse_options(char *options,
break;
case Opt_ignore:
sbi->flags |= AUTOFS_SBI_IGNORE;
break;
default:
return 1;
}
return 0;
}
static int parse_options(char *options,
struct inode *root, int *pgrp, bool *pgrp_set,
struct autofs_sb_info *sbi)
{
char *p;
root->i_uid = current_uid();
root->i_gid = current_gid();
if (!options)
return 1;
while ((p = strsep(&options, ",")) != NULL) {
if (!*p)
continue;
if (autofs_parse_param(p, root, pgrp, pgrp_set, sbi))
return 1;
}
return (sbi->pipefd < 0);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment