+ switch (o->type) {
+ case FIO_OPT_STR: {
+ fio_opt_str_fn *fn = o->cb;
+ const struct value_pair *vp;
+ struct value_pair posval[PARSE_MAX_VP];
+ int i;
+
+ posval_sort(o, posval);
+
+ for (i = 0; i < PARSE_MAX_VP; i++) {
+ vp = &posval[i];
+ if (!vp->ival || vp->ival[0] == '\0')
+ break;
+ ret = 1;
+ if (!strncmp(vp->ival, ptr, strlen(vp->ival))) {
+ ret = 0;
+ if (!o->off1)
+ break;
+ val_store(ilp, vp->oval, o->off1, data);
+ break;
+ }
+ }
+
+ if (ret)
+ show_option_values(o);
+ else if (fn)
+ ret = fn(data, ptr);
+ break;
+ }
+ case FIO_OPT_STR_VAL_TIME:
+ is_time = 1;
+ case FIO_OPT_STR_VAL:
+ case FIO_OPT_STR_VAL_INT: {
+ fio_opt_str_val_fn *fn = o->cb;
+
+ if (is_time)
+ ret = check_str_time(ptr, &ull);
+ else
+ ret = check_str_bytes(ptr, &ull);
+
+ if (ret)
+ break;
+
+ if (o->maxval && ull > o->maxval) {
+ fprintf(stderr, "max value out of range: %lld (%d max)\n", ull, o->maxval);
+ return 1;
+ }
+ if (o->minval && ull < o->minval) {
+ fprintf(stderr, "min value out of range: %lld (%d min)\n", ull, o->minval);
+ return 1;
+ }
+
+ if (fn)
+ ret = fn(data, &ull);
+ else {
+ if (o->type == FIO_OPT_STR_VAL_INT) {
+ if (first)
+ val_store(ilp, ull, o->off1, data);
+ if (!more && o->off2)
+ val_store(ilp, ull, o->off2, data);
+ } else {
+ if (first)
+ val_store(ullp, ull, o->off1, data);
+ if (!more && o->off2)
+ val_store(ullp, ull, o->off2, data);
+ }
+ }
+ break;
+ }
+ case FIO_OPT_STR_STORE: {
+ fio_opt_str_fn *fn = o->cb;
+
+ cp = td_var(data, o->off1);
+ *cp = strdup(ptr);
+ if (fn) {
+ ret = fn(data, ptr);
+ if (ret) {
+ free(*cp);
+ *cp = NULL;
+ }
+ }
+ break;
+ }
+ case FIO_OPT_RANGE: {
+ char tmp[128];
+ char *p1, *p2;
+
+ strncpy(tmp, ptr, sizeof(tmp) - 1);
+
+ p1 = strchr(tmp, '-');
+ if (!p1) {
+ p1 = strchr(tmp, ':');
+ if (!p1) {
+ ret = 1;
+ break;
+ }
+ }
+
+ p2 = p1 + 1;
+ *p1 = '\0';
+ p1 = tmp;
+
+ ret = 1;
+ if (!check_range_bytes(p1, &ul1) && !check_range_bytes(p2, &ul2)) {
+ ret = 0;
+ if (ul1 > ul2) {
+ unsigned long foo = ul1;
+
+ ul1 = ul2;
+ ul2 = foo;
+ }
+
+ if (first) {
+ val_store(ilp, ul1, o->off1, data);
+ val_store(ilp, ul2, o->off2, data);
+ }
+ if (o->off3 && o->off4) {
+ val_store(ilp, ul1, o->off3, data);
+ val_store(ilp, ul2, o->off4, data);
+ }
+ }
+
+ break;
+ }
+ case FIO_OPT_INT:
+ case FIO_OPT_BOOL: {
+ fio_opt_int_fn *fn = o->cb;