options: add support for checking if an option has been set
We often just do a non-zero check, but an option can be set
and be set to zero, so we can't currently detect that. For
complicated options, we add a second variable to mark if it
has been set or not. This allows us to directly check if a
given option was set by the user or not.
Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/options.h b/options.h
index b2e2c0c..fa015c3 100644
--- a/options.h
+++ b/options.h
@@ -22,6 +22,13 @@
extern struct fio_option fio_options[FIO_MAX_OPTS];
+extern int __fio_option_is_set(struct thread_options *, unsigned int off);
+
+#define fio_option_is_set(__td, name) \
+ __fio_option_is_set((__td), td_var_offset(name))
+
+extern void fio_option_mark_set(struct thread_options *, struct fio_option *);
+
static inline int o_match(struct fio_option *o, const char *opt)
{
if (!strcmp(o->name, opt))