Module Name: src
Committed By: christos
Date: Sun Mar 31 20:08:45 UTC 2019
Modified Files:
src/sys/lib/libsa: Makefile alloc.c arp.c atoi.c bootcfg.c bootcfg.h
bootp.c bootp.h bootparam.c cd9660.c checkpasswd.c dev_net.c
dosfs.c ether.c ext2fs.c gets.c ip.c loadfile.c minixfs3.c net.c
net.h netif.c nfs.c qsort.c rarp.c rpc.c tftp.c udp.c ufs.c
Log Message:
fix warnings, printf formats, etc.
To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/lib/libsa/Makefile
cvs rdiff -u -r1.27 -r1.28 src/sys/lib/libsa/alloc.c src/sys/lib/libsa/net.h
cvs rdiff -u -r1.34 -r1.35 src/sys/lib/libsa/arp.c
cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libsa/atoi.c
cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libsa/bootcfg.c src/sys/lib/libsa/ip.c
cvs rdiff -u -r1.2 -r1.3 src/sys/lib/libsa/bootcfg.h
cvs rdiff -u -r1.41 -r1.42 src/sys/lib/libsa/bootp.c
cvs rdiff -u -r1.9 -r1.10 src/sys/lib/libsa/bootp.h
cvs rdiff -u -r1.19 -r1.20 src/sys/lib/libsa/bootparam.c
cvs rdiff -u -r1.31 -r1.32 src/sys/lib/libsa/cd9660.c
cvs rdiff -u -r1.10 -r1.11 src/sys/lib/libsa/checkpasswd.c
cvs rdiff -u -r1.26 -r1.27 src/sys/lib/libsa/dev_net.c
cvs rdiff -u -r1.21 -r1.22 src/sys/lib/libsa/dosfs.c
cvs rdiff -u -r1.23 -r1.24 src/sys/lib/libsa/ether.c
cvs rdiff -u -r1.25 -r1.26 src/sys/lib/libsa/ext2fs.c \
src/sys/lib/libsa/netif.c
cvs rdiff -u -r1.14 -r1.15 src/sys/lib/libsa/gets.c
cvs rdiff -u -r1.30 -r1.31 src/sys/lib/libsa/loadfile.c
cvs rdiff -u -r1.7 -r1.8 src/sys/lib/libsa/minixfs3.c
cvs rdiff -u -r1.35 -r1.36 src/sys/lib/libsa/net.c src/sys/lib/libsa/tftp.c
cvs rdiff -u -r1.48 -r1.49 src/sys/lib/libsa/nfs.c
cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libsa/qsort.c
cvs rdiff -u -r1.32 -r1.33 src/sys/lib/libsa/rarp.c
cvs rdiff -u -r1.29 -r1.30 src/sys/lib/libsa/rpc.c
cvs rdiff -u -r1.12 -r1.13 src/sys/lib/libsa/udp.c
cvs rdiff -u -r1.74 -r1.75 src/sys/lib/libsa/ufs.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/lib/libsa/Makefile
diff -u src/sys/lib/libsa/Makefile:1.88 src/sys/lib/libsa/Makefile:1.89
--- src/sys/lib/libsa/Makefile:1.88 Mon Jun 4 20:57:47 2018
+++ src/sys/lib/libsa/Makefile Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.88 2018/06/05 00:57:47 christos Exp $
+# $NetBSD: Makefile,v 1.89 2019/03/31 20:08:45 christos Exp $
LIB= sa
LIBISPRIVATE?= yes
@@ -14,6 +14,11 @@ CPPFLAGS= -I${SADIR} ${SACPPFLAGS} ${SAM
#COPTS+= -ansi -pedantic -Wall
+# For testing
+# WARNS=5
+# COPTS+=-ffreestanding
+# CPPFLAGS+= -I${.CURDIR}/../../ -I${.CURDIR}
+
.if defined(SA_EXTRADIR)
.-include "${SA_EXTRADIR}/Makefile.inc"
.endif
Index: src/sys/lib/libsa/alloc.c
diff -u src/sys/lib/libsa/alloc.c:1.27 src/sys/lib/libsa/alloc.c:1.28
--- src/sys/lib/libsa/alloc.c:1.27 Sun Jun 5 09:44:48 2016
+++ src/sys/lib/libsa/alloc.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: alloc.c,v 1.27 2016/06/05 13:44:48 maxv Exp $ */
+/* $NetBSD: alloc.c,v 1.28 2019/03/31 20:08:45 christos Exp $ */
/*
* Copyright (c) 1993
@@ -224,16 +224,16 @@ dealloc(void *ptr, size_t size)
ALIGN(sizeof(unsigned int)));
#ifdef DEBUG
if (size > (size_t)f->size) {
- printf("dealloc %zu bytes @%lx, should be <=%u\n",
- size, (u_long)ptr, f->size);
+ printf("%s: %zu bytes @%p, should be <=%u\n", __func__,
+ size, ptr, f->size);
}
if (ptr < (void *)HEAP_START)
- printf("dealloc: %lx before start of heap.\n", (u_long)ptr);
+ printf("%s: %p before start of heap.\n", __func__, ptr);
#ifdef HEAP_LIMIT
if (ptr > (void *)HEAP_LIMIT)
- printf("dealloc: %lx beyond end of heap.\n", (u_long)ptr);
+ printf("%s: %p beyond end of heap.\n", __func__, ptr);
#endif
#endif /* DEBUG */
/* put into freelist */
Index: src/sys/lib/libsa/net.h
diff -u src/sys/lib/libsa/net.h:1.27 src/sys/lib/libsa/net.h:1.28
--- src/sys/lib/libsa/net.h:1.27 Sat Mar 29 10:30:16 2014
+++ src/sys/lib/libsa/net.h Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: net.h,v 1.27 2014/03/29 14:30:16 jakllsch Exp $ */
+/* $NetBSD: net.h,v 1.28 2019/03/31 20:08:45 christos Exp $ */
/*
* Copyright (c) 1993 Adam Glass
@@ -133,4 +133,6 @@ int ip_cksum(const void *, size_t);
/* Machine-dependent functions: */
#ifdef _STANDALONE /* XXX for mount_nfs(8) SMALLPROG hack */
satime_t getsecs(void);
+#else
+#define getsecs() time(NULL)
#endif
Index: src/sys/lib/libsa/arp.c
diff -u src/sys/lib/libsa/arp.c:1.34 src/sys/lib/libsa/arp.c:1.35
--- src/sys/lib/libsa/arp.c:1.34 Sat Mar 29 10:25:10 2014
+++ src/sys/lib/libsa/arp.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: arp.c,v 1.34 2014/03/29 14:25:10 jakllsch Exp $ */
+/* $NetBSD: arp.c,v 1.35 2019/03/31 20:08:45 christos Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@@ -50,6 +50,7 @@
#ifdef _STANDALONE
#include <lib/libkern/libkern.h>
#else
+#include <arpa/inet.h>
#include <string.h>
#endif
@@ -97,6 +98,7 @@ u_char *
arpwhohas(struct iodesc *d, struct in_addr addr)
{
int i;
+ ssize_t ns;
struct ether_arp *ah;
struct arp_list *al;
struct {
@@ -122,12 +124,12 @@ arpwhohas(struct iodesc *d, struct in_ad
/* Don't overflow cache */
if (arp_num > ARP_NUM - 1) {
arp_num = 1; /* recycle */
- printf("arpwhohas: overflowed arp_list!\n");
+ printf("%s: overflowed arp_list!\n", __func__);
}
#ifdef ARP_DEBUG
if (debug)
- printf("arpwhohas: send request for %s\n", inet_ntoa(addr));
+ printf("%s: send request for %s\n", __func__, inet_ntoa(addr));
#endif
(void)memset(&wbuf.data, 0, sizeof(wbuf.data));
@@ -145,21 +147,20 @@ arpwhohas(struct iodesc *d, struct in_ad
/* Store ip address in cache (incomplete entry). */
al->addr = addr;
- i = sendrecv(d,
+ ns = sendrecv(d,
arpsend, &wbuf.data, sizeof(wbuf.data),
arprecv, &rbuf.data, sizeof(rbuf.data));
- if (i == -1) {
- panic("arp: no response for %s",
- inet_ntoa(addr));
+ if (ns == -1) {
+ panic("%s: no response for %s", __func__, inet_ntoa(addr));
}
/* Store ethernet address in cache */
ah = &rbuf.data.arp;
#ifdef ARP_DEBUG
if (debug) {
- printf("arp: response from %s\n",
+ printf("%s: response from %s\n", __func__,
ether_sprintf(rbuf.eh.ether_shost));
- printf("arp: cacheing %s --> %s\n",
+ printf("%s: cacheing %s --> %s\n", __func__,
inet_ntoa(addr), ether_sprintf(ah->arp_sha));
}
#endif
@@ -175,7 +176,7 @@ arpsend(struct iodesc *d, void *pkt, siz
#ifdef ARP_DEBUG
if (debug)
- printf("arpsend: called\n");
+ printf("%s: called\n", __func__);
#endif
return sendether(d, pkt, len, bcea, ETHERTYPE_ARP);
@@ -193,16 +194,15 @@ arprecv(struct iodesc *d, void *pkt, siz
u_int16_t etype; /* host order */
#ifdef ARP_DEBUG
- if (debug)
- printf("arprecv: ");
+ if (debug)
+ printf("%s: ", __func__);
#endif
-
n = readether(d, pkt, len, tleft, &etype);
errno = 0; /* XXX */
if (n == -1 || (size_t)n < sizeof(struct ether_arp)) {
#ifdef ARP_DEBUG
if (debug)
- printf("bad len=%ld\n", (signed long) n);
+ printf("bad len=%zd\n", n);
#endif
return -1;
}
@@ -283,7 +283,7 @@ arp_reply(struct iodesc *d, void *pkt)
{
#ifdef ARP_DEBUG
if (debug)
- printf("arp_reply: bad hrd/pro/hln/pln\n");
+ printf("%s: bad hrd/pro/hln/pln\n", __func__);
#endif
return;
}
@@ -291,7 +291,7 @@ arp_reply(struct iodesc *d, void *pkt)
if (arp->arp_op != htons(ARPOP_REQUEST)) {
#ifdef ARP_DEBUG
if (debug)
- printf("arp_reply: not request!\n");
+ printf("%s: not request!\n", __func__);
#endif
return;
}
@@ -302,7 +302,7 @@ arp_reply(struct iodesc *d, void *pkt)
#ifdef ARP_DEBUG
if (debug) {
- printf("arp_reply: to %s\n", ether_sprintf(arp->arp_sha));
+ printf("%s: to %s\n", __func__, ether_sprintf(arp->arp_sha));
}
#endif
Index: src/sys/lib/libsa/atoi.c
diff -u src/sys/lib/libsa/atoi.c:1.1 src/sys/lib/libsa/atoi.c:1.2
--- src/sys/lib/libsa/atoi.c:1.1 Sun Aug 10 03:40:49 2014
+++ src/sys/lib/libsa/atoi.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: atoi.c,v 1.1 2014/08/10 07:40:49 isaki Exp $ */
+/* $NetBSD: atoi.c,v 1.2 2019/03/31 20:08:45 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@ atoi(const char *in)
int ret;
ret = 0;
- c = (char *)in;
+ c = __UNCONST(in);
if (*c == '-')
c++;
for (; isdigit(*c); c++)
Index: src/sys/lib/libsa/bootcfg.c
diff -u src/sys/lib/libsa/bootcfg.c:1.3 src/sys/lib/libsa/bootcfg.c:1.4
--- src/sys/lib/libsa/bootcfg.c:1.3 Mon Apr 2 05:44:19 2018
+++ src/sys/lib/libsa/bootcfg.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: bootcfg.c,v 1.3 2018/04/02 09:44:19 nonaka Exp $ */
+/* $NetBSD: bootcfg.c,v 1.4 2019/03/31 20:08:45 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -98,8 +98,9 @@ int
perform_bootcfg(const char *conf, bootcfg_command command, const off_t maxsz)
{
char *bc, *c;
- int cmenu, cbanner, len;
- int fd, err, off;
+ int cmenu, cbanner;
+ ssize_t len, off;
+ int fd, err;
struct stat st;
char *next, *key, *value, *v2;
@@ -128,7 +129,7 @@ perform_bootcfg(const char *conf, bootcf
return EFBIG;
}
- bc = alloc(st.st_size + 1);
+ bc = alloc((size_t)st.st_size + 1);
if (bc == NULL) {
printf("Could not allocate memory for boot configuration\n");
close(fd);
Index: src/sys/lib/libsa/ip.c
diff -u src/sys/lib/libsa/ip.c:1.3 src/sys/lib/libsa/ip.c:1.4
--- src/sys/lib/libsa/ip.c:1.3 Wed May 9 02:49:48 2018
+++ src/sys/lib/libsa/ip.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ip.c,v 1.3 2018/05/09 06:49:48 maxv Exp $ */
+/* $NetBSD: ip.c,v 1.4 2019/03/31 20:08:45 christos Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@@ -105,7 +105,7 @@ sendip(struct iodesc *d, void *pkt, size
if (cc == -1)
return -1;
if ((size_t)cc != len)
- panic("sendip: bad write (%zd != %zu)", cc, len);
+ panic("%s: bad write (%zd != %zu)", __func__, cc, len);
return (cc - (sizeof(*ip)));
}
@@ -133,7 +133,7 @@ readip(struct iodesc *d, void *pkt, size
if (etype == ETHERTYPE_ARP) {
struct arphdr *ah = (void *)ip;
- if (n < (sizeof(*ah) + 2 * (ah->ar_hln + ah->ar_pln))) {
+ if (n < (ssize_t)(sizeof(*ah) + 2 * (ah->ar_hln + ah->ar_pln))) {
return -1;
}
if (ah->ar_op == htons(ARPOP_REQUEST)) {
Index: src/sys/lib/libsa/bootcfg.h
diff -u src/sys/lib/libsa/bootcfg.h:1.2 src/sys/lib/libsa/bootcfg.h:1.3
--- src/sys/lib/libsa/bootcfg.h:1.2 Mon Apr 2 05:44:19 2018
+++ src/sys/lib/libsa/bootcfg.h Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: bootcfg.h,v 1.2 2018/04/02 09:44:19 nonaka Exp $ */
+/* $NetBSD: bootcfg.h,v 1.3 2019/03/31 20:08:45 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -48,7 +48,8 @@ struct bootcfg_def {
int timeout; /* Timeout in seconds */
int menuformat; /* Letters instead of numbers */
int clear; /* Clear the screen? */
-} extern bootcfg_info;
+};
+extern struct bootcfg_def bootcfg_info;
int perform_bootcfg(const char *, bootcfg_command, const off_t);
void bootcfg_do_noop(const char *, char *);
Index: src/sys/lib/libsa/bootp.c
diff -u src/sys/lib/libsa/bootp.c:1.41 src/sys/lib/libsa/bootp.c:1.42
--- src/sys/lib/libsa/bootp.c:1.41 Sat Jun 25 00:53:32 2016
+++ src/sys/lib/libsa/bootp.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: bootp.c,v 1.41 2016/06/25 04:53:32 isaki Exp $ */
+/* $NetBSD: bootp.c,v 1.42 2019/03/31 20:08:45 christos Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@@ -134,18 +134,18 @@ bootp(int sock)
#ifdef BOOTP_DEBUG
if (debug)
- printf("bootp: socket=%d\n", sock);
+ printf("%s: socket=%d\n", __func__, sock);
#endif
if (!bot)
bot = getsecs();
if (!(d = socktodesc(sock))) {
- printf("bootp: bad socket. %d\n", sock);
+ printf("%s: bad socket. %d\n", __func__, sock);
return;
}
#ifdef BOOTP_DEBUG
if (debug)
- printf("bootp: d=%lx\n", (long)d);
+ printf("%s: d=%p\n", __func__, d);
#endif
bp = &wbuf.wbootp;
@@ -176,11 +176,9 @@ bootp(int sock)
dhcp_ok = 0;
#endif
- if (sendrecv(d,
- bootpsend, bp, sizeof(*bp),
- bootprecv, &rbuf.rbootp, sizeof(rbuf.rbootp))
- == -1) {
- printf("bootp: no reply\n");
+ if (sendrecv(d, bootpsend, bp, sizeof(*bp),
+ bootprecv, &rbuf.rbootp, sizeof(rbuf.rbootp)) == -1) {
+ printf("%s: no reply\n", __func__);
return;
}
@@ -287,7 +285,7 @@ bootpsend(struct iodesc *d, void *pkt, s
#ifdef BOOTP_DEBUG
if (debug)
- printf("bootpsend: d=%lx called.\n", (long)d);
+ printf("%s: d=%p called.\n", __func__, d);
#endif
bp = pkt;
@@ -295,7 +293,7 @@ bootpsend(struct iodesc *d, void *pkt, s
#ifdef BOOTP_DEBUG
if (debug)
- printf("bootpsend: calling sendudp\n");
+ printf("%s: calling sendudp\n", __func__);
#endif
return sendudp(d, pkt, len);
@@ -309,7 +307,7 @@ bootprecv(struct iodesc *d, void *pkt, s
#ifdef BOOTP_DEBUG
if (debug)
- printf("bootprecv: called\n");
+ printf("%s: called\n", __func__);
#endif
n = readudp(d, pkt, len, tleft);
@@ -320,13 +318,12 @@ bootprecv(struct iodesc *d, void *pkt, s
#ifdef BOOTP_DEBUG
if (debug)
- printf("bootprecv: checked. bp = 0x%lx, n = %d\n",
- (long)bp, (int)n);
+ printf("%s: checked. bp = %p, n = %zd\n", __func__, bp, n);
#endif
if (bp->bp_xid != htonl(d->xid)) {
#ifdef BOOTP_DEBUG
if (debug) {
- printf("bootprecv: expected xid 0x%lx, got 0x%x\n",
+ printf("%s: expected xid %#lx, got %#x\n", __func__,
d->xid, ntohl(bp->bp_xid));
}
#endif
@@ -340,7 +337,7 @@ bootprecv(struct iodesc *d, void *pkt, s
#ifdef BOOTP_DEBUG
if (debug)
- printf("bootprecv: got one!\n");
+ printf("%s: got one!\n", __func__);
#endif
/* Suck out vendor info */
@@ -353,7 +350,7 @@ bootprecv(struct iodesc *d, void *pkt, s
vend_cmu(bp->bp_vend);
#endif
else
- printf("bootprecv: unknown vendor 0x%lx\n", (long)bp->bp_vend);
+ printf("%s: unknown vendor %p\n", __func__, bp->bp_vend);
return n;
bad:
@@ -365,12 +362,12 @@ static int
vend_rfc1048(u_char *cp, u_int len)
{
u_char *ep;
- int size;
+ size_t size;
u_char tag;
#ifdef BOOTP_DEBUG
if (debug)
- printf("vend_rfc1048 bootp info. len=%d\n", len);
+ printf("%s: bootp info. len=%d\n", __func__, len);
#endif
ep = cp + len;
@@ -433,7 +430,7 @@ vend_cmu(u_char *cp)
#ifdef BOOTP_DEBUG
if (debug)
- printf("vend_cmu bootp info.\n");
+ printf("%s: bootp info.\n", __func__);
#endif
vp = (struct cmu_vend *)cp;
Index: src/sys/lib/libsa/bootp.h
diff -u src/sys/lib/libsa/bootp.h:1.9 src/sys/lib/libsa/bootp.h:1.10
--- src/sys/lib/libsa/bootp.h:1.9 Sat Jan 17 09:00:36 2009
+++ src/sys/lib/libsa/bootp.h Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: bootp.h,v 1.9 2009/01/17 14:00:36 tsutsui Exp $ */
+/* $NetBSD: bootp.h,v 1.10 2019/03/31 20:08:45 christos Exp $ */
/*
* Bootstrap Protocol (BOOTP). RFC951 and RFC1048.
@@ -62,7 +62,7 @@ struct bootp {
/*
* Vendor magic cookie (v_magic) for RFC1048
*/
-#define VM_RFC1048 { 99, 130, 83, 99 }
+#define VM_RFC1048 { 99, (char) 130, 83, 99 }
/*
Index: src/sys/lib/libsa/bootparam.c
diff -u src/sys/lib/libsa/bootparam.c:1.19 src/sys/lib/libsa/bootparam.c:1.20
--- src/sys/lib/libsa/bootparam.c:1.19 Wed Oct 21 19:12:10 2009
+++ src/sys/lib/libsa/bootparam.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: bootparam.c,v 1.19 2009/10/21 23:12:10 snj Exp $ */
+/* $NetBSD: bootparam.c,v 1.20 2019/03/31 20:08:45 christos Exp $ */
/*
* Copyright (c) 1995 Gordon W. Ross
@@ -59,7 +59,7 @@
struct in_addr bp_server_addr; /* net order */
n_short bp_server_port; /* net order */
-int hostnamelen;
+uint32_t hostnamelen;
char domainname[FNAME_SIZE]; /* our DNS domain */
int domainnamelen;
@@ -76,15 +76,15 @@ int domainnamelen;
* (Note, really four ints, NOT chars. Blech.)
*/
struct xdr_inaddr {
- u_int32_t atype;
+ uint32_t atype;
int32_t addr[4];
};
int xdr_inaddr_encode(char **, struct in_addr);
int xdr_inaddr_decode(char **, struct in_addr *);
-int xdr_string_encode(char **, char *, int);
-int xdr_string_decode(char **, char *, int *);
+int xdr_string_encode(char **, char *, uint32_t);
+int xdr_string_decode(char **, char *, uint32_t *);
/*
@@ -107,16 +107,16 @@ bp_whoami(int sockfd)
{
/* RPC structures for PMAPPROC_CALLIT */
struct args {
- u_int32_t prog;
- u_int32_t vers;
- u_int32_t proc;
- u_int32_t arglen;
+ uint32_t prog;
+ uint32_t vers;
+ uint32_t proc;
+ uint32_t arglen;
struct xdr_inaddr xina;
} *args;
struct repl {
- u_int16_t _pad;
- u_int16_t port;
- u_int32_t encap_len;
+ uint16_t _pad;
+ uint16_t port;
+ uint32_t encap_len;
/* encapsulated data here */
n_long capsule[64];
} *repl;
@@ -130,12 +130,13 @@ bp_whoami(int sockfd)
} rdata;
char *send_tail, *recv_head;
struct iodesc *d;
- int len, x;
+ uint32_t x;
+ ssize_t len;
- RPC_PRINTF(("bp_whoami: myip=%s\n", inet_ntoa(myip)));
+ RPC_PRINTF(("%s: myip=%s\n", __func__, inet_ntoa(myip)));
if (!(d = socktodesc(sockfd))) {
- RPC_PRINTF(("bp_whoami: bad socket. %d\n", sockfd));
+ RPC_PRINTF(("%s: bad socket. %d\n", __func__, sockfd));
return -1;
}
args = &sdata.d;
@@ -144,10 +145,10 @@ bp_whoami(int sockfd)
/*
* Build request args for PMAPPROC_CALLIT.
*/
- args->prog = htonl(BOOTPARAM_PROG);
- args->vers = htonl(BOOTPARAM_VERS);
- args->proc = htonl(BOOTPARAM_WHOAMI);
- args->arglen = htonl(sizeof(struct xdr_inaddr));
+ args->prog = htonl((uint32_t)BOOTPARAM_PROG);
+ args->vers = htonl((uint32_t)BOOTPARAM_VERS);
+ args->proc = htonl((uint32_t)BOOTPARAM_WHOAMI);
+ args->arglen = htonl((uint32_t)sizeof(struct xdr_inaddr));
send_tail = (char *)&args->xina;
/*
@@ -157,15 +158,16 @@ bp_whoami(int sockfd)
return -1;
/* RPC: portmap/callit */
- d->myport = htons(--rpc_port);
+ --rpc_port;
+ d->myport = (uint16_t)htons((uint16_t)rpc_port);
d->destip.s_addr = INADDR_BROADCAST; /* XXX: subnet bcast? */
/* rpc_call will set d->destport */
len = rpc_call(d, PMAPPROG, PMAPVERS, PMAPPROC_CALLIT,
- args, send_tail - (char *)args,
+ args, (size_t)(send_tail - (char *)args),
repl, sizeof(*repl));
if (len < 8) {
- printf("bootparamd: 'whoami' call failed\n");
+ printf("%s: 'whoami' call failed\n", __func__);
return -1;
}
@@ -179,21 +181,21 @@ bp_whoami(int sockfd)
*/
bp_server_port = repl->port;
- RPC_PRINTF(("bp_whoami: server at %s:%d\n",
- inet_ntoa(bp_server_addr), ntohs(bp_server_port)));
+ RPC_PRINTF(("%s: server at %s:%d\n", __func__,
+ inet_ntoa(bp_server_addr), ntohs((uint16_t)bp_server_port)));
/* We have just done a portmap call, so cache the portnum. */
rpc_pmap_putcache(bp_server_addr,
BOOTPARAM_PROG,
BOOTPARAM_VERS,
- (int)ntohs(bp_server_port));
+ (int)ntohs((uint16_t)bp_server_port));
/*
* Parse the encapsulated results from bootparam/whoami
*/
- x = ntohl(repl->encap_len);
+ x = ntohl((uint32_t)repl->encap_len);
if (len < x) {
- printf("bp_whoami: short reply, %d < %d\n", len, x);
+ printf("%s: short reply, %zd < %d\n", __func__, len, x);
return -1;
}
recv_head = (char *)repl->capsule;
@@ -201,20 +203,20 @@ bp_whoami(int sockfd)
/* client name */
hostnamelen = MAXHOSTNAMELEN-1;
if (xdr_string_decode(&recv_head, hostname, &hostnamelen)) {
- RPC_PRINTF(("bp_whoami: bad hostname\n"));
+ RPC_PRINTF(("%s: bad hostname\n", __func__));
return -1;
}
/* domain name */
domainnamelen = MAXHOSTNAMELEN-1;
if (xdr_string_decode(&recv_head, domainname, &domainnamelen)) {
- RPC_PRINTF(("bp_whoami: bad domainname\n"));
+ RPC_PRINTF(("%s: bad domainname\n", __func__));
return -1;
}
/* gateway address */
if (xdr_inaddr_decode(&recv_head, &gateip)) {
- RPC_PRINTF(("bp_whoami: bad gateway\n"));
+ RPC_PRINTF(("%s: bad gateway\n", __func__));
return -1;
}
@@ -245,10 +247,11 @@ bp_getfile(int sockfd, char *key, struct
char *send_tail, *recv_head;
/* misc... */
struct iodesc *d;
- int sn_len, path_len, rlen;
+ int sn_len, path_len;
+ ssize_t rlen;
if (!(d = socktodesc(sockfd))) {
- RPC_PRINTF(("bp_getfile: bad socket. %d\n", sockfd));
+ RPC_PRINTF(("%s: bad socket. %d\n", __func__, sockfd));
return -1;
}
@@ -261,27 +264,28 @@ bp_getfile(int sockfd, char *key, struct
/* client name (hostname) */
if (xdr_string_encode(&send_tail, hostname, hostnamelen)) {
- RPC_PRINTF(("bp_getfile: bad client\n"));
+ RPC_PRINTF(("%s: bad client\n", __func__));
return -1;
}
/* key name (root or swap) */
- if (xdr_string_encode(&send_tail, key, strlen(key))) {
- RPC_PRINTF(("bp_getfile: bad key\n"));
+ if (xdr_string_encode(&send_tail, key, (uint32_t)strlen(key))) {
+ RPC_PRINTF(("%s: bad key\n", __func__));
return -1;
}
/* RPC: bootparam/getfile */
- d->myport = htons(--rpc_port);
+ --rpc_port;
+ d->myport = htons((uint16_t)rpc_port);
d->destip = bp_server_addr;
/* rpc_call will set d->destport */
rlen = rpc_call(d,
BOOTPARAM_PROG, BOOTPARAM_VERS, BOOTPARAM_GETFILE,
- sdata.d, send_tail - (char *)sdata.d,
+ sdata.d, (size_t)(send_tail - (char *)sdata.d),
rdata.d, sizeof(rdata.d));
if (rlen < 4) {
- RPC_PRINTF(("bp_getfile: short reply\n"));
+ RPC_PRINTF(("%s: short reply\n", __func__));
errno = EBADRPC;
return -1;
}
@@ -294,20 +298,20 @@ bp_getfile(int sockfd, char *key, struct
/* server name */
sn_len = FNAME_SIZE-1;
if (xdr_string_decode(&recv_head, serv_name, &sn_len)) {
- RPC_PRINTF(("bp_getfile: bad server name\n"));
+ RPC_PRINTF(("%s: bad server name\n", __func__));
return -1;
}
/* server IP address (mountd/NFS) */
if (xdr_inaddr_decode(&recv_head, serv_addr)) {
- RPC_PRINTF(("bp_getfile: bad server addr\n"));
+ RPC_PRINTF(("%s: bad server addr\n", __func__));
return -1;
}
/* server pathname */
path_len = MAXPATHLEN - 1;
if (xdr_string_decode(&recv_head, pathname, &path_len)) {
- RPC_PRINTF(("bp_getfile: bad server path\n"));
+ RPC_PRINTF(("%s: bad server path\n", __func__));
return -1;
}
@@ -323,14 +327,14 @@ bp_getfile(int sockfd, char *key, struct
int
-xdr_string_encode(char **pkt, char *str, int len)
+xdr_string_encode(char **pkt, char *str, uint32_t len)
{
- u_int32_t *lenp;
+ uint32_t *lenp;
char *datap;
- int padlen = (len + 3) & ~3; /* padded length */
+ uint32_t padlen = (len + 3) & ~3U; /* padded length */
/* The data will be int aligned. */
- lenp = (u_int32_t *)*pkt;
+ lenp = (uint32_t *)*pkt;
*pkt += sizeof(*lenp);
*lenp = htonl(len);
@@ -343,18 +347,18 @@ xdr_string_encode(char **pkt, char *str,
/* len_p: bufsize - 1 */
int
-xdr_string_decode(char **pkt, char *str, int *len_p)
+xdr_string_decode(char **pkt, char *str, uint32_t *len_p)
{
- u_int32_t *lenp;
+ uint32_t *lenp;
char *datap;
- int slen; /* string length */
- int plen; /* padded length */
+ uint32_t slen; /* string length */
+ uint32_t plen; /* padded length */
/* The data will be int aligned. */
- lenp = (u_int32_t *)*pkt;
+ lenp = (uint32_t *)*pkt;
*pkt += sizeof(*lenp);
slen = ntohl(*lenp);
- plen = (slen + 3) & ~3;
+ plen = (slen + 3) & ~3U;
if (slen > *len_p)
slen = *len_p;
@@ -375,7 +379,7 @@ xdr_inaddr_encode(char **pkt, struct in_
{
struct xdr_inaddr *xi;
u_char *cp;
- int32_t *ip;
+ uint32_t *ip;
union {
n_long l; /* network order */
u_char c[4];
@@ -393,10 +397,10 @@ xdr_inaddr_encode(char **pkt, struct in_
* imply that uia.l is in host order.
* In fact this needs it in net order.
*/
- *ip++ = htonl((unsigned int)*cp++);
- *ip++ = htonl((unsigned int)*cp++);
- *ip++ = htonl((unsigned int)*cp++);
- *ip++ = htonl((unsigned int)*cp++);
+ *ip++ = htonl((uint32_t)*cp++);
+ *ip++ = htonl((uint32_t)*cp++);
+ *ip++ = htonl((uint32_t)*cp++);
+ *ip++ = htonl((uint32_t)*cp++);
return 0;
}
@@ -407,7 +411,7 @@ xdr_inaddr_decode(char **pkt, struct in_
{
struct xdr_inaddr *xi;
u_char *cp;
- int32_t *ip;
+ uint32_t *ip;
union {
n_long l; /* network order */
u_char c[4];
@@ -416,9 +420,9 @@ xdr_inaddr_decode(char **pkt, struct in_
/* The data will be int aligned. */
xi = (struct xdr_inaddr *)*pkt;
*pkt += sizeof(*xi);
- if (xi->atype != htonl(1)) {
- RPC_PRINTF(("xdr_inaddr_decode: bad addrtype=%d\n",
- ntohl(xi->atype)));
+ if (xi->atype != htonl((uint32_t)1)) {
+ RPC_PRINTF(("%s: bad addrtype=%d\n", __func__,
+ ntohl((uint32_t)nxi->atype)));
return -1;
}
@@ -429,10 +433,10 @@ xdr_inaddr_decode(char **pkt, struct in_
* imply that uia.l is in host order.
* In fact this needs it in net order.
*/
- *cp++ = ntohl(*ip++);
- *cp++ = ntohl(*ip++);
- *cp++ = ntohl(*ip++);
- *cp++ = ntohl(*ip++);
+ *cp++ = (u_char)ntohl(*ip++);
+ *cp++ = (u_char)ntohl(*ip++);
+ *cp++ = (u_char)ntohl(*ip++);
+ *cp++ = (u_char)ntohl(*ip++);
ia->s_addr = uia.l;
return 0;
Index: src/sys/lib/libsa/cd9660.c
diff -u src/sys/lib/libsa/cd9660.c:1.31 src/sys/lib/libsa/cd9660.c:1.32
--- src/sys/lib/libsa/cd9660.c:1.31 Thu Mar 8 18:02:50 2018
+++ src/sys/lib/libsa/cd9660.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cd9660.c,v 1.31 2018/03/08 23:02:50 nonaka Exp $ */
+/* $NetBSD: cd9660.c,v 1.32 2019/03/31 20:08:45 christos Exp $ */
/*
* Copyright (C) 1996 Wolfgang Solfrank.
@@ -41,6 +41,7 @@
#ifdef _STANDALONE
#include <lib/libkern/libkern.h>
#else
+#include <ctype.h>
#include <string.h>
#endif
#include <fs/cd9660/iso.h>
@@ -86,7 +87,7 @@ pnmatch(const char *path, struct ptable_
cp = pp->name;
for (i = isonum_711(pp->namlen); --i >= 0; path++, cp++) {
- if (toupper(*path) == *cp)
+ if (toupper((unsigned char)*path) == *cp)
continue;
return 0;
}
@@ -109,7 +110,7 @@ dirmatch(const char *path, struct iso_di
for (i = isonum_711(dp->name_len); --i >= 0; path++, cp++) {
if (!*path)
break;
- if (toupper(*path) == *cp)
+ if (toupper((unsigned char)*path) == *cp)
continue;
return 0;
}
@@ -195,7 +196,7 @@ cd9660_open(const char *path, struct ope
parent = 1;
pp = (struct ptable_ent *)buf;
ent = 1;
- bno = isonum_732(pp->block) + isonum_711(pp->extlen);
+ bno = (daddr_t)isonum_732(pp->block) + isonum_711(pp->extlen);
rc = ENOENT;
@@ -217,7 +218,7 @@ cd9660_open(const char *path, struct ope
}
path += isonum_711(pp->namlen) + 1;
parent = ent;
- bno = isonum_732(pp->block) + isonum_711(pp->extlen);
+ bno = (daddr_t)isonum_732(pp->block) + isonum_711(pp->extlen);
while ((char *)pp < (char *)buf + psize) {
if (isonum_722(pp->parent) == parent)
break;
@@ -261,7 +262,7 @@ cd9660_open(const char *path, struct ope
dsize = isonum_733(dp->size);
if (dirmatch(path, dp))
break;
- psize += isonum_711(dp->length);
+ psize += (size_t)isonum_711(dp->length);
dp = (struct iso_directory_record *)
((char *)dp + isonum_711(dp->length));
}
@@ -335,15 +336,17 @@ cd9660_read(struct open_file *f, void *s
if (nread != ISO_DEFAULT_BLOCK_SIZE)
return EIO;
if (dp == buf) {
+ size_t nr;
off = fp->off & (ISO_DEFAULT_BLOCK_SIZE - 1);
if (nread > off + size)
nread = off + size;
nread -= off;
- if (nread > fp->size - fp->off)
- nread = fp->size - fp->off;
+ nr = (size_t)(fp->size - fp->off);
+ if (nread > nr)
+ nread = nr;
memcpy(start, buf + off, nread);
start = (char *)start + nread;
- fp->off += nread;
+ fp->off += (off_t)nread;
size -= nread;
} else {
start = (char *)start + ISO_DEFAULT_BLOCK_SIZE;
@@ -352,7 +355,7 @@ cd9660_read(struct open_file *f, void *s
}
}
if(fp->off > fp->size)
- size += fp->off - fp->size;
+ size += (size_t)(fp->off - fp->size);
if (resid)
*resid = size;
return rc;
Index: src/sys/lib/libsa/checkpasswd.c
diff -u src/sys/lib/libsa/checkpasswd.c:1.10 src/sys/lib/libsa/checkpasswd.c:1.11
--- src/sys/lib/libsa/checkpasswd.c:1.10 Mon Sep 5 17:11:11 2016
+++ src/sys/lib/libsa/checkpasswd.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: checkpasswd.c,v 1.10 2016/09/05 21:11:11 dholland Exp $ */
+/* $NetBSD: checkpasswd.c,v 1.11 2019/03/31 20:08:45 christos Exp $ */
/*-
* Copyright (c) 1993
@@ -85,7 +85,7 @@ getpass(const char *prompt)
break;
default:
if ((size_t)(lp - buf) < sizeof(buf) - 1) {
- *lp++ = c;
+ *lp++ = (char)c;
putchar('*');
}
break;
@@ -122,7 +122,7 @@ check_password(const char *password)
for (i = 0; i < 3; i++) {
passwd = getpass("Password: ");
MD5Init(&md5ctx);
- MD5Update(&md5ctx, passwd, strlen(passwd));
+ MD5Update(&md5ctx, passwd, (u_int)strlen(passwd));
MD5Final(pwdigest, &md5ctx);
if (memcmp(pwdigest, password, 16) == 0)
return 1;
Index: src/sys/lib/libsa/dev_net.c
diff -u src/sys/lib/libsa/dev_net.c:1.26 src/sys/lib/libsa/dev_net.c:1.27
--- src/sys/lib/libsa/dev_net.c:1.26 Sun Jul 17 16:54:52 2011
+++ src/sys/lib/libsa/dev_net.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dev_net.c,v 1.26 2011/07/17 20:54:52 joerg Exp $ */
+/* $NetBSD: dev_net.c,v 1.27 2019/03/31 20:08:45 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -157,7 +157,7 @@ net_close(struct open_file *f)
if (netdev_sock >= 0) {
#ifdef NETIF_DEBUG
if (debug)
- printf("net_close: calling netif_close()\n");
+ printf("%s: calling netif_close()\n", __func__);
#endif
netif_close(netdev_sock);
netdev_sock = -1;
@@ -249,7 +249,7 @@ net_getparams(int sock)
smask = 0;
gateip.s_addr = 0;
if (bp_getfile(sock, "gateway", &gateip, buf)) {
- printf("nfs_open: gateway bootparam missing\n");
+ printf("%s: gateway bootparam missing\n", __func__);
} else {
/* Got it! Parse the netmask. */
smask = inet_addr(buf);
Index: src/sys/lib/libsa/dosfs.c
diff -u src/sys/lib/libsa/dosfs.c:1.21 src/sys/lib/libsa/dosfs.c:1.22
--- src/sys/lib/libsa/dosfs.c:1.21 Fri Mar 11 13:38:25 2016
+++ src/sys/lib/libsa/dosfs.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dosfs.c,v 1.21 2016/03/11 18:38:25 christos Exp $ */
+/* $NetBSD: dosfs.c,v 1.22 2019/03/31 20:08:45 christos Exp $ */
/*
* Copyright (c) 1996, 1998 Robert Nordier
@@ -282,7 +282,8 @@ dosfs_read(struct open_file *fd, void *v
nb = (u_int) nbyte;
if ((size = fsize(f->fs, &f->de)) == -1)
return EINVAL;
- if (nb > (n = size - f->offset))
+ n = (u_int)(size - f->offset);
+ if (nb > n)
nb = n;
off = f->offset;
if ((clus = stclus(f->fs->fatsz, &f->de)))
@@ -432,7 +433,7 @@ parsebs(DOS_FS *fs, DOS_BS *bs)
if (!(fs->spc = bs->bpb.bpbSecPerClust) || fs->spc & (fs->spc - 1))
return EINVAL;
fs->bsize = secbyt(fs->spc);
- fs->bshift = ffs(fs->bsize) - 1;
+ fs->bshift = (u_int)ffs((int)fs->bsize) - 1;
if ((fs->spf = getushort(bs->bpb.bpbFATsecs))) {
if (bs->bpb.bpbFATs != 2)
return EINVAL;
@@ -483,7 +484,8 @@ namede(DOS_FS *fs, const char *path, con
while (*path) {
if (!(s = strchr(path, '/')))
s = strchr(path, 0);
- if ((n = s - path) > 255)
+ n = (size_t)(s - path);
+ if (n > 255)
return ENAMETOOLONG;
memcpy(name, path, n);
name[n] = 0;
@@ -571,7 +573,7 @@ lookup(DOS_FS *fs, u_int clus, const cha
for (x = 0, i = 0;
i < 11; i++)
x = ((((x & 1) << 7) | (x >> 1)) +
- msdos_dirchar(&dir[ent].de,i)) & 0xff;
+ (size_t)msdos_dirchar(&dir[ent].de,(size_t)i)) & 0xff;
ok = chk == x &&
!strcasecmp(name, (const char *)lfn);
}
@@ -629,7 +631,7 @@ cp_xdnm(u_char *lfn, struct winentry *xd
p += 2, x--) {
if ((c = getushort(p)) && (c < 32 || c > 127))
c = '?';
- if (!(*lfn++ = c))
+ if (!(*lfn++ = (u_char)c))
return;
}
if (xde->weCnt & WIN_LAST)
@@ -668,7 +670,7 @@ cp_sfn(u_char *sfn, struct direntry *de)
static off_t
fsize(DOS_FS *fs, struct direntry *de)
{
- u_long size;
+ size_t size;
u_int c;
int n;
@@ -679,10 +681,10 @@ fsize(DOS_FS *fs, struct direntry *de)
} else {
if ((n = fatcnt(fs, c)) == -1)
return n;
- size = blkbyt(fs, n);
+ size = (size_t)blkbyt(fs, n);
}
}
- return size;
+ return (off_t)size;
}
/*
Index: src/sys/lib/libsa/ether.c
diff -u src/sys/lib/libsa/ether.c:1.23 src/sys/lib/libsa/ether.c:1.24
--- src/sys/lib/libsa/ether.c:1.23 Sat Mar 29 10:30:16 2014
+++ src/sys/lib/libsa/ether.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ether.c,v 1.23 2014/03/29 14:30:16 jakllsch Exp $ */
+/* $NetBSD: ether.c,v 1.24 2019/03/31 20:08:45 christos Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@@ -65,7 +65,7 @@ sendether(struct iodesc *d, void *pkt, s
#ifdef ETHER_DEBUG
if (debug)
- printf("sendether: called\n");
+ printf("%s: called\n", __func__);
#endif
eh = (struct ether_header *)pkt - 1;
@@ -79,7 +79,7 @@ sendether(struct iodesc *d, void *pkt, s
if (n == -1 || (size_t)n < sizeof(*eh))
return -1;
- n -= sizeof(*eh);
+ n -= (ssize_t)sizeof(*eh);
return n;
}
@@ -97,7 +97,7 @@ readether(struct iodesc *d, void *pkt, s
#ifdef ETHER_DEBUG
if (debug)
- printf("readether: called\n");
+ printf("%s: called\n", __func__);
#endif
eh = (struct ether_header *)pkt - 1;
@@ -112,13 +112,13 @@ readether(struct iodesc *d, void *pkt, s
memcmp(bcea, eh->ether_dhost, ETHER_ADDR_LEN) != 0) {
#ifdef ETHER_DEBUG
if (debug)
- printf("readether: not ours (ea=%s)\n",
+ printf("%s: not ours (ea=%s)\n", __func__,
ether_sprintf(eh->ether_dhost));
#endif
return -1;
}
*etype = ntohs(eh->ether_type);
- n -= sizeof(*eh);
+ n -= (ssize_t)sizeof(*eh);
return n;
}
Index: src/sys/lib/libsa/ext2fs.c
diff -u src/sys/lib/libsa/ext2fs.c:1.25 src/sys/lib/libsa/ext2fs.c:1.26
--- src/sys/lib/libsa/ext2fs.c:1.25 Sun Aug 21 04:27:57 2016
+++ src/sys/lib/libsa/ext2fs.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs.c,v 1.25 2016/08/21 08:27:57 christos Exp $ */
+/* $NetBSD: ext2fs.c,v 1.26 2019/03/31 20:08:45 christos Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer.
@@ -182,7 +182,7 @@ read_inode(ino32_t inumber, struct open_
inode_sector, fs->e2fs_bsize, buf, &rsize);
if (rc)
return rc;
- if (rsize != fs->e2fs_bsize)
+ if (rsize != (size_t)fs->e2fs_bsize)
return EIO;
dip = (struct ext2fs_dinode *)(buf +
@@ -288,7 +288,7 @@ block_map(struct open_file *f, indp_t fi
buf, &rsize);
if (rc)
return rc;
- if (rsize != fs->e2fs_bsize)
+ if (rsize != (size_t)fs->e2fs_bsize)
return EIO;
ind_block_num = fs2h32(buf[file_block >> level]);
if (level == 0)
@@ -318,7 +318,7 @@ buf_read_file(struct open_file *f, char
long off;
indp_t file_block;
indp_t disk_block = 0; /* XXX: gcc */
- size_t block_size;
+ size_t block_size, tsz;
int rc;
off = ext2_blkoff(fs, fp->f_seekp);
@@ -357,8 +357,9 @@ buf_read_file(struct open_file *f, char
* But truncate buffer at end of file.
*/
/* XXX should handle LARGEFILE */
- if (*size_p > fp->f_di.e2di_size - fp->f_seekp)
- *size_p = fp->f_di.e2di_size - fp->f_seekp;
+ tsz = (size_t)(fp->f_di.e2di_size - fp->f_seekp);
+ if (*size_p > tsz)
+ *size_p = tsz;
return 0;
}
@@ -470,14 +471,14 @@ read_gdblock(struct open_file *f, struct
fs->e2fs_bsize, fp->f_buf, &rsize);
if (rc)
return rc;
- if (rsize != fs->e2fs_bsize)
+ if (rsize != (size_t)fs->e2fs_bsize)
return EIO;
e2fs_cgload((struct ext2_gd *)fp->f_buf,
&fs->e2fs_gd[i * gdpb],
(i == (fs->e2fs_ngdb - 1)) ?
(fs->e2fs_ncg - gdpb * i) * sizeof(struct ext2_gd):
- fs->e2fs_bsize);
+ (size_t)fs->e2fs_bsize);
}
return 0;
@@ -615,8 +616,8 @@ ext2fs_open(const char *path, struct ope
*/
if ((fp->f_di.e2di_mode & EXT2_IFMT) == EXT2_IFLNK) {
/* XXX should handle LARGEFILE */
- int link_len = fp->f_di.e2di_size;
- int len;
+ size_t link_len = fp->f_di.e2di_size;
+ size_t len;
len = strlen(cp);
@@ -991,7 +992,7 @@ dump_sblock(struct m_ext2fs *fs)
printf("fs->e2fs.e2fs_log_bsize = %u\n", fs->e2fs.e2fs_log_bsize);
printf("fs->e2fs.e2fs_bpg = %u\n", fs->e2fs.e2fs_bpg);
printf("fs->e2fs.e2fs_ipg = %u\n", fs->e2fs.e2fs_ipg);
- printf("fs->e2fs.e2fs_magic = 0x%x\n", fs->e2fs.e2fs_magic);
+ printf("fs->e2fs.e2fs_magic = %#x\n", fs->e2fs.e2fs_magic);
printf("fs->e2fs.e2fs_rev = %u\n", fs->e2fs.e2fs_rev);
if (fs->e2fs.e2fs_rev == E2FS_REV1) {
Index: src/sys/lib/libsa/netif.c
diff -u src/sys/lib/libsa/netif.c:1.25 src/sys/lib/libsa/netif.c:1.26
--- src/sys/lib/libsa/netif.c:1.25 Sun Oct 20 13:16:57 2013
+++ src/sys/lib/libsa/netif.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: netif.c,v 1.25 2013/10/20 17:16:57 christos Exp $ */
+/* $NetBSD: netif.c,v 1.26 2019/03/31 20:08:45 christos Exp $ */
/*
* Copyright (c) 1993 Adam Glass
@@ -65,7 +65,7 @@ netif_init(void)
#ifdef NETIF_DEBUG
if (netif_debug)
- printf("netif_init: called\n");
+ printf("%s: called\n", __func__);
#endif
for (d = 0; d < n_netif_drivers; d++) {
drv = netif_drivers[d];
@@ -83,8 +83,8 @@ netif_match(struct netif *nif, void *mac
#if 0
if (netif_debug)
- printf("%s%d: netif_match (%d)\n", drv->netif_bname,
- nif->nif_unit, nif->nif_sel);
+ printf("%s%d: %s (%d)\n", drv->netif_bname,
+ nif->nif_unit, __func__, nif->nif_sel);
#endif
return drv->netif_match(nif, machdep_hint);
}
@@ -104,7 +104,7 @@ netif_select(void *machdep_hint)
#ifdef NETIF_DEBUG
if (netif_debug)
- printf("netif_select: %d interfaces\n", n_netif_drivers);
+ printf("%s: %d interfaces\n", __func__, n_netif_drivers);
#endif
for (d = 0; d < n_netif_drivers; d++) {
@@ -156,7 +156,7 @@ netif_select(void *machdep_hint)
#ifdef NETIF_DEBUG
if (netif_debug)
- printf("netif_select: %s%d(%d) wins\n",
+ printf("%s: %s%d(%d) wins\n", __func__,
best_if.nif_driver->netif_bname,
best_if.nif_unit, best_if.nif_sel);
#endif
@@ -170,7 +170,7 @@ netif_probe(struct netif *nif, void *mac
#ifdef NETIF_DEBUG
if (netif_debug)
- printf("%s%d: netif_probe\n", drv->netif_bname, nif->nif_unit);
+ printf("%s%d: %s\n", drv->netif_bname, nif->nif_unit, __func__);
#endif
return drv->netif_probe(nif, machdep_hint);
}
@@ -182,7 +182,7 @@ netif_attach(struct netif *nif, struct i
#ifdef NETIF_DEBUG
if (netif_debug)
- printf("%s%d: netif_attach\n", drv->netif_bname, nif->nif_unit);
+ printf("%s%d: %s\n", drv->netif_bname, nif->nif_unit, __func__);
#endif
desc->io_netif = nif;
#ifdef PARANOID
@@ -202,7 +202,7 @@ netif_detach(struct netif *nif)
#ifdef NETIF_DEBUG
if (netif_debug)
- printf("%s%d: netif_detach\n", drv->netif_bname, nif->nif_unit);
+ printf("%s%d: %s\n", drv->netif_bname, nif->nif_unit, __func__);
#endif
#ifdef PARANOID
if (drv->netif_end == NULL)
@@ -221,18 +221,18 @@ netif_get(struct iodesc *desc, void *pkt
#ifdef NETIF_DEBUG
if (netif_debug)
- printf("%s%d: netif_get\n", drv->netif_bname, nif->nif_unit);
+ printf("%s%d: %s\n", drv->netif_bname, nif->nif_unit, __func__);
#endif
#ifdef PARANOID
if (drv->netif_get == NULL)
- panic("%s%d: no netif_get support", drv->netif_bname,
- nif->nif_unit);
+ panic("%s%d: no %s support", drv->netif_bname,
+ nif->nif_unit, __func__);
#endif
rv = drv->netif_get(desc, pkt, len, timo);
#ifdef NETIF_DEBUG
if (netif_debug)
- printf("%s%d: netif_get returning %d\n", drv->netif_bname,
- nif->nif_unit, (int)rv);
+ printf("%s%d: %s returning %zd\n", drv->netif_bname,
+ nif->nif_unit, __func__, rv);
#endif
return rv;
}
@@ -246,7 +246,7 @@ netif_put(struct iodesc *desc, void *pkt
#ifdef NETIF_DEBUG
if (netif_debug)
- printf("%s%d: netif_put\n", drv->netif_bname, nif->nif_unit);
+ printf("%s%d: %s\n", drv->netif_bname, nif->nif_unit, __func__);
#endif
#ifdef PARANOID
if (drv->netif_put == NULL)
@@ -256,8 +256,8 @@ netif_put(struct iodesc *desc, void *pkt
rv = drv->netif_put(desc, pkt, len);
#ifdef NETIF_DEBUG
if (netif_debug)
- printf("%s%d: netif_put returning %d\n", drv->netif_bname,
- nif->nif_unit, (int)rv);
+ printf("%s%d: %s returning %zd\n", drv->netif_bname,
+ nif->nif_unit, __func__, rv);
#endif
return rv;
}
@@ -295,7 +295,7 @@ fnd:
if (!nif)
panic("netboot: no interfaces left untried");
if (netif_probe(nif, machdep_hint)) {
- printf("netboot: couldn't probe %s%d\n",
+ printf("%s: couldn't probe %s%d\n", __func__,
nif->nif_driver->netif_bname, nif->nif_unit);
errno = EINVAL;
return -1;
Index: src/sys/lib/libsa/gets.c
diff -u src/sys/lib/libsa/gets.c:1.14 src/sys/lib/libsa/gets.c:1.15
--- src/sys/lib/libsa/gets.c:1.14 Sat Aug 27 02:31:42 2016
+++ src/sys/lib/libsa/gets.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: gets.c,v 1.14 2016/08/27 06:31:42 dholland Exp $ */
+/* $NetBSD: gets.c,v 1.15 2019/03/31 20:08:45 christos Exp $ */
/*-
* Copyright (c) 1993
@@ -48,7 +48,7 @@ kgets(char *buf, size_t size)
char *lp;
for (lp = buf;;) {
- if (lp - buf == size) {
+ if ((size_t)(lp - buf) == size) {
lp--;
*lp = '\0';
return;
Index: src/sys/lib/libsa/loadfile.c
diff -u src/sys/lib/libsa/loadfile.c:1.30 src/sys/lib/libsa/loadfile.c:1.31
--- src/sys/lib/libsa/loadfile.c:1.30 Tue May 20 12:04:08 2008
+++ src/sys/lib/libsa/loadfile.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile.c,v 1.30 2008/05/20 16:04:08 ad Exp $ */
+/* $NetBSD: loadfile.c,v 1.31 2019/03/31 20:08:45 christos Exp $ */
/*-
* Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -185,7 +185,7 @@ fdloadfile(int fd, u_long *marks, int fl
if (rval == 0) {
if ((flags & LOAD_ALL) != 0)
- PROGRESS(("=0x%lx\n",
+ PROGRESS(("=%#lx\n",
marks[MARK_END] - marks[MARK_START]));
return 0;
}
Index: src/sys/lib/libsa/minixfs3.c
diff -u src/sys/lib/libsa/minixfs3.c:1.7 src/sys/lib/libsa/minixfs3.c:1.8
--- src/sys/lib/libsa/minixfs3.c:1.7 Wed Mar 19 23:13:18 2014
+++ src/sys/lib/libsa/minixfs3.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: minixfs3.c,v 1.7 2014/03/20 03:13:18 christos Exp $ */
+/* $NetBSD: minixfs3.c,v 1.8 2019/03/31 20:08:45 christos Exp $ */
/*-
* Copyright (c) 2012
@@ -122,6 +122,7 @@
#ifdef _STANDALONE
#include <lib/libkern/libkern.h>
#else
+#include <stddef.h>
#include <string.h>
#endif
@@ -341,7 +342,7 @@ buf_read_file(struct open_file *f, void
long off;
block_t file_block;
block_t disk_block = 0; /* XXX: gcc */
- size_t block_size;
+ size_t block_size, nsz;
int rc;
off = mfs_blkoff(fs, fp->f_seekp);
@@ -379,8 +380,9 @@ buf_read_file(struct open_file *f, void
/*
* But truncate buffer at end of file.
*/
- if (*size_p > fp->f_di.mdi_size - fp->f_seekp)
- *size_p = fp->f_di.mdi_size - fp->f_seekp;
+ nsz = (size_t)(fp->f_di.mdi_size - fp->f_seekp);
+ if (*size_p > nsz)
+ *size_p = nsz;
return 0;
}
Index: src/sys/lib/libsa/net.c
diff -u src/sys/lib/libsa/net.c:1.35 src/sys/lib/libsa/net.c:1.36
--- src/sys/lib/libsa/net.c:1.35 Sat Apr 11 06:57:55 2009
+++ src/sys/lib/libsa/net.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: net.c,v 1.35 2009/04/11 10:57:55 lukem Exp $ */
+/* $NetBSD: net.c,v 1.36 2019/03/31 20:08:45 christos Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@@ -64,7 +64,6 @@
#include <unistd.h>
#define panic printf
#define delay() usleep(100000)
-#define getsecs() time(NULL)
#endif
#include "net.h"
@@ -93,7 +92,7 @@ sendrecv(struct iodesc *d,
#ifdef NET_DEBUG
if (debug)
- printf("sendrecv: called\n");
+ printf("%s: called\n", __func__);
#endif
tmo = MINTMO;
@@ -121,7 +120,7 @@ sendrecv(struct iodesc *d,
continue;
}
if ((size_t)cc < ssize)
- panic("sendrecv: short write! (%zd < %zu)",
+ panic("%s: short write! (%zd < %zu)", __func__,
cc, ssize);
tlast = t;
Index: src/sys/lib/libsa/tftp.c
diff -u src/sys/lib/libsa/tftp.c:1.35 src/sys/lib/libsa/tftp.c:1.36
--- src/sys/lib/libsa/tftp.c:1.35 Wed Mar 19 23:13:18 2014
+++ src/sys/lib/libsa/tftp.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: tftp.c,v 1.35 2014/03/20 03:13:18 christos Exp $ */
+/* $NetBSD: tftp.c,v 1.36 2019/03/31 20:08:45 christos Exp $ */
/*
* Copyright (c) 1996
@@ -309,8 +309,8 @@ tftp_read(struct open_file *f, void *add
res = tftp_getnextblock(tftpfile);
if (res) { /* no answer */
#ifdef DEBUG
- printf("tftp: read error (block %d->%d)\n",
- tftpfile->currblock, needblock);
+ printf("%s: read error (block %d->%d)\n",
+ __func__, tftpfile->currblock, needblock);
#endif
return res;
}
@@ -323,9 +323,9 @@ tftp_read(struct open_file *f, void *add
offinblock = tftpfile->off % SEGSIZE;
- if (offinblock > tftpfile->validsize) {
+ if ((int)offinblock > tftpfile->validsize) {
#ifdef DEBUG
- printf("tftp: invalid offset %d\n",
+ printf("%s: invalid offset %d\n", __func__,
tftpfile->off);
#endif
return EINVAL;
@@ -344,7 +344,8 @@ tftp_read(struct open_file *f, void *add
break; /* EOF */
} else {
#ifdef DEBUG
- printf("tftp: block %d not found\n", needblock);
+ printf("%s: block %d not found\n",
+ __func__, needblock);
#endif
return EINVAL;
}
@@ -402,15 +403,15 @@ tftp_size_of_file(struct tftp_handle *tf
res = tftp_getnextblock(tftpfile);
if (res) { /* no answer */
#ifdef DEBUG
- printf("tftp: read error (block %d)\n",
- tftpfile->currblock);
+ printf("%s: read error (block %d)\n",
+ __func__, tftpfile->currblock);
#endif
return -1;
}
filesize += tftpfile->validsize;
}
#ifdef DEBUG
- printf("tftp_size_of_file: file is %zu bytes\n", filesize);
+ printf("%s: file is %zu bytes\n", __func__, filesize);
#endif
return filesize;
}
Index: src/sys/lib/libsa/nfs.c
diff -u src/sys/lib/libsa/nfs.c:1.48 src/sys/lib/libsa/nfs.c:1.49
--- src/sys/lib/libsa/nfs.c:1.48 Wed Mar 19 23:13:18 2014
+++ src/sys/lib/libsa/nfs.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs.c,v 1.48 2014/03/20 03:13:18 christos Exp $ */
+/* $NetBSD: nfs.c,v 1.49 2019/03/31 20:08:45 christos Exp $ */
/*-
* Copyright (c) 1993 John Brezak
@@ -145,7 +145,7 @@ nfs_getrootfh(struct iodesc *d, char *pa
#ifdef NFS_DEBUG
if (debug)
- printf("nfs_getrootfh: %s\n", path);
+ printf("%s: %s\n", __func__, path);
#endif
args = &sdata.d;
@@ -208,7 +208,7 @@ nfs_lookupfh(struct nfs_iodesc *d, const
#ifdef NFS_DEBUG
if (debug)
- printf("lookupfh: called\n");
+ printf("%s: called\n", __func__);
#endif
args = &sdata.d;
@@ -259,7 +259,7 @@ nfs_readlink(struct nfs_iodesc *d, char
#ifdef NFS_DEBUG
if (debug)
- printf("readlink: called\n");
+ printf("%s: called\n", __func__);
#endif
(void)memcpy(sdata.fh, d->fh, NFS_FHSIZE);
@@ -335,7 +335,7 @@ nfs_readdata(struct nfs_iodesc *d, off_t
rlen = cc - hlen;
x = ntohl(repl->count);
if (rlen < (size_t)x) {
- printf("nfsread: short packet, %lu < %ld\n", (u_long) rlen, x);
+ printf("%s: short packet, %zu < %ld\n", __func__, rlen, x);
errno = EBADRPC;
return -1;
}
@@ -372,7 +372,7 @@ nfs_mount(int sock, struct in_addr ip, c
#ifdef NFS_DEBUG
if (debug)
- printf("nfs_mount: got fh for %s\n", path);
+ printf("%s: got fh for %s\n", __func__, path);
#endif
return 0;
@@ -398,10 +398,10 @@ nfs_open(const char *path, struct open_f
#ifdef NFS_DEBUG
if (debug)
- printf("nfs_open: %s\n", path);
+ printf("%s: %s\n", __func__, path);
#endif
if (nfs_root_node.iodesc == NULL) {
- printf("nfs_open: must mount first.\n");
+ printf("%s: must mount first.\n", __func__);
return ENXIO;
}
@@ -526,7 +526,7 @@ out:
#ifdef NFS_DEBUG
if (debug)
- printf("nfs_open: %s lookupfh failed: %s\n",
+ printf("%s: %s lookupfh failed: %s\n", __func__,
path, strerror(error));
#endif
if (currfd != &nfs_root_node)
@@ -544,7 +544,7 @@ nfs_close(struct open_file *f)
#ifdef NFS_DEBUG
if (debug)
- printf("nfs_close: fp=0x%lx\n", (u_long)fp);
+ printf("%s: fp=%p\n", __func__, fp);
#endif
if (fp)
@@ -566,8 +566,7 @@ nfs_read(struct open_file *f, void *buf,
#ifdef NFS_DEBUG
if (debug)
- printf("nfs_read: size=%lu off=%d\n", (u_long)size,
- (int)fp->off);
+ printf("%s: size=%zu off=%td\n", __func__, size, fp->off);
#endif
while ((int)size > 0) {
#if !defined(LIBSA_NO_TWIDDLE)
@@ -578,15 +577,15 @@ nfs_read(struct open_file *f, void *buf,
if (cc == -1) {
#ifdef NFS_DEBUG
if (debug)
- printf("nfs_read: read: %s\n",
- strerror(errno));
+ printf("%s: read: %s\n", __func__,
+ strerror(errno));
#endif
return errno; /* XXX - from nfs_readdata */
}
if (cc == 0) {
#ifdef NFS_DEBUG
if (debug)
- printf("nfs_read: hit EOF unexpectantly\n");
+ printf("%s: hit EOF unexpectedly\n", __func__);
#endif
goto ret;
}
Index: src/sys/lib/libsa/qsort.c
diff -u src/sys/lib/libsa/qsort.c:1.4 src/sys/lib/libsa/qsort.c:1.5
--- src/sys/lib/libsa/qsort.c:1.4 Sat Nov 24 08:20:56 2007
+++ src/sys/lib/libsa/qsort.c Sun Mar 31 16:08:45 2019
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/libkern/qsort.c,v 1.12 2002/11/09 12:55:06 alfred Exp $
- * $NetBSD: qsort.c,v 1.4 2007/11/24 13:20:56 isaki Exp $
+ * $NetBSD: qsort.c,v 1.5 2019/03/31 20:08:45 christos Exp $
*/
#include <sys/cdefs.h>
@@ -41,7 +41,7 @@ typedef int cmp_t(const void *, const
static inline char *med3(char *, char *, char *, cmp_t *);
static inline void swapfunc(char *, char *, int, int);
-#define min(a, b) (a) < (b) ? (a) : (b)
+#define min(a, b) (int)(a) < (int)(b) ? (int)(a) : (int)(b)
void qsort(void *a, size_t n, size_t es, cmp_t *cmp);
@@ -158,9 +158,9 @@ loop:
vecswap(a, pb - r, r);
r = min(pd - pc, pn - pd - es);
vecswap(pb, pn - r, r);
- if ((r = pb - pa) > es)
+ if ((size_t)(r = pb - pa) > es)
qsort(a, r / es, es, cmp);
- if ((r = pd - pc) > es) {
+ if ((size_t)(r = pd - pc) > es) {
/* Iterate rather than recurse to save stack space */
a = pn - r;
n = r / es;
Index: src/sys/lib/libsa/rarp.c
diff -u src/sys/lib/libsa/rarp.c:1.32 src/sys/lib/libsa/rarp.c:1.33
--- src/sys/lib/libsa/rarp.c:1.32 Sat Mar 29 10:30:16 2014
+++ src/sys/lib/libsa/rarp.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rarp.c,v 1.32 2014/03/29 14:30:16 jakllsch Exp $ */
+/* $NetBSD: rarp.c,v 1.33 2019/03/31 20:08:45 christos Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@@ -104,15 +104,15 @@ rarp_getipaddress(int sock)
#ifdef RARP_DEBUG
if (debug)
- printf("rarp: socket=%d\n", sock);
+ printf("%s: socket=%d\n", __func__, sock);
#endif
if (!(d = socktodesc(sock))) {
- printf("rarp: bad socket. %d\n", sock);
+ printf("%s: bad socket. %d\n", __func__, sock);
return -1;
}
#ifdef RARP_DEBUG
if (debug)
- printf("rarp: d=%lx\n", (u_long)d);
+ printf("%s: d=%p\n", __func__, d);
#endif
(void)memset(&wbuf.data, 0, sizeof(wbuf.data));
@@ -161,7 +161,7 @@ rarpsend(struct iodesc *d, void *pkt, si
#ifdef RARP_DEBUG
if (debug)
- printf("rarpsend: called\n");
+ printf("%s: called\n", __func__);
#endif
return sendether(d, pkt, len, bcea, ETHERTYPE_REVARP);
@@ -180,7 +180,7 @@ rarprecv(struct iodesc *d, void *pkt, si
#ifdef RARP_DEBUG
if (debug)
- printf("rarprecv: ");
+ printf("%s: ", __func__);
#endif
n = readether(d, pkt, len, tleft, &etype);
@@ -196,7 +196,7 @@ rarprecv(struct iodesc *d, void *pkt, si
if (etype != ETHERTYPE_REVARP) {
#ifdef RARP_DEBUG
if (debug)
- printf("bad type=0x%x\n", etype);
+ printf("bad type=%#x\n", etype);
#endif
return -1;
}
@@ -217,7 +217,7 @@ rarprecv(struct iodesc *d, void *pkt, si
if (ap->arp_op != htons(ARPOP_REVREPLY)) {
#ifdef RARP_DEBUG
if (debug)
- printf("bad op=0x%x\n", ntohs(ap->arp_op));
+ printf("bad op=%#x\n", ntohs(ap->arp_op));
#endif
return -1;
}
Index: src/sys/lib/libsa/rpc.c
diff -u src/sys/lib/libsa/rpc.c:1.29 src/sys/lib/libsa/rpc.c:1.30
--- src/sys/lib/libsa/rpc.c:1.29 Sat Jan 17 09:00:36 2009
+++ src/sys/lib/libsa/rpc.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rpc.c,v 1.29 2009/01/17 14:00:36 tsutsui Exp $ */
+/* $NetBSD: rpc.c,v 1.30 2019/03/31 20:08:45 christos Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@@ -127,7 +127,7 @@ rpc_call(struct iodesc *d, n_long prog,
#ifdef RPC_DEBUG
if (debug)
- printf("rpc_call: prog=0x%x vers=%d proc=%d\n",
+ printf("%s: prog=%#x vers=%d proc=%d\n", __func__,
prog, vers, proc);
#endif
@@ -188,7 +188,7 @@ rpc_call(struct iodesc *d, n_long prog,
#ifdef RPC_DEBUG
if (debug)
- printf("callrpc: cc=%ld rlen=%lu\n", (long)cc, (u_long)rlen);
+ printf("%s: cc=%zd rlen=%zu\n", __func__, cc, rlen);
#endif
if (cc == -1)
return -1;
@@ -210,14 +210,14 @@ rpc_call(struct iodesc *d, n_long prog,
if (x != 0) {
#ifdef RPC_DEBUG
if (debug)
- printf("callrpc: reply auth != NULL\n");
+ printf("%s: reply auth != NULL\n", __func__);
#endif
errno = EBADRPC;
return -1;
}
x = ntohl(reply->rp_u.rpu_rok.rok_status);
if (x != 0) {
- printf("callrpc: error = %d\n", x);
+ printf("%s: error = %d\n", __func__, x);
errno = EBADRPC;
return -1;
}
@@ -241,7 +241,7 @@ recvrpc(struct iodesc *d, void *pkt, siz
errno = 0;
#ifdef RPC_DEBUG
if (debug)
- printf("recvrpc: called len=%lu\n", (u_long)len);
+ printf("%s: called len=%zu\n", __func__, len);
#endif
n = readudp(d, pkt, len, tleft);
@@ -254,7 +254,8 @@ recvrpc(struct iodesc *d, void *pkt, siz
if (x != rpc_xid) {
#ifdef RPC_DEBUG
if (debug)
- printf("recvrpc: rp_xid %d != xid %d\n", x, rpc_xid);
+ printf("%s: rp_xid %d != xid %d\n",
+ __func__, x, rpc_xid);
#endif
return -1;
}
@@ -263,7 +264,7 @@ recvrpc(struct iodesc *d, void *pkt, siz
if (x != RPC_REPLY) {
#ifdef RPC_DEBUG
if (debug)
- printf("recvrpc: rp_direction %d != REPLY\n", x);
+ printf("%s: rp_direction %d != REPLY\n", __func__, x);
#endif
return -1;
}
@@ -271,7 +272,7 @@ recvrpc(struct iodesc *d, void *pkt, siz
x = ntohl(reply->rp_astatus);
if (x != RPC_MSGACCEPTED) {
errno = ntohl(reply->rp_u.rpu_errno);
- printf("recvrpc: reject, astat=%d, errno=%d\n", x, errno);
+ printf("%s: reject, astat=%d, errno=%d\n", __func__, x, errno);
return -1;
}
@@ -361,7 +362,7 @@ rpc_pmap_putcache(struct in_addr addr, u
/* ... just re-use the last entry. */
rpc_pmap_num = PMAP_NUM - 1;
#ifdef RPC_DEBUG
- printf("rpc_pmap_putcache: cache overflow\n");
+ printf("%s: cache overflow\n", __func__);
#endif
}
@@ -407,7 +408,7 @@ rpc_getport(struct iodesc *d, n_long pro
#ifdef RPC_DEBUG
if (debug)
- printf("getport: prog=0x%x vers=%d\n", prog, vers);
+ printf("%s: prog=%#x vers=%d\n", __func__, prog, vers);
#endif
/* This one is fixed forever. */
@@ -429,7 +430,7 @@ rpc_getport(struct iodesc *d, n_long pro
cc = rpc_call(d, PMAPPROG, PMAPVERS, PMAPPROC_GETPORT,
args, sizeof(*args), res, sizeof(*res));
if ((size_t)cc < sizeof(*res)) {
- printf("getport: %s", strerror(errno));
+ printf("%s: %s", __func__, strerror(errno));
errno = EBADRPC;
return -1;
}
Index: src/sys/lib/libsa/udp.c
diff -u src/sys/lib/libsa/udp.c:1.12 src/sys/lib/libsa/udp.c:1.13
--- src/sys/lib/libsa/udp.c:1.12 Sun Mar 31 12:14:48 2019
+++ src/sys/lib/libsa/udp.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: udp.c,v 1.12 2019/03/31 16:14:48 mlelstv Exp $ */
+/* $NetBSD: udp.c,v 1.13 2019/03/31 20:08:45 christos Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@@ -71,7 +71,7 @@ sendudp(struct iodesc *d, void *pkt, siz
#ifdef NET_DEBUG
if (debug) {
- printf("sendudp: d=%lx called.\n", (long)d);
+ printf("%s: d=%p called.\n", __func__, d);
if (d) {
printf("saddr: %s:%d",
inet_ntoa(d->myip), ntohs(d->myport));
@@ -94,7 +94,7 @@ sendudp(struct iodesc *d, void *pkt, siz
if (cc == -1)
return -1;
if ((size_t)cc != len)
- panic("sendudp: bad write (%zd != %zu)", cc, len);
+ panic("%s: bad write (%zd != %zu)", __func__, cc, len);
return (cc - sizeof(*uh));
}
@@ -116,8 +116,8 @@ readudp(struct iodesc *d, void *pkt, siz
if (uh->uh_dport != d->myport) {
#ifdef NET_DEBUG
if (debug)
- printf("readudp: bad dport %d != %d\n",
- ntohs(d->myport), ntohs(uh->uh_dport));
+ printf("%s: bad dport %d != %d\n", __func__,
+ ntohs(d->myport), ntohs(uh->uh_dport));
#endif
return -1;
}
@@ -125,8 +125,8 @@ readudp(struct iodesc *d, void *pkt, siz
if (ntohs(uh->uh_ulen) < sizeof(*uh)) {
#ifdef NET_DEBUG
if (debug)
- printf("readudp: bad udp len %d < %d\n",
- ntohs(uh->uh_ulen), (int)sizeof(*uh));
+ printf("%s: bad udp len %d < %zu\n", __func__,
+ ntohs(uh->uh_ulen), sizeof(*uh));
#endif
return -1;
}
Index: src/sys/lib/libsa/ufs.c
diff -u src/sys/lib/libsa/ufs.c:1.74 src/sys/lib/libsa/ufs.c:1.75
--- src/sys/lib/libsa/ufs.c:1.74 Tue Sep 1 02:16:58 2015
+++ src/sys/lib/libsa/ufs.c Sun Mar 31 16:08:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs.c,v 1.74 2015/09/01 06:16:58 dholland Exp $ */
+/* $NetBSD: ufs.c,v 1.75 2019/03/31 20:08:45 christos Exp $ */
/*-
* Copyright (c) 1993
@@ -279,7 +279,7 @@ read_inode(ino32_t inumber, struct open_
inode_sector, fs->fs_bsize, buf, &rsize);
if (rc)
return rc;
- if (rsize != fs->fs_bsize)
+ if (rsize != (size_t)fs->fs_bsize)
return EIO;
#ifdef LIBSA_LFS
@@ -387,7 +387,7 @@ block_map(struct open_file *f, indp_t fi
buf, &rsize);
if (rc)
return rc;
- if (rsize != fs->fs_bsize)
+ if (rsize != (size_t)fs->fs_bsize)
return EIO;
ind_block_num = buf[file_block >> level];
if (level == 0)
@@ -422,9 +422,9 @@ buf_read_file(struct open_file *f, char
off = ufs_blkoff(fs, fp->f_seekp);
file_block = ufs_lblkno(fs, fp->f_seekp);
#ifdef LIBSA_LFS
- block_size = dblksize(fs, &fp->f_di, file_block);
+ block_size = (size_t)dblksize(fs, &fp->f_di, file_block);
#else
- block_size = ffs_sblksize(fs, (int64_t)fp->f_di.di_size, file_block);
+ block_size = (size_t)ffs_sblksize(fs, (int64_t)fp->f_di.di_size, file_block);
#endif
if (file_block != fp->f_buf_blkno) {