[stgt] isns.c: fix compiler warnings
arne.redlich at googlemail.com
Mon Apr 2 21:58:52 CEST 2012
2012/4/2 FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>:
> On Sat, 31 Mar 2012 23:56:00 +0200
> Arne Redlich <arne.redlich at googlemail.com> wrote:
>> The get_hdr_param macro is used exuberantly, leading to variables
>> that are defined and set but never actually used, as pointed out by
>> 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.
>> 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;
>> - get_hdr_param(hdr, function, length, flags, transaction, sequence);
> I think that the point of get_hdr_param is putting how to get extract
> values from a header into one place. That is, I like to avoid putting
> ntohs everywhere.
> I guess we had better to drop -Wall?
I don't think this is a good idea for any project as -Wall (and
various other "-W"s) has (have) proven to be quite invaluable to me.
If you think abstractions are useful there (I'm not convinced, as it's
all internal to isns.c), how about getters per header field?
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