From c47537ee91cd4f73e575c371c28ca2ac6babd2c1 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 17 Apr 2018 21:49:51 -0600 Subject: [PATCH] parse: add support for soft deprecated options The currently deprecated option types will fail parsing. But we can also have options where we don't care, log an error for those but continue executing the job. Signed-off-by: Jens Axboe --- parse.c | 10 +++++++--- parse.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/parse.c b/parse.c index 539c6028..9685f1ea 100644 --- a/parse.c +++ b/parse.c @@ -36,6 +36,7 @@ static const char *opt_type_names[] = { "OPT_FLOAT_LIST", "OPT_STR_SET", "OPT_DEPRECATED", + "OPT_SOFT_DEPRECATED", "OPT_UNSUPPORTED", }; @@ -876,8 +877,9 @@ static int __handle_option(const struct fio_option *o, const char *ptr, break; } case FIO_OPT_DEPRECATED: - log_info("Option %s is deprecated\n", o->name); ret = 1; + case FIO_OPT_SOFT_DEPRECATED: + log_info("Option %s is deprecated\n", o->name); break; default: log_err("Bad option type %u\n", o->type); @@ -1235,7 +1237,8 @@ int show_cmd_help(const struct fio_option *options, const char *name) for (o = &options[0]; o->name; o++) { int match = 0; - if (o->type == FIO_OPT_DEPRECATED) + if (o->type == FIO_OPT_DEPRECATED || + o->type == FIO_OPT_SOFT_DEPRECATED) continue; if (!exec_profile && o->prof_name) continue; @@ -1309,7 +1312,8 @@ void fill_default_options(void *data, const struct fio_option *options) static void option_init(struct fio_option *o) { - if (o->type == FIO_OPT_DEPRECATED || o->type == FIO_OPT_UNSUPPORTED) + if (o->type == FIO_OPT_DEPRECATED || o->type == FIO_OPT_UNSUPPORTED || + o->type == FIO_OPT_SOFT_DEPRECATED) return; if (o->name && !o->lname) log_err("Option %s: missing long option name\n", o->name); diff --git a/parse.h b/parse.h index 4ad92d9d..4de5e77d 100644 --- a/parse.h +++ b/parse.h @@ -20,6 +20,7 @@ enum fio_opt_type { FIO_OPT_FLOAT_LIST, FIO_OPT_STR_SET, FIO_OPT_DEPRECATED, + FIO_OPT_SOFT_DEPRECATED, FIO_OPT_UNSUPPORTED, /* keep this last */ }; -- 2.25.1