iscsi: Change type CHAP parameters for discovery from int to bool

Currently CHAP parameters for discovery are handled as bool but
they are defined as int. Hence change their type from int to bool
as done for target node previously.

Change-Id: I1e815946d4bdececcdd7cc873a725afbbcb98e50
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/403234
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2018-03-09 08:43:45 +09:00 committed by Jim Harris
parent 3af8e26df8
commit ed3e889fcd
3 changed files with 26 additions and 26 deletions

View File

@ -269,9 +269,9 @@ struct spdk_iscsi_opts {
char *nodebase;
int timeout;
int nopininterval;
int no_discovery_auth;
int req_discovery_auth;
int req_discovery_auth_mutual;
bool no_discovery_auth;
bool req_discovery_auth;
bool req_discovery_auth_mutual;
int discovery_auth_group;
uint32_t MaxSessions;
uint32_t MaxConnectionsPerSession;
@ -295,9 +295,9 @@ struct spdk_iscsi_globals {
int timeout;
int nopininterval;
int no_discovery_auth;
int req_discovery_auth;
int req_discovery_auth_mutual;
bool no_discovery_auth;
bool req_discovery_auth;
bool req_discovery_auth_mutual;
int discovery_auth_group;
uint32_t MaxSessions;

View File

@ -1231,11 +1231,11 @@ spdk_rpc_get_iscsi_global_params(struct spdk_jsonrpc_request *request,
spdk_json_write_int32(w, g_spdk_iscsi.nopininterval);
spdk_json_write_name(w, "discovery_auth_method");
if (g_spdk_iscsi.no_discovery_auth != 0) {
if (g_spdk_iscsi.no_discovery_auth) {
spdk_json_write_string(w, "none");
} else if (g_spdk_iscsi.req_discovery_auth == 0) {
} else if (!g_spdk_iscsi.req_discovery_auth) {
spdk_json_write_string(w, "auto");
} else if (g_spdk_iscsi.req_discovery_auth_mutual != 0) {
} else if (g_spdk_iscsi.req_discovery_auth_mutual) {
spdk_json_write_string(w, "chap mutual");
} else {
spdk_json_write_string(w, "chap");

View File

@ -545,10 +545,10 @@ spdk_iscsi_log_globals(void)
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "Timeout %d\n", g_spdk_iscsi.timeout);
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "NopInInterval %d\n",
g_spdk_iscsi.nopininterval);
if (g_spdk_iscsi.no_discovery_auth != 0) {
if (g_spdk_iscsi.no_discovery_auth) {
SPDK_DEBUGLOG(SPDK_LOG_ISCSI,
"DiscoveryAuthMethod None\n");
} else if (g_spdk_iscsi.req_discovery_auth == 0) {
} else if (!g_spdk_iscsi.req_discovery_auth) {
SPDK_DEBUGLOG(SPDK_LOG_ISCSI,
"DiscoveryAuthMethod Auto\n");
} else {
@ -584,9 +584,9 @@ spdk_iscsi_opts_init(struct spdk_iscsi_opts *opts)
opts->ErrorRecoveryLevel = DEFAULT_ERRORRECOVERYLEVEL;
opts->timeout = DEFAULT_TIMEOUT;
opts->nopininterval = DEFAULT_NOPININTERVAL;
opts->no_discovery_auth = 0;
opts->req_discovery_auth = 0;
opts->req_discovery_auth_mutual = 0;
opts->no_discovery_auth = false;
opts->req_discovery_auth = false;
opts->req_discovery_auth_mutual = false;
opts->discovery_auth_group = 0;
opts->authfile = strdup(SPDK_ISCSI_DEFAULT_AUTHFILE);
opts->nodebase = strdup(SPDK_ISCSI_DEFAULT_NODEBASE);
@ -717,21 +717,21 @@ spdk_iscsi_read_config_file_params(struct spdk_conf_section *sp,
val = spdk_conf_section_get_val(sp, "DiscoveryAuthMethod");
if (val != NULL) {
if (strcasecmp(val, "CHAP") == 0) {
opts->no_discovery_auth = 0;
opts->req_discovery_auth = 1;
opts->req_discovery_auth_mutual = 0;
opts->no_discovery_auth = false;
opts->req_discovery_auth = true;
opts->req_discovery_auth_mutual = false;
} else if (strcasecmp(val, "Mutual") == 0) {
opts->no_discovery_auth = 0;
opts->req_discovery_auth = 1;
opts->req_discovery_auth_mutual = 1;
opts->no_discovery_auth = false;
opts->req_discovery_auth = true;
opts->req_discovery_auth_mutual = true;
} else if (strcasecmp(val, "Auto") == 0) {
opts->no_discovery_auth = 0;
opts->req_discovery_auth = 0;
opts->req_discovery_auth_mutual = 0;
opts->no_discovery_auth = false;
opts->req_discovery_auth = false;
opts->req_discovery_auth_mutual = false;
} else if (strcasecmp(val, "None") == 0) {
opts->no_discovery_auth = 1;
opts->req_discovery_auth = 0;
opts->req_discovery_auth_mutual = 0;
opts->no_discovery_auth = true;
opts->req_discovery_auth = false;
opts->req_discovery_auth_mutual = false;
} else {
SPDK_ERRLOG("unknown auth %s, ignoring\n", val);
}