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/thread_options.h b/thread_options.h
index f311e2c..f0c6325 100644
--- a/thread_options.h
+++ b/thread_options.h
@@ -3,6 +3,7 @@
 
 #include "arch/arch.h"
 #include "os/os.h"
+#include "options.h"
 #include "stat.h"
 #include "gettime.h"
 #include "lib/ieee754.h"
@@ -28,10 +29,13 @@
 	uint32_t perc;
 };
 
+#define NR_OPTS_SZ	(FIO_MAX_OPTS / (8 * sizeof(uint64_t)))
+
 #define OPT_MAGIC	0x4f50544e
 
 struct thread_options {
 	int magic;
+	uint64_t set_options[NR_OPTS_SZ];
 	char *description;
 	char *name;
 	char *directory;
@@ -265,6 +269,7 @@
 #define FIO_TOP_STR_MAX		256
 
 struct thread_options_pack {
+	uint64_t set_options[NR_OPTS_SZ];
 	uint8_t description[FIO_TOP_STR_MAX];
 	uint8_t name[FIO_TOP_STR_MAX];
 	uint8_t directory[FIO_TOP_STR_MAX];