+static int vp_cmp(const void *p1, const void *p2)
+{
+ const struct value_pair *vp1 = p1;
+ const struct value_pair *vp2 = p2;
+
+ return strlen(vp2->ival) - strlen(vp1->ival);
+}
+
+static void posval_sort(struct fio_option *o, struct value_pair *vpmap)
+{
+ const struct value_pair *vp;
+ int entries;
+
+ memset(vpmap, 0, PARSE_MAX_VP * sizeof(struct value_pair));
+
+ for (entries = 0; entries < PARSE_MAX_VP; entries++) {
+ vp = &o->posval[entries];
+ if (!vp->ival || vp->ival[0] == '\0')
+ break;
+
+ memcpy(&vpmap[entries], vp, sizeof(*vp));
+ }
+
+ qsort(vpmap, entries, sizeof(struct value_pair), vp_cmp);
+}
+
+static void show_option_range(struct fio_option *o)
+{
+ if (!o->minval && !o->maxval)
+ return;
+
+ printf("%20s: min=%d, max=%d\n", "range", o->minval, o->maxval);
+}
+
+static void show_option_values(struct fio_option *o)
+{
+ int i = 0;
+
+ do {
+ const struct value_pair *vp = &o->posval[i];
+
+ if (!vp->ival)
+ break;
+
+ printf("%20s: %-10s", i == 0 ? "valid values" : "", vp->ival);
+ if (vp->help)
+ printf(" %s", vp->help);
+ printf("\n");
+ i++;
+ } while (i < PARSE_MAX_VP);
+
+ if (i)
+ printf("\n");
+}
+