From c31ad668938e0a867933bf41fed60a68a085bb1b Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Fri, 23 Oct 2020 17:03:17 +0000 Subject: [PATCH] event: deprecate opts.config_file member Just always put the config file name in json_config_file, since we now only support JSON. If user specifies both -c and --json, it will just take the latter of the two. This is similar to if the user specified --json twice. Signed-off-by: Jim Harris Change-Id: Idc21d73acf0e190eda57a7b0c5d9bcfa14e87030 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4858 Reviewed-by: Aleksey Marchuk Reviewed-by: Ben Walker Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot --- include/spdk/event.h | 2 +- lib/event/app.c | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/spdk/event.h b/include/spdk/event.h index c2ccfd3c9..570bc6a7b 100644 --- a/include/spdk/event.h +++ b/include/spdk/event.h @@ -89,7 +89,7 @@ typedef void (*spdk_sighandler_t)(int signal); */ struct spdk_app_opts { const char *name; - const char *config_file; + const char *config_file; /* deprecated */ const char *json_config_file; bool json_config_ignore_errors; const char *rpc_addr; /* Can be UNIX domain socket path or IP address + TCP port */ diff --git a/lib/event/app.c b/lib/event/app.c index 0a84c10ac..da50a88b9 100644 --- a/lib/event/app.c +++ b/lib/event/app.c @@ -401,6 +401,18 @@ spdk_app_start(struct spdk_app_opts *opts, spdk_msg_fn start_fn, return 1; } + if (opts->config_file) { + SPDK_ERRLOG("opts->config_file is deprecated. Use opts->json_config_file instead.\n"); + /* For now we will just treat config_file as json_config_file. But if both were + * specified we will return an error here. + */ + if (opts->json_config_file) { + SPDK_ERRLOG("Setting both opts->config_file and opts->json_config_file not allowed.\n"); + return 1; + } + opts->json_config_file = opts->config_file; + } + if (!start_fn) { SPDK_ERRLOG("start_fn should not be NULL\n"); return 1; @@ -640,8 +652,6 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts, while ((ch = getopt_long(argc, argv, cmdline_short_opts, cmdline_options, &opt_idx)) != -1) { switch (ch) { case CONFIG_FILE_OPT_IDX: - opts->config_file = optarg; - break; case JSON_CONFIG_OPT_IDX: opts->json_config_file = optarg; break; @@ -823,16 +833,6 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts, } } - if (opts->config_file) { - if (opts->json_config_file) { - SPDK_ERRLOG("ERROR: --config and --json options can't be used together.\n"); - goto out; - } - - opts->json_config_file = opts->config_file; - opts->config_file = NULL; - } - if (opts->json_config_file && opts->delay_subsystem_init) { SPDK_ERRLOG("JSON configuration file can't be used together with --wait-for-rpc.\n"); goto out;