+static struct fio_option *find_child(struct fio_option *options,
+ struct fio_option *o)
+{
+ struct fio_option *__o;
+
+ for (__o = options + 1; __o->name; __o++)
+ if (__o->parent && !strcmp(__o->parent, o->name))
+ return __o;
+
+ return NULL;
+}
+
+static void __print_option(struct fio_option *o, struct fio_option *org,
+ int level)
+{
+ char name[256], *p;
+ int depth;
+
+ if (!o)
+ return;
+ if (!org)
+ org = o;
+
+ p = name;
+ depth = level;
+ while (depth--)
+ p += sprintf(p, "%s", " ");
+
+ sprintf(p, "%s", o->name);
+
+ printf("%-24s: %s\n", name, o->help);
+}
+
+static void print_option(struct fio_option *o)
+{
+ struct fio_option *parent;
+ struct fio_option *__o;
+ unsigned int printed;
+ unsigned int level;
+
+ __print_option(o, NULL, 0);
+ parent = o;
+ level = 0;
+ do {
+ level++;
+ printed = 0;
+
+ while ((__o = find_child(o, parent)) != NULL) {
+ __print_option(__o, o, level);
+ o = __o;
+ printed++;
+ }
+
+ parent = o;
+ } while (printed);
+}
+