From: Jens Axboe Date: Thu, 2 Nov 2006 08:12:40 +0000 (+0100) Subject: [PATCH] Improve job/cmd line parsing error logging X-Git-Tag: fio-1.8~14 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=b1508cf9ead36dc789a4e289f7522a070e57058c [PATCH] Improve job/cmd line parsing error logging Drop jobs when needed and so on. Signed-off-by: Jens Axboe --- diff --git a/init.c b/init.c index 6ad3c64c..b004d890 100644 --- a/init.c +++ b/init.c @@ -932,6 +932,9 @@ int parse_jobs_ini(char *file, int stonewall_flag) if (!ret) { fsetpos(f, &off); ret = add_job(td, name, 0); + } else { + log_err("fio: job %s dropped\n", name); + put_job(td); } } while (!ret); @@ -1054,7 +1057,12 @@ static int parse_cmd_line(int argc, char *argv[]) return 0; } - parse_cmd_option(opt, val, options, td); + ret = parse_cmd_option(opt, val, options, td); + if (ret) { + log_err("fio: job dropped\n"); + put_job(td); + td = NULL; + } break; } default: @@ -1184,7 +1192,6 @@ int parse_options(int argc, char *argv[]) if (!thread_number) { log_err("No jobs defined(s)\n"); - usage(); return 1; } diff --git a/parse.c b/parse.c index 7af6be1a..ae8d0d91 100644 --- a/parse.c +++ b/parse.c @@ -240,9 +240,6 @@ static int handle_option(struct fio_option *o, const char *ptr, void *data) ret = 1; } - if (ret) - fprintf(stderr, "fio: failed parsing %s=%s\n", o->name, ptr); - return ret; } @@ -257,7 +254,11 @@ int parse_cmd_option(const char *opt, const char *val, return 1; } - return handle_option(o, val, data); + if (!handle_option(o, val, data)) + return 0; + + fprintf(stderr, "fio: failed parsing %s=%s\n", opt, val); + return 1; } int parse_option(const char *opt, struct fio_option *options, void *data) @@ -285,5 +286,9 @@ int parse_option(const char *opt, struct fio_option *options, void *data) return 1; } - return handle_option(o, post, data); + if (!handle_option(o, post, data)) + return 0; + + fprintf(stderr, "fio: failed parsing %s\n", opt); + return 1; }