- /* Set default flags here */
-
- s1 = options;
- while (*s1) {
- int clear = 0;
- int time_min = OBD_RECOVERY_TIME_MIN;
-
- /* Skip whitespace and extra commas */
- while (*s1 == ' ' || *s1 == ',')
- s1++;
-
- /* Client options are parsed in ll_options: eg. flock,
- user_xattr, acl */
-
- /* Parse non-ldiskfs options here. Rather than modifying
- ldiskfs, we just zero these out here */
- if (strncmp(s1, "abort_recov", 11) == 0) {
- lmd->lmd_flags |= LMD_FLG_ABORT_RECOV;
- clear++;
- } else if (strncmp(s1, "recovery_time_soft=", 19) == 0) {
- lmd->lmd_recovery_time_soft = max_t(int,
- simple_strtoul(s1 + 19, NULL, 10), time_min);
- clear++;
- } else if (strncmp(s1, "recovery_time_hard=", 19) == 0) {
- lmd->lmd_recovery_time_hard = max_t(int,
- simple_strtoul(s1 + 19, NULL, 10), time_min);
- clear++;
- } else if (strncmp(s1, "noir", 4) == 0) {
- lmd->lmd_flags |= LMD_FLG_NOIR; /* test purpose only. */
- clear++;
- } else if (strncmp(s1, "nosvc", 5) == 0) {
- lmd->lmd_flags |= LMD_FLG_NOSVC;
- clear++;
- } else if (strncmp(s1, "nomgs", 5) == 0) {
- lmd->lmd_flags |= LMD_FLG_NOMGS;
- clear++;
- } else if (strncmp(s1, "noscrub", 7) == 0) {
- lmd->lmd_flags |= LMD_FLG_NOSCRUB;
- clear++;
- } else if (strncmp(s1, PARAM_MGSNODE,
- sizeof(PARAM_MGSNODE) - 1) == 0) {
- s2 = s1 + sizeof(PARAM_MGSNODE) - 1;
- /* Assume the next mount opt is the first
- invalid nid we get to. */
- rc = lmd_parse_mgs(lmd, &s2);
- if (rc)
- goto invalid;
- clear++;
- } else if (strncmp(s1, "writeconf", 9) == 0) {
- lmd->lmd_flags |= LMD_FLG_WRITECONF;
- clear++;
- } else if (strncmp(s1, "update", 6) == 0) {
- lmd->lmd_flags |= LMD_FLG_UPDATE;
- clear++;
- } else if (strncmp(s1, "virgin", 6) == 0) {
- lmd->lmd_flags |= LMD_FLG_VIRGIN;
- clear++;
- } else if (strncmp(s1, "noprimnode", 10) == 0) {
- lmd->lmd_flags |= LMD_FLG_NO_PRIMNODE;
- clear++;
- } else if (strncmp(s1, "mgssec=", 7) == 0) {
- rc = lmd_parse_mgssec(lmd, s1 + 7);
- if (rc)
- goto invalid;
- clear++;
- /* ost exclusion list */
- } else if (strncmp(s1, "exclude=", 8) == 0) {
- rc = lmd_make_exclusion(lmd, s1 + 7);
- if (rc)
- goto invalid;
- clear++;
- } else if (strncmp(s1, "mgs", 3) == 0) {
- /* We are an MGS */
- lmd->lmd_flags |= LMD_FLG_MGS;
- clear++;
- } else if (strncmp(s1, "svname=", 7) == 0) {
- rc = lmd_parse_string(&lmd->lmd_profile, s1 + 7);
- if (rc)
- goto invalid;
- clear++;
- } else if (strncmp(s1, "param=", 6) == 0) {
- int length;
- char *tail = strchr(s1 + 6, ',');
- if (tail == NULL)
- length = strlen(s1);
- else
- length = tail - s1;
- length -= 6;
- strncat(lmd->lmd_params, s1 + 6, length);
- strcat(lmd->lmd_params, " ");
- clear++;
- } else if (strncmp(s1, "osd=", 4) == 0) {
- rc = lmd_parse_string(&lmd->lmd_osd_type, s1 + 4);
- if (rc)
- goto invalid;
- clear++;
- }
- /* Linux 2.4 doesn't pass the device, so we stuck it at the
- end of the options. */
- else if (strncmp(s1, "device=", 7) == 0) {
- devname = s1 + 7;
- /* terminate options right before device. device
- must be the last one. */
- *s1 = '\0';
- break;
- }
-
- /* Find next opt */
- s2 = strchr(s1, ',');
- if (s2 == NULL) {
- if (clear)
- *s1 = '\0';
- break;
- }
- s2++;
- if (clear)
- memmove(s1, s2, strlen(s2) + 1);
- else
- s1 = s2;
- }
-
- if (!devname) {
- LCONSOLE_ERROR_MSG(0x164, "Can't find the device name "
- "(need mount option 'device=...')\n");
- goto invalid;
- }
-
- s1 = strstr(devname, ":/");
- if (s1) {
- ++s1;
- lmd->lmd_flags |= LMD_FLG_CLIENT;
- /* Remove leading /s from fsname */
- while (*++s1 == '/') ;
- /* Freed in lustre_free_lsi */
- OBD_ALLOC(lmd->lmd_profile, strlen(s1) + 8);
- if (!lmd->lmd_profile)
- RETURN(-ENOMEM);
- sprintf(lmd->lmd_profile, "%s-client", s1);
- }
-
- /* Freed in lustre_free_lsi */
- OBD_ALLOC(lmd->lmd_dev, strlen(devname) + 1);
- if (!lmd->lmd_dev)
- RETURN(-ENOMEM);
- strcpy(lmd->lmd_dev, devname);
-
- /* Save mount options */
- s1 = options + strlen(options) - 1;
- while (s1 >= options && (*s1 == ',' || *s1 == ' '))
- *s1-- = 0;
- if (*options != 0) {
- /* Freed in lustre_free_lsi */
- OBD_ALLOC(lmd->lmd_opts, strlen(options) + 1);
- if (!lmd->lmd_opts)
- RETURN(-ENOMEM);
- strcpy(lmd->lmd_opts, options);
- }
-
- lmd_print(lmd);
- lmd->lmd_magic = LMD_MAGIC;
-
- RETURN(rc);
+static const match_table_t lmd_flags_table = {
+ {LMD_FLG_SKIP_LFSCK, "skip_lfsck"},
+ {LMD_FLG_ABORT_RECOV, "abort_recov"},
+ {LMD_FLG_ABORT_RECOV, "abort_recovery"},
+ {LMD_FLG_NOSVC, "nosvc"},
+ {LMD_FLG_MGS, "mgs"},
+ {LMD_FLG_NOMGS, "nomgs"},
+ {LMD_FLG_WRITECONF, "writeconf"},
+ {LMD_FLG_NOIR, "noir"},
+ {LMD_FLG_NOSCRUB, "noscrub"},
+ {LMD_FLG_NO_PRIMNODE, "noprimnode"},
+ {LMD_FLG_VIRGIN, "virgin"},
+ {LMD_FLG_UPDATE, "update"},
+ {LMD_FLG_DEV_RDONLY, "rdonly_dev"},
+ {LMD_FLG_NO_CREATE, "no_create"},
+ {LMD_FLG_NO_CREATE, "no_precreate"},
+ {LMD_FLG_LOCAL_RECOV, "localrecov"},
+ {LMD_FLG_ABORT_RECOV_MDT, "abort_recov_mdt"},
+ {LMD_FLG_ABORT_RECOV_MDT, "abort_recovery_mdt"},
+ {LMD_FLG_NO_LOCAL_LOGS, "nolocallogs"},
+
+ {LMD_OPT_RECOVERY_TIME_SOFT, "recovery_time_soft=%u"},
+ {LMD_OPT_RECOVERY_TIME_HARD, "recovery_time_hard=%u"},
+ {LMD_OPT_MGSNODE, "mgsnode=%s"},
+ {LMD_OPT_MGSSEC, "mgssec=%s"},
+ {LMD_OPT_EXCLUDE, "exclude=%s"},
+ {LMD_OPT_SVNAME, "svname=%s"},
+ {LMD_OPT_PARAM, "param=%s"},
+ {LMD_OPT_OSD, "osd=%s"},
+ {LMD_OPT_NETWORK, "network=%s"},
+ {LMD_OPT_DEVICE, "device=%s"}, /* should be last */
+ {LMD_NUM_MOUNT_OPT, NULL}
+};