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;