[stgt] [PATCH 5/7] change return value of system_set_state() to tgtadm_err, update use cases

nezhinsky at gmail.com nezhinsky at gmail.com
Fri May 18 12:24:27 CEST 2012


From: Alexander Nezhinsky <alexandern at mellanox.com>


Signed-off-by: Alexander Nezhinsky <alexandern at mellanox.com>
---
 usr/iscsi/isns.c |    2 +-
 usr/target.c     |    9 +++++----
 usr/tgtd.h       |    2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/usr/iscsi/isns.c b/usr/iscsi/isns.c
index 1bbc9c1..e7d44a5 100644
--- a/usr/iscsi/isns.c
+++ b/usr/iscsi/isns.c
@@ -1136,7 +1136,7 @@ tgtadm_err isns_update(char *params)
 			break;
 		case Opt_state:
 			match_strncpy(tmp, &args[0], sizeof(tmp));
-			system_set_state(tmp);
+			adm_err = system_set_state(tmp);
 			break;
 		default:
 			adm_err = TGTADM_INVALID_REQUEST;
diff --git a/usr/target.c b/usr/target.c
index 95af706..d9aa92a 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -2146,18 +2146,19 @@ static char *system_state_name(enum tgt_system_state state)
 
 static enum tgt_system_state sys_state = TGT_SYSTEM_READY;
 
-int system_set_state(char *str)
+tgtadm_err system_set_state(char *str)
 {
-	int i, err = TGTADM_INVALID_REQUEST;
+	tgtadm_err adm_err = TGTADM_INVALID_REQUEST;
+	int i;
 
 	for (i = 0; i < ARRAY_SIZE(target_state); i++) {
 		if (!strcmp(system_state[i].name, str)) {
 			sys_state = system_state[i].value;
-			err = 0;
+			adm_err = TGTADM_SUCCESS;
 			break;
 		}
 	}
-	return err;
+	return adm_err;
 }
 
 tgtadm_err system_show(int mode, struct concat_buf *b)
diff --git a/usr/tgtd.h b/usr/tgtd.h
index 04c5ed4..779d386 100644
--- a/usr/tgtd.h
+++ b/usr/tgtd.h
@@ -243,7 +243,7 @@ extern tgtadm_err tgt_target_create(int lld, int tid, char *args);
 extern tgtadm_err tgt_target_destroy(int lld, int tid, int force);
 extern char *tgt_targetname(int tid);
 extern tgtadm_err tgt_target_show_all(struct concat_buf *b);
-int system_set_state(char *str);
+tgtadm_err system_set_state(char *str);
 tgtadm_err system_show(int mode, struct concat_buf *b);
 int is_system_available(void);
 int is_system_inactive(void);
-- 
1.7.9.6

--
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