summaryrefslogtreecommitdiff
path: root/usr/iscsi_sysfs.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2011-08-14 15:31:21 -0500
committerMike Christie <michaelc@cs.wisc.edu>2011-08-14 22:12:57 -0500
commite8c5b1d34ee5ce0a755ff54518829156dfa5fabe (patch)
treecaccf31db5b032d5ce89490956798f7ab9997098 /usr/iscsi_sysfs.c
parent4c46693adcc35a1e2dbe22e1e7bd90254f189bd1 (diff)
downloadopen-iscsi-e8c5b1d34ee5ce0a755ff54518829156dfa5fabe.tar.gz
iscsi tools: add tgt reset to session info and fix unknown values
This patch adds tgt reset to the displayed timeouts. It also fixes recovery timeout handling. -1 is a valid setting in newer tools. If the kernel displays it then it is ok. And instead of printing "<NULL>" for settings we do not know the value for this prints out "<empty>" like is done in other places. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Diffstat (limited to 'usr/iscsi_sysfs.c')
-rw-r--r--usr/iscsi_sysfs.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index d854e22..995549e 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -777,27 +777,26 @@ int iscsi_sysfs_get_sessioninfo_by_id(struct session_info *info, char *session)
ret = sysfs_get_str(session, ISCSI_SESSION_SUBSYS, "username",
(info->chap).username,
sizeof((info->chap).username));
-
- if ((info->chap).username[0] == '\0' || ret)
- strcpy((info->chap).username, "<NULL>");
+ if (ret)
+ log_debug(5, "could not read username: %d", ret);
ret = sysfs_get_str(session, ISCSI_SESSION_SUBSYS, "password",
(info->chap).password,
sizeof((info->chap).password));
- if ((info->chap).password[0] == '\0' || ret)
- strcpy((info->chap).password, "<NULL>");
+ if (ret)
+ log_debug(5, "could not read password: %d", ret);
ret = sysfs_get_str(session, ISCSI_SESSION_SUBSYS, "username_in",
(info->chap).username_in,
sizeof((info->chap).username_in));
- if ((info->chap).username_in[0] == '\0' || ret)
- strcpy((info->chap).username_in, "<NULL>");
+ if (ret)
+ log_debug(5, "could not read username in: %d", ret);
ret = sysfs_get_str(session, ISCSI_SESSION_SUBSYS, "password_in",
(info->chap).password_in,
sizeof((info->chap).password_in));
- if ((info->chap).password_in[0] == '\0' || ret)
- strcpy((info->chap).password_in, "<NULL>");
+ if (ret)
+ log_debug(5, "could not read password in: %d", ret);
ret = sysfs_get_int(session, ISCSI_SESSION_SUBSYS, "recovery_tmo",
&((info->tmo).recovery_tmo));
@@ -809,6 +808,11 @@ int iscsi_sysfs_get_sessioninfo_by_id(struct session_info *info, char *session)
if (ret)
(info->tmo).lu_reset_tmo = -1;
+ ret = sysfs_get_int(session, ISCSI_SESSION_SUBSYS, "tgt_reset_tmo",
+ &((info->tmo).tgt_reset_tmo));
+ if (ret)
+ (info->tmo).lu_reset_tmo = -1;
+
sysfs_get_int(session, ISCSI_SESSION_SUBSYS, "abort_tmo",
&((info->tmo).abort_tmo));
if (ret)