CVS commit: src/sys

2014-07-07 Thread Tyler R. Retzlaff
Module Name:src
Committed By:   rtr
Date:   Mon Jul  7 07:09:59 UTC 2014

Modified Files:
src/sys/netatalk: ddp_usrreq.c
src/sys/netbt: hci_socket.c l2cap_socket.c rfcomm_socket.c sco_socket.c
src/sys/netinet: raw_ip.c tcp_usrreq.c udp_usrreq.c
src/sys/netinet6: raw_ip6.c udp6_usrreq.c
src/sys/netipsec: keysock.c
src/sys/netnatm: natm.c
src/sys/rump/net/lib/libsockin: sockin.c

Log Message:
* have pr_stat return EOPNOTSUPP consistently for all protocols that do
  not fill in struct stat instead of returning success.

* in pr_stat remove all checks for non-NULL so-so_pcb except where the
  pcb is actually used (i.e. cases where we don't return EOPNOTSUPP).

proposed on tech-net@


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/netatalk/ddp_usrreq.c
cvs rdiff -u -r1.27 -r1.28 src/sys/netbt/hci_socket.c
cvs rdiff -u -r1.18 -r1.19 src/sys/netbt/l2cap_socket.c
cvs rdiff -u -r1.19 -r1.20 src/sys/netbt/rfcomm_socket.c
cvs rdiff -u -r1.20 -r1.21 src/sys/netbt/sco_socket.c
cvs rdiff -u -r1.128 -r1.129 src/sys/netinet/raw_ip.c
cvs rdiff -u -r1.181 -r1.182 src/sys/netinet/tcp_usrreq.c
cvs rdiff -u -r1.203 -r1.204 src/sys/netinet/udp_usrreq.c
cvs rdiff -u -r1.122 -r1.123 src/sys/netinet6/raw_ip6.c
cvs rdiff -u -r1.102 -r1.103 src/sys/netinet6/udp6_usrreq.c
cvs rdiff -u -r1.30 -r1.31 src/sys/netipsec/keysock.c
cvs rdiff -u -r1.32 -r1.33 src/sys/netnatm/natm.c
cvs rdiff -u -r1.43 -r1.44 src/sys/rump/net/lib/libsockin/sockin.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/netatalk/ddp_usrreq.c
diff -u src/sys/netatalk/ddp_usrreq.c:1.48 src/sys/netatalk/ddp_usrreq.c:1.49
--- src/sys/netatalk/ddp_usrreq.c:1.48	Sun Jul  6 03:33:33 2014
+++ src/sys/netatalk/ddp_usrreq.c	Mon Jul  7 07:09:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ddp_usrreq.c,v 1.48 2014/07/06 03:33:33 rtr Exp $	 */
+/*	$NetBSD: ddp_usrreq.c,v 1.49 2014/07/07 07:09:58 rtr Exp $	 */
 
 /*
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ddp_usrreq.c,v 1.48 2014/07/06 03:33:33 rtr Exp $);
+__KERNEL_RCSID(0, $NetBSD: ddp_usrreq.c,v 1.49 2014/07/07 07:09:58 rtr Exp $);
 
 #include opt_mbuftrace.h
 
@@ -481,14 +481,7 @@ ddp_ioctl(struct socket *so, u_long cmd,
 static int
 ddp_stat(struct socket *so, struct stat *ub)
 {
-	struct ddpcb   *ddp;
-
-	ddp = sotoddpcb(so);
-	if (ddp == NULL)
-		return EINVAL;
-
-	/* Don't return block size. */
-	return 0;
+	return EOPNOTSUPP;
 }
 
 /*

Index: src/sys/netbt/hci_socket.c
diff -u src/sys/netbt/hci_socket.c:1.27 src/sys/netbt/hci_socket.c:1.28
--- src/sys/netbt/hci_socket.c:1.27	Sun Jul  6 03:33:33 2014
+++ src/sys/netbt/hci_socket.c	Mon Jul  7 07:09:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci_socket.c,v 1.27 2014/07/06 03:33:33 rtr Exp $	*/
+/*	$NetBSD: hci_socket.c,v 1.28 2014/07/07 07:09:58 rtr Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hci_socket.c,v 1.27 2014/07/06 03:33:33 rtr Exp $);
+__KERNEL_RCSID(0, $NetBSD: hci_socket.c,v 1.28 2014/07/07 07:09:58 rtr Exp $);
 
 /* load symbolic names */
 #ifdef BLUETOOTH_DEBUG
@@ -496,12 +496,7 @@ hci_ioctl(struct socket *up, u_long cmd,
 static int
 hci_stat(struct socket *so, struct stat *ub)
 {
-	struct hci_pcb *pcb = (struct hci_pcb *)so-so_pcb;
-
-	if (pcb == NULL)
-		return EINVAL;
-
-	return 0;
+	return EOPNOTSUPP;
 }
 
 /*

Index: src/sys/netbt/l2cap_socket.c
diff -u src/sys/netbt/l2cap_socket.c:1.18 src/sys/netbt/l2cap_socket.c:1.19
--- src/sys/netbt/l2cap_socket.c:1.18	Sun Jul  6 03:33:33 2014
+++ src/sys/netbt/l2cap_socket.c	Mon Jul  7 07:09:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: l2cap_socket.c,v 1.18 2014/07/06 03:33:33 rtr Exp $	*/
+/*	$NetBSD: l2cap_socket.c,v 1.19 2014/07/07 07:09:58 rtr Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: l2cap_socket.c,v 1.18 2014/07/06 03:33:33 rtr Exp $);
+__KERNEL_RCSID(0, $NetBSD: l2cap_socket.c,v 1.19 2014/07/07 07:09:58 rtr Exp $);
 
 /* load symbolic names */
 #ifdef BLUETOOTH_DEBUG
@@ -125,12 +125,7 @@ l2cap_ioctl(struct socket *up, u_long cm
 static int
 l2cap_stat(struct socket *so, struct stat *ub)
 {
-	struct l2cap_channel *pcb = so-so_pcb;
-
-	if (pcb == NULL)
-		return EINVAL;
-
-	return 0;
+	return EOPNOTSUPP;
 }
 
 /*

Index: src/sys/netbt/rfcomm_socket.c
diff -u src/sys/netbt/rfcomm_socket.c:1.19 src/sys/netbt/rfcomm_socket.c:1.20
--- src/sys/netbt/rfcomm_socket.c:1.19	Sun Jul  6 03:33:33 2014
+++ src/sys/netbt/rfcomm_socket.c	Mon Jul  7 07:09:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rfcomm_socket.c,v 1.19 2014/07/06 03:33:33 rtr Exp $	*/
+/*	$NetBSD: rfcomm_socket.c,v 1.20 2014/07/07 07:09:58 rtr Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 

CVS commit: src/crypto/external/bsd/openssl

2014-07-07 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Jul  7 09:14:43 UTC 2014

Modified Files:
src/crypto/external/bsd/openssl: mkpc pkgconfig.mk

Log Message:
Use cross-cpp when extracting OpenSSL version.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/crypto/external/bsd/openssl/mkpc
cvs rdiff -u -r1.5 -r1.6 src/crypto/external/bsd/openssl/pkgconfig.mk

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

Modified files:

Index: src/crypto/external/bsd/openssl/mkpc
diff -u src/crypto/external/bsd/openssl/mkpc:1.3 src/crypto/external/bsd/openssl/mkpc:1.4
--- src/crypto/external/bsd/openssl/mkpc:1.3	Fri Feb  1 21:02:48 2013
+++ src/crypto/external/bsd/openssl/mkpc	Mon Jul  7 09:14:43 2014
@@ -1,9 +1,9 @@
 #!/bin/sh
-#	$NetBSD: mkpc,v 1.3 2013/02/01 21:02:48 christos Exp $
+#	$NetBSD: mkpc,v 1.4 2014/07/07 09:14:43 joerg Exp $
 
 getversion() {
 	(echo '#include opensslv.h'; echo OPENSSL_VERSION_TEXT) |
-	cpp -I$1 | grep OpenSSL | cut -d ' ' -f 2
+	$CPP $CPPFLAGS -I$1 | grep OpenSSL | cut -d ' ' -f 2
 }
 VERSION=$(getversion $1)
 
@@ -32,7 +32,7 @@ openssl.pc)
 esac
 
 cat  EOF  $2
-# \$NetBSD: mkpc,v 1.3 2013/02/01 21:02:48 christos Exp $
+# \$NetBSD: mkpc,v 1.4 2014/07/07 09:14:43 joerg Exp $
 prefix=/usr
 exec_prefix=/usr
 libdir=/usr/lib

Index: src/crypto/external/bsd/openssl/pkgconfig.mk
diff -u src/crypto/external/bsd/openssl/pkgconfig.mk:1.5 src/crypto/external/bsd/openssl/pkgconfig.mk:1.6
--- src/crypto/external/bsd/openssl/pkgconfig.mk:1.5	Mon Apr  7 17:40:49 2014
+++ src/crypto/external/bsd/openssl/pkgconfig.mk	Mon Jul  7 09:14:43 2014
@@ -1,4 +1,4 @@
-# $NetBSD: pkgconfig.mk,v 1.5 2014/04/07 17:40:49 apb Exp $
+# $NetBSD: pkgconfig.mk,v 1.6 2014/07/07 09:14:43 joerg Exp $
 
 .include bsd.own.mk
 
@@ -8,5 +8,5 @@ FILES+=${pkg}.pc
 FILESBUILD_${pkg}.pc=yes
 
 ${pkg}.pc: ${.CURDIR}/../../mkpc
-	${HOST_SH} ${.ALLSRC} ${OPENSSLSRC}/crypto ${.TARGET}  ${.TARGET}
+	CPPFLAGS=${CPPFLAGS:N-DOPENSSLDIR=*:N-DENGINESDIR=*:Q} CPP=${CPP:Q} ${HOST_SH} ${.ALLSRC} ${OPENSSLSRC}/crypto ${.TARGET}  ${.TARGET}
 .endfor



CVS commit: src/sys/arch/playstation2/dev

2014-07-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul  7 10:12:24 UTC 2014

Modified Files:
src/sys/arch/playstation2/dev: emac3.c

Log Message:
Add missing includes, use new style function declarations.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/playstation2/dev/emac3.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/playstation2/dev/emac3.c
diff -u src/sys/arch/playstation2/dev/emac3.c:1.9 src/sys/arch/playstation2/dev/emac3.c:1.10
--- src/sys/arch/playstation2/dev/emac3.c:1.9	Mon Mar 31 11:25:49 2014
+++ src/sys/arch/playstation2/dev/emac3.c	Mon Jul  7 10:12:24 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: emac3.c,v 1.9 2014/03/31 11:25:49 martin Exp $	*/
+/*	$NetBSD: emac3.c,v 1.10 2014/07/07 10:12:24 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -34,14 +34,16 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: emac3.c,v 1.9 2014/03/31 11:25:49 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: emac3.c,v 1.10 2014/07/07 10:12:24 martin Exp $);
 
 #include debug_playstation2.h
 
 #include sys/param.h
 #include sys/systm.h
 
+#include sys/device.h
 #include sys/socket.h
+#include sys/pmf.h
 
 #include net/if.h
 #include net/if_ether.h
@@ -62,7 +64,7 @@ int	emac3_debug = 0;
 		printf(%s:  fmt, __func__ , ##args) 
 #define	DPRINTFN(n, arg)		\
 	if (emac3_debug  (n))		\
-n		printf(%s:  fmt, __func__ , ##args) 
+		printf(%s:  fmt, __func__ , ##args) 
 #else
 #define STATIC			static
 #define	DPRINTF(arg...)		((void)0)
@@ -151,14 +153,14 @@ emac3_reset(struct emac3_softc *sc)
 }
 
 void
-emac3_enable()
+emac3_enable(void)
 {
 
 	_emac3_reg_write_4(EMAC3_MR0, MR0_TXE | MR0_RXE);
 }
 
 void
-emac3_disable()
+emac3_disable(void)
 {
 	int retry = 1;
 
@@ -175,21 +177,21 @@ emac3_disable()
 }
 
 void
-emac3_intr_enable()
+emac3_intr_enable(void)
 {
 
 	_emac3_reg_write_4(EMAC3_ISER, ~0);
 }
 
 void
-emac3_intr_disable()
+emac3_intr_disable(void)
 {
 
 	_emac3_reg_write_4(EMAC3_ISER, 0);
 }
 
 void
-emac3_intr_clear()
+emac3_intr_clear(void)
 {
 
 	_emac3_reg_write_4(EMAC3_ISR, _emac3_reg_read_4(EMAC3_ISR));
@@ -207,14 +209,14 @@ emac3_intr(void *arg)
 }
 
 void
-emac3_tx_kick()
+emac3_tx_kick(void)
 {
 	
 	_emac3_reg_write_4(EMAC3_TMR0, TMR0_GNP0);
 }
 
 int
-emac3_tx_done()
+emac3_tx_done(void)
 {
 
 	return (_emac3_reg_read_4(EMAC3_TMR0)  TMR0_GNP0);
@@ -256,7 +258,7 @@ allmulti:
 }
 
 int
-emac3_soft_reset()
+emac3_soft_reset(void)
 {
 	int retry = 1;
 
@@ -378,7 +380,7 @@ emac3_phy_statchg(struct device *dev)
 }
 
 int
-emac3_phy_ready()
+emac3_phy_ready(void)
 {
 	int retry = 1;
 



CVS commit: src/sys/net

2014-07-07 Thread Tyler R. Retzlaff
Module Name:src
Committed By:   rtr
Date:   Mon Jul  7 10:18:20 UTC 2014

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

Log Message:
return EOPNOTSUPP for pr_stat instead of returning success since we
don't fill in the struct stat passed to us.


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/net/rtsock.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/rtsock.c
diff -u src/sys/net/rtsock.c:1.150 src/sys/net/rtsock.c:1.151
--- src/sys/net/rtsock.c:1.150	Sun Jul  6 03:33:33 2014
+++ src/sys/net/rtsock.c	Mon Jul  7 10:18:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.150 2014/07/06 03:33:33 rtr Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.151 2014/07/07 10:18:20 rtr Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rtsock.c,v 1.150 2014/07/06 03:33:33 rtr Exp $);
+__KERNEL_RCSID(0, $NetBSD: rtsock.c,v 1.151 2014/07/07 10:18:20 rtr Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_inet.h
@@ -233,7 +233,7 @@ COMPATNAME(route_ioctl)(struct socket *s
 static int
 COMPATNAME(route_stat)(struct socket *so, struct stat *ub)
 {
-	return 0;
+	return EOPNOTSUPP;
 }
 
 static int



CVS commit: src/sys

2014-07-07 Thread Tyler R. Retzlaff
Module Name:src
Committed By:   rtr
Date:   Mon Jul  7 15:13:22 UTC 2014

Modified Files:
src/sys/net: rtsock.c
src/sys/netatalk: ddp_usrreq.c
src/sys/netbt: hci_socket.c l2cap_socket.c rfcomm_socket.c sco_socket.c
src/sys/netinet: raw_ip.c tcp_usrreq.c udp_usrreq.c
src/sys/netinet6: raw_ip6.c udp6_usrreq.c
src/sys/netipsec: keysock.c
src/sys/netnatm: natm.c
src/sys/rump/net/lib/libsockin: sockin.c

Log Message:
backout change that made pr_stat return EOPNOTSUPP for protocols that
were not filling in struct stat.

decision made after further discussion with rmind and investigation of
how other operating systems behave.  soo_stat() is doing just enough to
be able to call what gets returned valid and thus justifys a return of
success.

additional review will be done to determine of the pr_stat functions
that were already returning EOPNOTSUPP can be considered successful with
what soo_stat() is doing.


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/sys/net/rtsock.c
cvs rdiff -u -r1.49 -r1.50 src/sys/netatalk/ddp_usrreq.c
cvs rdiff -u -r1.28 -r1.29 src/sys/netbt/hci_socket.c
cvs rdiff -u -r1.19 -r1.20 src/sys/netbt/l2cap_socket.c
cvs rdiff -u -r1.20 -r1.21 src/sys/netbt/rfcomm_socket.c
cvs rdiff -u -r1.21 -r1.22 src/sys/netbt/sco_socket.c
cvs rdiff -u -r1.129 -r1.130 src/sys/netinet/raw_ip.c
cvs rdiff -u -r1.182 -r1.183 src/sys/netinet/tcp_usrreq.c
cvs rdiff -u -r1.204 -r1.205 src/sys/netinet/udp_usrreq.c
cvs rdiff -u -r1.123 -r1.124 src/sys/netinet6/raw_ip6.c
cvs rdiff -u -r1.103 -r1.104 src/sys/netinet6/udp6_usrreq.c
cvs rdiff -u -r1.31 -r1.32 src/sys/netipsec/keysock.c
cvs rdiff -u -r1.33 -r1.34 src/sys/netnatm/natm.c
cvs rdiff -u -r1.44 -r1.45 src/sys/rump/net/lib/libsockin/sockin.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/rtsock.c
diff -u src/sys/net/rtsock.c:1.151 src/sys/net/rtsock.c:1.152
--- src/sys/net/rtsock.c:1.151	Mon Jul  7 10:18:20 2014
+++ src/sys/net/rtsock.c	Mon Jul  7 15:13:21 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.151 2014/07/07 10:18:20 rtr Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.152 2014/07/07 15:13:21 rtr Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rtsock.c,v 1.151 2014/07/07 10:18:20 rtr Exp $);
+__KERNEL_RCSID(0, $NetBSD: rtsock.c,v 1.152 2014/07/07 15:13:21 rtr Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_inet.h
@@ -233,7 +233,7 @@ COMPATNAME(route_ioctl)(struct socket *s
 static int
 COMPATNAME(route_stat)(struct socket *so, struct stat *ub)
 {
-	return EOPNOTSUPP;
+	return 0;
 }
 
 static int

Index: src/sys/netatalk/ddp_usrreq.c
diff -u src/sys/netatalk/ddp_usrreq.c:1.49 src/sys/netatalk/ddp_usrreq.c:1.50
--- src/sys/netatalk/ddp_usrreq.c:1.49	Mon Jul  7 07:09:58 2014
+++ src/sys/netatalk/ddp_usrreq.c	Mon Jul  7 15:13:21 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ddp_usrreq.c,v 1.49 2014/07/07 07:09:58 rtr Exp $	 */
+/*	$NetBSD: ddp_usrreq.c,v 1.50 2014/07/07 15:13:21 rtr Exp $	 */
 
 /*
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ddp_usrreq.c,v 1.49 2014/07/07 07:09:58 rtr Exp $);
+__KERNEL_RCSID(0, $NetBSD: ddp_usrreq.c,v 1.50 2014/07/07 15:13:21 rtr Exp $);
 
 #include opt_mbuftrace.h
 
@@ -481,7 +481,8 @@ ddp_ioctl(struct socket *so, u_long cmd,
 static int
 ddp_stat(struct socket *so, struct stat *ub)
 {
-	return EOPNOTSUPP;
+	/* stat: don't bother with a blocksize. */
+	return 0;
 }
 
 /*

Index: src/sys/netbt/hci_socket.c
diff -u src/sys/netbt/hci_socket.c:1.28 src/sys/netbt/hci_socket.c:1.29
--- src/sys/netbt/hci_socket.c:1.28	Mon Jul  7 07:09:58 2014
+++ src/sys/netbt/hci_socket.c	Mon Jul  7 15:13:21 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci_socket.c,v 1.28 2014/07/07 07:09:58 rtr Exp $	*/
+/*	$NetBSD: hci_socket.c,v 1.29 2014/07/07 15:13:21 rtr Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hci_socket.c,v 1.28 2014/07/07 07:09:58 rtr Exp $);
+__KERNEL_RCSID(0, $NetBSD: hci_socket.c,v 1.29 2014/07/07 15:13:21 rtr Exp $);
 
 /* load symbolic names */
 #ifdef BLUETOOTH_DEBUG
@@ -496,7 +496,7 @@ hci_ioctl(struct socket *up, u_long cmd,
 static int
 hci_stat(struct socket *so, struct stat *ub)
 {
-	return EOPNOTSUPP;
+	return 0;
 }
 
 /*

Index: src/sys/netbt/l2cap_socket.c
diff -u src/sys/netbt/l2cap_socket.c:1.19 src/sys/netbt/l2cap_socket.c:1.20
--- src/sys/netbt/l2cap_socket.c:1.19	Mon Jul  7 07:09:58 2014
+++ src/sys/netbt/l2cap_socket.c	Mon Jul  7 15:13:21 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: l2cap_socket.c,v 1.19 2014/07/07 07:09:58 rtr Exp $	*/
+/*	$NetBSD: l2cap_socket.c,v 1.20 2014/07/07 15:13:21 rtr Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h

CVS commit: src/sys/dev/sbus

2014-07-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul  7 15:22:07 UTC 2014

Modified Files:
src/sys/dev/sbus: tcx.c

Log Message:
actually put the colour space ID where it belongs in tcx_clearscreen()


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/sbus/tcx.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/sbus/tcx.c
diff -u src/sys/dev/sbus/tcx.c:1.52 src/sys/dev/sbus/tcx.c:1.53
--- src/sys/dev/sbus/tcx.c:1.52	Tue Jun 24 05:04:14 2014
+++ src/sys/dev/sbus/tcx.c	Mon Jul  7 15:22:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcx.c,v 1.52 2014/06/24 05:04:14 macallan Exp $ */
+/*	$NetBSD: tcx.c,v 1.53 2014/07/07 15:22:07 macallan Exp $ */
 
 /*
  *  Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.52 2014/06/24 05:04:14 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: tcx.c,v 1.53 2014/07/07 15:22:07 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -903,9 +903,8 @@ tcx_clearscreen(struct tcx_softc *sc, in
 	uint64_t spc64;
 	int i, len;
 
-	bg |=  ((uint64_t)sc-sc_bg  32);
-	spc64 = (spc  3)  24;
-	bg |= spc64;
+	spc64 = ((spc  3)  24) | sc-sc_bg;
+	bg |= (spc64  32);
 
 	len = sc-sc_fb.fb_type.fb_width * sc-sc_fb.fb_type.fb_height;
 	for (i = 0; i  len; i += 32)



CVS commit: src/sys

2014-07-07 Thread Tyler R. Retzlaff
Module Name:src
Committed By:   rtr
Date:   Mon Jul  7 17:13:57 UTC 2014

Modified Files:
src/sys/kern: uipc_usrreq.c
src/sys/net: link_proto.c rtsock.c
src/sys/netatalk: ddp_usrreq.c
src/sys/netbt: hci_socket.c l2cap_socket.c rfcomm_socket.c sco_socket.c
src/sys/netinet: raw_ip.c tcp_usrreq.c udp_usrreq.c
src/sys/netinet6: raw_ip6.c udp6_usrreq.c
src/sys/netipsec: keysock.c
src/sys/netmpls: mpls_proto.c
src/sys/netnatm: natm.c
src/sys/rump/net/lib/libsockin: sockin.c

Log Message:
* sprinkle KASSERT(solocked(so)); in all pr_stat() functions.
* fix remaining inconsistent struct socket parameter names.


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/kern/uipc_usrreq.c
cvs rdiff -u -r1.13 -r1.14 src/sys/net/link_proto.c
cvs rdiff -u -r1.152 -r1.153 src/sys/net/rtsock.c
cvs rdiff -u -r1.50 -r1.51 src/sys/netatalk/ddp_usrreq.c
cvs rdiff -u -r1.29 -r1.30 src/sys/netbt/hci_socket.c
cvs rdiff -u -r1.20 -r1.21 src/sys/netbt/l2cap_socket.c
cvs rdiff -u -r1.21 -r1.22 src/sys/netbt/rfcomm_socket.c
cvs rdiff -u -r1.22 -r1.23 src/sys/netbt/sco_socket.c
cvs rdiff -u -r1.130 -r1.131 src/sys/netinet/raw_ip.c
cvs rdiff -u -r1.183 -r1.184 src/sys/netinet/tcp_usrreq.c
cvs rdiff -u -r1.205 -r1.206 src/sys/netinet/udp_usrreq.c
cvs rdiff -u -r1.124 -r1.125 src/sys/netinet6/raw_ip6.c
cvs rdiff -u -r1.104 -r1.105 src/sys/netinet6/udp6_usrreq.c
cvs rdiff -u -r1.32 -r1.33 src/sys/netipsec/keysock.c
cvs rdiff -u -r1.12 -r1.13 src/sys/netmpls/mpls_proto.c
cvs rdiff -u -r1.34 -r1.35 src/sys/netnatm/natm.c
cvs rdiff -u -r1.45 -r1.46 src/sys/rump/net/lib/libsockin/sockin.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/kern/uipc_usrreq.c
diff -u src/sys/kern/uipc_usrreq.c:1.156 src/sys/kern/uipc_usrreq.c:1.157
--- src/sys/kern/uipc_usrreq.c:1.156	Sun Jul  6 03:33:33 2014
+++ src/sys/kern/uipc_usrreq.c	Mon Jul  7 17:13:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.156 2014/07/06 03:33:33 rtr Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.157 2014/07/07 17:13:56 rtr Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uipc_usrreq.c,v 1.156 2014/07/06 03:33:33 rtr Exp $);
+__KERNEL_RCSID(0, $NetBSD: uipc_usrreq.c,v 1.157 2014/07/07 17:13:56 rtr Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -854,6 +854,8 @@ unp_stat(struct socket *so, struct stat 
 	struct unpcb *unp;
 	struct socket *so2;
 
+	KASSERT(solocked(so));
+
 	unp = sotounpcb(so);
 	if (unp == NULL)
 		return EINVAL;

Index: src/sys/net/link_proto.c
diff -u src/sys/net/link_proto.c:1.13 src/sys/net/link_proto.c:1.14
--- src/sys/net/link_proto.c:1.13	Sun Jul  6 16:06:19 2014
+++ src/sys/net/link_proto.c	Mon Jul  7 17:13:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: link_proto.c,v 1.13 2014/07/06 16:06:19 rtr Exp $	*/
+/*	$NetBSD: link_proto.c,v 1.14 2014/07/07 17:13:56 rtr Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: link_proto.c,v 1.13 2014/07/06 16:06:19 rtr Exp $);
+__KERNEL_RCSID(0, $NetBSD: link_proto.c,v 1.14 2014/07/07 17:13:56 rtr Exp $);
 
 #include sys/param.h
 #include sys/socket.h
@@ -242,6 +242,8 @@ link_ioctl(struct socket *so, u_long cmd
 static int
 link_stat(struct socket *so, struct stat *ub)
 {
+	KASSERT(solocked(so));
+
 	return EOPNOTSUPP;
 }
 

Index: src/sys/net/rtsock.c
diff -u src/sys/net/rtsock.c:1.152 src/sys/net/rtsock.c:1.153
--- src/sys/net/rtsock.c:1.152	Mon Jul  7 15:13:21 2014
+++ src/sys/net/rtsock.c	Mon Jul  7 17:13:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.152 2014/07/07 15:13:21 rtr Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.153 2014/07/07 17:13:56 rtr Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rtsock.c,v 1.152 2014/07/07 15:13:21 rtr Exp $);
+__KERNEL_RCSID(0, $NetBSD: rtsock.c,v 1.153 2014/07/07 17:13:56 rtr Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_inet.h
@@ -233,6 +233,8 @@ COMPATNAME(route_ioctl)(struct socket *s
 static int
 COMPATNAME(route_stat)(struct socket *so, struct stat *ub)
 {
+	KASSERT(solocked(so));
+
 	return 0;
 }
 

Index: src/sys/netatalk/ddp_usrreq.c
diff -u src/sys/netatalk/ddp_usrreq.c:1.50 src/sys/netatalk/ddp_usrreq.c:1.51
--- src/sys/netatalk/ddp_usrreq.c:1.50	Mon Jul  7 15:13:21 2014
+++ src/sys/netatalk/ddp_usrreq.c	Mon Jul  7 17:13:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ddp_usrreq.c,v 1.50 2014/07/07 15:13:21 rtr Exp $	 */
+/*	$NetBSD: ddp_usrreq.c,v 1.51 2014/07/07 17:13:56 rtr Exp $	 */
 
 /*
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ddp_usrreq.c,v 1.50 2014/07/07 15:13:21 rtr Exp $);
+__KERNEL_RCSID(0, 

CVS commit: src/sbin/fsck_msdos

2014-07-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jul  7 17:45:42 UTC 2014

Modified Files:
src/sbin/fsck_msdos: dir.c fat.c

Log Message:
From: http://marc.info/?t=14030431075r=1w=2
When truncating cluster chains fix the length of the cluster head.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sbin/fsck_msdos/dir.c
cvs rdiff -u -r1.24 -r1.25 src/sbin/fsck_msdos/fat.c

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

Modified files:

Index: src/sbin/fsck_msdos/dir.c
diff -u src/sbin/fsck_msdos/dir.c:1.25 src/sbin/fsck_msdos/dir.c:1.26
--- src/sbin/fsck_msdos/dir.c:1.25	Sun Feb 20 16:42:50 2011
+++ src/sbin/fsck_msdos/dir.c	Mon Jul  7 13:45:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.25 2011/02/20 21:42:50 christos Exp $	*/
+/*	$NetBSD: dir.c,v 1.26 2014/07/07 17:45:42 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
@@ -30,7 +30,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: dir.c,v 1.25 2011/02/20 21:42:50 christos Exp $);
+__RCSID($NetBSD: dir.c,v 1.26 2014/07/07 17:45:42 christos Exp $);
 #endif /* not lint */
 
 #include stdio.h
@@ -420,12 +420,14 @@ checksize(struct bootblock *boot, struct
 		  fullpath(dir));
 		if (ask(1, Drop superfluous clusters)) {
 			cl_t cl;
-			u_int32_t sz = 0;
+			u_int32_t sz, len;
 
-			for (cl = dir-head; (sz += boot-ClusterSize)  dir-size;)
+			for (cl = dir-head, len = sz = 0;
+			(sz += boot-ClusterSize)  dir-size; len++)
 cl = fat[cl].next;
 			clearchain(boot, fat, fat[cl].next);
 			fat[cl].next = CLUST_EOF;
+			fat[dir-head].length = len;
 			return FSFATMOD;
 		} else
 			return FSERROR;

Index: src/sbin/fsck_msdos/fat.c
diff -u src/sbin/fsck_msdos/fat.c:1.24 src/sbin/fsck_msdos/fat.c:1.25
--- src/sbin/fsck_msdos/fat.c:1.24	Thu Jan 17 11:45:48 2013
+++ src/sbin/fsck_msdos/fat.c	Mon Jul  7 13:45:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fat.c,v 1.24 2013/01/17 16:45:48 jakllsch Exp $	*/
+/*	$NetBSD: fat.c,v 1.25 2014/07/07 17:45:42 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: fat.c,v 1.24 2013/01/17 16:45:48 jakllsch Exp $);
+__RCSID($NetBSD: fat.c,v 1.25 2014/07/07 17:45:42 christos Exp $);
 #endif /* not lint */
 
 #include stdlib.h
@@ -355,7 +355,15 @@ tryclear(struct bootblock *boot, struct 
 		clearchain(boot, fat, head);
 		return FSFATMOD;
 	} else if (ask(0, Truncate)) {
+		uint32_t len;
+		cl_t p;
+
+		for (p = head, len = 0;
+		p = CLUST_FIRST  p  boot-NumClusters;
+		p = fat[p].next, len++)
+			continue;
 		*truncp = CLUST_EOF;
+		fat[head].length = len;
 		return FSFATMOD;
 	} else
 		return FSERROR;



CVS commit: src/sbin/fsck_msdos

2014-07-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jul  7 17:55:53 UTC 2014

Modified Files:
src/sbin/fsck_msdos: fat.c

Log Message:
From: http://marc.info/?l=openbsd-techm=140275150804337w=2
Avoid infinite loops in cluster chain linked lists.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sbin/fsck_msdos/fat.c

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

Modified files:

Index: src/sbin/fsck_msdos/fat.c
diff -u src/sbin/fsck_msdos/fat.c:1.25 src/sbin/fsck_msdos/fat.c:1.26
--- src/sbin/fsck_msdos/fat.c:1.25	Mon Jul  7 13:45:42 2014
+++ src/sbin/fsck_msdos/fat.c	Mon Jul  7 13:55:53 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fat.c,v 1.25 2014/07/07 17:45:42 christos Exp $	*/
+/*	$NetBSD: fat.c,v 1.26 2014/07/07 17:55:53 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: fat.c,v 1.25 2014/07/07 17:45:42 christos Exp $);
+__RCSID($NetBSD: fat.c,v 1.26 2014/07/07 17:55:53 christos Exp $);
 #endif /* not lint */
 
 #include stdlib.h
@@ -413,10 +413,10 @@ checkfat(struct bootblock *boot, struct 
 			continue;
 
 		/* follow the chain to its end (hopefully) */
-		for (p = head;
+		for (len = fat[head].length, p = head;
 		 (n = fat[p].next) = CLUST_FIRST  n  boot-NumClusters;
 		 p = n)
-			if (fat[n].head != head)
+			if (fat[n].head != head || len--  2)
 break;
 		if (n = CLUST_EOFS)
 			continue;
@@ -424,14 +424,20 @@ checkfat(struct bootblock *boot, struct 
 		if (n == CLUST_FREE || n = CLUST_RSRVD) {
 			pwarn(Cluster chain starting at %u ends with cluster marked %s\n,
 			  head, rsrvdcltype(n));
+clear:
 			ret |= tryclear(boot, fat, head, fat[p].next);
 			continue;
 		}
 		if (n  CLUST_FIRST || n = boot-NumClusters) {
 			pwarn(Cluster chain starting at %u ends with cluster out of range (%u)\n,
-			  head, n);
-			ret |= tryclear(boot, fat, head, fat[p].next);
-			continue;
+			head, n);
+			goto clear;
+		}
+		if (head == fat[n].head) {
+			pwarn(Cluster chain starting at %u loops at cluster %u\n,
+			
+			head, p);
+			goto clear;
 		}
 		pwarn(Cluster chains starting at %u and %u are linked at cluster %u\n,
 		  head, fat[n].head, n);



CVS commit: src/sbin/fsck_msdos

2014-07-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jul  7 18:46:45 UTC 2014

Modified Files:
src/sbin/fsck_msdos: fat.c

Log Message:
From: http://marc.info/?l=openbsd-techm=140234174104724w=2
Avoid off-by-one on FAT12 filesystems.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sbin/fsck_msdos/fat.c

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

Modified files:

Index: src/sbin/fsck_msdos/fat.c
diff -u src/sbin/fsck_msdos/fat.c:1.26 src/sbin/fsck_msdos/fat.c:1.27
--- src/sbin/fsck_msdos/fat.c:1.26	Mon Jul  7 13:55:53 2014
+++ src/sbin/fsck_msdos/fat.c	Mon Jul  7 14:46:45 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fat.c,v 1.26 2014/07/07 17:55:53 christos Exp $	*/
+/*	$NetBSD: fat.c,v 1.27 2014/07/07 18:46:45 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: fat.c,v 1.26 2014/07/07 17:55:53 christos Exp $);
+__RCSID($NetBSD: fat.c,v 1.27 2014/07/07 18:46:45 christos Exp $);
 #endif /* not lint */
 
 #include stdlib.h
@@ -554,13 +554,15 @@ writefat(int fs, struct bootblock *boot,
 		default:
 			if (fat[cl].next == CLUST_FREE)
 boot-NumFree++;
-			if (cl + 1  boot-NumClusters
-			 fat[cl + 1].next == CLUST_FREE)
-boot-NumFree++;
 			*p++ = (u_char)fat[cl].next;
-			*p++ = (u_char)((fat[cl].next  8)  0xf)
-			   |(u_char)(fat[cl+1].next  4);
-			*p++ = (u_char)(fat[++cl].next  4);
+			*p++ = (u_char)((fat[cl].next  8)  0xf);
+			cl++;
+			if (cl = boot-NumClusters)
+break;
+			if (fat[cl].next == CLUST_FREE)
+boot-NumFree++;
+			*p |= (u_char)(fat[cl + 1].next  4);
+			*p++ = (u_char)(fat[cl + 1].next  4);
 			break;
 		}
 	}



CVS commit: src/sbin/fsck_msdos

2014-07-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jul  7 19:04:37 UTC 2014

Modified Files:
src/sbin/fsck_msdos: boot.c

Log Message:
From: http://marc.info/?l=openbsd-techm=140354518512871w=2
more consistency checks


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sbin/fsck_msdos/boot.c

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

Modified files:

Index: src/sbin/fsck_msdos/boot.c
diff -u src/sbin/fsck_msdos/boot.c:1.15 src/sbin/fsck_msdos/boot.c:1.16
--- src/sbin/fsck_msdos/boot.c:1.15	Sat Apr 11 03:14:50 2009
+++ src/sbin/fsck_msdos/boot.c	Mon Jul  7 15:04:37 2014
@@ -1,4 +1,3 @@
-/*	$NetBSD: boot.c,v 1.15 2009/04/11 07:14:50 lukem Exp $	*/
 
 /*
  * Copyright (C) 1995, 1997 Wolfgang Solfrank
@@ -28,11 +27,12 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: boot.c,v 1.15 2009/04/11 07:14:50 lukem Exp $);
+__RCSID($NetBSD: boot.c,v 1.16 2014/07/07 19:04:37 christos Exp $);
 #endif /* not lint */
 
 #include stdlib.h
 #include string.h
+#include strings.h
 #include stdio.h
 #include unistd.h
 
@@ -64,8 +64,16 @@ readboot(int dosfs, struct bootblock *bo
 	/* decode bios parameter block */
 	boot-BytesPerSec = block[11] + (block[12]  8);
 	boot-SecPerClust = block[13];
+	if (boot-SecPerClust == 0 || popcount(boot-SecPerClust) != 1) {
+ 		pfatal(Invalid cluster size: %u\n, boot-SecPerClust);
+		return FSFATAL;
+	}
 	boot-ResSectors = block[14] + (block[15]  8);
 	boot-FATs = block[16];
+	if (boot-FATs == 0) {
+		pfatal(Invalid number of FATs: %u\n, boot-FATs);
+		return FSFATAL;
+	}
 	boot-RootDirEnts = block[17] + (block[18]  8);
 	boot-Sectors = block[19] + (block[20]  8);
 	boot-Media = block[21];
@@ -171,6 +179,10 @@ readboot(int dosfs, struct bootblock *bo
 		}
 		/* Check backup FSInfo?	XXX */
 	}
+	if (boot-FATsecs == 0) {
+		pfatal(Invalid number of FAT sectors: %u\n, boot-FATsecs);
+		return FSFATAL;
+	}
 
 	boot-ClusterOffset = (boot-RootDirEnts * 32 + boot-BytesPerSec - 1)
 	/ boot-BytesPerSec
@@ -193,6 +205,12 @@ readboot(int dosfs, struct bootblock *bo
 		boot-NumSectors = boot-HugeSectors;
 	boot-NumClusters = (boot-NumSectors - boot-ClusterOffset) / boot-SecPerClust;
 
+	if (boot-ClusterOffset  boot-NumSectors) {
+		pfatal(Cluster offset too large (%u clusters)\n,
+		boot-ClusterOffset);
+		return FSFATAL;
+	}
+
 	if (boot-flagsFAT32)
 		boot-ClustMask = CLUST32_MASK;
 	else if (boot-NumClusters  (CLUST_RSRVDCLUST12_MASK))



CVS commit: src/tests/net/bpf

2014-07-07 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Mon Jul  7 19:40:28 UTC 2014

Added Files:
src/tests/net/bpf: t_mbuf.c

Log Message:
Add rump tests for checking how bpf_validate() works with mbuf chains.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/net/bpf/t_mbuf.c

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

Added files:

Index: src/tests/net/bpf/t_mbuf.c
diff -u /dev/null src/tests/net/bpf/t_mbuf.c:1.1
--- /dev/null	Mon Jul  7 19:40:28 2014
+++ src/tests/net/bpf/t_mbuf.c	Mon Jul  7 19:40:28 2014
@@ -0,0 +1,963 @@
+/*	$NetBSD: t_mbuf.c,v 1.1 2014/07/07 19:40:28 alnsn Exp $	*/
+
+/*-
+ * Copyright (c) 2014 Alexander Nasonov.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__RCSID($NetBSD: t_mbuf.c,v 1.1 2014/07/07 19:40:28 alnsn Exp $);
+
+#include sys/param.h
+#include sys/mbuf.h
+#include unistd.h
+
+#include net/bpf.h
+
+#include stdint.h
+#include stdio.h
+#include string.h
+
+#include rump/rump.h
+#include rump/rump_syscalls.h
+
+#include ../../net/bpf/h_bpf.h
+
+/* XXX: atf-c.h has collisions with mbuf */
+#undef m_type
+#undef m_data
+#include atf-c.h
+
+#include ../../h_macros.h
+
+static bool
+test_ldb_abs(size_t split)
+{
+	/* Return a product of all packet bytes. */
+	static struct bpf_insn insns[] = {
+		BPF_STMT(BPF_LDX+BPF_W+BPF_IMM, 1), /* X - 1 */
+
+		BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 0),  /* A - P[0]  */
+		BPF_STMT(BPF_ALU+BPF_MUL+BPF_X, 0), /* A - A * X */
+		BPF_STMT(BPF_MISC+BPF_TAX, 0),  /* X - A */
+
+		BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 1),  /* A - P[1]  */
+		BPF_STMT(BPF_ALU+BPF_MUL+BPF_X, 0), /* A - A * X */
+		BPF_STMT(BPF_MISC+BPF_TAX, 0),  /* X - A */
+
+		BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 2),  /* A - P[2]  */
+		BPF_STMT(BPF_ALU+BPF_MUL+BPF_X, 0), /* A - A * X */
+		BPF_STMT(BPF_MISC+BPF_TAX, 0),  /* X - A */
+
+		BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 3),  /* A - P[3]  */
+		BPF_STMT(BPF_ALU+BPF_MUL+BPF_X, 0), /* A - A * X */
+		BPF_STMT(BPF_MISC+BPF_TAX, 0),  /* X - A */
+
+		BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 4),  /* A - P[4]  */
+		BPF_STMT(BPF_ALU+BPF_MUL+BPF_X, 0), /* A - A * X */
+		BPF_STMT(BPF_RET+BPF_A, 0), /* ret A  */
+	};
+
+	static char P[] = { 1, 2, 3, 4, 5 };
+	const unsigned int res = 120;
+
+	if (!prog_validate(insns, sizeof(insns) / sizeof(insns[0])))
+		return false;
+
+	return interp_prog_mchain2(insns, P, sizeof(P), split) == res;
+}
+
+static bool
+test_ldh_abs(size_t split)
+{
+	static struct bpf_insn insns[] = {
+		BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 0),  /* A - P[0:2]  */
+		BPF_STMT(BPF_ALU+BPF_ADD+BPF_X, 0), /* A - A + X   */
+		BPF_STMT(BPF_MISC+BPF_TAX, 0),  /* X - A   */
+
+		BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 1),  /* A - P[1:2]  */
+		BPF_STMT(BPF_ALU+BPF_ADD+BPF_X, 0), /* A - A + X   */
+		BPF_STMT(BPF_MISC+BPF_TAX, 0),  /* X - A   */
+
+		BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 2),  /* A - P[2:2]  */
+		BPF_STMT(BPF_ALU+BPF_ADD+BPF_X, 0), /* A - A + X   */
+		BPF_STMT(BPF_MISC+BPF_TAX, 0),  /* X - A   */
+
+		BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 3),  /* A - P[3:2]  */
+		BPF_STMT(BPF_ALU+BPF_ADD+BPF_X, 0), /* A - A + X   */
+		BPF_STMT(BPF_RET+BPF_A, 0), /* ret A*/
+	};
+
+	static char P[] = { 1, 2, 3, 4, 5 };
+	const unsigned int res = 0x0a0e; /* 10 14 */
+
+	if (!prog_validate(insns, sizeof(insns) / sizeof(insns[0])))
+		return false;
+
+	return interp_prog_mchain2(insns, P, sizeof(P), split) == res;
+}
+
+static bool
+test_ldw_abs(size_t split)
+{
+	static struct bpf_insn insns[] = {
+		BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 0),  /* A - P[0:4] */
+		BPF_STMT(BPF_ALU+BPF_ADD+BPF_X, 0), /* A - A + X  */
+		

CVS commit: src

2014-07-07 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Mon Jul  7 19:41:22 UTC 2014

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/net/bpf: Makefile

Log Message:
Add bpf/t_mbuf test to the build.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.576 -r1.577 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.4 -r1.5 src/tests/net/bpf/Makefile

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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.67 src/distrib/sets/lists/debug/mi:1.68
--- src/distrib/sets/lists/debug/mi:1.67	Sun Jul  6 21:06:48 2014
+++ src/distrib/sets/lists/debug/mi	Mon Jul  7 19:41:22 2014
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.67 2014/07/06 21:06:48 tron Exp $
+# $NetBSD: mi,v 1.68 2014/07/07 19:41:22 alnsn Exp $
 
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib
@@ -2125,6 +2125,7 @@
 ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_dlvsym.debug		tests-libexec-debug	debug,atf,pic
 ./usr/libdata/debug/usr/tests/net/bpf/t_bpf.debug		tests-net-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/net/bpf/t_div-by-zero.debug		tests-net-debug		debug,atf,rump
+./usr/libdata/debug/usr/tests/net/bpf/t_mbuf.debug		tests-net-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/net/bpfilter/t_bpfilter.debug		tests-net-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/net/bpfjit/t_bpfjit.debug		tests-net-debug		debug,atf,sljit,rump
 ./usr/libdata/debug/usr/tests/net/carp/t_basic.debug		tests-net-debug		debug,atf,rump

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.576 src/distrib/sets/lists/tests/mi:1.577
--- src/distrib/sets/lists/tests/mi:1.576	Tue Jul  1 03:43:09 2014
+++ src/distrib/sets/lists/tests/mi	Mon Jul  7 19:41:22 2014
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.576 2014/07/01 03:43:09 htodd Exp $
+# $NetBSD: mi,v 1.577 2014/07/07 19:41:22 alnsn Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -3081,6 +3081,7 @@
 ./usr/tests/net/bpf/Kyuafile			tests-net-tests		atf,rump,kyua
 ./usr/tests/net/bpf/t_bpf		tests-net-tests		atf,rump
 ./usr/tests/net/bpf/t_div-by-zero		tests-net-tests		atf,rump
+./usr/tests/net/bpf/t_mbuf		tests-net-tests		atf,rump
 ./usr/tests/net/bpfilter			tests-net-tests
 ./usr/tests/net/bpfilter/Atffile		tests-net-tests		atf,rump
 ./usr/tests/net/bpfilter/Kyuafile		tests-net-tests		atf,rump,kyua

Index: src/tests/net/bpf/Makefile
diff -u src/tests/net/bpf/Makefile:1.4 src/tests/net/bpf/Makefile:1.5
--- src/tests/net/bpf/Makefile:1.4	Tue Jun 10 04:28:40 2014
+++ src/tests/net/bpf/Makefile	Mon Jul  7 19:41:22 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2014/06/10 04:28:40 he Exp $
+# $NetBSD: Makefile,v 1.5 2014/07/07 19:41:22 alnsn Exp $
 #
 
 .include bsd.own.mk
@@ -7,6 +7,7 @@ TESTSDIR=	${TESTSBASE}/net/bpf
 
 TESTS_C=	t_bpf
 TESTS_C+=	t_div-by-zero
+TESTS_C+=	t_mbuf
 
 LDADD+=		-lrumpnet_shmif
 LDADD+=		-lrumpdev_bpf -lrumpdev -lrumpnet_netinet -lrumpnet_net



CVS commit: src/tests/net/bpf

2014-07-07 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Mon Jul  7 19:34:32 UTC 2014

Added Files:
src/tests/net/bpf: h_bpf.h

Log Message:
Add some helper functions for bpf/bpfjit rump tests.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/net/bpf/h_bpf.h

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

Added files:

Index: src/tests/net/bpf/h_bpf.h
diff -u /dev/null src/tests/net/bpf/h_bpf.h:1.1
--- /dev/null	Mon Jul  7 19:34:32 2014
+++ src/tests/net/bpf/h_bpf.h	Mon Jul  7 19:34:32 2014
@@ -0,0 +1,143 @@
+/*	$NetBSD: h_bpf.h,v 1.1 2014/07/07 19:34:32 alnsn Exp $	*/
+
+/*-
+ * Copyright (c) 2014 Alexander Nasonov.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _TESTS_NET_BPF_H_BPF_H_
+#define _TESTS_NET_BPF_H_BPF_H_
+
+#include sys/param.h
+#include sys/mbuf.h
+
+#include net/bpf.h
+#include net/bpfjit.h
+
+#include rump/rump.h
+#include rump/rump_syscalls.h
+
+#include stdint.h
+#include string.h
+
+/* XXX These declarations don't look kosher. */
+int rumpns_bpf_validate(const struct bpf_insn *, int);
+unsigned int rumpns_bpf_filter_ext(const bpf_ctx_t *,
+const struct bpf_insn *, bpf_args_t *);
+bpfjit_func_t rumpns_bpfjit_generate_code(const bpf_ctx_t *,
+const struct bpf_insn *, size_t);
+void rumpns_bpfjit_free_code(bpfjit_func_t);
+
+/*
+ * Init mbuf chain with one or two chunks. The first chunk holds
+ * [pkt, pkt + split] bytes, the second chunk (if it's not empty)
+ * holds (pkt + split, pkt + pktsize) bytes.
+ * The function returns (const uint8_t *)mb1.
+ */
+static inline const uint8_t *
+init_mchain2(struct mbuf *mb1, struct mbuf *mb2,
+char pkt[], size_t pktsize, size_t split)
+{
+
+	(void)memset(mb1, 0, sizeof(*mb1));
+	mb1-m_data = pkt;
+	mb1-m_next = (split  pktsize) ? mb2 : NULL;
+	mb1-m_len = (split  pktsize) ? split : pktsize;
+
+	if (split  pktsize) {
+		(void)memset(mb2, 0, sizeof(*mb2));
+		mb2-m_next = NULL;
+		mb2-m_data = pkt[split];
+		mb2-m_len = pktsize - split;
+	}
+
+	return (const uint8_t*)mb1;
+}
+
+/*
+ * Interpret a filter program with mbuf chain passed to bpf_filter_ext().
+ */
+static inline unsigned int
+interp_prog_mchain2(struct bpf_insn *insns,
+char *pkt, size_t pktsize, size_t split)
+{
+	uint32_t mem[BPF_MEMWORDS];
+	struct mbuf mb1, mb2;
+	bpf_args_t args;
+	unsigned int res;
+
+	args.pkt = init_mchain2(mb1, mb2, pkt, pktsize, split);
+	args.buflen = 0;
+	args.wirelen = pktsize;
+	args.mem = mem;
+
+	rump_schedule();
+	res = rumpns_bpf_filter_ext(NULL, insns, args);
+	rump_unschedule();
+
+	return res;
+}
+
+/*
+ * Compile and run a filter program with mbuf chain passed to compiled function.
+ */
+static inline unsigned int
+exec_prog_mchain2(struct bpf_insn *insns, size_t insn_count,
+char *pkt, size_t pktsize, size_t split)
+{
+	bpfjit_func_t fn;
+	struct mbuf mb1, mb2;
+	bpf_args_t args;
+	unsigned int res;
+
+	args.pkt = init_mchain2(mb1, mb2, pkt, pktsize, split);
+	args.buflen = 0;
+	args.wirelen = pktsize;
+
+	rump_schedule();
+	fn = rumpns_bpfjit_generate_code(NULL, insns, insn_count);
+	rump_unschedule();
+
+	res = fn(NULL, args);
+
+	rump_schedule();
+	rumpns_bpfjit_free_code(fn);
+	rump_unschedule();
+
+	return res;
+}
+
+static inline bool
+prog_validate(struct bpf_insn *insns, size_t insn_count)
+{
+	bool res;
+
+	rump_schedule();
+	res = rumpns_bpf_validate(insns, insn_count);
+	rump_unschedule();
+
+	return res;
+}
+
+#endif /* _TESTS_NET_BPF_H_BPF_H_ */



CVS commit: src/sys/net

2014-07-07 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Mon Jul  7 19:56:03 UTC 2014

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

Log Message:
Arithmetic overflow when calculating variable offsets (BPF_LD+BPF_IND
instructions) should be handled uniformly for contiguous buffers and mbufs.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/net/bpf_filter.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/bpf_filter.c
diff -u src/sys/net/bpf_filter.c:1.66 src/sys/net/bpf_filter.c:1.67
--- src/sys/net/bpf_filter.c:1.66	Sat Jul  5 22:06:11 2014
+++ src/sys/net/bpf_filter.c	Mon Jul  7 19:56:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf_filter.c,v 1.66 2014/07/05 22:06:11 alnsn Exp $	*/
+/*	$NetBSD: bpf_filter.c,v 1.67 2014/07/07 19:56:03 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bpf_filter.c,v 1.66 2014/07/05 22:06:11 alnsn Exp $);
+__KERNEL_RCSID(0, $NetBSD: bpf_filter.c,v 1.67 2014/07/07 19:56:03 alnsn Exp $);
 
 #if 0
 #if !(defined(lint) || defined(KERNEL))
@@ -327,13 +327,12 @@ bpf_filter(const struct bpf_insn *pc, co
 
 		case BPF_LD|BPF_W|BPF_IND:
 			k = X + pc-k;
-			if (pc-k  args-buflen ||
-			X  args-buflen - pc-k ||
+			if (k  X || k = args-buflen ||
 			sizeof(int32_t)  args-buflen - k) {
 #ifdef _KERNEL
 int merr;
 
-if (args-buflen != 0)
+if (k  X || args-buflen != 0)
 	return 0;
 A = xword(args-pkt, k, merr);
 if (merr != 0)
@@ -348,13 +347,12 @@ bpf_filter(const struct bpf_insn *pc, co
 
 		case BPF_LD|BPF_H|BPF_IND:
 			k = X + pc-k;
-			if (pc-k  args-buflen ||
-			X  args-buflen - pc-k ||
+			if (k  X || k = args-buflen ||
 			sizeof(int16_t)  args-buflen - k) {
 #ifdef _KERNEL
 int merr;
 
-if (args-buflen != 0)
+if (k  X || args-buflen != 0)
 	return 0;
 A = xhalf(args-pkt, k, merr);
 if (merr != 0)
@@ -369,12 +367,11 @@ bpf_filter(const struct bpf_insn *pc, co
 
 		case BPF_LD|BPF_B|BPF_IND:
 			k = X + pc-k;
-			if (pc-k = args-buflen ||
-			X = args-buflen - pc-k) {
+			if (k  X || k = args-buflen) {
 #ifdef _KERNEL
 int merr;
 
-if (args-buflen != 0)
+if (k  X || args-buflen != 0)
 	return 0;
 A = xbyte(args-pkt, k, merr);
 if (merr != 0)



CVS commit: src/sys

2014-07-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul  7 20:14:43 UTC 2014

Modified Files:
src/sys/kern: init_main.c
src/sys/uvm: uvm_bio.c uvm_extern.h

Log Message:
Initialize ubchist earlier.


To generate a diff of this commit:
cvs rdiff -u -r1.456 -r1.457 src/sys/kern/init_main.c
cvs rdiff -u -r1.80 -r1.81 src/sys/uvm/uvm_bio.c
cvs rdiff -u -r1.190 -r1.191 src/sys/uvm/uvm_extern.h

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

Modified files:

Index: src/sys/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.456 src/sys/kern/init_main.c:1.457
--- src/sys/kern/init_main.c:1.456	Mon May 19 23:33:19 2014
+++ src/sys/kern/init_main.c	Mon Jul  7 20:14:43 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.456 2014/05/19 23:33:19 rmind Exp $	*/
+/*	$NetBSD: init_main.c,v 1.457 2014/07/07 20:14:43 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: init_main.c,v 1.456 2014/05/19 23:33:19 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: init_main.c,v 1.457 2014/07/07 20:14:43 riastradh Exp $);
 
 #include opt_ddb.h
 #include opt_ipsec.h
@@ -307,6 +307,7 @@ main(void)
 	evcnt_init();
 
 	uvm_init();
+	ubchist_init();
 	kcpuset_sysinit();
 
 	prop_kern_init();

Index: src/sys/uvm/uvm_bio.c
diff -u src/sys/uvm/uvm_bio.c:1.80 src/sys/uvm/uvm_bio.c:1.81
--- src/sys/uvm/uvm_bio.c:1.80	Fri Oct 25 20:23:33 2013
+++ src/sys/uvm/uvm_bio.c	Mon Jul  7 20:14:43 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_bio.c,v 1.80 2013/10/25 20:23:33 martin Exp $	*/
+/*	$NetBSD: uvm_bio.c,v 1.81 2014/07/07 20:14:43 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998 Chuck Silvers.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_bio.c,v 1.80 2013/10/25 20:23:33 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_bio.c,v 1.81 2014/07/07 20:14:43 riastradh Exp $);
 
 #include opt_uvmhist.h
 #include opt_ubc.h
@@ -210,6 +210,12 @@ ubc_init(void)
 UVM_ADV_RANDOM, UVM_FLAG_NOMERGE)) != 0) {
 		panic(ubc_init: failed to map ubc_object);
 	}
+}
+
+void
+ubchist_init(void)
+{
+
 	UVMHIST_INIT(ubchist, 300);
 }
 

Index: src/sys/uvm/uvm_extern.h
diff -u src/sys/uvm/uvm_extern.h:1.190 src/sys/uvm/uvm_extern.h:1.191
--- src/sys/uvm/uvm_extern.h:1.190	Thu May 22 14:01:46 2014
+++ src/sys/uvm/uvm_extern.h	Mon Jul  7 20:14:43 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_extern.h,v 1.190 2014/05/22 14:01:46 riastradh Exp $	*/
+/*	$NetBSD: uvm_extern.h,v 1.191 2014/07/07 20:14:43 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -545,6 +545,7 @@ void			uao_reference(struct uvm_object *
 
 /* uvm_bio.c */
 void			ubc_init(void);
+void			ubchist_init(void);
 void *			ubc_alloc(struct uvm_object *, voff_t, vsize_t *, int,
 			int);
 void			ubc_release(void *, int);



CVS commit: src/sys/external/bsd/drm2/drm

2014-07-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul  7 20:21:31 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/drm: drm_drv.c

Log Message:
Hook up drm suspend/resume.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/drm/drm_drv.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/external/bsd/drm2/drm/drm_drv.c
diff -u src/sys/external/bsd/drm2/drm/drm_drv.c:1.5 src/sys/external/bsd/drm2/drm/drm_drv.c:1.6
--- src/sys/external/bsd/drm2/drm/drm_drv.c:1.5	Fri Jun 13 00:47:08 2014
+++ src/sys/external/bsd/drm2/drm/drm_drv.c	Mon Jul  7 20:21:31 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_drv.c,v 1.5 2014/06/13 00:47:08 riastradh Exp $	*/
+/*	$NetBSD: drm_drv.c,v 1.6 2014/07/07 20:21:31 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: drm_drv.c,v 1.5 2014/06/13 00:47:08 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: drm_drv.c,v 1.6 2014/07/07 20:21:31 riastradh Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, $NetBSD: drm_drv.c,v 
 /* XXX Mega-kludge because modules are broken.  */
 #include sys/once.h
 #endif
+#include sys/pmf.h
 #include sys/poll.h
 #ifndef _MODULE
 #include sys/reboot.h		/* XXX drm_init kludge */
@@ -54,6 +55,8 @@ __KERNEL_RCSID(0, $NetBSD: drm_drv.c,v 
 
 #include prop/proplib.h
 
+#include linux/pm.h
+
 #include drm/drmP.h
 
 #include ioconf.h
@@ -97,6 +100,9 @@ static int	drm_init(void);
 static ONCE_DECL(drm_init_once);
 #endif
 
+static bool	drm_suspend(device_t, const pmf_qual_t *);
+static bool	drm_resume(device_t, const pmf_qual_t *);
+
 static void	drm_undo_fill_in_dev(struct drm_device *);
 
 static struct drm_softc *drm_dev_softc(dev_t);
@@ -386,10 +392,22 @@ drm_attach(device_t parent, device_t sel
 		}
 	}
 
+	if (!pmf_device_register(parent, NULL, NULL)) {
+		aprint_error_dev(parent, unable to establish power handler);
+		goto fail2;
+	}
+	if (!pmf_device_register(self, drm_suspend, drm_resume)) {
+		aprint_error_dev(self, unable to establish power handler);
+		goto fail3;
+	}
+
 	/* Success!  */
 	sc-sc_initialized = true;
 	return;
 
+fail4: __unused
+	pmf_device_deregister(self);
+fail3:	pmf_device_deregister(parent);
 fail2:	if (dev-driver-unload != NULL)
 		(*dev-driver-unload)(dev);
 fail1:	drm_undo_fill_in_dev(dev);
@@ -411,6 +429,9 @@ drm_detach(device_t self, int flags)
 	if (sc-sc_opencount != 0)
 		return EBUSY;
 
+	pmf_device_deregister(self);
+	pmf_device_deregister(device_parent(self));
+
 	/* XXX The placement of this is pretty random...  */
 	if (dev-driver-unload != NULL)
 		(*dev-driver-unload)(dev);
@@ -509,6 +530,35 @@ drm_undo_fill_in_dev(struct drm_device *
 	spin_lock_destroy(dev-count_lock);
 }
 
+static bool
+drm_suspend(device_t self, const pmf_qual_t *qual)
+{
+	struct drm_softc *const sc = device_private(self);
+	struct drm_device *const dev = sc-sc_drm_dev;
+	int error;
+
+	error = (*dev-driver-suspend)(dev,
+	(pm_message_t) { .event = PM_EVENT_SUSPEND });
+	if (error)
+		return false;
+
+	return true;
+}
+
+static bool
+drm_resume(device_t self, const pmf_qual_t *qual)
+{
+	struct drm_softc *const sc = device_private(self);
+	struct drm_device *const dev = sc-sc_drm_dev;
+	int error;
+
+	error = (*dev-driver-resume)(dev);
+	if (error)
+		return false;
+
+	return true;
+}
+
 static struct drm_softc *
 drm_dev_softc(dev_t d)
 {



CVS commit: src/tests/fs/cd9660

2014-07-07 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jul  7 22:06:02 UTC 2014

Modified Files:
src/tests/fs/cd9660: t_high_ino_big_file.sh

Log Message:
Update disk-space-available requirement to match reality, and leave a
little extra just in case.  The test file is much larger than previously
indicated.

Thanks martin@ for detailed investigation.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/fs/cd9660/t_high_ino_big_file.sh

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

Modified files:

Index: src/tests/fs/cd9660/t_high_ino_big_file.sh
diff -u src/tests/fs/cd9660/t_high_ino_big_file.sh:1.3 src/tests/fs/cd9660/t_high_ino_big_file.sh:1.4
--- src/tests/fs/cd9660/t_high_ino_big_file.sh:1.3	Sun Jun  8 13:45:14 2014
+++ src/tests/fs/cd9660/t_high_ino_big_file.sh	Mon Jul  7 22:06:02 2014
@@ -1,4 +1,4 @@
-# $NetBSD: t_high_ino_big_file.sh,v 1.3 2014/06/08 13:45:14 pgoyette Exp $
+# $NetBSD: t_high_ino_big_file.sh,v 1.4 2014/07/07 22:06:02 pgoyette Exp $
 #
 # Copyright (c) 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -77,8 +77,8 @@ pr_kern_48787_head() {
 
 pr_kern_48787_body() {
 	avail=$( df -Pk . | awk '{if (NR==2) print $4}' )
-	if [ $avail -lt 225 ]; then
-		atf_skip not enough free disk space, have ${avail} Kbytes, need ~ 225 Kbytes
+	if [ $avail -lt 450 ]; then
+		atf_skip not enough free disk space, have ${avail} Kbytes, need ~ 450 Kbytes
 	fi
 	bunzip2  $(atf_get_srcdir)/pr_48787.image.bz2  pr_48787.image
 	mntpnt=$(pwd)/mnt



CVS commit: src/external/bsd/bind/dist/contrib/zkt-1.1.2/examples/flat

2014-07-07 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Tue Jul  8 05:47:36 UTC 2014

Added Files:
src/external/bsd/bind/dist/contrib/zkt-1.1.2/examples/flat: zkt-ls
zkt-signer

Log Message:
two merge escapees


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
src/external/bsd/bind/dist/contrib/zkt-1.1.2/examples/flat/zkt-ls \
src/external/bsd/bind/dist/contrib/zkt-1.1.2/examples/flat/zkt-signer

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

Added files:

Index: src/external/bsd/bind/dist/contrib/zkt-1.1.2/examples/flat/zkt-ls
diff -u /dev/null src/external/bsd/bind/dist/contrib/zkt-1.1.2/examples/flat/zkt-ls:1.1
--- /dev/null	Tue Jul  8 05:47:36 2014
+++ src/external/bsd/bind/dist/contrib/zkt-1.1.2/examples/flat/zkt-ls	Tue Jul  8 05:47:36 2014
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+#	Shell script to start the zkt-ls command
+#	out of the example directory
+#
+
+if test ! -f dnssec.conf
+then
+	echo Please start this skript out of the flat or hierarchical sub directory
+	exit 1
+fi
+ZKT_CONFFILE=`pwd`/dnssec.conf ../../zkt-ls $@
Index: src/external/bsd/bind/dist/contrib/zkt-1.1.2/examples/flat/zkt-signer
diff -u /dev/null src/external/bsd/bind/dist/contrib/zkt-1.1.2/examples/flat/zkt-signer:1.1
--- /dev/null	Tue Jul  8 05:47:36 2014
+++ src/external/bsd/bind/dist/contrib/zkt-1.1.2/examples/flat/zkt-signer	Tue Jul  8 05:47:36 2014
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+#	Shell script to start the zkt-signer
+#	command out of the example directory
+#
+
+if test ! -f dnssec.conf
+then
+	echo Please start this skript out of the flat or hierarchical sub directory
+	exit 1
+fi
+ZKT_CONFFILE=`pwd`/dnssec.conf ../../zkt-signer $@



CVS commit: src

2014-07-07 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Tue Jul  8 05:55:34 UTC 2014

Modified Files:
src/distrib/sets/lists/base: ad.arm ad.mips ad.powerpc md.amd64
md.sparc64 mi shl.mi
src/distrib/sets/lists/comp: ad.arm ad.mips ad.powerpc md.amd64
md.sparc64 mi shl.mi
src/distrib/sets/lists/man: mi
src/external/bsd/bind/bin: Makefile
src/external/bsd/bind/bin/dnssec: Makefile
src/external/bsd/bind/include: config.h
src/external/bsd/bind/include/isc: atomic.h platform.h
src/external/bsd/bind/lib: Makefile
src/external/bsd/bind/lib/libisccfg: Makefile shlib_version
Added Files:
src/external/bsd/bind/bin/delv: Makefile
src/external/bsd/bind/bin/dnssec/dnssec-importkey: Makefile
src/external/bsd/bind/include/irs: netdb.h platform.h
src/external/bsd/bind/lib/libirs: Makefile shlib_version

Log Message:
infrastructure for bind-9.10.0-P2:
adding the tools delv and dnssec-importkey
adding libirs to support delv


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/distrib/sets/lists/base/ad.arm
cvs rdiff -u -r1.42 -r1.43 src/distrib/sets/lists/base/ad.mips
cvs rdiff -u -r1.11 -r1.12 src/distrib/sets/lists/base/ad.powerpc
cvs rdiff -u -r1.236 -r1.237 src/distrib/sets/lists/base/md.amd64
cvs rdiff -u -r1.223 -r1.224 src/distrib/sets/lists/base/md.sparc64
cvs rdiff -u -r1.1071 -r1.1072 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.705 -r1.706 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.56 -r1.57 src/distrib/sets/lists/comp/ad.arm
cvs rdiff -u -r1.48 -r1.49 src/distrib/sets/lists/comp/ad.mips
cvs rdiff -u -r1.69 -r1.70 src/distrib/sets/lists/comp/ad.powerpc
cvs rdiff -u -r1.221 -r1.222 src/distrib/sets/lists/comp/md.amd64
cvs rdiff -u -r1.184 -r1.185 src/distrib/sets/lists/comp/md.sparc64
cvs rdiff -u -r1.1896 -r1.1897 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.264 -r1.265 src/distrib/sets/lists/comp/shl.mi
cvs rdiff -u -r1.1477 -r1.1478 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/bind/bin/Makefile
cvs rdiff -u -r0 -r1.1 src/external/bsd/bind/bin/delv/Makefile
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/bind/bin/dnssec/Makefile
cvs rdiff -u -r0 -r1.1 \
src/external/bsd/bind/bin/dnssec/dnssec-importkey/Makefile
cvs rdiff -u -r1.12 -r1.13 src/external/bsd/bind/include/config.h
cvs rdiff -u -r0 -r1.1 src/external/bsd/bind/include/irs/netdb.h \
src/external/bsd/bind/include/irs/platform.h
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/bind/include/isc/atomic.h
cvs rdiff -u -r1.15 -r1.16 src/external/bsd/bind/include/isc/platform.h
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/bind/lib/Makefile
cvs rdiff -u -r0 -r1.1 src/external/bsd/bind/lib/libirs/Makefile \
src/external/bsd/bind/lib/libirs/shlib_version
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/bind/lib/libisccfg/Makefile
cvs rdiff -u -r1.12 -r1.13 src/external/bsd/bind/lib/libisccfg/shlib_version

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/base/ad.arm
diff -u src/distrib/sets/lists/base/ad.arm:1.46 src/distrib/sets/lists/base/ad.arm:1.47
--- src/distrib/sets/lists/base/ad.arm:1.46	Wed Jun 18 17:50:14 2014
+++ src/distrib/sets/lists/base/ad.arm	Tue Jul  8 05:55:33 2014
@@ -1,4 +1,4 @@
-# $NetBSD: ad.arm,v 1.46 2014/06/18 17:50:14 christos Exp $
+# $NetBSD: ad.arm,v 1.47 2014/07/08 05:55:33 spz Exp $
 ./lib/oabi	base-compat-shlib	compat
 ./lib/oabi/npf	base-npf-shlib		compat
 ./lib/oabi/npf/ext_log.so			base-npf-shlib		compat,pic
@@ -163,12 +163,15 @@
 ./usr/lib/oabi/libintl.so.1.0			base-compat-shlib	compat,pic
 ./usr/lib/oabi/libipsec.so.3			base-compat-shlib	compat,pic
 ./usr/lib/oabi/libipsec.so.3.0			base-compat-shlib	compat,pic
+./usr/lib/oabi/libirs.so.8			base-compat-shlib	compat,pic
+./usr/lib/oabi/libirs.so.8.0			base-compat-shlib	compat,pic
 ./usr/lib/oabi/libisc.so.8			base-compat-shlib	compat,pic
 ./usr/lib/oabi/libisc.so.8.0			base-compat-shlib	compat,pic
 ./usr/lib/oabi/libisccc.so.8			base-compat-shlib	compat,pic
 ./usr/lib/oabi/libisccc.so.8.0			base-compat-shlib	compat,pic
 ./usr/lib/oabi/libisccfg.so.8			base-compat-shlib	compat,pic
-./usr/lib/oabi/libisccfg.so.8.0			base-compat-shlib	compat,pic
+./usr/lib/oabi/libisccfg.so.8.1			base-compat-shlib	compat,pic
+./usr/lib/oabi/libisccfg.so.8.0			base-compat-shlib	obsolete
 ./usr/lib/oabi/libiscsi.so.2			base-compat-shlib	compat,pic,iscsi
 ./usr/lib/oabi/libiscsi.so.2.0			base-compat-shlib	compat,pic,iscsi
 ./usr/lib/oabi/libisns.so.0			base-compat-shlib	compat,pic

Index: src/distrib/sets/lists/base/ad.mips
diff -u src/distrib/sets/lists/base/ad.mips:1.42 src/distrib/sets/lists/base/ad.mips:1.43
--- src/distrib/sets/lists/base/ad.mips:1.42	Wed Jun 18 17:50:14 2014
+++ src/distrib/sets/lists/base/ad.mips	Tue Jul  8 05:55:33 2014
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips,v 1.42 2014/06/18 17:50:14