CVS commit: src/sys/arch/sparc

2016-04-01 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Fri Apr  1 20:21:45 UTC 2016

Modified Files:
src/sys/arch/sparc/include: openfirm.h
src/sys/arch/sparc/sparc: openfirm.c promlib.c

Log Message:
sun4v: Workaround for OpenBoot feature where a 64-bit address is truncated to a 
32-bit address. This happends when a write to the console 
(/virtual-devices@100/console@1) is done. Avoid this by using a static buffer 
that is mapped below 4GB. Thanks to Tarl Neustaedter for explaining how 
OpenBoot works. ok martin@


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc/include/openfirm.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/sparc/sparc/openfirm.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/sparc/sparc/promlib.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/arch/sparc/include/openfirm.h
diff -u src/sys/arch/sparc/include/openfirm.h:1.9 src/sys/arch/sparc/include/openfirm.h:1.10
--- src/sys/arch/sparc/include/openfirm.h:1.9	Tue Oct  6 20:03:05 2015
+++ src/sys/arch/sparc/include/openfirm.h	Fri Apr  1 20:21:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.h,v 1.9 2015/10/06 20:03:05 martin Exp $	*/
+/*	$NetBSD: openfirm.h,v 1.10 2016/04/01 20:21:45 palle Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -61,6 +61,7 @@ typedef uint32_t cell_t;
 #define HDQ2CELL_LO(x)	(cell_t)(x)
 #endif /* __sparc_v9__ */
 
+void	OF_init(void);
 int	OF_test(const char *);
 int	OF_test_method(int, const char *);
 void	OF_set_symbol_lookup(void (*)(void *), void (*)(void *));

Index: src/sys/arch/sparc/sparc/openfirm.c
diff -u src/sys/arch/sparc/sparc/openfirm.c:1.20 src/sys/arch/sparc/sparc/openfirm.c:1.21
--- src/sys/arch/sparc/sparc/openfirm.c:1.20	Fri Mar 27 06:10:25 2015
+++ src/sys/arch/sparc/sparc/openfirm.c	Fri Apr  1 20:21:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.c,v 1.20 2015/03/27 06:10:25 nakayama Exp $	*/
+/*	$NetBSD: openfirm.c,v 1.21 2016/04/01 20:21:45 palle Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.20 2015/03/27 06:10:25 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.21 2016/04/01 20:21:45 palle Exp $");
 
 #include 
 #include 
@@ -44,6 +44,34 @@ __KERNEL_RCSID(0, "$NetBSD: openfirm.c,v
 #include 
 #endif
 
+#ifdef SUN4V
+#ifdef __arch64__
+#define OFBOUNCE_MAXSIZE 1024
+/* 
+ * Sun4v OpenBoot is not always happy with 64-bit addresses - an example is the
+ * addr parameter in the OF_write() call which can be truncated to a 32-bit
+ * value.
+ * Avoid this behaviour by using a static buffer which is assumed to be mapped
+ * in on a 32-bit address.
+ * Use a mutex to protect access to the buffer from multiple threads.
+ * 
+ */
+kmutex_t ofcall_mtx;
+static char ofbounce[OFBOUNCE_MAXSIZE];
+#endif
+#endif
+
+void
+OF_init(void)
+{
+#ifdef SUN4V
+#ifdef __arch64__
+  KASSERT(((uint64_t) & 0xUL)==(uint64_t));
+  mutex_init(_mtx, MUTEX_DEFAULT, IPL_NONE);
+#endif	
+#endif
+}
+
 int
 OF_peer(int phandle)
 {
@@ -512,6 +540,15 @@ OF_write(int handle, const void *addr, i
 	if (len > 1024) {
 		panic("OF_write(len = %d)\n", len);
 	}
+#ifdef SUN4V
+#if __arch64__
+	mutex_enter(_mtx);
+	if (len > OFBOUNCE_MAXSIZE) 
+		panic("OF_write(len = %d) exceedes bounce buffer\n", len);
+	memcpy(ofbounce, addr, len);
+	addr = ofbounce;
+#endif	
+#endif
 	args.name = ADR2CELL("write");
 	args.nargs = 3;
 	args.nreturns = 1;
@@ -525,6 +562,11 @@ OF_write(int handle, const void *addr, i
 		l = args.actual;
 		act += l;
 	}
+#ifdef SUN4V
+#if __arch64__
+	mutex_exit(_mtx);
+#endif
+#endif
 	return act;
 }
 

Index: src/sys/arch/sparc/sparc/promlib.c
diff -u src/sys/arch/sparc/sparc/promlib.c:1.44 src/sys/arch/sparc/sparc/promlib.c:1.45
--- src/sys/arch/sparc/sparc/promlib.c:1.44	Wed Mar 26 15:55:43 2014
+++ src/sys/arch/sparc/sparc/promlib.c	Fri Apr  1 20:21:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: promlib.c,v 1.44 2014/03/26 15:55:43 christos Exp $ */
+/*	$NetBSD: promlib.c,v 1.45 2016/04/01 20:21:45 palle Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: promlib.c,v 1.44 2014/03/26 15:55:43 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: promlib.c,v 1.45 2016/04/01 20:21:45 palle Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_sparc_arch.h"
@@ -1276,6 +1276,8 @@ prom_init_opf(void)
 	node = findchosen();
 	OF_getprop(node, "stdin", _stdin, sizeof(int));
 	OF_getprop(node, "stdout", _stdout, sizeof(int));
+
+	OF_init();
 }
 
 /*



CVS commit: src/lib/libterminfo

2016-04-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  1 19:59:08 UTC 2016

Modified Files:
src/lib/libterminfo: curterm.c termcap.c

Log Message:
- if we are freeing cur_term, set it to NULL.
- preserve and free "last" properly.

$ cat foo.c
#include 
#include 

int
main(void)
{
tgetent(NULL, "dumb");
tgetent(NULL, "network");
tgetflag("so");
return 0;
}
$ cc foo.c -lterminfo
$ MALLOC_OPTIONS=J ./a.out
Boom.

XXX: pullup-7


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libterminfo/curterm.c
cvs rdiff -u -r1.18 -r1.19 src/lib/libterminfo/termcap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libterminfo/curterm.c
diff -u src/lib/libterminfo/curterm.c:1.11 src/lib/libterminfo/curterm.c:1.12
--- src/lib/libterminfo/curterm.c:1.11	Wed Nov 25 13:38:21 2015
+++ src/lib/libterminfo/curterm.c	Fri Apr  1 15:59:08 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: curterm.c,v 1.11 2015/11/25 18:38:21 christos Exp $ */
+/* $NetBSD: curterm.c,v 1.12 2016/04/01 19:59:08 christos Exp $ */
 
 /*
  * Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: curterm.c,v 1.11 2015/11/25 18:38:21 christos Exp $");
+__RCSID("$NetBSD: curterm.c,v 1.12 2016/04/01 19:59:08 christos Exp $");
 
 #include 
 #include 
@@ -141,6 +141,8 @@ del_curterm(TERMINAL *oterm)
 	free(oterm->_userdefs);
 	free(oterm->_buf);
 	free(oterm);
+	if (oterm == cur_term)
+		cur_term = NULL;
 	return OK;
 }
 

Index: src/lib/libterminfo/termcap.c
diff -u src/lib/libterminfo/termcap.c:1.18 src/lib/libterminfo/termcap.c:1.19
--- src/lib/libterminfo/termcap.c:1.18	Wed Nov 25 13:46:24 2015
+++ src/lib/libterminfo/termcap.c	Fri Apr  1 15:59:08 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: termcap.c,v 1.18 2015/11/25 18:46:24 christos Exp $ */
+/* $NetBSD: termcap.c,v 1.19 2016/04/01 19:59:08 christos Exp $ */
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: termcap.c,v 1.18 2015/11/25 18:46:24 christos Exp $");
+__RCSID("$NetBSD: termcap.c,v 1.19 2016/04/01 19:59:08 christos Exp $");
 
 #include 
 #include 
@@ -57,14 +57,17 @@ tgetent(__unused char *bp, const char *n
 	_DIAGASSERT(name != NULL);
 
 	/* Free the old term */
-	if (last != NULL) {
-		del_curterm(last);
-		last = NULL;
+	if (cur_term != NULL) {
+		if (last != NULL && cur_term != last)
+			del_curterm(last);
+		last = cur_term;
 	}
 	errret = -1;
 	if (setupterm(name, STDOUT_FILENO, ) != 0)
 		return errret;
-	last = cur_term;
+
+	if (last == NULL)
+		last = cur_term;
 
 	if (pad_char != NULL)
 		PC = pad_char[0];



CVS commit: [nick-nhusb] src/sys/dev/usb

2016-04-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Apr  1 15:13:45 UTC 2016

Modified Files:
src/sys/dev/usb [nick-nhusb]: ohci.c

Log Message:
Revert previous as it needs some work.


To generate a diff of this commit:
cvs rdiff -u -r1.254.2.68 -r1.254.2.69 src/sys/dev/usb/ohci.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/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.254.2.68 src/sys/dev/usb/ohci.c:1.254.2.69
--- src/sys/dev/usb/ohci.c:1.254.2.68	Fri Apr  1 14:20:05 2016
+++ src/sys/dev/usb/ohci.c	Fri Apr  1 15:13:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.254.2.68 2016/04/01 14:20:05 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.254.2.69 2016/04/01 15:13:45 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.68 2016/04/01 14:20:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.69 2016/04/01 15:13:45 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -546,12 +546,8 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s
 
 	DPRINTFN(8, "xfer %p nstd %d mps %d", xfer, nstd, mps, 0);
 
-	/*
-	 * Assign next for the len == 0 case where we don't go through the
-	 * main loop.
-	 */
 	len = alen;
-	cur = next = ohci_alloc_std(sc);
+	cur = ohci_alloc_std(sc);
 	if (cur == NULL)
 		goto nomem;
 
@@ -561,24 +557,16 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s
 	(rd ? OHCI_TD_IN : OHCI_TD_OUT) |
 	OHCI_TD_NOCC | OHCI_TD_TOGGLE_CARRY | OHCI_TD_NOINTR);
 
-	size_t curoffs = 0;
-	size_t j = 0;
-	for (; j < ox->ox_nstd && len != 0;) {
+	for (size_t j = 0;;) {
 		ox->ox_stds[j++] = cur;
 		next = ohci_alloc_std(sc);
 		if (next == NULL)
 			goto nomem;
-		curlen = 0;
-		dataphys = DMAADDR(dma, curoffs);
-		dataphysend = DMAADDR(dma, curoffs + len - 1);
 
-		ohci_physaddr_t sphyspg = OHCI_PAGE(dataphys);
-		ohci_physaddr_t ephyspg = OHCI_PAGE(dataphysend);
-		/*
-		 * The OHCI hardware can handle at most one page
-		 * crossing per TD
-		 */
-		if (sphyspg == ephyspg || sphyspg + 1 == ephyspg) {
+		/* The OHCI hardware can handle at most one page crossing. */
+		if (OHCI_PAGE(dataphys) == dataphysend ||
+		OHCI_PAGE(dataphys) + OHCI_PAGE_SIZE == dataphysend) {
+			/* we can handle it in this TD */
 			curlen = len;
 		} else {
 			/* must use multiple TDs, fill as much as possible. */
@@ -586,8 +574,8 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s
 			(dataphys & (OHCI_PAGE_SIZE - 1));
 			/* the length must be a multiple of the max size */
 			curlen -= curlen % mps;
+			KASSERT(curlen != 0);
 		}
-		KASSERT(curlen != 0);
 		DPRINTFN(4, "dataphys=0x%08x dataphysend=0x%08x "
 		"len=%d curlen=%d", dataphys, dataphysend, len, curlen);
 		len -= curlen;
@@ -603,37 +591,31 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s
 
 		DPRINTFN(10, "cbp=0x%08x be=0x%08x", dataphys,
 		dataphys + curlen - 1, 0, 0);
-
-		curoffs += curlen;
-		len -= curlen;
-
-		if (len != 0)
-			cur = next;
-
+		if (len == 0)
+			break;
 		DPRINTFN(10, "extend chain", 0, 0, 0, 0);
+		dataphys += curlen;
+		cur = next;
 	}
-
-	/* Allocate a TD for a 0 length transfer at the end. */
-	if (!rd && (flags & USBD_FORCE_SHORT_XFER)) {
+	if (!rd && (flags & USBD_FORCE_SHORT_XFER) &&
+	alen % mps == 0) {
 		/* Force a 0 length transfer at the end. */
 
-		KASSERT(j < ox->ox_nstd);
-		KASSERT(next != NULL);
 		cur = next;
-		ox->ox_stds[j++] = cur;
+		next = ohci_alloc_std(sc);
+		if (next == NULL)
+			goto nomem;
 
 		cur->td.td_flags = tdflags;
 		cur->td.td_cbp = 0; /* indicate 0 length packet */
-		cur->td.td_nexttd = 0;
+		cur->td.td_nexttd = HTOO32(next->physaddr);
 		cur->td.td_be = ~0;
-		cur->nexttd = NULL;
+		cur->nexttd = next;
 		cur->len = 0;
 		cur->flags = 0;
 		cur->xfer = xfer;
 
 		DPRINTFN(2, "add 0 xfer", 0, 0, 0, 0);
-	} else {
-		ohci_free_std(sc, next);
 	}
 
 	return USBD_NORMAL_COMPLETION;
@@ -685,38 +667,28 @@ ohci_reset_std_chain(ohci_softc_t *sc, s
 
 	int mps = UGETW(xfer->ux_pipe->up_endpoint->ue_edesc->wMaxPacketSize);
 
-	/*
-	 * Assign next for the len == 0 case where we don't go through the
-	 * main loop.
-	 */
 	len = alen;
-	cur = next = sp;
+	cur = sp;
 
+	dataphys = DMAADDR(dma, 0);
+	dataphysend = OHCI_PAGE(dataphys + len - 1);
 	usb_syncmem(dma, 0, len,
 	rd ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
 	const uint32_t tdflags = HTOO32(
 	(rd ? OHCI_TD_IN : OHCI_TD_OUT) |
 	OHCI_TD_NOCC | OHCI_TD_TOGGLE_CARRY | OHCI_TD_NOINTR);
 
-	size_t curoffs = 0;
-	for (size_t j = 1; len != 0;) {
+	for (size_t j = 1;;) {
 		if (j == ox->ox_nstd)
 			next = NULL;
 		else
 			next = ox->ox_stds[j++];
 		KASSERT(next != cur);
 
-		curlen = 0;
-		dataphys = DMAADDR(dma, curoffs);
-		dataphysend = DMAADDR(dma, curoffs + len - 1);
-
-		ohci_physaddr_t sphyspg = OHCI_PAGE(dataphys);
-		ohci_physaddr_t ephyspg = OHCI_PAGE(dataphysend);
-		/*
-		 * The OHCI hardware can 

CVS commit: [nick-nhusb] src/sys/dev/usb

2016-04-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Apr  1 14:17:24 UTC 2016

Modified Files:
src/sys/dev/usb [nick-nhusb]: ohci.c

Log Message:
Damn it... whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.254.2.66 -r1.254.2.67 src/sys/dev/usb/ohci.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/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.254.2.66 src/sys/dev/usb/ohci.c:1.254.2.67
--- src/sys/dev/usb/ohci.c:1.254.2.66	Fri Apr  1 14:13:29 2016
+++ src/sys/dev/usb/ohci.c	Fri Apr  1 14:17:24 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.254.2.66 2016/04/01 14:13:29 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.254.2.67 2016/04/01 14:17:24 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.66 2016/04/01 14:13:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.67 2016/04/01 14:17:24 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -699,7 +699,7 @@ ohci_reset_std_chain(ohci_softc_t *sc, s
 			KASSERT(curlen != 0);
 		}
 		DPRINTFN(4, "dataphys=0x%08x dataphysend=0x%08x "
-		"len=%d curlen=%d",  dataphys, dataphysend, len, curlen);
+		"len=%d curlen=%d", dataphys, dataphysend, len, curlen);
 		len -= curlen;
 
 		cur->td.td_flags = tdflags;



CVS commit: [nick-nhusb] src/sys/dev/usb

2016-04-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Apr  1 14:20:06 UTC 2016

Modified Files:
src/sys/dev/usb [nick-nhusb]: ohci.c

Log Message:
Deal with ZLP (zero length packets) properly


To generate a diff of this commit:
cvs rdiff -u -r1.254.2.67 -r1.254.2.68 src/sys/dev/usb/ohci.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/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.254.2.67 src/sys/dev/usb/ohci.c:1.254.2.68
--- src/sys/dev/usb/ohci.c:1.254.2.67	Fri Apr  1 14:17:24 2016
+++ src/sys/dev/usb/ohci.c	Fri Apr  1 14:20:05 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.254.2.67 2016/04/01 14:17:24 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.254.2.68 2016/04/01 14:20:05 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.67 2016/04/01 14:17:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.68 2016/04/01 14:20:05 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -546,8 +546,12 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s
 
 	DPRINTFN(8, "xfer %p nstd %d mps %d", xfer, nstd, mps, 0);
 
+	/*
+	 * Assign next for the len == 0 case where we don't go through the
+	 * main loop.
+	 */
 	len = alen;
-	cur = ohci_alloc_std(sc);
+	cur = next = ohci_alloc_std(sc);
 	if (cur == NULL)
 		goto nomem;
 
@@ -557,16 +561,24 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s
 	(rd ? OHCI_TD_IN : OHCI_TD_OUT) |
 	OHCI_TD_NOCC | OHCI_TD_TOGGLE_CARRY | OHCI_TD_NOINTR);
 
-	for (size_t j = 0;;) {
+	size_t curoffs = 0;
+	size_t j = 0;
+	for (; j < ox->ox_nstd && len != 0;) {
 		ox->ox_stds[j++] = cur;
 		next = ohci_alloc_std(sc);
 		if (next == NULL)
 			goto nomem;
+		curlen = 0;
+		dataphys = DMAADDR(dma, curoffs);
+		dataphysend = DMAADDR(dma, curoffs + len - 1);
 
-		/* The OHCI hardware can handle at most one page crossing. */
-		if (OHCI_PAGE(dataphys) == dataphysend ||
-		OHCI_PAGE(dataphys) + OHCI_PAGE_SIZE == dataphysend) {
-			/* we can handle it in this TD */
+		ohci_physaddr_t sphyspg = OHCI_PAGE(dataphys);
+		ohci_physaddr_t ephyspg = OHCI_PAGE(dataphysend);
+		/*
+		 * The OHCI hardware can handle at most one page
+		 * crossing per TD
+		 */
+		if (sphyspg == ephyspg || sphyspg + 1 == ephyspg) {
 			curlen = len;
 		} else {
 			/* must use multiple TDs, fill as much as possible. */
@@ -574,8 +586,8 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s
 			(dataphys & (OHCI_PAGE_SIZE - 1));
 			/* the length must be a multiple of the max size */
 			curlen -= curlen % mps;
-			KASSERT(curlen != 0);
 		}
+		KASSERT(curlen != 0);
 		DPRINTFN(4, "dataphys=0x%08x dataphysend=0x%08x "
 		"len=%d curlen=%d", dataphys, dataphysend, len, curlen);
 		len -= curlen;
@@ -591,31 +603,37 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s
 
 		DPRINTFN(10, "cbp=0x%08x be=0x%08x", dataphys,
 		dataphys + curlen - 1, 0, 0);
-		if (len == 0)
-			break;
+
+		curoffs += curlen;
+		len -= curlen;
+
+		if (len != 0)
+			cur = next;
+
 		DPRINTFN(10, "extend chain", 0, 0, 0, 0);
-		dataphys += curlen;
-		cur = next;
 	}
-	if (!rd && (flags & USBD_FORCE_SHORT_XFER) &&
-	alen % mps == 0) {
+
+	/* Allocate a TD for a 0 length transfer at the end. */
+	if (!rd && (flags & USBD_FORCE_SHORT_XFER)) {
 		/* Force a 0 length transfer at the end. */
 
+		KASSERT(j < ox->ox_nstd);
+		KASSERT(next != NULL);
 		cur = next;
-		next = ohci_alloc_std(sc);
-		if (next == NULL)
-			goto nomem;
+		ox->ox_stds[j++] = cur;
 
 		cur->td.td_flags = tdflags;
 		cur->td.td_cbp = 0; /* indicate 0 length packet */
-		cur->td.td_nexttd = HTOO32(next->physaddr);
+		cur->td.td_nexttd = 0;
 		cur->td.td_be = ~0;
-		cur->nexttd = next;
+		cur->nexttd = NULL;
 		cur->len = 0;
 		cur->flags = 0;
 		cur->xfer = xfer;
 
 		DPRINTFN(2, "add 0 xfer", 0, 0, 0, 0);
+	} else {
+		ohci_free_std(sc, next);
 	}
 
 	return USBD_NORMAL_COMPLETION;
@@ -667,28 +685,38 @@ ohci_reset_std_chain(ohci_softc_t *sc, s
 
 	int mps = UGETW(xfer->ux_pipe->up_endpoint->ue_edesc->wMaxPacketSize);
 
+	/*
+	 * Assign next for the len == 0 case where we don't go through the
+	 * main loop.
+	 */
 	len = alen;
-	cur = sp;
+	cur = next = sp;
 
-	dataphys = DMAADDR(dma, 0);
-	dataphysend = OHCI_PAGE(dataphys + len - 1);
 	usb_syncmem(dma, 0, len,
 	rd ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
 	const uint32_t tdflags = HTOO32(
 	(rd ? OHCI_TD_IN : OHCI_TD_OUT) |
 	OHCI_TD_NOCC | OHCI_TD_TOGGLE_CARRY | OHCI_TD_NOINTR);
 
-	for (size_t j = 1;;) {
+	size_t curoffs = 0;
+	for (size_t j = 1; len != 0;) {
 		if (j == ox->ox_nstd)
 			next = NULL;
 		else
 			next = ox->ox_stds[j++];
 		KASSERT(next != cur);
 
-		/* The OHCI hardware can handle at most one page crossing. */
-		if (OHCI_PAGE(dataphys) == dataphysend ||
-		OHCI_PAGE(dataphys) + OHCI_PAGE_SIZE == dataphysend) {
-			/* we can handle it in this TD */
+		curlen = 0;
+		dataphys = 

CVS commit: [nick-nhusb] src/sys/dev/usb

2016-04-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Apr  1 14:11:02 UTC 2016

Modified Files:
src/sys/dev/usb [nick-nhusb]: ohci.c

Log Message:
More whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.254.2.63 -r1.254.2.64 src/sys/dev/usb/ohci.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/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.254.2.63 src/sys/dev/usb/ohci.c:1.254.2.64
--- src/sys/dev/usb/ohci.c:1.254.2.63	Fri Apr  1 14:08:39 2016
+++ src/sys/dev/usb/ohci.c	Fri Apr  1 14:11:02 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.254.2.63 2016/04/01 14:08:39 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.254.2.64 2016/04/01 14:11:02 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.63 2016/04/01 14:08:39 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.64 2016/04/01 14:11:02 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -693,7 +693,7 @@ ohci_reset_std_chain(ohci_softc_t *sc, s
 		} else {
 			/* must use multiple TDs, fill as much as possible. */
 			curlen = 2 * OHCI_PAGE_SIZE -
- (dataphys & (OHCI_PAGE_SIZE - 1));
+			(dataphys & (OHCI_PAGE_SIZE - 1));
 			/* the length must be a multiple of the max size */
 			curlen -= curlen % mps;
 			KASSERT(curlen != 0);



CVS commit: [nick-nhusb] src/sys/dev/usb

2016-04-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Apr  1 14:13:29 UTC 2016

Modified Files:
src/sys/dev/usb [nick-nhusb]: ohci.c

Log Message:
Guess what... whitspace.


To generate a diff of this commit:
cvs rdiff -u -r1.254.2.65 -r1.254.2.66 src/sys/dev/usb/ohci.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/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.254.2.65 src/sys/dev/usb/ohci.c:1.254.2.66
--- src/sys/dev/usb/ohci.c:1.254.2.65	Fri Apr  1 14:12:17 2016
+++ src/sys/dev/usb/ohci.c	Fri Apr  1 14:13:29 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.254.2.65 2016/04/01 14:12:17 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.254.2.66 2016/04/01 14:13:29 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.65 2016/04/01 14:12:17 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.66 2016/04/01 14:13:29 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -3112,7 +3112,6 @@ ohci_device_bulk_start(struct usbd_xfer 
 	/* We want interrupt at the end of the transfer. */
 	last->td.td_flags &= HTOO32(~OHCI_TD_INTR_MASK);
 	last->td.td_flags |= HTOO32(OHCI_TD_SET_DI(1));
-
 	last->td.td_nexttd = HTOO32(tail->physaddr);
 	last->nexttd = tail;
 	last->flags |= OHCI_CALL_DONE;



CVS commit: [nick-nhusb] src/sys/dev/usb

2016-04-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Apr  1 14:12:17 UTC 2016

Modified Files:
src/sys/dev/usb [nick-nhusb]: ohci.c

Log Message:
More whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.254.2.64 -r1.254.2.65 src/sys/dev/usb/ohci.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/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.254.2.64 src/sys/dev/usb/ohci.c:1.254.2.65
--- src/sys/dev/usb/ohci.c:1.254.2.64	Fri Apr  1 14:11:02 2016
+++ src/sys/dev/usb/ohci.c	Fri Apr  1 14:12:17 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.254.2.64 2016/04/01 14:11:02 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.254.2.65 2016/04/01 14:12:17 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.64 2016/04/01 14:11:02 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.65 2016/04/01 14:12:17 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -577,7 +577,7 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s
 			KASSERT(curlen != 0);
 		}
 		DPRINTFN(4, "dataphys=0x%08x dataphysend=0x%08x "
-		"len=%d curlen=%d",  dataphys, dataphysend, len, curlen);
+		"len=%d curlen=%d", dataphys, dataphysend, len, curlen);
 		len -= curlen;
 
 		cur->td.td_flags = tdflags;



CVS commit: [nick-nhusb] src/sys/dev/usb

2016-04-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Apr  1 14:08:40 UTC 2016

Modified Files:
src/sys/dev/usb [nick-nhusb]: ohci.c

Log Message:
Really fix whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.254.2.62 -r1.254.2.63 src/sys/dev/usb/ohci.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/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.254.2.62 src/sys/dev/usb/ohci.c:1.254.2.63
--- src/sys/dev/usb/ohci.c:1.254.2.62	Fri Apr  1 14:06:14 2016
+++ src/sys/dev/usb/ohci.c	Fri Apr  1 14:08:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.254.2.62 2016/04/01 14:06:14 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.254.2.63 2016/04/01 14:08:39 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.62 2016/04/01 14:06:14 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.63 2016/04/01 14:08:39 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -571,7 +571,7 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s
 		} else {
 			/* must use multiple TDs, fill as much as possible. */
 			curlen = 2 * OHCI_PAGE_SIZE -
-		 	(dataphys & (OHCI_PAGE_SIZE - 1));
+			(dataphys & (OHCI_PAGE_SIZE - 1));
 			/* the length must be a multiple of the max size */
 			curlen -= curlen % mps;
 			KASSERT(curlen != 0);



CVS commit: [nick-nhusb] src/sys/dev/usb

2016-04-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Apr  1 14:06:14 UTC 2016

Modified Files:
src/sys/dev/usb [nick-nhusb]: ohci.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.254.2.61 -r1.254.2.62 src/sys/dev/usb/ohci.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/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.254.2.61 src/sys/dev/usb/ohci.c:1.254.2.62
--- src/sys/dev/usb/ohci.c:1.254.2.61	Fri Apr  1 12:58:15 2016
+++ src/sys/dev/usb/ohci.c	Fri Apr  1 14:06:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.254.2.61 2016/04/01 12:58:15 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.254.2.62 2016/04/01 14:06:14 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.61 2016/04/01 12:58:15 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.62 2016/04/01 14:06:14 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -571,7 +571,7 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s
 		} else {
 			/* must use multiple TDs, fill as much as possible. */
 			curlen = 2 * OHCI_PAGE_SIZE -
- (dataphys & (OHCI_PAGE_SIZE-1));
+		 	(dataphys & (OHCI_PAGE_SIZE - 1));
 			/* the length must be a multiple of the max size */
 			curlen -= curlen % mps;
 			KASSERT(curlen != 0);



CVS commit: [nick-nhusb] src/sys/dev/usb

2016-04-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Apr  1 12:58:15 UTC 2016

Modified Files:
src/sys/dev/usb [nick-nhusb]: ohci.c

Log Message:
constify tdflags in ohci_{alloc,reset}_std_chain


To generate a diff of this commit:
cvs rdiff -u -r1.254.2.60 -r1.254.2.61 src/sys/dev/usb/ohci.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/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.254.2.60 src/sys/dev/usb/ohci.c:1.254.2.61
--- src/sys/dev/usb/ohci.c:1.254.2.60	Thu Mar 24 15:30:17 2016
+++ src/sys/dev/usb/ohci.c	Fri Apr  1 12:58:15 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.254.2.60 2016/03/24 15:30:17 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.254.2.61 2016/04/01 12:58:15 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.60 2016/03/24 15:30:17 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.61 2016/04/01 12:58:15 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -523,7 +523,6 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s
 	struct usbd_pipe *pipe = xfer->ux_pipe;
 	ohci_soft_td_t *next, *cur;
 	ohci_physaddr_t dataphys, dataphysend;
-	uint32_t tdflags;
 	int len = alen;
 	int curlen;
 	usb_dma_t *dma = >ux_dmabuf;
@@ -554,7 +553,7 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s
 
 	dataphys = DMAADDR(dma, 0);
 	dataphysend = OHCI_PAGE(dataphys + len - 1);
-	tdflags = HTOO32(
+	const uint32_t tdflags = HTOO32(
 	(rd ? OHCI_TD_IN : OHCI_TD_OUT) |
 	OHCI_TD_NOCC | OHCI_TD_TOGGLE_CARRY | OHCI_TD_NOINTR);
 
@@ -650,7 +649,6 @@ ohci_reset_std_chain(ohci_softc_t *sc, s
 	struct ohci_xfer *ox = OHCI_XFER2OXFER(xfer);
 	ohci_soft_td_t *next, *cur;
 	ohci_physaddr_t dataphys, dataphysend;
-	uint32_t tdflags;
 	int len, curlen;
 	usb_dma_t *dma = >ux_dmabuf;
 	uint16_t flags = xfer->ux_flags;
@@ -676,7 +674,7 @@ ohci_reset_std_chain(ohci_softc_t *sc, s
 	dataphysend = OHCI_PAGE(dataphys + len - 1);
 	usb_syncmem(dma, 0, len,
 	rd ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
-	tdflags = HTOO32(
+	const uint32_t tdflags = HTOO32(
 	(rd ? OHCI_TD_IN : OHCI_TD_OUT) |
 	OHCI_TD_NOCC | OHCI_TD_TOGGLE_CARRY | OHCI_TD_NOINTR);
 



CVS commit: src

2016-04-01 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Apr  1 12:37:48 UTC 2016

Modified Files:
src/distrib/sets/lists/man: mi
src/lib/libc/stdlib: Makefile.inc

Log Message:
Add malloc.conf.5 (link to jemalloc.3).


To generate a diff of this commit:
cvs rdiff -u -r1.1520 -r1.1521 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.91 -r1.92 src/lib/libc/stdlib/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1520 src/distrib/sets/lists/man/mi:1.1521
--- src/distrib/sets/lists/man/mi:1.1520	Mon Feb 29 22:01:20 2016
+++ src/distrib/sets/lists/man/mi	Fri Apr  1 12:37:48 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1520 2016/02/29 22:01:20 riastradh Exp $
+# $NetBSD: mi,v 1.1521 2016/04/01 12:37:48 msaitoh Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5104,6 +5104,7 @@
 ./usr/share/man/html5/lvm.conf.html		man-lvm-htmlman		lvm,html
 ./usr/share/man/html5/magic.html		man-util-htmlman	html
 ./usr/share/man/html5/mailer.conf.html		man-mailwrapper-htmlman	html
+./usr/share/man/html5/malloc.conf.html		man-sys-htmlman		html
 ./usr/share/man/html5/man.conf.html		man-man-htmlman		html
 ./usr/share/man/html5/map3270.html		man-obsolete		obsolete
 ./usr/share/man/html5/master.html		man-postfix-htmlman	postfix,html
@@ -8037,6 +8038,7 @@
 ./usr/share/man/man5/lvm.conf.5			man-lvm-man		lvm,.man
 ./usr/share/man/man5/magic.5			man-util-man		.man
 ./usr/share/man/man5/mailer.conf.5		man-mailwrapper-man	.man
+./usr/share/man/man5/malloc.conf.5		man-sys-man		.man
 ./usr/share/man/man5/man.conf.5			man-man-man		.man
 ./usr/share/man/man5/map3270.5			man-obsolete		obsolete
 ./usr/share/man/man5/master.5			man-postfix-man		postfix,.man

Index: src/lib/libc/stdlib/Makefile.inc
diff -u src/lib/libc/stdlib/Makefile.inc:1.91 src/lib/libc/stdlib/Makefile.inc:1.92
--- src/lib/libc/stdlib/Makefile.inc:1.91	Sat Nov  7 16:21:42 2015
+++ src/lib/libc/stdlib/Makefile.inc	Fri Apr  1 12:37:48 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.91 2015/11/07 16:21:42 nros Exp $
+#	$NetBSD: Makefile.inc,v 1.92 2016/04/01 12:37:48 msaitoh Exp $
 #	from: @(#)Makefile.inc	8.3 (Berkeley) 2/4/95
 
 # stdlib sources
@@ -72,6 +72,7 @@ MLINKS+=hcreate.3 hdestroy.3 hcreate.3 h
 MLINKS+=hcreate.3 hcreate_r.3 hcreate.3 hdestroy_r.3 hcreate.3 hsearch_r.3
 MLINKS+=hcreate.3 hdestroy1.3 hcreate.3 hdestroy1_r.3
 MLINKS+=insque.3 remque.3
+MLINKS+=jemalloc.3 malloc.conf.5
 MLINKS+=lsearch.3 lfind.3
 MLINKS+=malloc.3 calloc.3 malloc.3 realloc.3 malloc.3 free.3
 MLINKS+=posix_memalign.3 aligned_alloc.3



CVS commit: src/sys/net

2016-04-01 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Apr  1 09:52:39 UTC 2016

Modified Files:
src/sys/net: route.c

Log Message:
Don't request returning rtentry if not use it


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/net/route.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/net/route.c
diff -u src/sys/net/route.c:1.156 src/sys/net/route.c:1.157
--- src/sys/net/route.c:1.156	Fri Apr  1 09:00:27 2016
+++ src/sys/net/route.c	Fri Apr  1 09:52:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.156 2016/04/01 09:00:27 ozaki-r Exp $	*/
+/*	$NetBSD: route.c,v 1.157 2016/04/01 09:52:39 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.156 2016/04/01 09:00:27 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.157 2016/04/01 09:52:39 ozaki-r Exp $");
 
 #include 
 #ifdef RTFLUSH_DEBUG
@@ -568,7 +568,6 @@ rtdeletemsg(struct rtentry *rt)
 {
 	int error;
 	struct rt_addrinfo info;
-	struct rtentry *retrt;
 
 	/*
 	 * Request the new route so that the entry is not actually
@@ -580,12 +579,10 @@ rtdeletemsg(struct rtentry *rt)
 	info.rti_info[RTAX_NETMASK] = rt_mask(rt);
 	info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
 	info.rti_flags = rt->rt_flags;
-	error = rtrequest1(RTM_DELETE, , );
+	error = rtrequest1(RTM_DELETE, , NULL);
 
 	rt_missmsg(RTM_DELETE, , info.rti_flags, error);
 
-	if (error == 0)
-		rtfree(retrt);
 	return error;
 }
 



CVS commit: src/sys

2016-04-01 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Apr  1 09:16:02 UTC 2016

Modified Files:
src/sys/netinet: ip_icmp.c
src/sys/netinet6: icmp6.c

Log Message:
Remove unnecessary casts and do s/0/NULL/ for rtrequest


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/netinet/ip_icmp.c
cvs rdiff -u -r1.180 -r1.181 src/sys/netinet6/icmp6.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/netinet/ip_icmp.c
diff -u src/sys/netinet/ip_icmp.c:1.144 src/sys/netinet/ip_icmp.c:1.145
--- src/sys/netinet/ip_icmp.c:1.144	Thu Jan 21 15:41:30 2016
+++ src/sys/netinet/ip_icmp.c	Fri Apr  1 09:16:02 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_icmp.c,v 1.144 2016/01/21 15:41:30 riastradh Exp $	*/
+/*	$NetBSD: ip_icmp.c,v 1.145 2016/04/01 09:16:02 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -94,7 +94,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.144 2016/01/21 15:41:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.145 2016/04/01 09:16:02 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -1106,8 +1106,7 @@ icmp_mtudisc(struct icmp *icp, struct in
 	if ((rt->rt_flags & RTF_HOST) == 0) {
 		struct rtentry *nrt;
 
-		error = rtrequest((int) RTM_ADD, dst,
-		(struct sockaddr *) rt->rt_gateway, NULL,
+		error = rtrequest(RTM_ADD, dst, rt->rt_gateway, NULL,
 		RTF_GATEWAY | RTF_HOST | RTF_DYNAMIC, );
 		if (error) {
 			rtfree(rt);
@@ -1220,8 +1219,8 @@ icmp_mtudisc_timeout(struct rtentry *rt,
 
 	if ((rt->rt_flags & (RTF_DYNAMIC | RTF_HOST)) ==
 	(RTF_DYNAMIC | RTF_HOST)) {
-		rtrequest((int) RTM_DELETE, rt_getkey(rt),
-		rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0);
+		rtrequest(RTM_DELETE, rt_getkey(rt),
+		rt->rt_gateway, rt_mask(rt), rt->rt_flags, NULL);
 	} else {
 		if ((rt->rt_rmx.rmx_locks & RTV_MTU) == 0) {
 			rt->rt_rmx.rmx_mtu = 0;
@@ -1238,8 +1237,8 @@ icmp_redirect_timeout(struct rtentry *rt
 
 	if ((rt->rt_flags & (RTF_DYNAMIC | RTF_HOST)) ==
 	(RTF_DYNAMIC | RTF_HOST)) {
-		rtrequest((int) RTM_DELETE, rt_getkey(rt),
-		rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0);
+		rtrequest(RTM_DELETE, rt_getkey(rt),
+		rt->rt_gateway, rt_mask(rt), rt->rt_flags, NULL);
 	}
 }
 

Index: src/sys/netinet6/icmp6.c
diff -u src/sys/netinet6/icmp6.c:1.180 src/sys/netinet6/icmp6.c:1.181
--- src/sys/netinet6/icmp6.c:1.180	Fri Apr  1 08:12:00 2016
+++ src/sys/netinet6/icmp6.c	Fri Apr  1 09:16:02 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: icmp6.c,v 1.180 2016/04/01 08:12:00 ozaki-r Exp $	*/
+/*	$NetBSD: icmp6.c,v 1.181 2016/04/01 09:16:02 ozaki-r Exp $	*/
 /*	$KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.180 2016/04/01 08:12:00 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.181 2016/04/01 09:16:02 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2682,8 +2682,7 @@ icmp6_mtudisc_clone(struct sockaddr *dst
 	if ((rt->rt_flags & RTF_HOST) == 0) {
 		struct rtentry *nrt;
 
-		error = rtrequest((int) RTM_ADD, dst,
-		(struct sockaddr *) rt->rt_gateway, NULL,
+		error = rtrequest(RTM_ADD, dst, rt->rt_gateway, NULL,
 		RTF_GATEWAY | RTF_HOST | RTF_DYNAMIC, );
 		if (error) {
 			rtfree(rt);
@@ -2712,7 +2711,7 @@ icmp6_mtudisc_timeout(struct rtentry *rt
 
 	if ((rt->rt_flags & (RTF_DYNAMIC | RTF_HOST)) ==
 	(RTF_DYNAMIC | RTF_HOST)) {
-		rtrequest((int) RTM_DELETE, rt_getkey(rt),
+		rtrequest(RTM_DELETE, rt_getkey(rt),
 		rt->rt_gateway, rt_mask(rt), rt->rt_flags, NULL);
 	} else {
 		if (!(rt->rt_rmx.rmx_locks & RTV_MTU))
@@ -2729,7 +2728,7 @@ icmp6_redirect_timeout(struct rtentry *r
 
 	if ((rt->rt_flags & (RTF_GATEWAY | RTF_DYNAMIC | RTF_HOST)) ==
 	(RTF_GATEWAY | RTF_DYNAMIC | RTF_HOST)) {
-		rtrequest((int) RTM_DELETE, rt_getkey(rt),
+		rtrequest(RTM_DELETE, rt_getkey(rt),
 		rt->rt_gateway, rt_mask(rt), rt->rt_flags, NULL);
 	}
 }



CVS commit: src/sys/net

2016-04-01 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Apr  1 09:00:27 UTC 2016

Modified Files:
src/sys/net: route.c

Log Message:
Remove unnecessary RTTIMER_CALLOUT macro

rttimer#rtt_func never be NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/net/route.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/net/route.c
diff -u src/sys/net/route.c:1.155 src/sys/net/route.c:1.156
--- src/sys/net/route.c:1.155	Fri Apr  1 02:00:14 2016
+++ src/sys/net/route.c	Fri Apr  1 09:00:27 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.155 2016/04/01 02:00:14 ozaki-r Exp $	*/
+/*	$NetBSD: route.c,v 1.156 2016/04/01 09:00:27 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.155 2016/04/01 02:00:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.156 2016/04/01 09:00:27 ozaki-r Exp $");
 
 #include 
 #ifdef RTFLUSH_DEBUG
@@ -1203,16 +1203,6 @@ rt_ifa_remlocal(struct ifaddr *ifa, stru
 LIST_HEAD(, rttimer_queue) rttimer_queue_head;
 static int rt_init_done = 0;
 
-#define RTTIMER_CALLOUT(r)	do {	\
-		if (r->rtt_func != NULL) {\
-			(*r->rtt_func)(r->rtt_rt, r);			\
-		} else {		\
-			rtrequest((int) RTM_DELETE,			\
-  rt_getkey(r->rtt_rt),			\
-  0, 0, 0, 0);\
-		}			\
-	} while (/*CONSTCOND*/0)
-
 /*
  * Some subtle order problems with domain initialization mean that
  * we cannot count on this being run from rt_init before various
@@ -1267,7 +1257,7 @@ rt_timer_queue_remove_all(struct rttimer
 		LIST_REMOVE(r, rtt_link);
 		TAILQ_REMOVE(>rtq_head, r, rtt_next);
 		if (destroy)
-			RTTIMER_CALLOUT(r);
+			(*r->rtt_func)(r->rtt_rt, r);
 		rtfree(r->rtt_rt);
 		/* we are already at splsoftnet */
 		pool_put(_pool, r);
@@ -1307,7 +1297,7 @@ rt_timer_remove_all(struct rtentry *rt, 
 		LIST_REMOVE(r, rtt_link);
 		TAILQ_REMOVE(>rtt_queue->rtq_head, r, rtt_next);
 		if (destroy)
-			RTTIMER_CALLOUT(r);
+			(*r->rtt_func)(r->rtt_rt, r);
 		if (r->rtt_queue->rtq_count > 0)
 			r->rtt_queue->rtq_count--;
 		else
@@ -1326,6 +1316,7 @@ rt_timer_add(struct rtentry *rt,
 	struct rttimer *r;
 	int s;
 
+	KASSERT(func != NULL);
 	/*
 	 * If there's already a timer with this action, destroy it before
 	 * we add a new one.
@@ -1378,7 +1369,7 @@ rt_timer_timer(void *arg)
 		(r->rtt_time + rtq->rtq_timeout) < time_uptime) {
 			LIST_REMOVE(r, rtt_link);
 			TAILQ_REMOVE(>rtq_head, r, rtt_next);
-			RTTIMER_CALLOUT(r);
+			(*r->rtt_func)(r->rtt_rt, r);
 			rtfree(r->rtt_rt);
 			pool_put(_pool, r);
 			if (rtq->rtq_count > 0)



CVS commit: src/bin/expr

2016-04-01 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Apr  1 08:19:32 UTC 2016

Modified Files:
src/bin/expr: Makefile

Log Message:
for GCC 5.3 pass -fwrapv as this relies upon well-defined integer overflow.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/bin/expr/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/expr/Makefile
diff -u src/bin/expr/Makefile:1.14 src/bin/expr/Makefile:1.15
--- src/bin/expr/Makefile:1.14	Tue Sep 19 17:20:00 2000
+++ src/bin/expr/Makefile	Fri Apr  1 08:19:31 2016
@@ -1,6 +1,12 @@
-#	$NetBSD: Makefile,v 1.14 2000/09/19 17:20:00 jdolecek Exp $
+#	$NetBSD: Makefile,v 1.15 2016/04/01 08:19:31 mrg Exp $
 
 PROG=		expr
 SRCS=		expr.y
 
 .include 
+
+# XXXGCC5
+.if defined(HAVE_GCC) && ${HAVE_GCC} == 53 && ${ACTIVE_CC} == "gcc"
+CFLAGS+= -fwrapv
+.endif
+



CVS commit: src/sys/netinet6

2016-04-01 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Apr  1 08:12:00 UTC 2016

Modified Files:
src/sys/netinet6: icmp6.c in6.c in6_ifattach.c ip6_input.c nd6.c nd6.h
nd6_nbr.c nd6_rtr.c

Log Message:
Refine nd6log

Add __func__ to nd6log itself instead of adding it to callers.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.196 -r1.197 src/sys/netinet6/in6.c
cvs rdiff -u -r1.95 -r1.96 src/sys/netinet6/in6_ifattach.c
cvs rdiff -u -r1.156 -r1.157 src/sys/netinet6/ip6_input.c
cvs rdiff -u -r1.186 -r1.187 src/sys/netinet6/nd6.c
cvs rdiff -u -r1.70 -r1.71 src/sys/netinet6/nd6.h
cvs rdiff -u -r1.113 -r1.114 src/sys/netinet6/nd6_nbr.c
cvs rdiff -u -r1.106 -r1.107 src/sys/netinet6/nd6_rtr.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/netinet6/icmp6.c
diff -u src/sys/netinet6/icmp6.c:1.179 src/sys/netinet6/icmp6.c:1.180
--- src/sys/netinet6/icmp6.c:1.179	Thu Jan 21 15:41:30 2016
+++ src/sys/netinet6/icmp6.c	Fri Apr  1 08:12:00 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: icmp6.c,v 1.179 2016/01/21 15:41:30 riastradh Exp $	*/
+/*	$NetBSD: icmp6.c,v 1.180 2016/04/01 08:12:00 ozaki-r Exp $	*/
 /*	$KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.179 2016/01/21 15:41:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.180 2016/04/01 08:12:00 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -404,7 +404,7 @@ icmp6_error(struct mbuf *m, int type, in
 	if (m && M_UNWRITABLE(m, preplen))
 		m = m_pullup(m, preplen);
 	if (m == NULL) {
-		nd6log((LOG_DEBUG, "ENOBUFS in icmp6_error %d\n", __LINE__));
+		nd6log(LOG_DEBUG, "ENOBUFS in icmp6_error %d\n", __LINE__);
 		return;
 	}
 
@@ -492,9 +492,8 @@ icmp6_input(struct mbuf **mp, int *offp,
 	code = icmp6->icmp6_code;
 
 	if ((sum = in6_cksum(m, IPPROTO_ICMPV6, off, icmp6len)) != 0) {
-		nd6log((LOG_ERR,
-		"ICMP6 checksum error(%d|%x) %s\n",
-		icmp6->icmp6_type, sum, ip6_sprintf(>ip6_src)));
+		nd6log(LOG_ERR, "ICMP6 checksum error(%d|%x) %s\n",
+		icmp6->icmp6_type, sum, ip6_sprintf(>ip6_src));
 		ICMP6_STATINC(ICMP6_STAT_CHECKSUM);
 		icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_error);
 		goto freeit;
@@ -850,11 +849,10 @@ icmp6_input(struct mbuf **mp, int *offp,
 		break;
 
 	default:
-		nd6log((LOG_DEBUG,
-		"icmp6_input: unknown type %d(src=%s, dst=%s, ifid=%d)\n",
+		nd6log(LOG_DEBUG, "unknown type %d(src=%s, dst=%s, ifid=%d)\n",
 		icmp6->icmp6_type, ip6_sprintf(>ip6_src),
 		ip6_sprintf(>ip6_dst),
-		m->m_pkthdr.rcvif ? m->m_pkthdr.rcvif->if_index : 0));
+		m->m_pkthdr.rcvif ? m->m_pkthdr.rcvif->if_index : 0);
 		if (icmp6->icmp6_type < ICMP6_ECHO_REQUEST) {
 			/* ICMPv6 error: MUST deliver it by spec... */
 			code = PRC_NCMDS;
@@ -1965,10 +1963,10 @@ icmp6_reflect(struct mbuf *m, size_t off
 
 	/* too short to reflect */
 	if (off < sizeof(struct ip6_hdr)) {
-		nd6log((LOG_DEBUG,
+		nd6log(LOG_DEBUG,
 		"sanity fail: off=%lx, sizeof(ip6)=%lx in %s:%d\n",
 		(u_long)off, (u_long)sizeof(struct ip6_hdr),
-		__FILE__, __LINE__));
+		__FILE__, __LINE__);
 		goto bad;
 	}
 
@@ -2065,10 +2063,10 @@ icmp6_reflect(struct mbuf *m, size_t off
 		src = in6_selectsrc(, NULL, NULL, , NULL, , );
 		rtcache_free();
 		if (src == NULL) {
-			nd6log((LOG_DEBUG,
-			"icmp6_reflect: source can't be determined: "
+			nd6log(LOG_DEBUG,
+			"source can't be determined: "
 			"dst=%s, error=%d\n",
-			ip6_sprintf(_addr), e));
+			ip6_sprintf(_addr), e);
 			goto bad;
 		}
 	}
@@ -2166,16 +2164,16 @@ icmp6_redirect_input(struct mbuf *m, int
 
 	/* validation */
 	if (!IN6_IS_ADDR_LINKLOCAL()) {
-		nd6log((LOG_ERR,
-			"ICMP6 redirect sent from %s rejected; "
-			"must be from linklocal\n", ip6_sprintf()));
+		nd6log(LOG_ERR,
+		"ICMP6 redirect sent from %s rejected; "
+		"must be from linklocal\n", ip6_sprintf());
 		goto bad;
 	}
 	if (ip6->ip6_hlim != 255) {
-		nd6log((LOG_ERR,
-			"ICMP6 redirect sent from %s rejected; "
-			"hlim=%d (must be 255)\n",
-			ip6_sprintf(), ip6->ip6_hlim));
+		nd6log(LOG_ERR,
+		"ICMP6 redirect sent from %s rejected; "
+		"hlim=%d (must be 255)\n",
+		ip6_sprintf(), ip6->ip6_hlim);
 		goto bad;
 	}
 {
@@ -2188,40 +2186,37 @@ icmp6_redirect_input(struct mbuf *m, int
 	if (rt) {
 		if (rt->rt_gateway == NULL ||
 		rt->rt_gateway->sa_family != AF_INET6) {
-			nd6log((LOG_ERR,
+			nd6log(LOG_ERR,
 			"ICMP6 redirect rejected; no route "
 			"with inet6 gateway found for redirect dst: %s\n",
-			icmp6_redirect_diag(, , )));
+			icmp6_redirect_diag(, , ));
 			rtfree(rt);
 			goto bad;
 		}
 
 		gw6 = &(((struct sockaddr_in6 *)rt->rt_gateway)->sin6_addr);
 		if (memcmp(, gw6, sizeof(struct in6_addr)) != 0) {
-			nd6log((LOG_ERR,
-"ICMP6 redirect 

CVS commit: src/usr.bin/kdump

2016-04-01 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Apr  1 07:23:15 UTC 2016

Modified Files:
src/usr.bin/kdump: Makefile.ioctl-c

Log Message:
' != " so make the condition actually work. (same as r1.30)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.bin/kdump/Makefile.ioctl-c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/kdump/Makefile.ioctl-c
diff -u src/usr.bin/kdump/Makefile.ioctl-c:1.31 src/usr.bin/kdump/Makefile.ioctl-c:1.32
--- src/usr.bin/kdump/Makefile.ioctl-c:1.31	Sat Feb  6 20:21:56 2016
+++ src/usr.bin/kdump/Makefile.ioctl-c	Fri Apr  1 07:23:15 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ioctl-c,v 1.31 2016/02/06 20:21:56 joerg Exp $
+#	$NetBSD: Makefile.ioctl-c,v 1.32 2016/04/01 07:23:15 knakahara Exp $
 
 # NOTE:  needs to be previously .included for NETBSDSRCDIR
 
@@ -41,7 +41,7 @@ DPSRCS+=	${PROG}-ioctl.c
 CPPFLAGS+=	-I${DESTDIR}/usr/X11R7/include/libdrm
 CPPFLAGS+=	-I${DESTDIR}/usr/X11R7/include/pixman-1
 CPPFLAGS+=	-I${DESTDIR}/usr/X11R7/include
-.if ${MKDTRACE} != 'no"
+.if ${MKDTRACE} != "no"
 CPPFLAGS+=	-I${NETBSDSRCDIR}/external/cddl/osnet/sys
 CPPFLAGS+=	-I${NETBSDSRCDIR}/external/cddl/osnet/dist/uts/common
 CPPFLAGS+=	-D_DEV_IC_BT8XX_H_



CVS commit: src/sys/netinet6

2016-04-01 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Apr  1 06:33:19 UTC 2016

Modified Files:
src/sys/netinet6: nd6_rtr.c

Log Message:
Use __func__ in log messages


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/netinet6/nd6_rtr.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/netinet6/nd6_rtr.c
diff -u src/sys/netinet6/nd6_rtr.c:1.105 src/sys/netinet6/nd6_rtr.c:1.106
--- src/sys/netinet6/nd6_rtr.c:1.105	Wed Nov 25 06:21:26 2015
+++ src/sys/netinet6/nd6_rtr.c	Fri Apr  1 06:33:19 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6_rtr.c,v 1.105 2015/11/25 06:21:26 ozaki-r Exp $	*/
+/*	$NetBSD: nd6_rtr.c,v 1.106 2016/04/01 06:33:19 ozaki-r Exp $	*/
 /*	$KAME: nd6_rtr.c,v 1.95 2001/02/07 08:09:47 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.105 2015/11/25 06:21:26 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.106 2016/04/01 06:33:19 ozaki-r Exp $");
 
 #include 
 #include 
@@ -1099,9 +1099,9 @@ prelist_update(struct nd_prefixctl *newp
 
 			if ((e = nd6_prefix_onlink(pr)) != 0) {
 nd6log((LOG_ERR,
-"prelist_update: failed to make "
+"%s: failed to make "
 "the prefix %s/%d on-link on %s "
-"(errno=%d)\n",
+"(errno=%d)\n", __func__,
 ip6_sprintf(>ndpr_prefix.sin6_addr),
 pr->ndpr_plen, if_name(pr->ndpr_ifp), e));
 /* proceed anyway. XXX: is it correct? */
@@ -1125,9 +1125,9 @@ prelist_update(struct nd_prefixctl *newp
 
 		error = nd6_prelist_add(newprc, dr, );
 		if (error != 0 || newpr == NULL) {
-			nd6log((LOG_NOTICE, "prelist_update: "
-			"nd6_prelist_add failed for %s/%d on %s "
-			"errno=%d, returnpr=%p\n",
+			nd6log((LOG_NOTICE,
+			"%s: nd6_prelist_add failed for %s/%d on %s "
+			"errno=%d, returnpr=%p\n", __func__,
 			ip6_sprintf(>ndprc_prefix.sin6_addr),
 			newprc->ndprc_plen, if_name(newprc->ndprc_ifp),
 			error, newpr));
@@ -1321,15 +1321,14 @@ prelist_update(struct nd_prefixctl *newp
 		ifidlen = in6_if2idlen(ifp);
 		if (ifidlen < 0) {
 			/* this should not happen, so we always log it. */
-			log(LOG_ERR, "prelist_update: IFID undefined (%s)\n",
-			if_name(ifp));
+			log(LOG_ERR, "%s: IFID undefined (%s)\n",
+			__func__, if_name(ifp));
 			goto end;
 		}
 		if (ifidlen + pr->ndpr_plen != 128) {
 			nd6log((LOG_INFO,
-			"prelist_update: invalid prefixlen "
-			"%d for %s, ignored\n",
-			pr->ndpr_plen, if_name(ifp)));
+			"%s: invalid prefixlen %d for %s, ignored\n",
+			__func__, pr->ndpr_plen, if_name(ifp)));
 			goto end;
 		}
 
@@ -1355,9 +1354,9 @@ prelist_update(struct nd_prefixctl *newp
 			if (ip6_use_tempaddr) {
 int e;
 if ((e = in6_tmpifadd(ia6, 1, 1)) != 0) {
-	nd6log((LOG_NOTICE, "prelist_update: "
-	"failed to create a temporary "
-	"address, errno=%d\n",
+	nd6log((LOG_NOTICE,
+	"%s: failed to create a temporary "
+	"address, errno=%d\n", __func__,
 	e));
 }
 			}



CVS commit: src/sys/netinet6

2016-04-01 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Apr  1 06:25:51 UTC 2016

Modified Files:
src/sys/netinet6: in6.c

Log Message:
Use __func__ in log messages


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/sys/netinet6/in6.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/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.195 src/sys/netinet6/in6.c:1.196
--- src/sys/netinet6/in6.c:1.195	Mon Feb 15 14:59:03 2016
+++ src/sys/netinet6/in6.c	Fri Apr  1 06:25:51 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.195 2016/02/15 14:59:03 rtr Exp $	*/
+/*	$NetBSD: in6.c,v 1.196 2016/04/01 06:25:51 ozaki-r Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.195 2016/02/15 14:59:03 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.196 2016/04/01 06:25:51 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -844,13 +844,15 @@ in6_update_ifa1(struct ifnet *ifp, struc
 
 		if ((ifp->if_flags & (IFF_POINTOPOINT|IFF_LOOPBACK)) == 0) {
 			/* XXX: noisy message */
-			nd6log((LOG_INFO, "in6_update_ifa: a destination can "
-			"be specified for a p2p or a loopback IF only\n"));
+			nd6log((LOG_INFO, "%s: a destination can "
+			"be specified for a p2p or a loopback IF only\n",
+			__func__));
 			return EINVAL;
 		}
 		if (plen != 128) {
-			nd6log((LOG_INFO, "in6_update_ifa: prefixlen should "
-			"be 128 when dstaddr is specified\n"));
+			nd6log((LOG_INFO, "%s: prefixlen should "
+			"be 128 when dstaddr is specified\n",
+			__func__));
 #ifdef FORCE_P2PPLEN
 			/*
 			 * To be compatible with old configurations,
@@ -879,7 +881,7 @@ in6_update_ifa1(struct ifnet *ifp, struc
 		 * configuration mistake or a tool's bug.
 		 */
 		nd6log((LOG_INFO,
-		"in6_update_ifa: valid lifetime is 0 for %s\n",
+		"%s: valid lifetime is 0 for %s\n", __func__,
 		ip6_sprintf(>ifra_addr.sin6_addr)));
 
 		if (ia == NULL)
@@ -947,9 +949,9 @@ in6_update_ifa1(struct ifnet *ifp, struc
 		 */
 		if (ia->ia_prefixmask.sin6_len &&
 		in6_mask2len(>ia_prefixmask.sin6_addr, NULL) != plen) {
-			nd6log((LOG_INFO, "in6_update_ifa: the prefix length of an"
+			nd6log((LOG_INFO, "%s: the prefix length of an"
 			" existing (%s) address should not be changed\n",
-			ip6_sprintf(>ia_addr.sin6_addr)));
+			__func__, ip6_sprintf(>ia_addr.sin6_addr)));
 			error = EINVAL;
 			goto unlink;
 		}
@@ -965,8 +967,8 @@ in6_update_ifa1(struct ifnet *ifp, struc
 	!IN6_ARE_ADDR_EQUAL(_addr, >ia_dstaddr.sin6_addr)) {
 		if ((ia->ia_flags & IFA_ROUTE) != 0 &&
 		rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST) != 0) {
-			nd6log((LOG_ERR, "in6_update_ifa: failed to remove "
-			"a route to the old destination: %s\n",
+			nd6log((LOG_ERR, "%s: failed to remove "
+			"a route to the old destination: %s\n", __func__,
 			ip6_sprintf(>ia_addr.sin6_addr)));
 			/* proceed anyway... */
 		} else
@@ -1048,8 +1050,7 @@ in6_update_ifa1(struct ifnet *ifp, struc
 		llsol.s6_addr8[12] = 0xff;
 		if ((error = in6_setscope(, ifp, NULL)) != 0) {
 			/* XXX: should not happen */
-			log(LOG_ERR, "in6_update_ifa: "
-			"in6_setscope failed\n");
+			log(LOG_ERR, "%s: in6_setscope failed\n", __func__);
 			goto cleanup;
 		}
 		dad_delay = 0;
@@ -1070,9 +1071,9 @@ in6_update_ifa1(struct ifnet *ifp, struc
 		imm = in6_joingroup(ifp, , , dad_delay);
 		if (!imm) {
 			nd6log((LOG_ERR,
-			"in6_update_ifa: addmulti "
-			"failed for %s on %s (errno=%d)\n",
-			ip6_sprintf(), if_name(ifp), error));
+			"%s: addmulti failed for %s on %s (errno=%d)\n",
+			__func__, ip6_sprintf(), if_name(ifp),
+			error));
 			goto cleanup;
 		}
 		LIST_INSERT_HEAD(>ia6_memberships, imm, i6mm_chain);
@@ -1135,9 +1136,8 @@ in6_update_ifa1(struct ifnet *ifp, struc
 		imm = in6_joingroup(ifp, _addr, , 0);
 		if (!imm) {
 			nd6log((LOG_WARNING,
-			"in6_update_ifa: addmulti failed for "
-			"%s on %s (errno=%d)\n",
-			ip6_sprintf(_addr),
+			"%s: addmulti failed for %s on %s (errno=%d)\n",
+			__func__, ip6_sprintf(_addr),
 			if_name(ifp), error));
 			goto cleanup;
 		}
@@ -1159,9 +1159,9 @@ in6_update_ifa1(struct ifnet *ifp, struc
 			;
 		else if ((imm = in6_joingroup(ifp, _addr, ,
 		  dad_delay)) == NULL) { /* XXX jinmei */
-			nd6log((LOG_WARNING, "in6_update_ifa: "
-			"addmulti failed for %s on %s (errno=%d)\n",
-			ip6_sprintf(_addr),
+			nd6log((LOG_WARNING,
+			"%s: addmulti failed for %s on %s (errno=%d)\n",
+			__func__, ip6_sprintf(_addr),
 			if_name(ifp), error));
 			/* XXX not very fatal, go on... */
 		} else {
@@ -1219,9 +1219,9 @@ in6_update_ifa1(struct ifnet *ifp, struc
 		}
 		imm = in6_joingroup(ifp, _addr, , 0);
 		if (!imm) {
-			nd6log((LOG_WARNING, "in6_update_ifa: "
-			"addmulti