summaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2015-12-17 08:32:15 -0700
committerJens Axboe <axboe@fb.com>2015-12-17 08:32:15 -0700
commitd8b4f39507ad49c6c0e1595a36a5787930647a6d (patch)
treef74ada5d3385dbfb5dcbfe429e0414f1ce5e73f6 /parse.c
parentdde7b2361bf5b052a9c5c727bb2b062c604c7d42 (diff)
downloadfio-d8b4f39507ad49c6c0e1595a36a5787930647a6d.tar.gz
fio-d8b4f39507ad49c6c0e1595a36a5787930647a6d.tar.bz2
Ensure that command line options also end up in json output
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c44
1 files changed, 27 insertions, 17 deletions
diff --git a/parse.c b/parse.c
index 0ef00b81..ac1bee9c 100644
--- a/parse.c
+++ b/parse.c
@@ -960,8 +960,27 @@ void sort_options(char **opts, struct fio_option *options, int num_opts)
__fio_options = NULL;
}
+static void add_to_dump_list(struct fio_option *o, struct flist_head *dump_list,
+ const char *post)
+{
+ struct print_option *p;
+
+ if (!dump_list)
+ return;
+
+ p = malloc(sizeof(*p));
+ p->name = strdup(o->name);
+ if (post)
+ p->value = strdup(post);
+ else
+ p->value = NULL;
+
+ flist_add_tail(&p->list, dump_list);
+}
+
int parse_cmd_option(const char *opt, const char *val,
- struct fio_option *options, void *data)
+ struct fio_option *options, void *data,
+ struct flist_head *dump_list)
{
struct fio_option *o;
@@ -971,11 +990,13 @@ int parse_cmd_option(const char *opt, const char *val,
return 1;
}
- if (!handle_option(o, val, data))
- return 0;
+ if (handle_option(o, val, data)) {
+ log_err("fio: failed parsing %s=%s\n", opt, val);
+ return 1;
+ }
- log_err("fio: failed parsing %s=%s\n", opt, val);
- return 1;
+ add_to_dump_list(o, dump_list, val);
+ return 0;
}
int parse_option(char *opt, const char *input,
@@ -1006,18 +1027,7 @@ int parse_option(char *opt, const char *input,
return 1;
}
- if (dump_list) {
- struct print_option *p = malloc(sizeof(*p));
-
- p->name = strdup((*o)->name);
- if (post)
- p->value = strdup(post);
- else
- p->value = NULL;
-
- flist_add_tail(&p->list, dump_list);
- }
-
+ add_to_dump_list(*o, dump_list, post);
return 0;
}