mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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: Ian Kent <raven@themaw.net> Reviewed-by: Bill O'Donnell <bodonnel@redhat.com> Message-Id: <20230922041215.13675-6-raven@themaw.net> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
7efd93ea79
commit
9b2731666d
1 changed files with 72 additions and 64 deletions
|
@ -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 token;
|
||||
int ret;
|
||||
|
||||
root->i_uid = current_uid();
|
||||
root->i_gid = current_gid();
|
||||
|
||||
if (!options)
|
||||
return 1;
|
||||
|
||||
while ((p = strsep(&options, ",")) != NULL) {
|
||||
int token;
|
||||
|
||||
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 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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue