[stgt] isns.c: fix compiler warnings

Arne Redlich arne.redlich at googlemail.com
Sat Mar 31 23:56:00 CEST 2012


The get_hdr_param macro is used exuberantly, leading to variables
that are defined and set but never actually used, as pointed out by
gcc-4.6.

Signed-off-by: Arne Redlich <arne.redlich at googlemail.com>
---

Tomo, list,

This patch is a rather mechanic translation from IET's isns code, and merely compile tested.

Cheers,
Arne

 usr/iscsi/isns.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)


diff --git a/usr/iscsi/isns.c b/usr/iscsi/isns.c
index 1f1852c..452c7af 100644
--- a/usr/iscsi/isns.c
+++ b/usr/iscsi/isns.c
@@ -638,12 +638,10 @@ static int recv_pdu(int fd, struct isns_io *rx, struct isns_hdr *hdr)
 static char *print_scn_pdu(struct isns_hdr *hdr)
 {
 	struct isns_tlv *tlv = (struct isns_tlv *) hdr->pdu;
-	uint16_t function, length, flags, transaction, sequence;
+	uint16_t length = ntohs(hdr->length);
 	char *name = NULL;
 	static char iscsi_name[224];
 
-	get_hdr_param(hdr, function, length, flags, transaction, sequence);
-
 	while (length) {
 		uint32_t vlen = ntohl(tlv->length);
 
@@ -677,7 +675,8 @@ static char *print_scn_pdu(struct isns_hdr *hdr)
 static void qry_rsp_handle(struct isns_hdr *hdr)
 {
 	struct isns_tlv *tlv;
-	uint16_t function, length, flags, transaction, sequence;
+	uint16_t length = ntohs(hdr->length);
+	uint16_t transaction = ntohs(hdr->transaction);
 	uint32_t status = (uint32_t) (*hdr->pdu);
 	struct isns_qry_mgmt *mgmt, *n;
 	struct iscsi_target *target = NULL;
@@ -685,8 +684,6 @@ static void qry_rsp_handle(struct isns_hdr *hdr)
 	char *name = NULL;
 	int reg_period = 0;
 
-	get_hdr_param(hdr, function, length, flags, transaction, sequence);
-
 	list_for_each_entry_safe(mgmt, n, &qry_list, qlist) {
 		if (mgmt->transaction == transaction) {
 			list_del(&mgmt->qlist);
@@ -774,8 +771,7 @@ static void isns_handle(int fd, int events, void *data)
 	int err;
 	struct isns_io *rx = &isns_rx;
 	struct isns_hdr *hdr = (struct isns_hdr *) rx->buf;
-	uint32_t result;
-	uint16_t function, length, flags, transaction, sequence;
+	uint16_t function;
 	char *name = NULL;
 
 	err = recv_pdu(isns_fd, rx, hdr);
@@ -789,8 +785,7 @@ static void isns_handle(int fd, int events, void *data)
 		return;
 	}
 
-	get_hdr_param(hdr, function, length, flags, transaction, sequence);
-	result = ntohl((uint32_t) hdr->pdu[0]);
+	function = ntohs(hdr->function);
 
 	switch (function) {
 	case ISNS_FUNC_DEV_ATTR_REG_RSP:
@@ -844,7 +839,7 @@ static void isns_scn_handle(int fd, int events, void *data)
 	int err;
 	struct isns_io *rx = &scn_rx;
 	struct isns_hdr *hdr = (struct isns_hdr *) rx->buf;
-	uint16_t function, length, flags, transaction, sequence;
+	uint16_t function, transaction;
 	char *name = NULL;
 
 	err = recv_pdu(scn_fd, rx, hdr);
@@ -858,7 +853,8 @@ static void isns_scn_handle(int fd, int events, void *data)
 		return;
 	}
 
-	get_hdr_param(hdr, function, length, flags, transaction, sequence);
+	function = ntohs(hdr->function);
+	transaction = ntohs(hdr->transaction);
 
 	switch (function) {
 	case ISNS_FUNC_SCN:
-- 
1.7.9.1



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