Skip to content

Commit

Permalink
Various warnings fixups for OpenBSD with gcc-3.3.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Brown committed Dec 7, 2007
1 parent 64787ba commit df86847
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion src/drivers/net/e1000/e1000.c
Expand Up @@ -577,7 +577,7 @@ e1000_transmit ( struct net_device *netdev, struct io_buffer *iobuf )
E1000_TXD_CMD_IFCS | iob_len ( iobuf );
tx_curr_desc->upper.data = 0;

DBG ( "TX fill: %ld tx_curr: %ld addr: %#08lx len: %d\n", adapter->tx_fill_ctr,
DBG ( "TX fill: %ld tx_curr: %ld addr: %#08lx len: %zd\n", adapter->tx_fill_ctr,
tx_curr, virt_to_bus ( iobuf->data ), iob_len ( iobuf ) );

/* Point to next free descriptor */
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/net/legacy.c
Expand Up @@ -25,7 +25,7 @@ static int legacy_transmit ( struct net_device *netdev, struct io_buffer *iobuf
struct nic *nic = netdev->priv;
struct ethhdr *ethhdr;

DBG ( "Transmitting %d bytes\n", iob_len ( iobuf ) );
DBG ( "Transmitting %zd bytes\n", iob_len ( iobuf ) );
iob_pad ( iobuf, ETH_ZLEN );
ethhdr = iobuf->data;
iob_pull ( iobuf, sizeof ( *ethhdr ) );
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/net/natsemi.c
Expand Up @@ -471,7 +471,7 @@ static int natsemi_transmit (struct net_device *netdev, struct io_buffer *iobuf)
np->tx[np->tx_cur].bufptr = virt_to_bus (iobuf->data);
np->tx[np->tx_cur].cmdsts = iob_len (iobuf) | OWN;

DBG ("TX id %d at %#08lx + %#08x\n", np->tx_cur,
DBG ("TX id %d at %#08lx + %#08zx\n", np->tx_cur,
virt_to_bus (&iobuf->data), iob_len (iobuf));

/* increment the circular buffer pointer to the next buffer location
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/net/rtl8139.c
Expand Up @@ -379,7 +379,7 @@ static int rtl_transmit ( struct net_device *netdev, struct io_buffer *iobuf ) {
iob_pad ( iobuf, ETH_ZLEN );

/* Add to TX ring */
DBG ( "TX id %d at %lx+%x\n", rtl->tx.next,
DBG ( "TX id %d at %lx+%zx\n", rtl->tx.next,
virt_to_bus ( iobuf->data ), iob_len ( iobuf ) );
rtl->tx.iobuf[rtl->tx.next] = iobuf;
outl ( virt_to_bus ( iobuf->data ),
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/nvs/nvs.c
Expand Up @@ -91,7 +91,7 @@ static int nvs_verify ( struct nvs_device *nvs, unsigned int address,

/* Compare data */
if ( memcmp ( data, read_data, len ) != 0 ) {
DBG ( "NVS %p verification failed at %#04x+%d\n",
DBG ( "NVS %p verification failed at %#04x+%zd\n",
nvs, address, len );
return -EIO;
}
Expand Down
2 changes: 1 addition & 1 deletion src/image/script.c
Expand Up @@ -66,7 +66,7 @@ static int script_exec ( struct image *image ) {
if ( ! eol )
eol = memchr ( cmdbuf, '\0', sizeof ( cmdbuf ) );
if ( ! eol ) {
DBG ( "Script line too long (max %d bytes)\n",
DBG ( "Script line too long (max %zd bytes)\n",
sizeof ( cmdbuf ) );
rc = -ENOEXEC;
goto done;
Expand Down
4 changes: 2 additions & 2 deletions src/net/dhcpopts.c
Expand Up @@ -426,11 +426,11 @@ struct dhcp_option * set_dhcp_option ( struct dhcp_option_block *options,
option = find_dhcp_option_with_encap ( options, tag, &encapsulator );
if ( option ) {
old_len = dhcp_option_len ( option );
DBG ( "Resizing DHCP option %s from length %d to %d in block "
DBG ( "Resizing DHCP option %s from length %d to %zd in block "
"%p\n", dhcp_tag_name (tag), option->len, len, options );
} else {
old_len = 0;
DBG ( "Creating DHCP option %s (length %d) in block %p\n",
DBG ( "Creating DHCP option %s (length %zd) in block %p\n",
dhcp_tag_name ( tag ), len, options );
}

Expand Down
2 changes: 1 addition & 1 deletion src/net/ethernet.c
Expand Up @@ -74,7 +74,7 @@ static int eth_rx ( struct io_buffer *iobuf, struct net_device *netdev ) {

/* Sanity check */
if ( iob_len ( iobuf ) < sizeof ( *ethhdr ) ) {
DBG ( "Ethernet packet too short (%d bytes)\n",
DBG ( "Ethernet packet too short (%zd bytes)\n",
iob_len ( iobuf ) );
free_iob ( iobuf );
return -EINVAL;
Expand Down
2 changes: 1 addition & 1 deletion src/net/icmpv6.c
Expand Up @@ -77,7 +77,7 @@ static int icmp6_rx ( struct io_buffer *iobuf, struct sockaddr_tcpip *st_src,

/* Sanity check */
if ( iob_len ( iobuf ) < sizeof ( *icmp6hdr ) ) {
DBG ( "Packet too short (%d bytes)\n", iob_len ( iobuf ) );
DBG ( "Packet too short (%zd bytes)\n", iob_len ( iobuf ) );
free_iob ( iobuf );
return -EINVAL;
}
Expand Down
16 changes: 8 additions & 8 deletions src/net/ipv4.c
Expand Up @@ -435,7 +435,7 @@ static int ipv4_rx ( struct io_buffer *iobuf, struct net_device *netdev __unused

/* Sanity check the IPv4 header */
if ( iob_len ( iobuf ) < sizeof ( *iphdr ) ) {
DBG ( "IPv4 packet too short at %d bytes (min %d bytes)\n",
DBG ( "IPv4 packet too short at %zd bytes (min %zd bytes)\n",
iob_len ( iobuf ), sizeof ( *iphdr ) );
goto err;
}
Expand All @@ -445,13 +445,13 @@ static int ipv4_rx ( struct io_buffer *iobuf, struct net_device *netdev __unused
}
hdrlen = ( ( iphdr->verhdrlen & IP_MASK_HLEN ) * 4 );
if ( hdrlen < sizeof ( *iphdr ) ) {
DBG ( "IPv4 header too short at %d bytes (min %d bytes)\n",
DBG ( "IPv4 header too short at %zd bytes (min %zd bytes)\n",
hdrlen, sizeof ( *iphdr ) );
goto err;
}
if ( hdrlen > iob_len ( iobuf ) ) {
DBG ( "IPv4 header too long at %d bytes "
"(packet is %d bytes)\n", hdrlen, iob_len ( iobuf ) );
DBG ( "IPv4 header too long at %zd bytes "
"(packet is %zd bytes)\n", hdrlen, iob_len ( iobuf ) );
goto err;
}
if ( ( csum = tcpip_chksum ( iphdr, hdrlen ) ) != 0 ) {
Expand All @@ -461,13 +461,13 @@ static int ipv4_rx ( struct io_buffer *iobuf, struct net_device *netdev __unused
}
len = ntohs ( iphdr->len );
if ( len < hdrlen ) {
DBG ( "IPv4 length too short at %d bytes "
"(header is %d bytes)\n", len, hdrlen );
DBG ( "IPv4 length too short at %zd bytes "
"(header is %zd bytes)\n", len, hdrlen );
goto err;
}
if ( len > iob_len ( iobuf ) ) {
DBG ( "IPv4 length too long at %d bytes "
"(packet is %d bytes)\n", len, iob_len ( iobuf ) );
DBG ( "IPv4 length too long at %zd bytes "
"(packet is %zd bytes)\n", len, iob_len ( iobuf ) );
goto err;
}

Expand Down
2 changes: 1 addition & 1 deletion src/net/ipv6.c
Expand Up @@ -302,7 +302,7 @@ static int ipv6_rx ( struct io_buffer *iobuf,

/* Sanity check */
if ( iob_len ( iobuf ) < sizeof ( *ip6hdr ) ) {
DBG ( "Packet too short (%d bytes)\n", iob_len ( iobuf ) );
DBG ( "Packet too short (%zd bytes)\n", iob_len ( iobuf ) );
goto drop;
}

Expand Down
6 changes: 3 additions & 3 deletions src/net/ndp.c
Expand Up @@ -81,7 +81,7 @@ add_ndp_entry ( struct net_device *netdev, struct in6_addr *in6,
}
ndp->state = state;
DBG ( "New neighbour cache entry (%d): IP6 %s => %s %s\n",
( ndp - ndp_table ) / sizeof ( *ndp ),
( ndp - ndp_table ),
inet6_ntoa ( ndp->in6 ), netdev->ll_protocol->name,
netdev->ll_protocol->ntoa ( ndp->ll_addr ) );
}
Expand Down Expand Up @@ -119,7 +119,7 @@ int ndp_resolve ( struct net_device *netdev, struct in6_addr *dest,
/* Check if the entry was already created */
if ( ndp ) {
DBG ( "Awaiting neighbour advertisement (cache entry %d)\n",
( ( ndp - ndp_table ) / sizeof ( *ndp ) ) );
( ndp - ndp_table ) );
/* For test */
// ndp->state = NDP_STATE_REACHABLE;
// memcpy ( ndp->ll_addr, netdev->ll_addr, 6 );
Expand Down Expand Up @@ -155,7 +155,7 @@ int ndp_process_advert ( struct io_buffer *iobuf, struct sockaddr_tcpip *st_src

/* Sanity check */
if ( iob_len ( iobuf ) < sizeof ( *nadvert ) ) {
DBG ( "Packet too short (%d bytes)\n", iob_len ( iobuf ) );
DBG ( "Packet too short (%zd bytes)\n", iob_len ( iobuf ) );
return -EINVAL;
}

Expand Down
10 changes: 5 additions & 5 deletions src/net/tcp.c
Expand Up @@ -557,7 +557,7 @@ static int tcp_xmit_reset ( struct tcp_connection *tcp,
tcphdr->csum = tcpip_chksum ( iobuf->data, iob_len ( iobuf ) );

/* Dump header */
DBGC ( tcp, "TCP %p TX %d->%d %08lx..%08lx %08lx %4zd",
DBGC ( tcp, "TCP %p TX %d->%d %08lx..%08lx %08lx %4d",
tcp, ntohs ( tcphdr->src ), ntohs ( tcphdr->dest ),
ntohl ( tcphdr->seq ), ( ntohl ( tcphdr->seq ) ),
ntohl ( tcphdr->ack ), 0 );
Expand Down Expand Up @@ -820,7 +820,7 @@ static int tcp_rx ( struct io_buffer *iobuf,
struct tcp_header *tcphdr = iobuf->data;
struct tcp_connection *tcp;
struct tcp_options options;
unsigned int hlen;
size_t hlen;
uint16_t csum;
uint32_t start_seq;
uint32_t seq;
Expand All @@ -832,20 +832,20 @@ static int tcp_rx ( struct io_buffer *iobuf,

/* Sanity check packet */
if ( iob_len ( iobuf ) < sizeof ( *tcphdr ) ) {
DBG ( "TCP packet too short at %d bytes (min %d bytes)\n",
DBG ( "TCP packet too short at %zd bytes (min %zd bytes)\n",
iob_len ( iobuf ), sizeof ( *tcphdr ) );
rc = -EINVAL;
goto discard;
}
hlen = ( ( tcphdr->hlen & TCP_MASK_HLEN ) / 16 ) * 4;
if ( hlen < sizeof ( *tcphdr ) ) {
DBG ( "TCP header too short at %d bytes (min %d bytes)\n",
DBG ( "TCP header too short at %zd bytes (min %zd bytes)\n",
hlen, sizeof ( *tcphdr ) );
rc = -EINVAL;
goto discard;
}
if ( hlen > iob_len ( iobuf ) ) {
DBG ( "TCP header too long at %d bytes (max %d bytes)\n",
DBG ( "TCP header too long at %zd bytes (max %zd bytes)\n",
hlen, iob_len ( iobuf ) );
rc = -EINVAL;
goto discard;
Expand Down
2 changes: 1 addition & 1 deletion src/net/tcp/iscsi.c
Expand Up @@ -213,7 +213,7 @@ static void iscsi_start_command ( struct iscsi_session *iscsi ) {
command->cmdsn = htonl ( iscsi->cmdsn );
command->expstatsn = htonl ( iscsi->statsn + 1 );
memcpy ( &command->cdb, &iscsi->command->cdb, sizeof ( command->cdb ));
DBGC ( iscsi, "iSCSI %p start " SCSI_CDB_FORMAT " %s %#x\n",
DBGC ( iscsi, "iSCSI %p start " SCSI_CDB_FORMAT " %s %#zx\n",
iscsi, SCSI_CDB_DATA ( command->cdb ),
( iscsi->command->data_in ? "in" : "out" ),
( iscsi->command->data_in ?
Expand Down
2 changes: 1 addition & 1 deletion src/net/tls.c
Expand Up @@ -452,7 +452,7 @@ static int tls_select_cipher ( struct tls_session *tls,
struct crypto_algorithm *pubkey = &crypto_null;
struct crypto_algorithm *cipher = &crypto_null;
struct crypto_algorithm *digest = &crypto_null;
size_t key_len = 0;
unsigned int key_len = 0;
int rc;

switch ( cipher_suite ) {
Expand Down
14 changes: 7 additions & 7 deletions src/net/udp.c
Expand Up @@ -215,7 +215,7 @@ static int udp_tx ( struct udp_connection *udp, struct io_buffer *iobuf,
udphdr->chksum = tcpip_chksum ( udphdr, len );

/* Dump debugging information */
DBGC ( udp, "UDP %p TX %d->%d len %zd\n", udp,
DBGC ( udp, "UDP %p TX %d->%d len %d\n", udp,
ntohs ( udphdr->src ), ntohs ( udphdr->dest ),
ntohs ( udphdr->len ) );

Expand Down Expand Up @@ -268,22 +268,22 @@ static int udp_rx ( struct io_buffer *iobuf, struct sockaddr_tcpip *st_src,

/* Sanity check packet */
if ( iob_len ( iobuf ) < sizeof ( *udphdr ) ) {
DBG ( "UDP packet too short at %d bytes (min %d bytes)\n",
DBG ( "UDP packet too short at %zd bytes (min %zd bytes)\n",
iob_len ( iobuf ), sizeof ( *udphdr ) );

rc = -EINVAL;
goto done;
}
ulen = ntohs ( udphdr->len );
if ( ulen < sizeof ( *udphdr ) ) {
DBG ( "UDP length too short at %d bytes "
"(header is %d bytes)\n", ulen, sizeof ( *udphdr ) );
DBG ( "UDP length too short at %zd bytes "
"(header is %zd bytes)\n", ulen, sizeof ( *udphdr ) );
rc = -EINVAL;
goto done;
}
if ( ulen > iob_len ( iobuf ) ) {
DBG ( "UDP length too long at %d bytes (packet is %d bytes)\n",
ulen, iob_len ( iobuf ) );
DBG ( "UDP length too long at %zd bytes (packet is %zd "
"bytes)\n", ulen, iob_len ( iobuf ) );
rc = -EINVAL;
goto done;
}
Expand Down Expand Up @@ -370,7 +370,7 @@ static struct io_buffer * udp_alloc_iob ( struct xfer_interface *xfer,

iobuf = alloc_iob ( UDP_MAX_HLEN + len );
if ( ! iobuf ) {
DBGC ( udp, "UDP %p cannot allocate buffer of length %d\n",
DBGC ( udp, "UDP %p cannot allocate buffer of length %zd\n",
udp, len );
return NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion src/net/udp/dhcp.c
Expand Up @@ -453,7 +453,7 @@ static struct dhcp_option_block * dhcp_parse ( const struct dhcphdr *dhcphdr,
/* Allocate empty options block of required size */
options = alloc_dhcp_options ( options_len );
if ( ! options ) {
DBG ( "DHCP could not allocate %d-byte option block\n",
DBG ( "DHCP could not allocate %zd-byte option block\n",
options_len );
return NULL;
}
Expand Down

0 comments on commit df86847

Please sign in to comment.