iscsi: cleanup iscsi_subsystem.c
1) Replace some perror() calls with SPDK_ERRLOG 2) Use spdk_conf_section_get_boolval() to simplify the code Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I2a6d0773b09ad16ea35cb6d2f18a9e0977dba31c Reviewed-on: https://review.gerrithub.io/386666 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
d97476efdf
commit
618c8f9040
@ -651,31 +651,16 @@ spdk_iscsi_read_parameters_from_config_file(struct spdk_conf_section *sp)
|
|||||||
g_spdk_iscsi.DefaultTime2Retain = DEFAULT_DEFAULTTIME2RETAIN;
|
g_spdk_iscsi.DefaultTime2Retain = DEFAULT_DEFAULTTIME2RETAIN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val = spdk_conf_section_get_val(sp, "ImmediateData");
|
g_spdk_iscsi.ImmediateData = spdk_conf_section_get_boolval(sp, "ImmediateData",
|
||||||
if (val != NULL) {
|
g_spdk_iscsi.ImmediateData);
|
||||||
if (strcasecmp(val, "Yes") == 0) {
|
|
||||||
g_spdk_iscsi.ImmediateData = 1;
|
|
||||||
} else if (strcasecmp(val, "No") == 0) {
|
|
||||||
g_spdk_iscsi.ImmediateData = 0;
|
|
||||||
} else {
|
|
||||||
SPDK_ERRLOG("unknown ImmediateData value %s, ignoring\n", val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This option is only for test.
|
/* This option is only for test.
|
||||||
* If AllowDuplicateIsid is enabled, it allows different connections carrying
|
* If AllowDuplicateIsid is enabled, it allows different connections carrying
|
||||||
* TSIH=0 login the target within the same session.
|
* TSIH=0 login the target within the same session.
|
||||||
*/
|
*/
|
||||||
val = spdk_conf_section_get_val(sp, "AllowDuplicateIsid");
|
g_spdk_iscsi.AllowDuplicateIsid = spdk_conf_section_get_boolval(sp, "AllowDuplicateIsid",
|
||||||
if (val != NULL) {
|
g_spdk_iscsi.AllowDuplicateIsid);
|
||||||
if (strcasecmp(val, "Yes") == 0) {
|
|
||||||
g_spdk_iscsi.AllowDuplicateIsid = 1;
|
|
||||||
} else if (strcasecmp(val, "No") == 0) {
|
|
||||||
g_spdk_iscsi.AllowDuplicateIsid = 0;
|
|
||||||
} else {
|
|
||||||
SPDK_ERRLOG("unknown AllowDuplicateIsid value %s, ignoring\n", val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ErrorRecoveryLevel = spdk_conf_section_get_intval(sp, "ErrorRecoveryLevel");
|
ErrorRecoveryLevel = spdk_conf_section_get_intval(sp, "ErrorRecoveryLevel");
|
||||||
if (ErrorRecoveryLevel >= 0) {
|
if (ErrorRecoveryLevel >= 0) {
|
||||||
if (ErrorRecoveryLevel > 2) {
|
if (ErrorRecoveryLevel > 2) {
|
||||||
@ -770,12 +755,12 @@ spdk_iscsi_app_read_parameters(void)
|
|||||||
g_spdk_iscsi.discovery_auth_group = 0;
|
g_spdk_iscsi.discovery_auth_group = 0;
|
||||||
g_spdk_iscsi.authfile = strdup(SPDK_ISCSI_DEFAULT_AUTHFILE);
|
g_spdk_iscsi.authfile = strdup(SPDK_ISCSI_DEFAULT_AUTHFILE);
|
||||||
if (!g_spdk_iscsi.authfile) {
|
if (!g_spdk_iscsi.authfile) {
|
||||||
perror("authfile");
|
SPDK_ERRLOG("could not strdup() default authfile name\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
g_spdk_iscsi.nodebase = strdup(SPDK_ISCSI_DEFAULT_NODEBASE);
|
g_spdk_iscsi.nodebase = strdup(SPDK_ISCSI_DEFAULT_NODEBASE);
|
||||||
if (!g_spdk_iscsi.nodebase) {
|
if (!g_spdk_iscsi.nodebase) {
|
||||||
perror("nodebase");
|
SPDK_ERRLOG("could not strdup() default nodebase\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -788,7 +773,7 @@ spdk_iscsi_app_read_parameters(void)
|
|||||||
|
|
||||||
g_spdk_iscsi.session = spdk_dma_zmalloc(sizeof(void *) * g_spdk_iscsi.MaxSessions, 0, NULL);
|
g_spdk_iscsi.session = spdk_dma_zmalloc(sizeof(void *) * g_spdk_iscsi.MaxSessions, 0, NULL);
|
||||||
if (!g_spdk_iscsi.session) {
|
if (!g_spdk_iscsi.session) {
|
||||||
perror("Unable to allocate session pointer array\n");
|
SPDK_ERRLOG("could not allocate session array\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user