Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/iscsictl remove some lint
details: https://anonhg.NetBSD.org/src/rev/7f9fb957d783
branches: trunk
changeset: 770721:7f9fb957d783
user: christos <christos%NetBSD.org@localhost>
date: Sun Oct 30 18:40:06 2011 +0000
description:
remove some lint
diffstat:
sbin/iscsictl/iscsic_daemonif.c | 37 ++++++++++++++++++++-----------------
sbin/iscsictl/iscsic_driverif.c | 12 ++++++------
sbin/iscsictl/iscsic_globals.h | 10 +++++-----
sbin/iscsictl/iscsic_main.c | 40 ++++++++++++++++++++++------------------
sbin/iscsictl/iscsic_parse.c | 28 +++++++++++++++++-----------
5 files changed, 70 insertions(+), 57 deletions(-)
diffs (truncated from 471 to 300 lines):
diff -r a842d90abf15 -r 7f9fb957d783 sbin/iscsictl/iscsic_daemonif.c
--- a/sbin/iscsictl/iscsic_daemonif.c Sun Oct 30 16:54:58 2011 +0000
+++ b/sbin/iscsictl/iscsic_daemonif.c Sun Oct 30 18:40:06 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iscsic_daemonif.c,v 1.1 2011/10/23 21:11:23 agc Exp $ */
+/* $NetBSD: iscsic_daemonif.c,v 1.2 2011/10/30 18:40:06 christos Exp $ */
/*-
* Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
if (rsp->status) {
status_error(rsp->status);
}
- res = (iscsid_add_target_rsp_t *) rsp->parameter;
+ res = (iscsid_add_target_rsp_t *)(void *)rsp->parameter;
tid = res->target_id;
if (kind == SEND_TARGETS_LIST) {
@@ -269,6 +269,7 @@
*/
int
+/*ARGSUSED*/
slp_find_targets(int argc, char **argv)
{
printf("Not implemented\n");
@@ -324,7 +325,7 @@
if (rsp->status) {
status_error(rsp->status);
}
- res = (iscsid_add_portal_rsp_t *) rsp->parameter;
+ res = (iscsid_add_portal_rsp_t *)(void *)rsp->parameter;
printf("Added Portal %d to Target %d\n",
res->portal_id.id, res->target_id.id);
@@ -361,7 +362,7 @@
if (trsp->status) {
status_error(trsp->status);
}
- targ = (iscsid_get_target_rsp_t *) trsp->parameter;
+ targ = (iscsid_get_target_rsp_t *)(void *)trsp->parameter;
/* display basic target info */
printf("%6d", targ->target_id.id);
@@ -382,7 +383,7 @@
if (prsp->status) {
status_error(prsp->status);
}
- port = (iscsid_get_portal_rsp_t *) prsp->parameter;
+ port = (iscsid_get_portal_rsp_t *)(void *)prsp->parameter;
printf(" %6d", port->portal_id.id);
if (port->portal_id.name[0]) {
@@ -427,7 +428,7 @@
if (rsp->status) {
status_error(rsp->status);
}
- list = (iscsid_get_list_rsp_t *) rsp->parameter;
+ list = (iscsid_get_list_rsp_t *)(void *)rsp->parameter;
/* display all targets */
for (i = 0; i < list->num_entries; i++) {
@@ -530,7 +531,7 @@
if (rsp->status) {
status_error(rsp->status);
}
- res = (iscsid_add_isns_server_rsp_t *) rsp->parameter;
+ res = (iscsid_add_isns_server_rsp_t *)(void *)rsp->parameter;
printf("Added iSNS Server ID %d\n", res->server_id);
@@ -595,6 +596,7 @@
*/
int
+/*ARGSUSED*/
find_isns_servers(int argc, char **argv)
{
printf("Not implemented\n");
@@ -631,7 +633,7 @@
if (rsp->status) {
status_error(rsp->status);
}
- list = (iscsid_get_list_rsp_t *) rsp->parameter;
+ list = (iscsid_get_list_rsp_t *)(void *)rsp->parameter;
/* display all servers */
for (i = 0; i < list->num_entries; i++) {
@@ -641,7 +643,7 @@
if (prsp->status)
status_error(prsp->status);
- isns = (iscsid_get_isns_server_rsp_t *) prsp->parameter;
+ isns = (iscsid_get_isns_server_rsp_t *)(void *)prsp->parameter;
printf("%6d: %s\n", list->id[i], isns->address);
free_response(prsp);
}
@@ -694,7 +696,7 @@
if (rsp->status) {
status_error(rsp->status);
}
- res = (iscsid_add_initiator_rsp_t *) rsp->parameter;
+ res = (iscsid_add_initiator_rsp_t *)(void *)rsp->parameter;
printf("Added Initiator Portal %d\n", res->portal_id);
free_response(rsp);
@@ -763,7 +765,7 @@
if (rsp->status) {
status_error(rsp->status);
}
- list = (iscsid_get_list_rsp_t *) rsp->parameter;
+ list = (iscsid_get_list_rsp_t *)(void *)rsp->parameter;
/* display all servers */
for (i = 0; i < list->num_entries; i++) {
@@ -773,7 +775,7 @@
if (prsp->status) {
status_error(prsp->status);
}
- init = (iscsid_get_initiator_rsp_t *) prsp->parameter;
+ init = (iscsid_get_initiator_rsp_t *)(void *)prsp->parameter;
printf("%6d", init->portal_id.id);
if (init->portal_id.name[0]) {
printf("[%s]", init->portal_id.name);
@@ -908,7 +910,7 @@
if (rsp->status) {
status_error(rsp->status);
}
- res = (iscsid_login_rsp_t *) rsp->parameter;
+ res = (iscsid_login_rsp_t *)(void *)rsp->parameter;
printf("Created Session %d, Connection %d\n",
res->session_id.id, res->connection_id.id);
@@ -1057,7 +1059,7 @@
if (lrsp->status) {
status_error(lrsp->status);
}
- list = (iscsid_get_session_list_rsp_t *) lrsp->parameter;
+ list = (iscsid_get_session_list_rsp_t *)(void *)lrsp->parameter;
for (i = 0, ent = list->session; i < list->num_entries; i++, ent++) {
creq.session_id.id = ent->session_id.id;
@@ -1066,7 +1068,7 @@
if (rsp->status) {
status_error(rsp->status);
}
- info = (iscsid_get_connection_info_rsp_t *) rsp->parameter;
+ info = (iscsid_get_connection_info_rsp_t *)(void *)rsp->parameter;
printf("Session %d", info->session_id.id);
if (info->session_id.name[0]) {
@@ -1085,7 +1087,7 @@
if (rsp->status) {
status_error(rsp->status);
}
- clinfo = (iscsid_get_connection_list_rsp_t *) rsp->parameter;
+ clinfo = (iscsid_get_connection_list_rsp_t *)(void *)rsp->parameter;
for (j = 0, clent = clinfo->connection;
j < clinfo->num_connections; j++, clent++) {
@@ -1152,6 +1154,7 @@
*/
int
+/*ARGSUSED*/
get_version(int argc, char **argv)
{
iscsid_response_t *rsp;
@@ -1162,7 +1165,7 @@
if (rsp->status) {
status_error(rsp->status);
}
- ver = (iscsid_get_version_rsp_t *)rsp->parameter;
+ ver = (iscsid_get_version_rsp_t *)(void *)rsp->parameter;
printf("%s\n%s\n%s\n", VERSION_STRING, ver->version_string,
ver->driver_version_string);
diff -r a842d90abf15 -r 7f9fb957d783 sbin/iscsictl/iscsic_driverif.c
--- a/sbin/iscsictl/iscsic_driverif.c Sun Oct 30 16:54:58 2011 +0000
+++ b/sbin/iscsictl/iscsic_driverif.c Sun Oct 30 18:40:06 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iscsic_driverif.c,v 1.1 2011/10/23 21:11:23 agc Exp $ */
+/* $NetBSD: iscsic_driverif.c,v 1.2 2011/10/30 18:40:06 christos Exp $ */
/*-
* Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -286,10 +286,10 @@
*/
void
-dump_data(const char *title, void *buffer, int len)
+dump_data(const char *title, const void *buffer, size_t len)
{
- uint8_t *bp = (uint8_t *) buffer;
- int i, nelem;
+ const uint8_t *bp = buffer;
+ size_t i, nelem;
printf("%s\n", title);
@@ -581,7 +581,7 @@
{
iscsi_iocommand_parameters_t io;
int rc;
- uint32_t llen;
+ size_t llen;
uint32_t n;
uint16_t n2;
uint64_t *lp;
@@ -611,7 +611,7 @@
if (llen + 8 > sizeof(buf))
printf("Partial ");
printf("LUN List:\n");
- lp = (uint64_t *) & buf[8];
+ lp = (uint64_t *)(void *) &buf[8];
for (llen = min(llen, sizeof(buf) - 8) / 8; llen; llen--) {
printf(" 0x%" PRIx64 "\n", ntohq(*lp));
diff -r a842d90abf15 -r 7f9fb957d783 sbin/iscsictl/iscsic_globals.h
--- a/sbin/iscsictl/iscsic_globals.h Sun Oct 30 16:54:58 2011 +0000
+++ b/sbin/iscsictl/iscsic_globals.h Sun Oct 30 18:40:06 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iscsic_globals.h,v 1.2 2011/10/23 23:41:56 christos Exp $ */
+/* $NetBSD: iscsic_globals.h,v 1.3 2011/10/30 18:40:06 christos Exp $ */
/*-
* Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -106,7 +106,7 @@
hton6(uint8_t * d, uint64_t x)
{
#if BYTE_ORDER == LITTLE_ENDIAN
- uint8_t *s = ((uint8_t *) & x) + 5;
+ uint8_t *s = ((uint8_t *)(void *)&x) + 5;
*d++ = *s--;
*d++ = *s--;
*d++ = *s--;
@@ -125,7 +125,7 @@
ntohq(uint64_t x)
{
#if BYTE_ORDER == LITTLE_ENDIAN
- uint8_t *s = (uint8_t *) & x;
+ uint8_t *s = (uint8_t *)(void *)&x;
return (uint64_t) ((uint64_t) s[0] << 56 | (uint64_t) s[1] << 48 |
(uint64_t) s[2] << 40 | (uint64_t) s[3] << 32 |
@@ -160,7 +160,7 @@
void status_error(unsigned);
void status_error_slist(unsigned);
-void send_request(unsigned, unsigned par_len, void *);
+void send_request(unsigned, size_t, void *);
iscsid_response_t *get_response(int);
void free_response(iscsid_response_t *);
@@ -196,7 +196,7 @@
/* iscsic_driverif.c */
uint32_t get_sessid(int, char **, int);
-void dump_data(const char *, void *, int);
+void dump_data(const char *, const void *, size_t);
int do_ioctl(iscsi_iocommand_parameters_t *, int);
int set_node_name(int, char **);
int inquiry(int, char **);
diff -r a842d90abf15 -r 7f9fb957d783 sbin/iscsictl/iscsic_main.c
--- a/sbin/iscsictl/iscsic_main.c Sun Oct 30 16:54:58 2011 +0000
+++ b/sbin/iscsictl/iscsic_main.c Sun Oct 30 18:40:06 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iscsic_main.c,v 1.2 2011/10/23 23:41:56 christos Exp $ */
+/* $NetBSD: iscsic_main.c,v 1.3 2011/10/30 18:40:06 christos Exp $ */
/*-
* Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -414,18 +414,19 @@
iscsid_response_t *
get_response(int temp)
{
- int ret, len;
+ ssize_t ret;
+ size_t len;
iscsid_response_t *rsp;
int *pbuf;
- pbuf = (int *) buf;
- rsp = (iscsid_response_t *) & pbuf[1];
+ pbuf = (int *)(void *)buf;
+ rsp = (iscsid_response_t *)(void *)&pbuf[1];
*pbuf = 0;
/* get size of response */
len = sizeof(iscsid_response_t);
ret = recv(sock, rsp, len, MSG_PEEK | MSG_WAITALL);
- if (ret != len)
+ if ((size_t)ret != len)
io_error("Receiving daemon data");
DEB(9, ("Status %d, parlen %d\n", rsp->status, rsp->parameter_length));
@@ -444,13 +445,13 @@
gen_error("Can't allocate response buffer (%zu bytes)",
len + sizeof(int));
Home |
Main Index |
Thread Index |
Old Index