Add option priorities
For instance, filename= must come after directory= or things will
go wrong. So add a priority value to each option, so that the parser
will take that into account.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/options.c b/options.c
index a7225ea..07e9304 100644
--- a/options.c
+++ b/options.c
@@ -463,6 +463,7 @@
.type = FIO_OPT_STR_STORE,
.off1 = td_var_offset(filename),
.cb = str_filename_cb,
+ .prio = 1, /* must come before "directory" */
.help = "File(s) to use for the workload",
},
{
@@ -1306,9 +1307,16 @@
}
}
-int fio_option_parse(struct thread_data *td, const char *opt)
+int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
{
- return parse_option(opt, options, td);
+ int i, ret;
+
+ sort_options(opts, options, num_opts);
+
+ for (ret = 0, i = 0; i < num_opts; i++)
+ ret |= parse_option(opts[i], options, td);
+
+ return ret;
}
int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)