From: Jens Axboe Date: Tue, 20 Mar 2012 09:19:44 +0000 (+0100) Subject: options: add ->hide_on_set X-Git-Tag: gfio-0.1~91 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=a4ed77fe07de1ca78cd44a6378dc20a2cd1ce7ad 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 --- diff --git a/goptions.c b/goptions.c index f7ba3038..b8ebaf9a 100644 --- a/goptions.c +++ b/goptions.c @@ -108,6 +108,9 @@ static void gopt_set_children_visible(struct fio_option *parent, 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 819c06d7..066724b2 100644 --- a/options.c +++ b/options.c @@ -2625,6 +2625,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .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 fe3b6bc5..83cb5b16 100644 --- a/parse.h +++ b/parse.h @@ -62,6 +62,7 @@ struct fio_option { 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 *);