sign-compare fixes

This commit is contained in:
lukem 2009-01-25 14:25:27 +00:00
parent 114b3fb343
commit 293645aa72
7 changed files with 68 additions and 66 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: conffile.c,v 1.6 2007/08/14 18:52:48 agc Exp $ */
/* $NetBSD: conffile.c,v 1.7 2009/01/25 14:25:27 lukem Exp $ */
/*
* Copyright © 2006 Alistair Crooks. All rights reserved.
@ -175,7 +175,7 @@ int
conffile_get_by_field(conffile_t *sp, ent_t *ep, int f, char *val)
{
while (conffile_getent(sp, ep)) {
if (ep->sv.c > f && strcmp(ep->sv.v[f], val) == 0) {
if (ep->sv.c > (uint32_t)f && strcmp(ep->sv.v[f], val) == 0) {
return 1;
}
}
@ -247,7 +247,7 @@ conffile_putent(conffile_t *sp, int f, char *val, char *newent)
}
}
(void) conffile_split(sp, &e, from);
if (val != NULL && f < e.sv.c && strcmp(val, e.sv.v[f]) == 0) {
if (val != NULL && (uint32_t)f < e.sv.c && strcmp(val, e.sv.v[f]) == 0) {
/* replace it */
if (!safe_write(fp, newent, strlen(newent))) {
return report_error(fp, name, "Short write 2 to `%s' (%s)\n", name, strerror(errno));
@ -272,7 +272,7 @@ conffile_putent(conffile_t *sp, int f, char *val, char *newent)
void
conffile_printent(ent_t *ep)
{
int i;
uint32_t i;
for (i = 0 ; i < ep->sv.c ; i++) {
printf("(%d `%s') ", i, ep->sv.v[i]);

24
dist/iscsi/src/disk.c vendored
View File

@ -1,4 +1,4 @@
/* $NetBSD: disk.c,v 1.38 2008/04/30 20:28:30 agc Exp $ */
/* $NetBSD: disk.c,v 1.39 2009/01/25 14:25:27 lukem Exp $ */
/*
* Copyright © 2006 Alistair Crooks. All rights reserved.
@ -181,7 +181,7 @@ static int disk_write(target_session_t * , iscsi_scsi_cmd_args_t * , uint8_
/* return the de index and offset within the device for RAID0 */
static int
raid0_getoff(disc_device_t *dp, uint64_t off, int *d, uint64_t *de_off)
raid0_getoff(disc_device_t *dp, uint64_t off, uint32_t *d, uint64_t *de_off)
{
uint64_t o;
@ -206,7 +206,7 @@ static int
device_open(disc_device_t *dp, int flags, int mode)
{
int fd;
int i;
uint32_t i;
for (fd = -1, i = 0 ; i < dp->c ; i++) {
switch (dp->xv[i].type) {
@ -254,7 +254,7 @@ device_lseek(disc_device_t *dp, off_t off, int whence)
{
uint64_t suboff;
off_t ret;
int d;
uint32_t d;
ret = -1;
switch(dp->raid) {
@ -331,7 +331,7 @@ device_fsync_range(disc_device_t *dp, int how, off_t from, off_t len)
{
uint64_t suboff;
int ret;
int d;
uint32_t d;
ret = -1;
switch(dp->raid) {
@ -408,7 +408,7 @@ device_read(disc_device_t *dp, void *buf, size_t cc)
ssize_t ret;
size_t subcc;
char *cbuf;
int d;
uint32_t d;
ret = -1;
switch(dp->raid) {
@ -494,7 +494,7 @@ device_write(disc_device_t *dp, void *buf, size_t cc)
ssize_t ret;
size_t subcc;
char *cbuf;
int d;
uint32_t d;
ret = -1;
switch(dp->raid) {
@ -585,7 +585,7 @@ static uint64_t
device_getsize(disc_device_t *dp)
{
uint64_t size;
int d;
uint32_t d;
size = 0;
switch(dp->raid) {
@ -686,7 +686,7 @@ de_allocate(disc_de_t *de, char *filename)
static int
allocate_space(disc_target_t *tp)
{
int i;
uint32_t i;
/* Don't perform check for writability in the target here, as the
following write() in de_allocate is non-destructive */
@ -710,7 +710,7 @@ allocate_space(disc_target_t *tp)
static void
strpadcpy(uint8_t *dst, size_t dstlen, const char *src, const size_t srclen, char pad)
{
int i;
size_t i;
if (srclen < dstlen) {
(void) memcpy(dst, src, srclen);
@ -729,7 +729,7 @@ report_luns(uint64_t *data, int64_t luns)
uint64_t lun;
int32_t off;
for (lun = 0, off = 8 ; lun < luns ; lun++, off += sizeof(lun)) {
for (lun = 0, off = 8 ; lun < (uint64_t)luns ; lun++, off += sizeof(lun)) {
data[(int)lun] = ISCSI_HTONLL(lun);
}
return off;
@ -1245,7 +1245,7 @@ disk_write(target_session_t *sess, iscsi_scsi_cmd_args_t *args, uint8_t lun, uin
iscsi_trace_error(__FILE__, __LINE__, "write() of %" PRIu64 " bytes failed at offset %" PRIu64 ", size %" PRIu64 "[READONLY TARGET]\n", num_bytes, byte_offset, de_getsize(&disks.v[sess->d].tv->v[lun].de));
return -1;
}
if (de_write(&disks.v[sess->d].tv->v[lun].de, ptr, (unsigned) num_bytes) != num_bytes) {
if ((uint64_t)de_write(&disks.v[sess->d].tv->v[lun].de, ptr, (unsigned) num_bytes) != num_bytes) {
iscsi_trace_error(__FILE__, __LINE__, "write() of %" PRIu64 " bytes failed at offset %" PRIu64 ", size %" PRIu64 "\n", num_bytes, byte_offset, de_getsize(&disks.v[sess->d].tv->v[lun].de));
return -1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: netmask.c,v 1.10 2007/12/20 23:17:05 agc Exp $ */
/* $NetBSD: netmask.c,v 1.11 2009/01/25 14:25:27 lukem Exp $ */
/*
* Copyright © 2006 Alistair Crooks. All rights reserved.
@ -97,7 +97,7 @@ allow_netmask(const char *netmaskarg, const char *addr)
(void) strlcpy(maskaddr, netmask, sizeof(maskaddr));
slash = 32;
} else {
(void) strlcpy(maskaddr, netmask, MIN(sizeof(maskaddr), (int)(cp - netmask) + 1));
(void) strlcpy(maskaddr, netmask, MIN(sizeof(maskaddr), (size_t)(cp - netmask) + 1));
slash = atoi(cp + 1);
}

View File

@ -344,13 +344,13 @@ param_text_print(char *text, uint32_t text_len)
char key[256];
char *ptr, *eq, *value;
for (ptr = text; ptr - text < text_len; ptr += (strlen(ptr) + 1)) {
for (ptr = text; (uint32_t)(ptr - text) < text_len; ptr += (strlen(ptr) + 1)) {
/* Skip over any NULLs */
while (!(*ptr) && ((ptr - text) < text_len))
while (!(*ptr) && ((uint32_t)(ptr - text) < text_len))
ptr++;
if ((ptr - text) >= text_len)
if ((uint32_t)(ptr - text) >= text_len)
break;
if ((eq = strchr(ptr, '=')) == NULL) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: storage.c,v 1.11 2008/04/11 08:22:37 agc Exp $ */
/* $NetBSD: storage.c,v 1.12 2009/01/25 14:25:27 lukem Exp $ */
/*
* Copyright © 2006 Alistair Crooks. All rights reserved.
@ -85,7 +85,7 @@ enum {
static disc_extent_t *
find_extent(extv_t *evp, char *s)
{
int i;
size_t i;
for (i = 0 ; i < evp->c ; i++) {
if (strcmp(evp->v[i].extent, s) == 0) {
@ -142,7 +142,7 @@ do_extent(conffile_t *cf, extv_t *evp, ent_t *ep)
static disc_device_t *
find_device(devv_t *devvp, char *s)
{
int i;
size_t i;
for (i = 0 ; i < devvp->c ; i++) {
if (strcmp(devvp->v[i].dev, s) == 0) {
@ -236,7 +236,7 @@ do_device(conffile_t *cf, devv_t *devvp, extv_t *evp, ent_t *ep)
static disc_target_t *
find_target(targv_t *tvp, char *s)
{
int i;
size_t i;
for (i = 0 ; i < tvp->c ; i++) {
if (strcmp(tvp->v[i].target, s) == 0) {
@ -344,7 +344,7 @@ static void
pdevice(disc_device_t *dp, int indent)
{
int i;
int j;
size_t j;
for (i = 0 ; i < indent ; i++) {
(void) fputc('\t', stdout);
@ -372,7 +372,7 @@ ptarget(disc_target_t *tp, int indent)
static void
ptargets(targv_t *tvp)
{
int i;
size_t i;
for (i = 0 ; i < tvp->c ; i++) {
ptarget(&tvp->v[i], 0);

View File

@ -107,7 +107,7 @@ static iscsi_mutex_t g_session_q_mutex;
*********************/
static char *
get_iqn(target_session_t *sess, int t, char *buf, size_t size)
get_iqn(target_session_t *sess, uint32_t t, char *buf, size_t size)
{
if (sess->globals->tv->v[t].iqn != NULL) {
(void) strlcpy(buf, sess->globals->tv->v[t].iqn, size);
@ -215,7 +215,7 @@ scsi_command_t(target_session_t *sess, uint8_t *header)
uint8_t ahs_type;
scsi_cmd.ahs = NULL;
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "reading %d bytes AHS\n", scsi_cmd.ahs_len);
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "reading %u bytes AHS\n", scsi_cmd.ahs_len);
if ((scsi_cmd.ahs = iscsi_malloc_atomic((unsigned)scsi_cmd.ahs_len)) == NULL) {
iscsi_trace_error(__FILE__, __LINE__, "iscsi_malloc_atomic() failed\n");
return -1;
@ -230,7 +230,7 @@ scsi_command_t(target_session_t *sess, uint8_t *header)
AHS_CLEANUP;
return -1;
}
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "read %d bytes AHS\n", scsi_cmd.ahs_len);
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "read %u bytes AHS\n", scsi_cmd.ahs_len);
for (ahs_ptr = scsi_cmd.ahs; ahs_ptr < (scsi_cmd.ahs + scsi_cmd.ahs_len - 1) ; ahs_ptr += ahs_len) {
ahs_len = ISCSI_NTOHS(*((uint16_t *) (void *)ahs_ptr));
RETURN_EQUAL("AHS Length", ahs_len, 0, AHS_CLEANUP, -1);
@ -250,7 +250,7 @@ scsi_command_t(target_session_t *sess, uint8_t *header)
return -1;
}
}
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "done parsing %d bytes AHS\n", scsi_cmd.ahs_len);
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "done parsing %u bytes AHS\n", scsi_cmd.ahs_len);
} else {
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "no AHS to read\n");
scsi_cmd.ahs = NULL;
@ -296,7 +296,7 @@ scsi_command_t(target_session_t *sess, uint8_t *header)
} else {
trans_len = scsi_cmd.trans_len;
}
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "sending %d bytes input data as separate PDUs\n", trans_len);
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "sending %u bytes input data as separate PDUs\n", trans_len);
if (scsi_cmd.send_sg_len) {
sg_orig = (struct iovec *) (void *) scsi_cmd.send_data;
@ -364,7 +364,7 @@ scsi_command_t(target_session_t *sess, uint8_t *header)
AHS_CLEANUP;
return -1;
}
if (iscsi_sock_send_header_and_data(sess->sock, rsp_header, ISCSI_HEADER_LEN, sg, data.length, sg_len)
if ((uint32_t)iscsi_sock_send_header_and_data(sess->sock, rsp_header, ISCSI_HEADER_LEN, sg, data.length, sg_len)
!= ISCSI_HEADER_LEN + data.length) {
iscsi_trace_error(__FILE__, __LINE__, "iscsi_sock_send_header_and_data() failed\n");
SG_CLEANUP;
@ -375,7 +375,7 @@ scsi_command_t(target_session_t *sess, uint8_t *header)
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "sent read data PDU ok (offset %u, len %u)\n", data.offset, data.length);
}
SG_CLEANUP;
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "successfully sent %d bytes read data\n", trans_len);
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "successfully sent %u bytes read data\n", trans_len);
}
/*
* Send a response PDU if
@ -405,7 +405,7 @@ response:
AHS_CLEANUP;
return -1;
}
if (iscsi_sock_send_header_and_data(sess->sock, rsp_header, ISCSI_HEADER_LEN,
if ((uint32_t)iscsi_sock_send_header_and_data(sess->sock, rsp_header, ISCSI_HEADER_LEN,
scsi_cmd.send_data, scsi_rsp.length, scsi_cmd.send_sg_len)
!= ISCSI_HEADER_LEN + scsi_rsp.length) {
iscsi_trace_error(__FILE__, __LINE__, "iscsi_sock_send_header_and_data() failed\n");
@ -529,26 +529,26 @@ nop_out_t(target_session_t * sess, uint8_t *header)
/* sess->MaxCmdSN++; */
if (nop_out.length) {
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "reading %d bytes ping data\n", nop_out.length);
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "reading %u bytes ping data\n", nop_out.length);
if ((ping_data = iscsi_malloc(nop_out.length)) == NULL) {
iscsi_trace_error(__FILE__, __LINE__, "iscsi_malloc() failed\n");
return -1;
}
if (iscsi_sock_msg(sess->sock, 0, nop_out.length, ping_data, 0) != nop_out.length) {
if ((uint32_t)iscsi_sock_msg(sess->sock, 0, nop_out.length, ping_data, 0) != nop_out.length) {
iscsi_trace_error(__FILE__, __LINE__, "iscsi_sock_msg() failed\n");
if (ping_data) {
iscsi_free(ping_data);
}
return -1;
}
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "successfully read %d bytes ping data:\n", nop_out.length);
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "successfully read %u bytes ping data:\n", nop_out.length);
iscsi_print_buffer(ping_data, nop_out.length);
}
if (nop_out.tag != 0xffffffff) {
iscsi_nop_in_args_t nop_in;
uint8_t rsp_header[ISCSI_HEADER_LEN];
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "sending %d bytes ping response\n", nop_out.length);
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "sending %u bytes ping response\n", nop_out.length);
(void) memset(&nop_in, 0x0, sizeof(nop_in));
nop_in.length = nop_out.length;
nop_in.lun = nop_out.lun;
@ -565,7 +565,7 @@ nop_out_t(target_session_t * sess, uint8_t *header)
}
return -1;
}
if (iscsi_sock_send_header_and_data(sess->sock, rsp_header, ISCSI_HEADER_LEN,
if ((uint32_t)iscsi_sock_send_header_and_data(sess->sock, rsp_header, ISCSI_HEADER_LEN,
ping_data, nop_in.length, 0) != ISCSI_HEADER_LEN + nop_in.length) {
iscsi_trace_error(__FILE__, __LINE__, "iscsi_sock_send_header_and_data() failed\n");
if (ping_data) {
@ -573,7 +573,7 @@ nop_out_t(target_session_t * sess, uint8_t *header)
}
return -1;
}
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "successfully sent %d bytes ping response\n", nop_out.length);
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "successfully sent %u bytes ping response\n", nop_out.length);
}
if (ping_data) {
iscsi_free(ping_data);
@ -596,7 +596,7 @@ text_command_t(target_session_t * sess, uint8_t *header)
unsigned len_in;
char buf[BUFSIZ];
int len_out = 0;
int i;
uint32_t i;
#define TC_CLEANUP do { \
if (text_in != NULL) { \
@ -637,8 +637,8 @@ text_command_t(target_session_t * sess, uint8_t *header)
TC_CLEANUP;
return -1;
}
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "reading %d bytes text parameters\n", len_in);
if (iscsi_sock_msg(sess->sock, 0, len_in, text_in, 0) != len_in) {
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "reading %u bytes text parameters\n", len_in);
if ((unsigned)iscsi_sock_msg(sess->sock, 0, len_in, text_in, 0) != len_in) {
iscsi_trace_error(__FILE__, __LINE__, "iscsi_sock_msg() failed\n");
TC_CLEANUP;
return -1;
@ -722,7 +722,7 @@ int
find_target_iqn(target_session_t *sess)
{
char buf[BUFSIZ];
int i;
uint32_t i;
for (i = 0 ; i < sess->globals->tv->c ; i++) {
if (param_equiv(sess->params, "TargetName",
@ -737,7 +737,7 @@ find_target_iqn(target_session_t *sess)
int
find_target_tsih(globals_t *globals, int tsih)
{
int i;
uint32_t i;
for (i = 0 ; i < globals->tv->c ; i++) {
if (globals->tv->v[i].tsih == tsih) {
@ -962,7 +962,7 @@ response:
return -1;
}
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "sending login response\n");
if (iscsi_sock_send_header_and_data(sess->sock, rsp_header, ISCSI_HEADER_LEN,
if ((uint32_t)iscsi_sock_send_header_and_data(sess->sock, rsp_header, ISCSI_HEADER_LEN,
text_out, rsp.length, 0) != ISCSI_HEADER_LEN + rsp.length) {
iscsi_trace_error(__FILE__, __LINE__, "iscsi_sock_send_header_and_data() failed\n");
LC_CLEANUP;
@ -1102,7 +1102,7 @@ verify_cmd_t(target_session_t * sess, uint8_t *header)
return -1;
}
iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__, "sending login response\n");
if (iscsi_sock_send_header_and_data(sess->sock, rsp_header,
if ((uint32_t)iscsi_sock_send_header_and_data(sess->sock, rsp_header,
ISCSI_HEADER_LEN, NULL, 0, 0) != ISCSI_HEADER_LEN +
rsp.length) {
iscsi_trace_error(__FILE__, __LINE__, "iscsi_sock_send_header_and_data() failed\n");
@ -1390,13 +1390,13 @@ target_transfer_data(target_session_t * sess, iscsi_scsi_cmd_args_t * args, stru
TTD_CLEANUP;
return -1;
}
iscsi_trace(TRACE_SCSI_DATA, __FILE__, __LINE__, "reading %d bytes immediate write data\n", args->length);
if (iscsi_sock_msg(sess->sock, 0, args->length, iov, iov_len) != args->length) {
iscsi_trace(TRACE_SCSI_DATA, __FILE__, __LINE__, "reading %u bytes immediate write data\n", args->length);
if ((uint32_t)iscsi_sock_msg(sess->sock, 0, args->length, iov, iov_len) != args->length) {
iscsi_trace_error(__FILE__, __LINE__, "iscsi_sock_msg() failed\n");
TTD_CLEANUP;
return -1;
}
iscsi_trace(TRACE_SCSI_DATA, __FILE__, __LINE__, "successfully read %d bytes immediate write data\n", args->length);
iscsi_trace(TRACE_SCSI_DATA, __FILE__, __LINE__, "successfully read %u bytes immediate write data\n", args->length);
args->bytes_recv += args->length;
}
/*
@ -1479,7 +1479,7 @@ target_transfer_data(target_session_t * sess, iscsi_scsi_cmd_args_t * args, stru
}
/* Scatter into destination buffers */
if (iscsi_sock_msg(sess->sock, 0, data.length, iov, iov_len) != data.length) {
if ((uint32_t)iscsi_sock_msg(sess->sock, 0, data.length, iov, iov_len) != data.length) {
iscsi_trace_error(__FILE__, __LINE__, "iscsi_sock_msg() failed\n");
TTD_CLEANUP;
return -1;
@ -1488,7 +1488,7 @@ target_transfer_data(target_session_t * sess, iscsi_scsi_cmd_args_t * args, stru
args->bytes_recv += data.length;
desired_xfer_len -= data.length;
if ((!r2t_flag) && (args->bytes_recv > sess->sess_params.first_burst_length)) {
iscsi_trace_error(__FILE__, __LINE__, "Received unsolicited data (%d) more than first_burst_length (%d)\n", args->bytes_recv, sess->sess_params.first_burst_length);
iscsi_trace_error(__FILE__, __LINE__, "Received unsolicited data (%u) more than first_burst_length (%u)\n", args->bytes_recv, sess->sess_params.first_burst_length);
args->status = 0x02;
TTD_CLEANUP;
return -1;
@ -1529,6 +1529,7 @@ int
target_init(globals_t *gp, targv_t *tv, char *TargetName)
{
int i;
uint32_t j;
NEWARRAY(target_session_t, g_session, gp->max_sessions, "target_init", return -1);
(void) strlcpy(gp->targetname, TargetName, sizeof(gp->targetname));
@ -1549,8 +1550,8 @@ target_init(globals_t *gp, targv_t *tv, char *TargetName)
return -1;
}
}
for (i = 0 ; i < tv->c ; i++) {
if ((g_session[i].d = device_init(gp, tv, &tv->v[i])) < 0) {
for (j = 0 ; j < tv->c ; j++) {
if ((g_session[j].d = device_init(gp, tv, &tv->v[j])) < 0) {
iscsi_trace_error(__FILE__, __LINE__, "device_init() failed\n");
return -1;
}

23
dist/iscsi/src/util.c vendored
View File

@ -303,7 +303,7 @@ void
iscsi_print_buffer(const char *buf, const size_t len)
{
#ifdef CONFIG_ISCSI_DEBUG
int i;
size_t i;
if (iscsi_debug_level & TRACE_NET_BUFF) {
for (i=0 ; i < len; i++) {
@ -311,7 +311,7 @@ iscsi_print_buffer(const char *buf, const size_t len)
if (i) {
printf("\n");
}
printf("%4i:", i);
printf("%4zu:", i);
}
printf("%2x ", (uint8_t) (buf)[i]);
}
@ -423,7 +423,7 @@ hash_destroy(hash_t * h)
int
modify_iov(struct iovec ** iov_ptr, int *iovc, uint32_t offset, uint32_t length)
{
int len;
size_t len;
int disp = offset;
int i;
struct iovec *iov = *iov_ptr;
@ -821,7 +821,8 @@ iscsi_sock_connect(iscsi_socket_t sock, char *hostname, int port)
int
iscsi_sock_msg(iscsi_socket_t sock, int xmit, unsigned len, void *data, int iovc)
{
int i, n = 0;
int i;
unsigned n = 0;
int rc;
struct iovec *iov;
struct iovec singleton;
@ -829,7 +830,7 @@ iscsi_sock_msg(iscsi_socket_t sock, int xmit, unsigned len, void *data, int iovc
struct iovec *iov_padding = NULL;
uint32_t remainder;
uint32_t padding_len = 0;
int total_len = 0;
size_t total_len = 0;
iscsi_trace(TRACE_NET_DEBUG, __FILE__, __LINE__, "%s %d bytes on sock\n", xmit ? "sending" : "receiving", len);
if (iovc == 0) {
@ -878,7 +879,7 @@ iscsi_sock_msg(iscsi_socket_t sock, int xmit, unsigned len, void *data, int iovc
total_len += iov[i].iov_len;
}
if (total_len != len - n) {
iscsi_trace_error(__FILE__, __LINE__, "iovcs sum to %d != total len of %d\n", total_len, len - n);
iscsi_trace_error(__FILE__, __LINE__, "iovcs sum to %u != total len of %u\n", total_len, len - n);
iscsi_trace_error(__FILE__, __LINE__, "iov = %p\n", iov);
for (i = 0; i < iovc; i++) {
iscsi_trace_error(__FILE__, __LINE__, "iov[%d].iov_base = %p, len %u\n",
@ -896,7 +897,7 @@ iscsi_sock_msg(iscsi_socket_t sock, int xmit, unsigned len, void *data, int iovc
}
n += rc;
if (n < len) {
iscsi_trace(TRACE_NET_DEBUG, __FILE__, __LINE__, "Got partial %s: %d bytes of %d\n", (xmit) ? "send" : "recv", rc, len - n + rc);
iscsi_trace(TRACE_NET_DEBUG, __FILE__, __LINE__, "Got partial %s: %d bytes of %u\n", (xmit) ? "send" : "recv", rc, len - n + rc);
total_len = 0;
for (i = 0; i < iovc; i++) {
@ -920,7 +921,7 @@ iscsi_sock_msg(iscsi_socket_t sock, int xmit, unsigned len, void *data, int iovc
if (remainder) {
iscsi_free_atomic(iov_padding);
}
iscsi_trace(TRACE_NET_DEBUG, __FILE__, __LINE__, "successfully %s %d bytes on sock (%d bytes padding)\n", xmit ? "sent" : "received", n, padding_len);
iscsi_trace(TRACE_NET_DEBUG, __FILE__, __LINE__, "successfully %s %u bytes on sock (%u bytes padding)\n", xmit ? "sent" : "received", n, padding_len);
return n - padding_len;
}
@ -959,16 +960,16 @@ iscsi_sock_send_header_and_data(iscsi_socket_t sock,
(void) memcpy(&iov[1], data, sizeof(struct iovec) * iovc);
iovc += 1;
}
if (iscsi_sock_msg(sock, Transmit, header_len + data_len, iov, iovc) != header_len + data_len) {
if ((unsigned)iscsi_sock_msg(sock, Transmit, header_len + data_len, iov, iovc) != header_len + data_len) {
iscsi_trace_error(__FILE__, __LINE__, "iscsi_sock_msg() failed\n");
return -1;
}
} else {
if (iscsi_sock_msg(sock, Transmit, header_len, header, 0) != header_len) {
if ((unsigned)iscsi_sock_msg(sock, Transmit, header_len, header, 0) != header_len) {
iscsi_trace_error(__FILE__, __LINE__, "iscsi_sock_msg() failed\n");
return -1;
}
if (data_len != 0 && iscsi_sock_msg(sock, Transmit, data_len, __UNCONST((const char *) data), iovc) != data_len) {
if (data_len != 0 && (unsigned)iscsi_sock_msg(sock, Transmit, data_len, __UNCONST((const char *) data), iovc) != data_len) {
iscsi_trace_error(__FILE__, __LINE__, "iscsi_sock_msg() failed\n");
return -1;
}