options: add ->hide_on_set
Normally we hide children if the parent isn't set, but for some
options it's the other way around.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/goptions.c b/goptions.c
index f7ba303..b8ebaf9 100644
--- a/goptions.c
+++ b/goptions.c
@@ -108,6 +108,9 @@
struct fio_option *o;
int i;
+ if (parent->hide_on_set)
+ visible = !visible;
+
/*
* This isn't super fast, but it should not be an issue. If it is, we
* can speed it up by caching the lookup at least. Or we can do it
diff --git a/options.c b/options.c
index 819c06d..066724b 100644
--- a/options.c
+++ b/options.c
@@ -2625,6 +2625,7 @@
.help = "Greatly reduce number of gettimeofday() calls",
.cb = str_gtod_reduce_cb,
.def = "0",
+ .hide_on_set = 1,
.category = FIO_OPT_C_STAT,
.group = FIO_OPT_G_INVALID,
},
diff --git a/parse.h b/parse.h
index fe3b6bc..83cb5b1 100644
--- a/parse.h
+++ b/parse.h
@@ -62,6 +62,7 @@
struct value_pair posval[PARSE_MAX_VP];/* possible values */
const char *parent; /* parent option */
int hide; /* hide if parent isn't set */
+ int hide_on_set; /* hide on set, not on unset */
const char *inverse; /* if set, apply opposite action to this option */
struct fio_option *inv_opt; /* cached lookup */
int (*verify)(struct fio_option *, void *);