-enum {
- Opt_uid, Opt_gid, Opt_err
-};
-
-static match_table_t tokens = {
- {Opt_uid, "uid=%u"},
- {Opt_gid, "gid=%u"},
- {Opt_err, NULL}
-};
-
-static int parse_options(char *options,uid_t *uid,gid_t *gid)
-{
- char *p;
- int option;
-
- *uid = current->uid;
- *gid = current->gid;
- if (!options)
- return 1;
-
- while ((p = strsep(&options, ",")) != NULL) {
- substring_t args[MAX_OPT_ARGS];
- int token;
- if (!*p)
- continue;
-
- token = match_token(p, tokens, args);
- switch (token) {
- case Opt_uid:
- if (match_int(args, &option))
- return 0;
- *uid = option;
- break;
- case Opt_gid:
- if (match_int(args, &option))
- return 0;
- *gid = option;
- break;
- default:
- return 0;
- }
- }
- return 1;
-}
-