event: Change the base to 0 when calling strtol

Previously, we can -p + hex value(e.g., 0x1) to assign the master core
and start the NVMe-oF or iSCSI target app.

However now it is not supported and prints error. I checked
the code, it only supports transformation with Decimal format,
so chaning the base to 0 to make it supporting other formats.

Change-Id: I82510ba0cef47b5593484b4fd3490f85c93cf6a5
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/444830 (master)
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447593
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Ziye Yang 2019-02-15 22:45:35 +08:00 committed by Darek Stojaczyk
parent b0cacd460d
commit e0c1093936

View File

@ -857,7 +857,7 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
retval = SPDK_APP_PARSE_ARGS_HELP; retval = SPDK_APP_PARSE_ARGS_HELP;
goto out; goto out;
case SHM_ID_OPT_IDX: case SHM_ID_OPT_IDX:
opts->shm_id = spdk_strtol(optarg, 10); opts->shm_id = spdk_strtol(optarg, 0);
if (opts->shm_id < 0) { if (opts->shm_id < 0) {
fprintf(stderr, "Invalid shared memory ID %s\n", optarg); fprintf(stderr, "Invalid shared memory ID %s\n", optarg);
goto out; goto out;
@ -867,14 +867,14 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
opts->reactor_mask = optarg; opts->reactor_mask = optarg;
break; break;
case MEM_CHANNELS_OPT_IDX: case MEM_CHANNELS_OPT_IDX:
opts->mem_channel = spdk_strtol(optarg, 10); opts->mem_channel = spdk_strtol(optarg, 0);
if (opts->mem_channel < 0) { if (opts->mem_channel < 0) {
fprintf(stderr, "Invalid memory channel %s\n", optarg); fprintf(stderr, "Invalid memory channel %s\n", optarg);
goto out; goto out;
} }
break; break;
case MASTER_CORE_OPT_IDX: case MASTER_CORE_OPT_IDX:
opts->master_core = spdk_strtol(optarg, 10); opts->master_core = spdk_strtol(optarg, 0);
if (opts->master_core < 0) { if (opts->master_core < 0) {
fprintf(stderr, "Invalid master core %s\n", optarg); fprintf(stderr, "Invalid master core %s\n", optarg);
goto out; goto out;