parse: add support for soft deprecated options
authorJens Axboe <axboe@kernel.dk>
Wed, 18 Apr 2018 03:49:51 +0000 (21:49 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 18 Apr 2018 03:49:51 +0000 (21:49 -0600)
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 <axboe@kernel.dk>
parse.c
parse.h

diff --git a/parse.c b/parse.c
index 539c602865fbd3127c7dcdfb3ab06a4e758a50c0..9685f1eaf4ef4ecb268aebd9bd99e71eb74cd6c1 100644 (file)
--- 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 4ad92d9db274b9b75c04b0768795d33e98f39030..4de5e77d96dd5a5e27b624d950957c0bc42b9cd2 100644 (file)
--- 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 */
 };