[stgt] [PATCH 2/2] Handle iSNS being turned On/Off
Chandra Seetharaman
sekharan at us.ibm.com
Wed Aug 4 03:17:41 CEST 2010
Allow turning SNS On and Off.
Signed-Off-By: Chandra Seetharaman <sekharan at us.ibm.com>
---
usr/iscsi/isns.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
Index: tgt-469b574/usr/iscsi/isns.c
===================================================================
--- tgt-469b574.orig/usr/iscsi/isns.c
+++ tgt-469b574/usr/iscsi/isns.c
@@ -902,7 +902,7 @@ void isns_exit(void)
return;
list_for_each_entry(target, &iscsi_targets_list, tlist)
- isns_scn_deregister(tgt_targetname(target->tid));
+ isns_target_deregister(tgt_targetname(target->tid));
if (isns_fd) {
tgt_event_del(isns_fd);
@@ -917,6 +917,7 @@ void isns_exit(void)
close(scn_fd);
}
+ use_isns = isns_fd = scn_listen_fd = scn_fd = 0;
free(rxbuf);
}
@@ -956,7 +957,7 @@ int isns_update(char *params)
while ((p = strsep(¶ms, ",")) != NULL) {
substring_t args[MAX_OPT_ARGS];
- int token;
+ int token, isns;
char tmp[16];
if (!*p)
@@ -965,16 +966,21 @@ int isns_update(char *params)
switch (token) {
case Opt_isns:
- /* FIXME */
- if (use_isns) {
+ match_strncpy(tmp, &args[0], sizeof(tmp));
+ if (!strcmp(tmp, "On"))
+ isns = 1;
+ else if (!strcmp(tmp, "Off"))
+ isns = 0;
+ else {
ret = TGTADM_INVALID_REQUEST;
break;
}
-
- match_strncpy(tmp, &args[0], sizeof(tmp));
- use_isns = !strcmp(tmp, "On");
- if (use_isns)
+ if (use_isns == isns)
+ break;
+ if (isns)
isns_init();
+ else
+ isns_exit();
break;
case Opt_ip:
match_strncpy(isns_addr, &args[0], sizeof(isns_addr));
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the stgt
mailing list