CVS commit: src/usr.sbin/postinstall

2013-12-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Dec  5 15:41:23 UTC 2013

Modified Files:
src/usr.sbin/postinstall: postinstall

Log Message:
Add a varshm check/fix to make sure /var/shm is mentioned in /etc/fstab
(and add a default of tmpfs with 25% of available ram limit if not).
To avoid the warning but not mount the tmpfs, just comment out the line
for /var/shm.

Also move obsolete to the end of the list again, as it should be run
last.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/usr.sbin/postinstall/postinstall

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

Modified files:

Index: src/usr.sbin/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.158 src/usr.sbin/postinstall/postinstall:1.159
--- src/usr.sbin/postinstall/postinstall:1.158	Mon Sep  9 15:04:12 2013
+++ src/usr.sbin/postinstall/postinstall	Thu Dec  5 15:41:23 2013
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.158 2013/09/09 15:04:12 prlw1 Exp $
+# $NetBSD: postinstall,v 1.159 2013/12/05 15:41:23 martin Exp $
 #
 # Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1749,34 +1749,6 @@ do_catpages()
 	return $failed
 }
 
-#
-#	obsolete
-#	(this item is last to allow other items to move obsolete files)
-#
-additem obsolete remove obsolete file sets and minor libraries
-do_obsolete()
-{
-	[ -n $1 ] || err 3 USAGE: do_obsolete  fix|check
-	op=$1
-	failed=0
-
-	sort -ru ${DEST_DIR}/var/db/obsolete/* | obsolete_paths ${op}
-	failed=$(( ${failed} + $? ))
-
-	(
-		obsolete_libs /lib
-		obsolete_libs /usr/lib
-		obsolete_libs /usr/lib/i18n
-		obsolete_libs /usr/X11R6/lib
-		obsolete_libs /usr/X11R7/lib
-		[ $MACHINE = amd64 ]  obsolete_libs /usr/lib/i386
-		[ $MACHINE = sparc64 ]  obsolete_libs /usr/lib/sparc
-	) | obsolete_paths ${op}
-	failed=$(( ${failed} + $? ))
-
-	return ${failed}
-}
-
 
 #
 #	ptyfsoldnodes
@@ -1864,6 +1836,63 @@ do_ptyfsoldnodes()
 
 
 #
+#	varshm
+#
+additem varshm check for a tmpfs mounted on /var/shm
+do_varshm()
+{
+	[ -n $1 ] || err 3 USAGE: do_varshm  fix|check
+	op=$1
+	failed=0
+
+	if ${GREP} -w /var/shm ${DEST_DIR}/etc/fstab /dev/null 21;
+	then
+		failed = 0;
+	else
+		if [ ${op} = check ]; then
+			failed=1
+			echo No /var/shm mount found in ${DEST_DIR}/etc/fstab
+		elif [ ${op} = fix ]; then
+			printf '\ntmpfs\t/var/shm\ttmpfs\trw,-m1777,-sram%%25\n' \
+ ${DEST_DIR}/etc/fstab
+			echo Added tmpfs with 25% ram limit as /var/shm
+
+		fi
+	fi
+
+	return ${failed}
+}
+
+
+#
+#	obsolete
+#	(this item is last to allow other items to move obsolete files)
+#
+additem obsolete remove obsolete file sets and minor libraries
+do_obsolete()
+{
+	[ -n $1 ] || err 3 USAGE: do_obsolete  fix|check
+	op=$1
+	failed=0
+
+	sort -ru ${DEST_DIR}/var/db/obsolete/* | obsolete_paths ${op}
+	failed=$(( ${failed} + $? ))
+
+	(
+		obsolete_libs /lib
+		obsolete_libs /usr/lib
+		obsolete_libs /usr/lib/i18n
+		obsolete_libs /usr/X11R6/lib
+		obsolete_libs /usr/X11R7/lib
+		[ $MACHINE = amd64 ]  obsolete_libs /usr/lib/i386
+		[ $MACHINE = sparc64 ]  obsolete_libs /usr/lib/sparc
+	) | obsolete_paths ${op}
+	failed=$(( ${failed} + $? ))
+
+	return ${failed}
+}
+
+#
 #	end of items
 #	
 #



CVS commit: src/sys/arch/evbarm/conf

2013-12-05 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Dec  5 15:53:50 UTC 2013

Modified Files:
src/sys/arch/evbarm/conf: mk.tisdp24xx

Log Message:
Use armv6z so {ldr,str}ex{b,h,d} won't generate warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/mk.tisdp24xx

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/evbarm/conf/mk.tisdp24xx
diff -u src/sys/arch/evbarm/conf/mk.tisdp24xx:1.4 src/sys/arch/evbarm/conf/mk.tisdp24xx:1.5
--- src/sys/arch/evbarm/conf/mk.tisdp24xx:1.4	Mon Dec 10 05:01:43 2012
+++ src/sys/arch/evbarm/conf/mk.tisdp24xx	Thu Dec  5 15:53:50 2013
@@ -1,5 +1,5 @@
-#	$NetBSD: mk.tisdp24xx,v 1.4 2012/12/10 05:01:43 matt Exp $
-CPPFLAGS+= -march=armv6k -mtune=arm1136jf-s -mfpu=vfp
+#	$NetBSD: mk.tisdp24xx,v 1.5 2013/12/05 15:53:50 matt Exp $
+CPPFLAGS+= -march=armv6z -mtune=arm1136jf-s -mfpu=vfp
 
 SYSTEM_FIRST_OBJ=	sdp24xx_start.o
 SYSTEM_FIRST_SFILE=	${THISARM}/tisdp24xx/sdp24xx_start.S



CVS commit: src/sys/net

2013-12-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec  5 15:55:35 UTC 2013

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

Log Message:
It is silly to kill the system when an interface failed to clear promiscuous
mode. Some return EINVAL when they are dying, but others like USB return EIO.
Downgrade to a DIAGNOSTIC printf. Same should be done for the malloc/NOWAIT,
but this is rarely hit.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/net/bpf.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.c
diff -u src/sys/net/bpf.c:1.179 src/sys/net/bpf.c:1.180
--- src/sys/net/bpf.c:1.179	Fri Nov 15 20:13:52 2013
+++ src/sys/net/bpf.c	Thu Dec  5 10:55:35 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.c,v 1.179 2013/11/16 01:13:52 rmind Exp $	*/
+/*	$NetBSD: bpf.c,v 1.180 2013/12/05 15:55:35 christos Exp $	*/
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bpf.c,v 1.179 2013/11/16 01:13:52 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: bpf.c,v 1.180 2013/12/05 15:55:35 christos Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_bpf.h
@@ -356,7 +356,7 @@ bpf_detachd(struct bpf_d *d)
 	 * If so, turn it off.
 	 */
 	if (d-bd_promisc) {
-		int error;
+		int error __diagused;
 
 		d-bd_promisc = 0;
 		/*
@@ -367,8 +367,10 @@ bpf_detachd(struct bpf_d *d)
 		 * if we don't get an unexpected error.
 		 */
   		error = ifpromisc(bp-bif_ifp, 0);
-		if (error  error != EINVAL)
-			panic(%s: ifpromisc failed: %d, __func__, error);
+#ifdef DIAGNOSTIC
+		if (error)
+			printf(%s: ifpromisc failed: %d, __func__, error);
+#endif
 	}
 	/* Remove d from the interface's descriptor list. */
 	p = bp-bif_dlist;



CVS commit: src/sys/arch

2013-12-05 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Dec  5 16:26:04 UTC 2013

Modified Files:
src/sys/arch/evbarm/stand/boot2440: Makefile
src/sys/arch/evbarm/stand/bootimx23: Makefile
src/sys/arch/evbarm/stand/gzboot: Makefile.gzboot
src/sys/arch/zaurus/stand/zboot: Makefile

Log Message:
Use -marm for clang builds, too.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/stand/boot2440/Makefile
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbarm/stand/bootimx23/Makefile
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/evbarm/stand/gzboot/Makefile.gzboot
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/zaurus/stand/zboot/Makefile

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/evbarm/stand/boot2440/Makefile
diff -u src/sys/arch/evbarm/stand/boot2440/Makefile:1.13 src/sys/arch/evbarm/stand/boot2440/Makefile:1.14
--- src/sys/arch/evbarm/stand/boot2440/Makefile:1.13	Mon Nov  4 21:25:05 2013
+++ src/sys/arch/evbarm/stand/boot2440/Makefile	Thu Dec  5 16:26:04 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2013/11/04 21:25:05 christos Exp $
+#	$NetBSD: Makefile,v 1.14 2013/12/05 16:26:04 joerg Exp $
 
 S=		${.CURDIR}/../../../..
 
@@ -16,14 +16,16 @@ CPPFLAGS+=	-DDM9000MAC=0x08,0x08,0x11,0
 CPPFLAGS+=	-DDEFAULT_BOOTFILE=ld0a:netbsd;net:
 CPPFLAGS+=	-nostdinc -I. -I${.OBJDIR} -I${S} -I${S}/arch
 CPPFLAGS+=	-march=armv4 -mabi=apcs-gnu -mfloat-abi=soft
-.if ${HAVE_GCC}  48
-CPPFLAGS+=	-mno-thumb -mno-thumb-interwork
-.else
+.if ${HAVE_LLVM:Uno} != no || ${HAVE_GCC:U0} = 48
 CPPFLAGS+=	-marm
+.else
+CPPFLAGS+=	-mno-thumb -mno-thumb-interwork
 .endif
 CPUFLAGS=
 DBG=		-Os
 
+CWARNFLAGS.clang+=	-Wno-asm-operand-widths
+
 LIBCRT0=	# nothing
 LIBCRTBEGIN=	# nothing
 LIBCRTEND=	# nothing

Index: src/sys/arch/evbarm/stand/bootimx23/Makefile
diff -u src/sys/arch/evbarm/stand/bootimx23/Makefile:1.10 src/sys/arch/evbarm/stand/bootimx23/Makefile:1.11
--- src/sys/arch/evbarm/stand/bootimx23/Makefile:1.10	Mon Nov  4 21:25:05 2013
+++ src/sys/arch/evbarm/stand/bootimx23/Makefile	Thu Dec  5 16:26:04 2013
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.10 2013/11/04 21:25:05 christos Exp $
+# $Id: Makefile,v 1.11 2013/12/05 16:26:04 joerg Exp $
 
 S=		${.CURDIR}/../../../../
 PROG=		bootimx23
@@ -13,10 +13,10 @@ CPPFLAGS+=	-D_STANDALONE -DMEMSIZE=64
 CPPFLAGS+=	-DKERNEL_BOOT_ARGS=\root=ld0a\
 CPPFLAGS+=	-nostdinc -I. -I${.CURDIR} -I${.OBJDIR} -I${S} -I${S}/arch
 CPPFLAGS+=	-mabi=apcs-gnu -mfloat-abi=soft
-.if ${HAVE_GCC}  48
-CPPFLAGS+=	-mno-thumb -mno-thumb-interwork
-.else
+.if ${HAVE_LLVM:Uno} != no || ${HAVE_GCC:U0} = 48
 CPPFLAGS+=	-marm
+.else
+CPPFLAGS+=	-mno-thumb -mno-thumb-interwork
 .endif
 #CPPFLAGS+=	-DDEBUG
 #CPPFLAGS+=	-DDIAGNOSTIC

Index: src/sys/arch/evbarm/stand/gzboot/Makefile.gzboot
diff -u src/sys/arch/evbarm/stand/gzboot/Makefile.gzboot:1.27 src/sys/arch/evbarm/stand/gzboot/Makefile.gzboot:1.28
--- src/sys/arch/evbarm/stand/gzboot/Makefile.gzboot:1.27	Mon Nov  4 21:25:05 2013
+++ src/sys/arch/evbarm/stand/gzboot/Makefile.gzboot	Thu Dec  5 16:26:04 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.gzboot,v 1.27 2013/11/04 21:25:05 christos Exp $
+#	$NetBSD: Makefile.gzboot,v 1.28 2013/12/05 16:26:04 joerg Exp $
 
 NOMAN=  # defined
 
@@ -37,10 +37,10 @@ CPPFLAGS+= -nostdinc -I. -I${EVBARM_STAN
 CPPFLAGS+= -I${S} -I${S}/arch -I${S}/lib/libsa
 CPPFLAGS+= -I${S}/../common/dist/zlib
 CPPFLAGS+= -mabi=apcs-gnu -mfloat-abi=soft
-.if ${HAVE_GCC}  48
-CPPFLAGS+= -mno-thumb -mno-thumb-interwork
+.if ${HAVE_LLVM:Uno} != no || ${HAVE_GCC:U0} = 48
+CPPFLAGS+=	-marm
 .else
-CPPFLAGS+= -marm
+CPPFLAGS+=	-mno-thumb -mno-thumb-interwork
 .endif
 
 CPPFLAGS+= -D_STANDALONE

Index: src/sys/arch/zaurus/stand/zboot/Makefile
diff -u src/sys/arch/zaurus/stand/zboot/Makefile:1.13 src/sys/arch/zaurus/stand/zboot/Makefile:1.14
--- src/sys/arch/zaurus/stand/zboot/Makefile:1.13	Mon Nov  4 21:30:16 2013
+++ src/sys/arch/zaurus/stand/zboot/Makefile	Thu Dec  5 16:26:04 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2013/11/04 21:30:16 christos Exp $
+#	$NetBSD: Makefile,v 1.14 2013/12/05 16:26:04 joerg Exp $
 
 PROG=		zboot
 
@@ -22,10 +22,10 @@ CPPFLAGS+=	-nostdinc -I. -I${.CURDIR} -I
 CPPFLAGS+=	-D_STANDALONE -DHEAP_VARIABLE
 CPPFLAGS+=	-DLIBSA_ENABLE_LS_OP
 CPPFLAGS+=	-mabi=apcs-gnu -mfloat-abi=soft -mcpu=xscale
-.if ${HAVE_GCC}  48
-CPPFLAGS+=	-mno-thumb -mno-thumb-interwork
-.else
+.if ${HAVE_LLVM:Uno} != no || ${HAVE_GCC:U0} = 48
 CPPFLAGS+=	-marm
+.else
+CPPFLAGS+=	-mno-thumb -mno-thumb-interwork
 .endif
 CPUFLAGS=
 AFLAGS+=	-D_LOCORE



CVS commit: [netbsd-6] src/usr.bin/gzip

2013-12-05 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Dec  5 18:44:26 UTC 2013

Modified Files:
src/usr.bin/gzip [netbsd-6]: zmore

Log Message:
Pull up following revision(s) (requested by pettai in ticket #982):
distrib/sets/lists/base/mi: revision 1.1049
distrib/sets/lists/man/mi: revision 1.1449
usr.bin/gzip/Makefile: revision 1.17
usr.bin/gzip/Makefile: revision 1.18
usr.bin/gzip/zmore: revision 1.4
usr.bin/gzip/zmore.1: revision 1.4
Added zless(1) - comes in the lastest version of zmore(1) from OpenBSD
(OKed by tron@)
Add zfgrep that fell off from last update


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.52.1 src/usr.bin/gzip/zmore

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/gzip/zmore
diff -u src/usr.bin/gzip/zmore:1.3 src/usr.bin/gzip/zmore:1.3.52.1
--- src/usr.bin/gzip/zmore:1.3	Mon Mar 29 09:59:42 2004
+++ src/usr.bin/gzip/zmore	Thu Dec  5 18:44:26 2013
@@ -1,8 +1,8 @@
 #!/bin/sh -
 #
-# $NetBSD: zmore,v 1.3 2004/03/29 09:59:42 wiz Exp $
+# $NetBSD: zmore,v 1.3.52.1 2013/12/05 18:44:26 bouyer Exp $
 #
-# $OpenBSD: zmore,v 1.4 2003/07/29 07:42:45 otto Exp $
+# $OpenBSD: zmore,v 1.6 2008/08/20 09:22:02 mpf Exp $
 #
 # Copyright (c) 2003 Todd C. Miller todd.mil...@courtesan.com
 #
@@ -41,6 +41,12 @@ while test $# -ne 0; do
 	esac
 done
 
+if [ `basename $0` == zless ] ; then
+	pager=${PAGER-less}
+else
+	pager=${PAGER-more}
+fi
+
 # No files means read from stdin
 if [ $# -eq 0 ]; then
 	gzip -cdfq 21 | ${PAGER-more} $flags



CVS commit: [netbsd-5] src/usr.bin/gzip

2013-12-05 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Dec  5 18:46:15 UTC 2013

Modified Files:
src/usr.bin/gzip [netbsd-5]: zmore

Log Message:
Pull up following revision(s) (requested by pettai in ticket #1889):
distrib/sets/lists/base/mi: revision 1.1049
distrib/sets/lists/man/mi: revision 1.1449
usr.bin/gzip/Makefile: revision 1.17
usr.bin/gzip/Makefile: revision 1.18
usr.bin/gzip/zmore: revision 1.4
usr.bin/gzip/zmore.1: revision 1.4
Added zless(1) - comes in the lastest version of zmore(1) from OpenBSD
(OKed by tron@)
Add zfgrep that fell off from last update


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.34.1 src/usr.bin/gzip/zmore

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/gzip/zmore
diff -u src/usr.bin/gzip/zmore:1.3 src/usr.bin/gzip/zmore:1.3.34.1
--- src/usr.bin/gzip/zmore:1.3	Mon Mar 29 09:59:42 2004
+++ src/usr.bin/gzip/zmore	Thu Dec  5 18:46:15 2013
@@ -1,8 +1,8 @@
 #!/bin/sh -
 #
-# $NetBSD: zmore,v 1.3 2004/03/29 09:59:42 wiz Exp $
+# $NetBSD: zmore,v 1.3.34.1 2013/12/05 18:46:15 bouyer Exp $
 #
-# $OpenBSD: zmore,v 1.4 2003/07/29 07:42:45 otto Exp $
+# $OpenBSD: zmore,v 1.6 2008/08/20 09:22:02 mpf Exp $
 #
 # Copyright (c) 2003 Todd C. Miller todd.mil...@courtesan.com
 #
@@ -41,6 +41,12 @@ while test $# -ne 0; do
 	esac
 done
 
+if [ `basename $0` == zless ] ; then
+	pager=${PAGER-less}
+else
+	pager=${PAGER-more}
+fi
+
 # No files means read from stdin
 if [ $# -eq 0 ]; then
 	gzip -cdfq 21 | ${PAGER-more} $flags



CVS commit: src

2013-12-05 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Dec  5 21:17:23 UTC 2013

Modified Files:
src/include: cdbr.h
src/lib/libc/cdb: cdbr.3 cdbr.c
src/lib/libc/include: namespace.h

Log Message:
Add cdbr_open_mem.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/include/cdbr.h
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/cdb/cdbr.3
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/cdb/cdbr.c
cvs rdiff -u -r1.169 -r1.170 src/lib/libc/include/namespace.h

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

Modified files:

Index: src/include/cdbr.h
diff -u src/include/cdbr.h:1.1 src/include/cdbr.h:1.2
--- src/include/cdbr.h:1.1	Sun Apr 25 00:54:45 2010
+++ src/include/cdbr.h	Thu Dec  5 21:17:23 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cdbr.h,v 1.1 2010/04/25 00:54:45 joerg Exp $	*/
+/*	$NetBSD: cdbr.h,v 1.2 2013/12/05 21:17:23 joerg Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -45,6 +45,8 @@ struct cdbr;
 __BEGIN_DECLS
 
 struct cdbr	*cdbr_open(const char *, int);
+struct cdbr	*cdbr_open_mem(void *, size_t, int,
+void (*)(void *, void *, size_t), void *);
 uint32_t	 cdbr_entries(struct cdbr *);
 int		 cdbr_get(struct cdbr *, uint32_t, const void **, size_t *);
 int		 cdbr_find(struct cdbr *, const void *, size_t,

Index: src/lib/libc/cdb/cdbr.3
diff -u src/lib/libc/cdb/cdbr.3:1.3 src/lib/libc/cdb/cdbr.3:1.4
--- src/lib/libc/cdb/cdbr.3:1.3	Sat Jul 20 21:39:56 2013
+++ src/lib/libc/cdb/cdbr.3	Thu Dec  5 21:17:23 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: cdbr.3,v 1.3 2013/07/20 21:39:56 wiz Exp $
+.\	$NetBSD: cdbr.3,v 1.4 2013/12/05 21:17:23 joerg Exp $
 .\
 .\ Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -28,12 +28,13 @@
 .\ 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.
-.Dd March 3, 2010
+.Dd December 5, 2013
 .Dt CDBR 3
 .Os
 .Sh NAME
 .Nm cdbr
 .Nm cdbr_open ,
+.Nm cdbr_open_mem ,
 .Nm cdbr_entries ,
 .Nm cdbr_get ,
 .Nm cdbr_find ,
@@ -43,6 +44,13 @@
 .Sh SYNOPSIS
 .Ft struct cdbr *
 .Fn cdbr_open const char *path int flags
+.Ft struct cdbr *
+.Fo cdbr_open_mem
+.Fa void *base
+.Fa size_t size
+.Fa void (*unmap)(void *, void *, size_t)
+.Fa void *cookie
+.Fc
 .Ft uint32_t
 .Fn cdbr_entries struct cdbr *cdbr
 .Ft int
@@ -78,6 +86,25 @@ returned by
 and
 .Fn cdbr_find
 is invalidated.
+.Fn cdbr_open_mem
+works like
+.Fn cdbr_open ,
+but takes a memory reference to the content of the database file.
+If
+.Va unmap
+is not
+.Dv NULL ,
+it is called by
+.Fn cdbr_close
+with
+.Va cookie ,
+.Va base
+and
+.Va size
+as arguments.
+It is not called by
+.Fn cdbr_open_mem
+on error.
 .Pp
 The number of records in the database can be obtained by calling
 .Fn cdbr_entries .

Index: src/lib/libc/cdb/cdbr.c
diff -u src/lib/libc/cdb/cdbr.c:1.4 src/lib/libc/cdb/cdbr.c:1.5
--- src/lib/libc/cdb/cdbr.c:1.4	Thu Sep 27 00:37:43 2012
+++ src/lib/libc/cdb/cdbr.c	Thu Dec  5 21:17:23 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cdbr.c,v 1.4 2012/09/27 00:37:43 joerg Exp $	*/
+/*	$NetBSD: cdbr.c,v 1.5 2013/12/05 21:17:23 joerg Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,7 +36,7 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: cdbr.c,v 1.4 2012/09/27 00:37:43 joerg Exp $);
+__RCSID($NetBSD: cdbr.c,v 1.5 2013/12/05 21:17:23 joerg Exp $);
 
 #include namespace.h
 
@@ -53,6 +53,7 @@ __RCSID($NetBSD: cdbr.c,v 1.4 2012/09/2
 #include errno.h
 #include fcntl.h
 #include inttypes.h
+#include limits.h
 #include stdlib.h
 #include string.h
 #include unistd.h
@@ -62,6 +63,7 @@ __weak_alias(cdbr_close,_cdbr_close)
 __weak_alias(cdbr_find,_cdbr_find)
 __weak_alias(cdbr_get,_cdbr_get)
 __weak_alias(cdbr_open,_cdbr_open)
+__weak_alias(cdbr_open_mem,_cdbr_open_mem)
 #endif
 
 #if HAVE_NBTOOL_CONFIG_H
@@ -70,6 +72,8 @@ __weak_alias(cdbr_open,_cdbr_open)
 #endif
 
 struct cdbr {
+	void (*unmap)(void *, void *, size_t);
+	void *cookie;
 	uint8_t *mmap_base;
 	size_t mmap_size;
 
@@ -91,27 +95,63 @@ struct cdbr {
 	uint8_t entries_index_s1, entries_index_s2;
 };
 
+static void
+cdbr_unmap(void *cookie __unused, void *base, size_t size)
+{
+	munmap(base, size);
+}
+
 /* ARGSUSED */
 struct cdbr *
 cdbr_open(const char *path, int flags)
 {
-	uint8_t buf[40];
+	void *base;
+	size_t size;
 	int fd;
 	struct cdbr *cdbr;
 	struct stat sb;
 
 	if ((fd = open(path, O_RDONLY)) == -1)
 		return NULL;
-
-	errno = EINVAL;
-	if (fstat(fd, sb) == -1 ||
-	read(fd, buf, sizeof(buf)) != sizeof(buf) ||
-	memcmp(buf, NBCDB\n\0\001, 8) ||
-	(cdbr = malloc(sizeof(*cdbr))) == NULL) {
+	if (fstat(fd, sb) == -1) {
 		close(fd);
 		return NULL;
 	}
 
+	if (sb.st_size = SSIZE_MAX) {
+		errno = EINVAL;
+		return NULL;
+	}
+
+
+	size = (size_t)sb.st_size;
+	base = mmap(NULL, size, PROT_READ, MAP_FILE|MAP_SHARED, fd, 0);
+	close(fd);
+
+	if (base == MAP_FAILED)

CVS commit: src/usr.bin/calendar/calendars

2013-12-05 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Thu Dec  5 22:06:13 UTC 2013

Modified Files:
src/usr.bin/calendar/calendars: calendar.history

Log Message:
Nelson Mandela died today, aged 95. I whish farewell to a great statesman.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/calendar/calendars/calendar.history

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/calendar/calendars/calendar.history
diff -u src/usr.bin/calendar/calendars/calendar.history:1.29 src/usr.bin/calendar/calendars/calendar.history:1.30
--- src/usr.bin/calendar/calendars/calendar.history:1.29	Sun Nov 11 20:25:19 2012
+++ src/usr.bin/calendar/calendars/calendar.history	Thu Dec  5 22:06:13 2013
@@ -502,6 +502,7 @@
 12/05	End of Prohibition, 1933 (at least the alcohol part)
 12/05	Phi Beta Kappa founded, 1776
 12/05	The Eighteenth Amendment repealed, ending Prohibition, 1933
+12/05	Nelson Mandela dies aged 95, 2013
 12/07	Japan bombs Pearl Harbor, 1941
 12/09	Ball-bearing roller skates patented, 1884
 12/10	Metric system established in France, 1799



CVS commit: src/share/mk

2013-12-05 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Dec  5 22:49:33 UTC 2013

Modified Files:
src/share/mk: bsd.dep.mk

Log Message:
add ${MKTARGET_CREATE} for tags


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/share/mk/bsd.dep.mk

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

Modified files:

Index: src/share/mk/bsd.dep.mk
diff -u src/share/mk/bsd.dep.mk:1.79 src/share/mk/bsd.dep.mk:1.80
--- src/share/mk/bsd.dep.mk:1.79	Thu Oct 31 01:55:03 2013
+++ src/share/mk/bsd.dep.mk	Thu Dec  5 22:49:33 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.dep.mk,v 1.79 2013/10/31 01:55:03 mrg Exp $
+#	$NetBSD: bsd.dep.mk,v 1.80 2013/12/05 22:49:33 matt Exp $
 
 # Basic targets
 realdepend:	beforedepend .depend afterdepend
@@ -101,6 +101,7 @@ CLEANDIRFILES+= .depend ${__DPSRCS.d} ${
 .if !target(tags)
 tags: ${SRCS}
 .if defined(SRCS)  !empty(SRCS)
+	${_MKTARGET_CREATE}
 	-cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \
 	${TOOL_SED} s;\${.CURDIR}/;;  tags
 .endif



CVS commit: src/share/mk

2013-12-05 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Dec  5 22:51:08 UTC 2013

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Add MACHINES.${MACHINE_CPU} values.


To generate a diff of this commit:
cvs rdiff -u -r1.755 -r1.756 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.755 src/share/mk/bsd.own.mk:1.756
--- src/share/mk/bsd.own.mk:1.755	Tue Oct 29 16:11:46 2013
+++ src/share/mk/bsd.own.mk	Thu Dec  5 22:51:08 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.755 2013/10/29 16:11:46 joerg Exp $
+#	$NetBSD: bsd.own.mk,v 1.756 2013/12/05 22:51:08 matt Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -486,6 +486,27 @@ CTFCONVERT=	${TOOL_CTFCONVERT}
 CTFMERGE=	${TOOL_CTFMERGE}
 .endif
 
+# For each ${MACHINE_CPU}, list the ports that use it.
+MACHINES.alpha=		alpha
+MACHINES.arm=		acorn26 acorn32 cats epoc32 evbarm hpcarm \
+			iyonix netwinder shark zaurus
+MACHINES.coldfire=	evbcf
+MACHINES.i386=		i386
+MACHINES.ia64=		ia64
+MACHINES.hppa=		hp700
+MACHINES.m68000=	sun2
+MACHINES.m68k=		amiga atari cesfic hp300 luna68k mac68k \
+			news68k next68k sun3 x68k
+MACHINES.mips=		arc cobalt algor cobalt emips evbmips ews4800mips \
+			hpcmips mipsco newsmips pmax sbmips sgimips
+MACHINES.powerpc=	amigappc bebox evbppc ibmnws macppc mvmeppc \
+			ofppc prep rs6000 sandpoint
+MACHINES.sh3=		dreamcast evbsh3 hpcsh landisk mmeye
+MACHINES.sparc=		sparc
+MACHINES.sparc64=	sparc64
+MACHINES.vax=		vax
+MACHINES.x86_64=	amd64
+
 # OBJCOPY flags to create a.out binaries for old firmware
 # shared among src/distrib and ${MACHINE}/conf/Makefile.${MACHINE}.inc
 .if ${MACHINE_CPU} == arm



CVS commit: src/sys/net/npf

2013-12-05 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Fri Dec  6 01:33:37 UTC 2013

Modified Files:
src/sys/net/npf: npf.h npf_alg.c npf_alg_icmp.c npf_bpf.c npf_impl.h
npf_inet.c npf_nat.c npf_session.c

Log Message:
NPF:
- Adjust NAT to not assume flow direction in some cases and thus support
  less usual setups which are possible when using 'map' with a custom
  filter criteria.
- Introduce NPF_SRC/NPF_DST and replace npc_src/npc_dst with npc_ips[2]
  for more convenient handling.
- ICMP ALG: restrict matching only to the outgoing traffic, but be more
  direction-agnostic elsewhere.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/net/npf/npf.h
cvs rdiff -u -r1.9 -r1.10 src/sys/net/npf/npf_alg.c
cvs rdiff -u -r1.17 -r1.18 src/sys/net/npf/npf_alg_icmp.c
cvs rdiff -u -r1.5 -r1.6 src/sys/net/npf/npf_bpf.c
cvs rdiff -u -r1.44 -r1.45 src/sys/net/npf/npf_impl.h
cvs rdiff -u -r1.27 -r1.28 src/sys/net/npf/npf_inet.c
cvs rdiff -u -r1.22 -r1.23 src/sys/net/npf/npf_nat.c
cvs rdiff -u -r1.29 -r1.30 src/sys/net/npf/npf_session.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/npf/npf.h
diff -u src/sys/net/npf/npf.h:1.33 src/sys/net/npf/npf.h:1.34
--- src/sys/net/npf/npf.h:1.33	Tue Nov 12 00:46:34 2013
+++ src/sys/net/npf/npf.h	Fri Dec  6 01:33:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf.h,v 1.33 2013/11/12 00:46:34 rmind Exp $	*/
+/*	$NetBSD: npf.h,v 1.34 2013/12/06 01:33:37 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -104,18 +104,24 @@ typedef uint8_t			npf_netmask_t;
 typedef struct {
 	/* Information flags. */
 	uint32_t		npc_info;
-	/* Pointers to the IP v4/v6 addresses. */
-	npf_addr_t *		npc_srcip;
-	npf_addr_t *		npc_dstip;
-	/* Size (v4 or v6) of IP addresses. */
+
+	/*
+	 * Pointers to the IP source and destination addresses,
+	 * and the address length (4 for IPv4 or 16 for IPv6).
+	 */
+	npf_addr_t *		npc_ips[2];
 	uint8_t			npc_alen;
+
+	/* IP header length and L4 protocol. */
 	uint8_t			npc_hlen;
 	uint16_t		npc_proto;
+
 	/* IPv4, IPv6. */
 	union {
 		struct ip *		v4;
 		struct ip6_hdr *	v6;
 	} npc_ip;
+
 	/* TCP, UDP, ICMP. */
 	union {
 		struct tcphdr *		tcp;
@@ -132,6 +138,9 @@ npf_iscached(const npf_cache_t *npc, con
 	return __predict_true((npc-npc_info  inf) != 0);
 }
 
+#define	NPF_SRC		0
+#define	NPF_DST		1
+
 /*
  * Network buffer interface.
  */

Index: src/sys/net/npf/npf_alg.c
diff -u src/sys/net/npf/npf_alg.c:1.9 src/sys/net/npf/npf_alg.c:1.10
--- src/sys/net/npf/npf_alg.c:1.9	Sun Jun  2 02:20:04 2013
+++ src/sys/net/npf/npf_alg.c	Fri Dec  6 01:33:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_alg.c,v 1.9 2013/06/02 02:20:04 rmind Exp $	*/
+/*	$NetBSD: npf_alg.c,v 1.10 2013/12/06 01:33:37 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2010-2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: npf_alg.c,v 1.9 2013/06/02 02:20:04 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: npf_alg.c,v 1.10 2013/12/06 01:33:37 rmind Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -58,8 +58,6 @@ struct npf_alg {
 	u_int		na_slot;
 };
 
-#define	NPF_MAX_ALGS	8
-
 /* List of ALGs and the count. */
 static pserialize_t	alg_psz			__cacheline_aligned;
 static npf_alg_t	alg_list[NPF_MAX_ALGS]	__read_mostly;
@@ -218,7 +216,7 @@ npf_alg_match(npf_cache_t *npc, nbuf_t *
  * npf_alg_exec: execute ALG hooks for translation.
  */
 void
-npf_alg_exec(npf_cache_t *npc, nbuf_t *nbuf, npf_nat_t *nt, int di)
+npf_alg_exec(npf_cache_t *npc, nbuf_t *nbuf, npf_nat_t *nt, bool forw)
 {
 	int s;
 
@@ -227,7 +225,7 @@ npf_alg_exec(npf_cache_t *npc, nbuf_t *n
 		npf_alg_func_t func;
 
 		if ((func = alg_tfunc[i]) != NULL) {
-			func(npc, nbuf, nt, di);
+			func(npc, nbuf, nt, (int)forw);
 		}
 	}
 	pserialize_read_exit(s);

Index: src/sys/net/npf/npf_alg_icmp.c
diff -u src/sys/net/npf/npf_alg_icmp.c:1.17 src/sys/net/npf/npf_alg_icmp.c:1.18
--- src/sys/net/npf/npf_alg_icmp.c:1.17	Sun Jun  2 02:20:04 2013
+++ src/sys/net/npf/npf_alg_icmp.c	Fri Dec  6 01:33:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_alg_icmp.c,v 1.17 2013/06/02 02:20:04 rmind Exp $	*/
+/*	$NetBSD: npf_alg_icmp.c,v 1.18 2013/12/06 01:33:37 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: npf_alg_icmp.c,v 1.17 2013/06/02 02:20:04 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: npf_alg_icmp.c,v 1.18 2013/12/06 01:33:37 rmind Exp $);
 
 #include sys/param.h
 #include sys/module.h
@@ -106,8 +106,8 @@ npf_alg_icmp_modcmd(modcmd_t cmd, void *
 }
 
 /*
- * npfa_icmp_match: ALG matching inspector - determines ALG case and
- * associates ALG with NAT entry.
+ * npfa_icmp_match: match inspector - determines ALG case and associates
+ * our ALG with the NAT entry.
  */
 static bool
 npfa_icmp_match(npf_cache_t *npc, nbuf_t *nbuf, npf_nat_t *nt, int di)
@@ -119,8 

CVS commit: src/sbin/gpt

2013-12-05 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Fri Dec  6 02:31:31 UTC 2013

Modified Files:
src/sbin/gpt: add.c gpt.8 resize.c

Log Message:
Don't attempt to create/resize an unaligned partition if the attempt
to create/resize an aligned one failed.  This simplifies the code
and prevents surprises.  If the user wants an unaligned partition
in the case where an aligned one fails, they can simply retry the
command without the -a option.  This change was requested by
wiz@, and after some thought I agree with it.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sbin/gpt/add.c src/sbin/gpt/gpt.8
cvs rdiff -u -r1.5 -r1.6 src/sbin/gpt/resize.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/gpt/add.c
diff -u src/sbin/gpt/add.c:1.21 src/sbin/gpt/add.c:1.22
--- src/sbin/gpt/add.c:1.21	Thu Nov 28 01:37:14 2013
+++ src/sbin/gpt/add.c	Fri Dec  6 02:31:31 2013
@@ -29,7 +29,7 @@
 __FBSDID($FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $);
 #endif
 #ifdef __RCSID
-__RCSID($NetBSD: add.c,v 1.21 2013/11/28 01:37:14 jnemeth Exp $);
+__RCSID($NetBSD: add.c,v 1.22 2013/12/06 02:31:31 jnemeth Exp $);
 #endif
 
 #include sys/types.h
@@ -136,17 +136,15 @@ add(int fd)
 		alignsecs = alignment / secsz;
 		map = map_alloc(block, size, alignsecs);
 		if (map == NULL) {
-			warnx(%s: error: not enough space available on device for an aligned partition, device_name);
-			map = map_alloc(block, size, 0);
-			if (map == NULL) {
-warnx(%s: error: not enough available on device, device_name);
-return;
-			}
+			warnx(%s: error: not enough space available on 
+			  device for an aligned partition, device_name);
+			return;
 		}
 	} else {
 		map = map_alloc(block, size, 0);
 		if (map == NULL) {
-			warnx(%s: error: not enough space available on device, device_name);
+			warnx(%s: error: not enough space available on 
+			  device, device_name);
 			return;
 		}
 	}
Index: src/sbin/gpt/gpt.8
diff -u src/sbin/gpt/gpt.8:1.21 src/sbin/gpt/gpt.8:1.22
--- src/sbin/gpt/gpt.8:1.21	Sat Nov 30 19:43:53 2013
+++ src/sbin/gpt/gpt.8	Fri Dec  6 02:31:31 2013
@@ -1,4 +1,4 @@
-.\ $NetBSD: gpt.8,v 1.21 2013/11/30 19:43:53 jnemeth Exp $
+.\ $NetBSD: gpt.8,v 1.22 2013/12/06 02:31:31 jnemeth Exp $
 .\
 .\ Copyright (c) 2002 Marcel Moolenaar
 .\ All rights reserved.
@@ -26,7 +26,7 @@
 .\
 .\ $FreeBSD: src/sbin/gpt/gpt.8,v 1.17 2006/06/22 22:22:32 marcel Exp $
 .\
-.Dd November 30, 2013
+.Dd December 5, 2013
 .Dt GPT 8
 .Os
 .Sh NAME
@@ -110,7 +110,6 @@ option allows the user to specify an ali
 The alignment may have a suffix to indicate its magnitude.
 .Nm
 will attempt to align the partition.
-If it can not, then it will attempt to create an unaligned partition.
 .Pp
 The
 .Fl b Ar blocknr

Index: src/sbin/gpt/resize.c
diff -u src/sbin/gpt/resize.c:1.5 src/sbin/gpt/resize.c:1.6
--- src/sbin/gpt/resize.c:1.5	Thu Nov 28 01:37:14 2013
+++ src/sbin/gpt/resize.c	Fri Dec  6 02:31:31 2013
@@ -29,7 +29,7 @@
 __FBSDID($FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $);
 #endif
 #ifdef __RCSID
-__RCSID($NetBSD: resize.c,v 1.5 2013/11/28 01:37:14 jnemeth Exp $);
+__RCSID($NetBSD: resize.c,v 1.6 2013/12/06 02:31:31 jnemeth Exp $);
 #endif
 
 #include sys/types.h
@@ -134,12 +134,11 @@ resize(int fd)
 		}
 
 	newsize = map_resize(map, size, alignsecs);
-	if (newsize == 0  alignment  0  size  0) {
+	if (newsize == 0  alignment  0) {
 		warnx(%s: could not resize partition with alignment 
 		  constraint, device_name);
-		newsize = map_resize(map, size, 0);
-	}
-	if (newsize == 0) {
+		return;
+	} else if (newsize == 0) {
 		warnx(%s: could not resize partition, device_name);
 		return;
 	}



CVS commit: src/sys/dev/pci

2013-12-05 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Fri Dec  6 02:39:58 UTC 2013

Modified Files:
src/sys/dev/pci: virtioreg.h virtiovar.h

Log Message:
virtio: move a comment to a more appropriate place

no functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/virtioreg.h \
src/sys/dev/pci/virtiovar.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/dev/pci/virtioreg.h
diff -u src/sys/dev/pci/virtioreg.h:1.1 src/sys/dev/pci/virtioreg.h:1.2
--- src/sys/dev/pci/virtioreg.h:1.1	Sun Oct 30 12:12:21 2011
+++ src/sys/dev/pci/virtioreg.h	Fri Dec  6 02:39:58 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtioreg.h,v 1.1 2011/10/30 12:12:21 hannken Exp $	*/
+/*	$NetBSD: virtioreg.h,v 1.2 2013/12/06 02:39:58 yamt Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -147,6 +147,29 @@ struct vring_used {
 struct vring_used_elem ring[0];
 } __packed;
 
+/* The standard layout for the ring is a continuous chunk of memory which
+ * looks like this.  We assume num is a power of 2.
+ *
+ * struct vring {
+ *  // The actual descriptors (16 bytes each)
+ *  struct vring_desc desc[num];
+ *
+ *  // A ring of available descriptor heads with free-running index.
+ *  __u16 avail_flags;
+ *  __u16 avail_idx;
+ *  __u16 available[num];
+ *
+ *  // Padding to the next align boundary.
+ *  char pad[];
+ *
+ *  // A ring of used descriptor heads with free-running index.
+ *  __u16 used_flags;
+ *  __u16 used_idx;
+ *  struct vring_used_elem used[num];
+ * };
+ * Note: for virtio PCI, align is 4096.
+ */
+
 #define VIRTIO_PAGE_SIZE	(4096)
 
 #endif /* _DEV_PCI_VIRTIOREG_H_ */
Index: src/sys/dev/pci/virtiovar.h
diff -u src/sys/dev/pci/virtiovar.h:1.1 src/sys/dev/pci/virtiovar.h:1.2
--- src/sys/dev/pci/virtiovar.h:1.1	Sun Oct 30 12:12:21 2011
+++ src/sys/dev/pci/virtiovar.h	Fri Dec  6 02:39:58 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtiovar.h,v 1.1 2011/10/30 12:12:21 hannken Exp $	*/
+/*	$NetBSD: virtiovar.h,v 1.2 2013/12/06 02:39:58 yamt Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -146,29 +146,6 @@ struct virtio_softc {
 	 /* set by child */
 };
 
-/* The standard layout for the ring is a continuous chunk of memory which
- * looks like this.  We assume num is a power of 2.
- *
- * struct vring {
- *  // The actual descriptors (16 bytes each)
- *  struct vring_desc desc[num];
- *
- *  // A ring of available descriptor heads with free-running index.
- *  __u16 avail_flags;
- *  __u16 avail_idx;
- *  __u16 available[num];
- *
- *  // Padding to the next align boundary.
- *  char pad[];
- *
- *  // A ring of used descriptor heads with free-running index.
- *  __u16 used_flags;
- *  __u16 used_idx;
- *  struct vring_used_elem used[num];
- * };
- * Note: for virtio PCI, align is 4096.
- */
-
 /* public interface */
 uint32_t virtio_negotiate_features(struct virtio_softc*, uint32_t);