event: move default opt values out of public API

The public API user is supposed to retrieve the defaults via the
spdk_app_opts_init() function.

Change-Id: Ie2bd6e809b2d47dbd5d62d396e8715f89f4052d9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2017-01-04 17:02:01 -07:00 committed by Ben Walker
parent 2931a3efef
commit 3d528833d5
5 changed files with 20 additions and 13 deletions

View File

@ -62,6 +62,10 @@ spdk_sigusr1(int signo __attribute__((__unused__)))
static void static void
usage(char *executable_name) usage(char *executable_name)
{ {
struct spdk_app_opts opts;
spdk_app_opts_init(&opts);
printf("%s [options]\n", executable_name); printf("%s [options]\n", executable_name);
printf("options:\n"); printf("options:\n");
printf(" -c config config file (default %s)\n", SPDK_ISCSI_DEFAULT_CONFIG); printf(" -c config config file (default %s)\n", SPDK_ISCSI_DEFAULT_CONFIG);
@ -69,7 +73,7 @@ usage(char *executable_name)
printf(" -m mask core mask for DPDK\n"); printf(" -m mask core mask for DPDK\n");
printf(" -i instance ID\n"); printf(" -i instance ID\n");
printf(" -l facility use specific syslog facility (default %s)\n", printf(" -l facility use specific syslog facility (default %s)\n",
SPDK_APP_DEFAULT_LOG_FACILITY); opts.log_facility);
printf(" -n channel number of memory channels used for DPDK\n"); printf(" -n channel number of memory channels used for DPDK\n");
printf(" -p core master (primary) core for DPDK\n"); printf(" -p core master (primary) core for DPDK\n");
printf(" -s size memory size in MB for DPDK\n"); printf(" -s size memory size in MB for DPDK\n");

View File

@ -296,6 +296,10 @@ nvmf_tgt_shutdown_subsystem_by_nqn(const char *nqn)
static void static void
usage(void) usage(void)
{ {
struct spdk_app_opts opts;
spdk_app_opts_init(&opts);
printf("nvmf [options]\n"); printf("nvmf [options]\n");
printf("options:\n"); printf("options:\n");
printf(" -c config - config file (default %s)\n", SPDK_NVMF_DEFAULT_CONFIG); printf(" -c config - config file (default %s)\n", SPDK_NVMF_DEFAULT_CONFIG);
@ -303,7 +307,7 @@ usage(void)
printf(" -m mask - core mask for DPDK\n"); printf(" -m mask - core mask for DPDK\n");
printf(" -i instance ID\n"); printf(" -i instance ID\n");
printf(" -l facility - use specific syslog facility (default %s)\n", printf(" -l facility - use specific syslog facility (default %s)\n",
SPDK_APP_DEFAULT_LOG_FACILITY); opts.log_facility);
printf(" -n channel number of memory channels used for DPDK\n"); printf(" -n channel number of memory channels used for DPDK\n");
printf(" -p core master (primary) core for DPDK\n"); printf(" -p core master (primary) core for DPDK\n");
printf(" -s size memory size in MB for DPDK\n"); printf(" -s size memory size in MB for DPDK\n");

View File

@ -80,9 +80,6 @@
#include "spdk/queue.h" #include "spdk/queue.h"
#define SPDK_APP_DEFAULT_LOG_FACILITY "local7"
#define SPDK_APP_DEFAULT_LOG_PRIORITY "info"
typedef struct spdk_event *spdk_event_t; typedef struct spdk_event *spdk_event_t;
typedef void (*spdk_event_fn)(spdk_event_t); typedef void (*spdk_event_fn)(spdk_event_t);
@ -107,11 +104,6 @@ struct spdk_poller;
typedef void (*spdk_app_shutdown_cb)(void); typedef void (*spdk_app_shutdown_cb)(void);
typedef void (*spdk_sighandler_t)(int); typedef void (*spdk_sighandler_t)(int);
#define SPDK_APP_DPDK_DEFAULT_MEM_SIZE 2048
#define SPDK_APP_DPDK_DEFAULT_MASTER_CORE 0
#define SPDK_APP_DPDK_DEFAULT_MEM_CHANNEL 4
#define SPDK_APP_DPDK_DEFAULT_CORE_MASK "0x1"
/** /**
* \brief Event framework initialization options * \brief Event framework initialization options
*/ */

View File

@ -53,6 +53,14 @@
#include "spdk/conf.h" #include "spdk/conf.h"
#include "spdk/trace.h" #include "spdk/trace.h"
#define SPDK_APP_DEFAULT_LOG_FACILITY "local7"
#define SPDK_APP_DEFAULT_LOG_PRIORITY "info"
#define SPDK_APP_DPDK_DEFAULT_MEM_SIZE 2048
#define SPDK_APP_DPDK_DEFAULT_MASTER_CORE 0
#define SPDK_APP_DPDK_DEFAULT_MEM_CHANNEL 4
#define SPDK_APP_DPDK_DEFAULT_CORE_MASK "0x1"
/* Add enough here to append ".pid" plus 2 digit instance ID */ /* Add enough here to append ".pid" plus 2 digit instance ID */
#define SPDK_APP_PIDFILE_MAX_LENGTH 40 #define SPDK_APP_PIDFILE_MAX_LENGTH 40
#define SPDK_APP_PIDFILE_PREFIX "/var/run" #define SPDK_APP_PIDFILE_PREFIX "/var/run"
@ -215,9 +223,10 @@ spdk_app_opts_init(struct spdk_app_opts *opts)
memset(opts, 0, sizeof(*opts)); memset(opts, 0, sizeof(*opts));
opts->log_facility = SPDK_APP_DEFAULT_LOG_FACILITY;
opts->enable_coredump = true; opts->enable_coredump = true;
opts->instance_id = -1; opts->instance_id = -1;
opts->dpdk_mem_size = -1; opts->dpdk_mem_size = SPDK_APP_DPDK_DEFAULT_MEM_SIZE;
opts->dpdk_master_core = SPDK_APP_DPDK_DEFAULT_MASTER_CORE; opts->dpdk_master_core = SPDK_APP_DPDK_DEFAULT_MASTER_CORE;
opts->dpdk_mem_channel = SPDK_APP_DPDK_DEFAULT_MEM_CHANNEL; opts->dpdk_mem_channel = SPDK_APP_DPDK_DEFAULT_MEM_CHANNEL;
opts->reactor_mask = NULL; opts->reactor_mask = NULL;

View File

@ -130,8 +130,6 @@ spdk_build_eal_cmdline(struct spdk_app_opts *opts)
} }
/* set the memory size */ /* set the memory size */
if (opts->dpdk_mem_size == -1)
opts->dpdk_mem_size = SPDK_APP_DPDK_DEFAULT_MEM_SIZE;
g_arg_strings[EAL_MEMSIZE_ARG] = spdk_sprintf_alloc("-m %d", opts->dpdk_mem_size); g_arg_strings[EAL_MEMSIZE_ARG] = spdk_sprintf_alloc("-m %d", opts->dpdk_mem_size);
if (g_arg_strings[EAL_MEMSIZE_ARG] == NULL) { if (g_arg_strings[EAL_MEMSIZE_ARG] == NULL) {
spdk_free_ealargs(); spdk_free_ealargs();