options: add ->hide_on_set
authorJens Axboe <axboe@kernel.dk>
Tue, 20 Mar 2012 09:19:44 +0000 (10:19 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 20 Mar 2012 09:19:44 +0000 (10:19 +0100)
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>
goptions.c
options.c
parse.h

index f7ba3038fafe1e7a9007394542f6d75160ed8278..b8ebaf9a3252a72f3764c5904352c398028ac989 100644 (file)
@@ -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
index 819c06d77b31e5a7cbfcb147dcfae0e91a4e22e6..066724b23993684761b27a2d0d61d0343df42b4f 100644 (file)
--- 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 fe3b6bc5f236510dc3cdbb66b5c3a6069b79df34..83cb5b162931183bb104fb2b98823a430c235ec1 100644 (file)
--- 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 *);