+ printf("No such command: %s", name);
+ if (closest) {
+ printf(" - showing closest match\n");
+ printf("%20s: %s\n", closest->name, closest->help);
+ show_option_help(closest);
+ } else
+ printf("\n");
+
+ return 1;
+}
+
+/*
+ * Handle parsing of default parameters.
+ */
+void fill_default_options(void *data, struct fio_option *options)
+{
+ struct fio_option *o;
+
+ for (o = &options[0]; o->name; o++)
+ if (o->def)
+ handle_option(o, o->def, data);
+}
+
+/*
+ * Sanitize the options structure. For now it just sets min/max for bool
+ * values and whether both callback and offsets are given.
+ */
+void options_init(struct fio_option *options)
+{
+ struct fio_option *o;
+
+ for (o = &options[0]; o->name; o++) {
+ if (o->type == FIO_OPT_BOOL) {
+ o->minval = 0;
+ o->maxval = 1;
+ }
+ if (!o->cb && !o->off1)
+ fprintf(stderr, "Option %s: neither cb nor offset given\n", o->name);
+ if (o->type == FIO_OPT_STR)
+ continue;
+ if (o->cb && (o->off1 || o->off2 || o->off3 || o->off4))
+ fprintf(stderr, "Option %s: both cb and offset given\n", o->name);
+ }