X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=parse.c;h=ac1bee9c296ece240613d8759725aa2efe2b4233;hp=0ef00b81cda60ffb6209a0c3b305b370aeee8810;hb=d8b4f39507ad49c6c0e1595a36a5787930647a6d;hpb=dde7b2361bf5b052a9c5c727bb2b062c604c7d42 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; }