},
{
.name = "randrepeat",
- .type = FIO_OPT_INT,
+ .type = FIO_OPT_BOOL,
.off1 = td_var_offset(rand_repeatable),
.help = "Use repeatable random IO pattern",
.def = "1",
},
{
.name = "invalidate",
- .type = FIO_OPT_INT,
+ .type = FIO_OPT_BOOL,
.off1 = td_var_offset(invalidate_cache),
.help = "Invalidate buffer/page cache prior to running job",
.def = "1",
},
{
.name = "sync",
- .type = FIO_OPT_INT,
+ .type = FIO_OPT_BOOL,
.off1 = td_var_offset(sync_io),
.help = "Use O_SYNC for buffered writes",
.def = "0",
},
{
.name = "create_serialize",
- .type = FIO_OPT_INT,
+ .type = FIO_OPT_BOOL,
.off1 = td_var_offset(create_serialize),
.help = "Serialize creating of job files",
.def = "1",
},
{
.name = "create_fsync",
- .type = FIO_OPT_INT,
+ .type = FIO_OPT_BOOL,
.off1 = td_var_offset(create_fsync),
.help = "Fsync file after creation",
.def = "1",
},
{
.name = "direct",
- .type = FIO_OPT_INT,
+ .type = FIO_OPT_BOOL,
.off1 = td_var_offset(odirect),
.help = "Use O_DIRECT IO",
.def = "1",
},
{
.name = "overwrite",
- .type = FIO_OPT_INT,
+ .type = FIO_OPT_BOOL,
.off1 = td_var_offset(overwrite),
.help = "When writing, set whether to overwrite current data",
.def = "0",
#endif
{
.name = "end_fsync",
- .type = FIO_OPT_INT,
+ .type = FIO_OPT_BOOL,
.off1 = td_var_offset(end_fsync),
.help = "Include fsync at the end of job",
.def = "0",
},
{
.name = "unlink",
- .type = FIO_OPT_INT,
+ .type = FIO_OPT_BOOL,
.off1 = td_var_offset(unlink),
.help = "Unlink created files after job has completed",
.def = "1",
f_out = stdout;
f_err = stderr;
+ options_init(options);
+
dupe_job_options();
if (setup_thread_area())
break;
}
- case FIO_OPT_INT: {
+ case FIO_OPT_INT:
+ case FIO_OPT_BOOL: {
fio_opt_int_fn *fn = o->cb;
ret = check_int(ptr, &il);
"string (opt=bla)",
"string with dual range (opt=1k-4k,4k-8k)",
"integer value (opt=100)",
+ "boolean value (opt=1)",
"no argument (opt)",
};
int found = 0;
return 1;
}
+/*
+ * Handle parsing of default parameters.
+ */
void fill_default_options(void *data, struct fio_option *options)
{
struct fio_option *o = &options[0];
o++;
}
}
+
+/*
+ * Sanitize the options structure. For now it just sets min/max for bool
+ * values.
+ */
+void options_init(struct fio_option *options)
+{
+ struct fio_option *o = &options[0];
+
+ while (o->name) {
+ if (o->type == FIO_OPT_BOOL) {
+ o->minval = 0;
+ o->maxval = 1;
+ }
+ o++;
+ }
+}
FIO_OPT_STR_STORE,
FIO_OPT_RANGE,
FIO_OPT_INT,
+ FIO_OPT_BOOL,
FIO_OPT_STR_SET,
};
extern int parse_cmd_option(const char *t, const char *l, struct fio_option *, void *);
extern int show_cmd_help(struct fio_option *, const char *);
extern void fill_default_options(void *, struct fio_option *);
+extern void options_init(struct fio_option *);
extern void strip_blank_front(char **);
extern void strip_blank_end(char *);