- case BEGIN:
- begin = strtol(optarg, &endptr, 0);
- if ((*endptr != 0) || (begin < 0)) {
- fatal(0, "Invalid --start value.\n");
- }
- break;
- case ITERS:
- iters = strtol(optarg, &endptr, 0);
- if ((*endptr != 0) || (iters <= 0)) {
- fatal(0, "Invalid --iters value.\n");
- }
- if (mode != LOOKUP && mode != OPEN) {
- usage(stderr, "--iters only makes sense with "
- "--lookup or --open.\n");
- }
- break;
- case TIME:
- seconds = strtol(optarg, &endptr, 0);
- if ((*endptr != 0) || (seconds <= 0)) {
- fatal(0, "Invalid --time value.\n");
- }
- break;
- case DIRFMT:
- if (strlen(optarg) > (PATH_MAX - 16)) {
- fatal(0, "--dirfmt too long\n");
- }
- dirfmt = optarg;
- break;
- case NDIRS:
- ndirs = strtol(optarg, &endptr, 0);
- if ((*endptr != 0) || (ndirs <= 0)) {
- fatal(0, "Invalid --ndirs value.\n");
- }
- if ((ndirs > nthreads) &&
- ((mode == CREATE) || (mode == MKNOD))) {
- fatal(0, "--ndirs=%d must be less than or "
- "equal to the number of threads (%d).\n",
- ndirs, nthreads);
- }
- break;
- case FILEFMT:
- if (strlen(optarg) > 4080) {
- fatal(0, "--filefmt too long\n");
- }
-
- /* Use %%d where you want the file # in the name. */
- sprintf(filefmt, optarg, myrank);
- break;
- case NFILES:
- nfiles = strtol(optarg, &endptr, 0);
- if ((*endptr != 0) || (nfiles <= 0)) {
- fatal(0, "Invalid --nfiles value.\n");
- }
- break;
- case STRIPES:
- stripes = strtol(optarg, &endptr, 0);
- if ((*endptr != 0) || (stripes < 0)) {
- fatal(0, "Invalid --stripes value.\n");
- }
-
- if (stripes == 0) {
- openflags |= O_LOV_DELAY_CREATE;
- } else {
- fatal(0, "non-zero --stripes value "
- "not yet supported.\n");
- }
-
- break;
- case SEED:
- seed = strtoul(optarg, &endptr, 0);
- if (*endptr) {
- fatal(0, "bad --seed option %s\n", optarg);
- }
- break;
- case SEEDFILE:
- seed_file = fopen(optarg, "r");
- if (!seed_file) {
- fatal(myrank, "fopen(%s) error: %s\n",
- optarg, strerror(errno));
- }
-
- for (i = -1; fgets(tmp, 16, seed_file) != NULL;) {
- if (++i == myrank)
- break;
- }
-
- if (i == myrank) {
- rc = sscanf(tmp, "%d", &seed);
- if ((rc != 1) || (seed < 0)) {
- fatal(myrank, "Invalid seed value '%s' "
- "at line %d in %s.\n",
- tmp, i, optarg);
- }
- } else {
- fatal(myrank, "File '%s' too short. Does not "
- "contain a seed for thread %d.\n",
- optarg, myrank);
- }
-
- fclose(seed_file);
- break;
- case RANDOM:
- case READDIR:
- if (mode != LOOKUP && mode != OPEN) {
- fatal(0, "--%s can only be specified with "
- "--lookup, or --open.\n",
- (char *)longOpts[index].name);
- }
- order = rc;
- break;
- case IGNORE:
- ++ignore;
- break;
- case DEBUG:
- ++debug;
- case VERBOSE:
- ++verbose;
- break;
- case HELP:
- usage(stdout, NULL);
+ case BEGIN:
+ begin = strtol(optarg, &endptr, 0);
+ if ((*endptr != 0) || (begin < 0))
+ fatal(0, "Invalid --start value.\n");
+ break;
+ case ITERS:
+ iters = strtol(optarg, &endptr, 0);
+ if ((*endptr != 0) || (iters <= 0))
+ fatal(0, "Invalid --iters value.\n");
+ if (mode != LOOKUP && mode != OPEN)
+ usage(stderr,
+ "--iters only makes sense with --lookup or --open.\n");
+ break;
+ case TIME:
+ seconds = strtol(optarg, &endptr, 0);
+ if ((*endptr != 0) || (seconds <= 0))
+ fatal(0, "Invalid --time value.\n");
+ break;
+ case DIRFMT:
+ if (strlen(optarg) > (PATH_MAX - 16))
+ fatal(0, "--dirfmt too long\n");
+ dirfmt = optarg;
+ break;
+ case NDIRS:
+ ndirs = strtol(optarg, &endptr, 0);
+ if ((*endptr != 0) || (ndirs <= 0))
+ fatal(0, "Invalid --ndirs value.\n");
+ if ((ndirs > nthreads) &&
+ ((mode == CREATE) || (mode == MKNOD))) {
+ fatal(0,
+ "--ndirs=%d must be less than or equal to the number of threads (%d).\n",
+ ndirs, nthreads);
+ }
+ break;
+ case FILEFMT:
+ if (strlen(optarg) > 4080)
+ fatal(0, "--filefmt too long\n");
+
+ /* Use %%d where you want the file # in the name. */
+ sprintf(filefmt, optarg, myrank);
+ break;
+ case NFILES:
+ nfiles = strtol(optarg, &endptr, 0);
+ if ((*endptr != 0) || (nfiles <= 0))
+ fatal(0, "Invalid --nfiles value.\n");
+ break;
+ case STRIPES:
+ stripes = strtol(optarg, &endptr, 0);
+ if ((*endptr != 0) || (stripes < 0))
+ fatal(0, "Invalid --stripes value.\n");
+
+ if (stripes == 0) {
+ openflags |= O_LOV_DELAY_CREATE;
+ } else {
+ fatal(0,
+ "non-zero --stripes value not yet supported.\n");
+ }
+
+ break;
+ case SEED:
+ seed = strtoul(optarg, &endptr, 0);
+ if (*endptr)
+ fatal(0, "bad --seed option %s\n", optarg);
+ break;
+ case SEEDFILE:
+ seed_file = fopen(optarg, "r");
+ if (!seed_file) {
+ fatal(myrank, "fopen(%s) error: %s\n",
+ optarg, strerror(errno));
+ }
+
+ for (i = -1; fgets(tmp, 16, seed_file) != NULL;) {
+ if (++i == myrank)
+ break;
+ }
+
+ if (i == myrank) {
+ rc = sscanf(tmp, "%d", &seed);
+ if ((rc != 1) || (seed < 0)) {
+ fatal(myrank,
+ "Invalid seed value '%s' at line %d in %s.\n",
+ tmp, i, optarg);
+ }
+ } else {
+ fatal(myrank,
+ "File '%s' too short. Does not contain a seed for thread %d.\n",
+ optarg, myrank);
+ }
+
+ fclose(seed_file);
+ break;
+ case RANDOM:
+ case READDIR:
+ if (mode != LOOKUP && mode != OPEN) {
+ fatal(0,
+ "--%s can only be specified with --lookup, or --open.\n",
+ (char *)longOpts[index].name);
+ }
+ order = rc;
+ break;
+ case IGNORE:
+ ++ignore;
+ break;
+ case DEBUG:
+ ++debug;
+ case VERBOSE:
+ ++verbose;
+ break;
+ case HELP:
+ usage(stdout, NULL);