CVS commit: src

2021-04-28 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Wed Apr 28 16:57:05 UTC 2021

Modified Files:
src/share/man/man4/man4.evbarm: sun8icrypto.4
src/sys/arch/arm/sunxi: sun8i_crypto.c
src/sys/arch/evbarm/conf: GENERIC

Log Message:
enable sun8icrypto on Allwinner H3 too.

Allwinner H3 needs a slower mod clock according to the Linux driver.

tested on NanoPi R1.

thanks jmcneill@ and riastradh@ for advice.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/man4.evbarm/sun8icrypto.4
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/sunxi/sun8i_crypto.c
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/evbarm/conf/GENERIC

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

Modified files:

Index: src/share/man/man4/man4.evbarm/sun8icrypto.4
diff -u src/share/man/man4/man4.evbarm/sun8icrypto.4:1.1 src/share/man/man4/man4.evbarm/sun8icrypto.4:1.2
--- src/share/man/man4/man4.evbarm/sun8icrypto.4:1.1	Tue Apr 27 21:13:38 2021
+++ src/share/man/man4/man4.evbarm/sun8icrypto.4	Wed Apr 28 16:57:05 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: sun8icrypto.4,v 1.1 2021/04/27 21:13:38 nia Exp $
+.\" $NetBSD: sun8icrypto.4,v 1.2 2021/04/28 16:57:05 bad Exp $
 .\"
 .\" Copyright (c) 2021 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 25, 2021
+.Dd April 28, 2021
 .Dt SUN8ICRYPTO 4
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@
 The
 .Nm
 driver provides support for the cryptographic processors on Allwinner
-A64 and H5 systems-on-a-chip.
+A64, H3 and H5 systems-on-a-chip.
 The Allwinner Crypto Engine is the successor to the earlier
 Allwinner Security System.
 .Pp

Index: src/sys/arch/arm/sunxi/sun8i_crypto.c
diff -u src/sys/arch/arm/sunxi/sun8i_crypto.c:1.24 src/sys/arch/arm/sunxi/sun8i_crypto.c:1.25
--- src/sys/arch/arm/sunxi/sun8i_crypto.c:1.24	Sat Apr 24 13:01:35 2021
+++ src/sys/arch/arm/sunxi/sun8i_crypto.c	Wed Apr 28 16:57:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sun8i_crypto.c,v 1.24 2021/04/24 13:01:35 riastradh Exp $	*/
+/*	$NetBSD: sun8i_crypto.c,v 1.25 2021/04/28 16:57:05 bad Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.24 2021/04/24 13:01:35 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.25 2021/04/28 16:57:05 bad Exp $");
 
 #include 
 #include 
@@ -72,6 +72,28 @@ __KERNEL_RCSID(1, "$NetBSD: sun8i_crypto
 #define	SUN8I_CRYPTO_RNGENTROPY	100 /* estimated bits per bit of entropy */
 #define	SUN8I_CRYPTO_RNGBYTES	PAGE_SIZE
 
+struct sun8i_crypto_config {
+	u_int	mod_rate;	/* module clock rate */
+};
+
+/*
+ * The module clock is set to 50 MHz on H3, 300 MHz otherwise.
+ * From Linux drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c:
+ * Module clock is lower on H3 than other SoC due to some DMA
+ * timeout occurring with high value.
+ */
+static const struct sun8i_crypto_config sun50i_a64_crypto_config = {
+	.mod_rate = 300*1000*1000,
+};
+
+static const struct sun8i_crypto_config sun50i_h5_crypto_config = {
+	.mod_rate = 300*1000*1000,
+};
+
+static const struct sun8i_crypto_config sun8i_h3_crypto_config = {
+	.mod_rate = 50*1000*1000,
+};
+
 struct sun8i_crypto_task;
 
 struct sun8i_crypto_buf {
@@ -86,6 +108,9 @@ struct sun8i_crypto_softc {
 	bus_space_handle_t		sc_bsh;
 	bus_dma_tag_t			sc_dmat;
 	struct pool_cache		*sc_taskpool;
+
+	const struct sun8i_crypto_config *sc_cfg;
+
 	kmutex_t			sc_lock;
 	struct sun8i_crypto_chan {
 		struct sun8i_crypto_task	*cc_task;
@@ -319,8 +344,12 @@ CFATTACH_DECL_NEW(sun8i_crypto, sizeof(s
 sun8i_crypto_match, sun8i_crypto_attach, NULL, NULL);
 
 static const struct device_compatible_entry compat_data[] = {
-	{ .compat = "allwinner,sun50i-a64-crypto" },
-	{ .compat = "allwinner,sun50i-h5-crypto" },
+	{ .compat = "allwinner,sun50i-a64-crypto",
+	  .data = &sun50i_a64_crypto_config },
+	{ .compat = "allwinner,sun50i-h5-crypto",
+	  .data = &sun50i_h5_crypto_config },
+	{ .compat = "allwinner,sun8i-h3-crypto",
+	  .data = &sun8i_h3_crypto_config },
 	DEVICE_COMPAT_EOL
 };
 
@@ -343,6 +372,7 @@ sun8i_crypto_attach(device_t parent, dev
 	char intrstr[128];
 	struct clk *clk;
 	struct fdtbus_reset *rst;
+	u_int mod_rate;
 
 	sc->sc_dev = self;
 	sc->sc_dmat = faa->faa_dmat;
@@ -350,6 +380,7 @@ sun8i_crypto_attach(device_t parent, dev
 	sc->sc_taskpool = pool_cache_init(sizeof(struct sun8i_crypto_task),
 	0, 0, 0, "sun8icry", NULL, IPL_VM,
 	&sun8i_crypto_task_ctor, &sun8i_crypto_task_dtor, sc);
+	sc->sc_cfg = of_compatible_lookup(phandle, compat_data)->data;
 	mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_VM);
 	callout_init(&sc->sc_timeout, CALLOUT_MPSAFE);
 	callout_setfunc(&sc->sc_timeout, &sun8i_crypto_timeout, sc);
@@ -388,14 +419,16 @@ sun8i_crypto_attach(device_t parent, dev
 		return;
 	}
 
-	/* Get th

CVS commit: src

2009-10-10 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sat Oct 10 18:06:54 UTC 2009

Modified Files:
src/common/lib/libprop: prop_array.3 prop_copyin_ioctl.9
prop_dictionary.3 prop_kern.c
src/distrib/sets/lists/base: shl.mi
src/distrib/sets/lists/comp: mi
src/lib/libprop: Makefile shlib_version

Log Message:
Implement prop_array_externalize_to_pref(), prop_array_copyin(),
prop_dictionary_externalize_to_pref() and prop_dictionary_copyin()
as discussed in the thread:
http://mail-index.netbsd.org/tech-kern/2009/07/29/msg005594.html

Bump libprop shlib minor.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/common/lib/libprop/prop_array.3
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libprop/prop_copyin_ioctl.9
cvs rdiff -u -r1.13 -r1.14 src/common/lib/libprop/prop_dictionary.3
cvs rdiff -u -r1.10 -r1.11 src/common/lib/libprop/prop_kern.c
cvs rdiff -u -r1.498 -r1.499 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.1325 -r1.1326 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.16 -r1.17 src/lib/libprop/Makefile
cvs rdiff -u -r1.9 -r1.10 src/lib/libprop/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/common/lib/libprop/prop_array.3
diff -u src/common/lib/libprop/prop_array.3:1.9 src/common/lib/libprop/prop_array.3:1.10
--- src/common/lib/libprop/prop_array.3:1.9	Thu Apr  9 01:18:17 2009
+++ src/common/lib/libprop/prop_array.3	Sat Oct 10 18:06:54 2009
@@ -1,6 +1,6 @@
-.\"	$NetBSD: prop_array.3,v 1.9 2009/04/09 01:18:17 joerg Exp $
+.\"	$NetBSD: prop_array.3,v 1.10 2009/10/10 18:06:54 bad Exp $
 .\"
-.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
+.\" Copyright (c) 2006, 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to The NetBSD Foundation
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 19, 2006
+.Dd October 10, 2009
 .Dt PROP_ARRAY 3
 .Os
 .Sh NAME
@@ -50,6 +50,7 @@
 .Nm prop_array_internalize ,
 .Nm prop_array_externalize_to_file ,
 .Nm prop_array_internalize_from_file ,
+.Nm prop_array_externalize_to_pref ,
 .Nm prop_array_equals
 .Nd array property collection object
 .Sh LIBRARY
@@ -102,6 +103,9 @@
 .Fn prop_array_internalize_from_file "const char *path"
 .\"
 .Ft bool
+.Fn prop_array_externalize_to_pref "prop_array_t array" "struct plistref *pref"
+.\"
+.Ft bool
 .Fn prop_array_equals "prop_array_t array1" "prop_array_t array2"
 .Sh DESCRIPTION
 The
@@ -269,6 +273,13 @@
 Returns
 .Dv NULL
 on failure.
+.It Fn prop_array_externalize_to_pref "prop_array_t array" \
+	"struct plistref *pref"
+Externalizes an array and packs it into the plistref specified by
+.Fa pref .
+Returns
+.Dv false
+if externalizing the array fails for any reason.
 .El
 .Sh SEE ALSO
 .Xr prop_bool 3 ,

Index: src/common/lib/libprop/prop_copyin_ioctl.9
diff -u src/common/lib/libprop/prop_copyin_ioctl.9:1.4 src/common/lib/libprop/prop_copyin_ioctl.9:1.5
--- src/common/lib/libprop/prop_copyin_ioctl.9:1.4	Wed Apr 30 13:10:46 2008
+++ src/common/lib/libprop/prop_copyin_ioctl.9	Sat Oct 10 18:06:54 2009
@@ -1,6 +1,6 @@
-.\"	$NetBSD: prop_copyin_ioctl.9,v 1.4 2008/04/30 13:10:46 martin Exp $
+.\"	$NetBSD: prop_copyin_ioctl.9,v 1.5 2009/10/10 18:06:54 bad Exp $
 .\"
-.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
+.\" Copyright (c) 2006, 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to The NetBSD Foundation
@@ -27,14 +27,16 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 25, 2006
+.Dd October 10, 2009
 .Dt PROP_COPYIN_IOCTL 9
 .Os
 .Sh NAME
 .Nm prop_array_copyin_ioctl ,
 .Nm prop_array_copyout_ioctl ,
+.Nm prop_array_copyin ,
 .Nm prop_dictionary_copyin_ioctl ,
-.Nm prop_dictionary_copyout_ioctl
+.Nm prop_dictionary_copyout_ioctl ,
+.Nm prop_dictionary_copyin
 .Nd Copy property lists to and from kernel space
 .Sh SYNOPSIS
 .In prop/proplib.h
@@ -42,12 +44,18 @@
 .Fn prop_array_copyin_ioctl "const struct plistref *pref" \
 "const u_long cmd" "prop_array_t *arrayp"
 .Ft int
+.Fn prop_array_copyin "const struct plistref *pref" \
+"prop_array_t *arrayp"
+.Ft int
 .Fn prop_array_copyout_ioctl "struct plistref *pref" \
 "const u_long cmd" "prop_array_t array"
 .Ft int
 .Fn prop_dictionary_copyin_ioctl "const struct plistref *pref" \
 "const u_long cmd" "prop_dictionary_t *dictp"
 .Ft int
+.Fn prop_dictionary_copyin "const struct plistref *pref" \
+"prop_dictionary_t *dictp"
+.Ft int
 .Fn prop_dictionary_copyout_ioctl "struct plistref *pref" \
 "const u_long cmd" "prop_dictionary_t dict"
 .Sh DESCRIPTION
@@ -60,8 +68,14 @@
 functions implement the kernel side of a protocol for sending property lists
 to and from the kernel using
 .Xr ioct

CVS commit: src/common/include/prop

2009-10-10 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sat Oct 10 21:26:16 UTC 2009

Modified Files:
src/common/include/prop: prop_array.h prop_dictionary.h

Log Message:
Commit changes to header files missed in my previous commit.

Implement prop_array_externalize_to_pref(), prop_array_copyin(),
prop_dictionary_externalize_to_pref() and prop_dictionary_copyin()
as discussed in the thread:
http://mail-index.netbsd.org/tech-kern/2009/07/29/msg005594.html

Add prototypes for prop_array_externalize_to_pref() and
prop_dictionary_externalize_to_pref().


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/common/include/prop/prop_array.h
cvs rdiff -u -r1.9 -r1.10 src/common/include/prop/prop_dictionary.h

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

Modified files:

Index: src/common/include/prop/prop_array.h
diff -u src/common/include/prop/prop_array.h:1.8 src/common/include/prop/prop_array.h:1.9
--- src/common/include/prop/prop_array.h:1.8	Thu Sep 11 13:15:13 2008
+++ src/common/include/prop/prop_array.h	Sat Oct 10 21:26:16 2009
@@ -1,7 +1,7 @@
-/* $NetBSD: prop_array.h,v 1.8 2008/09/11 13:15:13 haad Exp $*/
+/* $NetBSD: prop_array.h,v 1.9 2009/10/10 21:26:16 bad Exp $*/
 
 /*-
- * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * Copyright (c) 2006, 2009 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -66,12 +66,14 @@
 prop_array_t	prop_array_internalize_from_file(const char *);
 
 #if defined(__NetBSD__)
+struct plistref;
+
 #if !defined(_KERNEL) && !defined(_STANDALONE)
+bool		prop_array_externalize_to_pref(prop_array_t, struct plistref *);
 int		prop_array_send_ioctl(prop_array_t, int, unsigned long);
 int		prop_array_recv_ioctl(int, unsigned long, prop_array_t *);
 #elif defined(_KERNEL)
-struct plistref;
-
+int		prop_array_copyin(const struct plistref *, prop_array_t *);
 int		prop_array_copyin_ioctl(const struct plistref *, const u_long,
 	prop_array_t *);
 int		prop_array_copyout_ioctl(struct plistref *, const u_long,

Index: src/common/include/prop/prop_dictionary.h
diff -u src/common/include/prop/prop_dictionary.h:1.9 src/common/include/prop/prop_dictionary.h:1.10
--- src/common/include/prop/prop_dictionary.h:1.9	Mon Apr 28 20:22:51 2008
+++ src/common/include/prop/prop_dictionary.h	Sat Oct 10 21:26:16 2009
@@ -1,7 +1,7 @@
-/*	$NetBSD: prop_dictionary.h,v 1.9 2008/04/28 20:22:51 martin Exp $	*/
+/*	$NetBSD: prop_dictionary.h,v 1.10 2009/10/10 21:26:16 bad Exp $	*/
 
 /*-
- * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * Copyright (c) 2006, 2009 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -82,7 +82,10 @@
 	  prop_dictionary_keysym_t);
 
 #if defined(__NetBSD__)
+struct plistref;
+
 #if !defined(_KERNEL) && !defined(_STANDALONE)
+bool		prop_dictionary_externalize_to_pref(prop_dictionary_t, struct plistref *);
 int		prop_dictionary_send_ioctl(prop_dictionary_t, int,
 	   unsigned long);
 int		prop_dictionary_recv_ioctl(int, unsigned long,
@@ -91,8 +94,8 @@
 	   int, unsigned long,
 	   prop_dictionary_t *);
 #elif defined(_KERNEL)
-struct plistref;
-
+int		prop_dictionary_copyin(const struct plistref *,
+   prop_dictionary_t *);
 int		prop_dictionary_copyin_ioctl(const struct plistref *,
 	 const u_long,
 	 prop_dictionary_t *);



CVS commit: src/common/lib/libprop

2009-10-11 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sun Oct 11 12:13:45 UTC 2009

Modified Files:
src/common/lib/libprop: prop_kern.c

Log Message:
Back out previous.  Builds for me and on autobuild cluster.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/common/lib/libprop/prop_kern.c

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

Modified files:

Index: src/common/lib/libprop/prop_kern.c
diff -u src/common/lib/libprop/prop_kern.c:1.12 src/common/lib/libprop/prop_kern.c:1.13
--- src/common/lib/libprop/prop_kern.c:1.12	Sat Oct 10 21:27:46 2009
+++ src/common/lib/libprop/prop_kern.c	Sun Oct 11 12:13:45 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_kern.c,v 1.12 2009/10/10 21:27:46 christos Exp $	*/
+/*	$NetBSD: prop_kern.c,v 1.13 2009/10/11 12:13:45 bad Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2009 The NetBSD Foundation, Inc.
@@ -332,7 +332,6 @@
 	return _prop_object_copyin(pref, type, objp);
 }
 
-#ifdef notyet
 /*
  * prop_array_copyin --
  *	Copy in an array passed as a syscall arg.
@@ -354,7 +353,6 @@
 	return (_prop_object_copyin(pref, PROP_TYPE_DICTIONARY,
 	  (prop_object_t *)dictp));
 }
-#endif
 
 
 /*



CVS commit: src/sys

2009-08-01 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sat Aug  1 21:17:12 UTC 2009

Modified Files:
src/sys/kern: vfs_syscalls.c
src/sys/sys: vfs_syscalls.h

Log Message:
As discussed on tech-kern:

Factor out common code of chroot-like syscalls into change_root() and export
that function for use in other parts of the kernel.
Rename change_dir() to chdir_lookup() as the latter describes better what
the function does.  While there, move the namei_data initialisation into
chdir_lookup(), too.  And export chdir_lookup().


To generate a diff of this commit:
cvs rdiff -u -r1.396 -r1.397 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.11 -r1.12 src/sys/sys/vfs_syscalls.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/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.396 src/sys/kern/vfs_syscalls.c:1.397
--- src/sys/kern/vfs_syscalls.c:1.396	Thu Jul  2 12:53:47 2009
+++ src/sys/kern/vfs_syscalls.c	Sat Aug  1 21:17:11 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.396 2009/07/02 12:53:47 pooka Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.397 2009/08/01 21:17:11 bad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.396 2009/07/02 12:53:47 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.397 2009/08/01 21:17:11 bad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -110,7 +110,6 @@
 
 MALLOC_DEFINE(M_MOUNT, "mount", "vfs mount struct");
 
-static int change_dir(struct nameidata *, struct lwp *);
 static int change_flags(struct vnode *, u_long, struct lwp *);
 static int change_mode(struct vnode *, int, struct lwp *l);
 static int change_owner(struct vnode *, uid_t, gid_t, struct lwp *, int);
@@ -1126,7 +1125,6 @@
 sys_fchroot(struct lwp *l, const struct sys_fchroot_args *uap, register_t *retval)
 {
 	struct proc *p = l->l_proc;
-	struct cwdinfo *cwdi;
 	struct vnode	*vp;
 	file_t	*fp;
 	int		 error, fd = SCARG(uap, fd);
@@ -1135,7 +1133,7 @@
  	KAUTH_REQ_SYSTEM_CHROOT_FCHROOT, NULL, NULL, NULL)) != 0)
 		return error;
 	/* fd_getvnode() will use the descriptor for us */
-	if ((error = fd_getvnode(SCARG(uap, fd), &fp)) != 0)
+	if ((error = fd_getvnode(fd, &fp)) != 0)
 		return error;
 	vp = fp->f_data;
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
@@ -1148,27 +1146,7 @@
 		goto out;
 	VREF(vp);
 
-	/*
-	 * Prevent escaping from chroot by putting the root under
-	 * the working directory.  Silently chdir to / if we aren't
-	 * already there.
-	 */
-	cwdi = p->p_cwdi;
-	rw_enter(&cwdi->cwdi_lock, RW_WRITER);
-	if (!vn_isunder(cwdi->cwdi_cdir, vp, l)) {
-		/*
-		 * XXX would be more failsafe to change directory to a
-		 * deadfs node here instead
-		 */
-		vrele(cwdi->cwdi_cdir);
-		VREF(vp);
-		cwdi->cwdi_cdir = vp;
-	}
-
-	if (cwdi->cwdi_rdir != NULL)
-		vrele(cwdi->cwdi_rdir);
-	cwdi->cwdi_rdir = vp;
-	rw_exit(&cwdi->cwdi_lock);
+	change_root(p->p_cwdi, vp, l);
 
  out:
 	fd_putfile(fd);
@@ -1188,16 +1166,15 @@
 	struct proc *p = l->l_proc;
 	struct cwdinfo *cwdi;
 	int error;
-	struct nameidata nd;
+	struct vnode *vp;
 
-	NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, UIO_USERSPACE,
-	SCARG(uap, path));
-	if ((error = change_dir(&nd, l)) != 0)
+	if ((error = chdir_lookup(SCARG(uap, path), UIO_USERSPACE,
+  &vp, l)) != 0)
 		return (error);
 	cwdi = p->p_cwdi;
 	rw_enter(&cwdi->cwdi_lock, RW_WRITER);
 	vrele(cwdi->cwdi_cdir);
-	cwdi->cwdi_cdir = nd.ni_vp;
+	cwdi->cwdi_cdir = vp;
 	rw_exit(&cwdi->cwdi_lock);
 	return (0);
 }
@@ -1213,24 +1190,31 @@
 		syscallarg(const char *) path;
 	} */
 	struct proc *p = l->l_proc;
-	struct cwdinfo *cwdi;
-	struct vnode *vp;
 	int error;
-	struct nameidata nd;
+	struct vnode *vp;
 
 	if ((error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_CHROOT,
 	KAUTH_REQ_SYSTEM_CHROOT_CHROOT, NULL, NULL, NULL)) != 0)
 		return (error);
-	NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, UIO_USERSPACE,
-	SCARG(uap, path));
-	if ((error = change_dir(&nd, l)) != 0)
+	if ((error = chdir_lookup(SCARG(uap, path), UIO_USERSPACE,
+  &vp, l)) != 0)
 		return (error);
 
-	cwdi = p->p_cwdi;
+	change_root(p->p_cwdi, vp, l);
+
+	return (0);
+}
+
+/*
+ * Common routine for chroot and fchroot.
+ */
+void
+change_root(struct cwdinfo *cwdi, struct vnode *vp, struct lwp *l)
+{
+
 	rw_enter(&cwdi->cwdi_lock, RW_WRITER);
 	if (cwdi->cwdi_rdir != NULL)
 		vrele(cwdi->cwdi_rdir);
-	vp = nd.ni_vp;
 	cwdi->cwdi_rdir = vp;
 
 	/*
@@ -1248,31 +1232,31 @@
 		cwdi->cwdi_cdir = vp;
 	}
 	rw_exit(&cwdi->cwdi_lock);
-
-	return (0);
 }
 
 /*
  * Common routine for chroot and chdir.
  */
-static int
-change_dir(struct nameidata *ndp, struct lwp *l)
+int
+chdir_lookup(const char *path, int where, struct vnode **vpp, struct lwp *l)
 {
-	struct vnode *vp;
+	struct nameidata nd;
 	int error;
 
-	if ((error = namei(ndp)) != 0)
+	NDINIT(&nd, LOOKUP, F

CVS commit: src/sys/kern

2009-08-02 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sun Aug  2 20:44:55 UTC 2009

Modified Files:
src/sys/kern: vfs_syscalls.c

Log Message:
Add a note to change_root() that the callers need to authorize the operation.
As requested by e...@.


To generate a diff of this commit:
cvs rdiff -u -r1.397 -r1.398 src/sys/kern/vfs_syscalls.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/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.397 src/sys/kern/vfs_syscalls.c:1.398
--- src/sys/kern/vfs_syscalls.c:1.397	Sat Aug  1 21:17:11 2009
+++ src/sys/kern/vfs_syscalls.c	Sun Aug  2 20:44:55 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.397 2009/08/01 21:17:11 bad Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.398 2009/08/02 20:44:55 bad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.397 2009/08/01 21:17:11 bad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.398 2009/08/02 20:44:55 bad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -1207,6 +1207,7 @@
 
 /*
  * Common routine for chroot and fchroot.
+ * NB: callers need to properly authorize the change root operation.
  */
 void
 change_root(struct cwdinfo *cwdi, struct vnode *vp, struct lwp *l)



CVS commit: src/etc/rc.d

2010-09-25 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sat Sep 25 15:10:14 UTC 2010

Modified Files:
src/etc/rc.d: fsck_root

Log Message:
Treat empty or missing fs_passno field like it has a value of 0 as fstab(5)
specifies.
Related to PR misc/43905 but does not fix the underlying issues.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/etc/rc.d/fsck_root

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

Modified files:

Index: src/etc/rc.d/fsck_root
diff -u src/etc/rc.d/fsck_root:1.4 src/etc/rc.d/fsck_root:1.5
--- src/etc/rc.d/fsck_root:1.4	Tue Feb 16 02:46:02 2010
+++ src/etc/rc.d/fsck_root	Sat Sep 25 15:10:14 2010
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: fsck_root,v 1.4 2010/02/16 02:46:02 mrg Exp $
+# $NetBSD: fsck_root,v 1.5 2010/09/25 15:10:14 bad Exp $
 #
 
 # PROVIDE: fsck_root
@@ -24,7 +24,7 @@
 	# Do nothing if root file system has fs_passno=0 in /etc/fstab.
 	while read fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno
 	do
-		case "${fs_spec}:${fs_file}:${fs_passno}" in
+		case "${fs_spec}:${fs_file}:${fs_passno:=0}" in
 		\#*|'':*)
 			continue # skip comment or blank line
 			;;



CVS commit: src/sys/netinet

2010-10-02 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sat Oct  2 20:07:39 UTC 2010

Modified Files:
src/sys/netinet: files.ipfilter

Log Message:
Defopt the rest of the Ipfilter options and tunables.
Per discussion with darrenr@ a year ago.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/netinet/files.ipfilter

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

Modified files:

Index: src/sys/netinet/files.ipfilter
diff -u src/sys/netinet/files.ipfilter:1.11 src/sys/netinet/files.ipfilter:1.12
--- src/sys/netinet/files.ipfilter:1.11	Sat Apr 17 22:00:33 2010
+++ src/sys/netinet/files.ipfilter	Sat Oct  2 20:07:39 2010
@@ -1,10 +1,25 @@
-#	$NetBSD: files.ipfilter,v 1.11 2010/04/17 22:00:33 darrenr Exp $
+#	$NetBSD: files.ipfilter,v 1.12 2010/10/02 20:07:39 bad Exp $
 
 defflag	opt_ipfilter.h	IPFILTER_LOG		# logging of ip packets
 defflag	opt_ipfilter.h	IPFILTER_DEFAULT_BLOCK
-defflag	opt_ipfilter.h	IPFILTER_LOOKUP
+defflag	opt_ipfilter.h	IPFILTER_BPF		# BPF opcodes in rules
+defflag	opt_ipfilter.h	IPFILTER_CKSUM		# check layer 4 checksums
+defflag	opt_ipfilter.h	IPFILTER_COMPILED	# support for compiled IPF rules
+defflag	opt_ipfilter.h	IPFILTER_LOOKUP		# support for ippool(8)
+defflag	opt_ipfilter.h	IPFILTER_SCAN		# scanning of packet contents
+defflag	opt_ipfilter.h	IPFILTER_SYNC		# synchronisation of state 
 defflag	opt_ipfilter.h	IPFILTER_COMPAT		# IPFilter version compat.
 
+defparam opt_ipfilter.h	IPFILTER_LOGSIZE	# size of logging buffer
+defparam opt_ipfilter.h	IPSTATE_MAX	# maximum number of references to state table entry
+defparam opt_ipfilter.h	IPSTATE_SIZE	# size of state hash table
+defparam opt_ipfilter.h	NAT_TABLE_MAX	# maximum number of NAT state entries
+defparam opt_ipfilter.h	NAT_TABLE_SZ	# size of NAT state hash table
+defparam opt_ipfilter.h	NAT_SIZE	# size of nat rules hash table
+defparam opt_ipfilter.h	RDR_SIZE	# size of rdr rules hash table
+defparam opt_ipfilter.h	HOSTMAP_SIZE	# size of hostmap hash table
+
+
 defpseudo ipfilter: ifnet, bpf_filter		# XXX not really an ifnet
 
 file	dist/ipf/netinet/fil.c			ipfilter
@@ -17,9 +32,9 @@
 file	dist/ipf/netinet/ip_nat.c		ipfilter
 file	dist/ipf/netinet/ip_pool.c		ipfilter
 file	dist/ipf/netinet/ip_proxy.c		ipfilter
-file	dist/ipf/netinet/ip_scan.c		ipfilter
+file	dist/ipf/netinet/ip_scan.c		ipfilter & ipfilter_scan
 file	dist/ipf/netinet/ip_state.c		ipfilter
-file	dist/ipf/netinet/ip_sync.c		ipfilter
+file	dist/ipf/netinet/ip_sync.c		ipfilter & ipfilter_sync
 file	dist/ipf/netinet/ip_fil_compat.c	ipfilter & ipfilter_compat
 
 makeoptions	ipfilter	CPPFLAGS+="-I$S/dist/ipf"



CVS commit: src/share/man/man9

2009-12-24 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Thu Dec 24 22:45:15 UTC 2009

Modified Files:
src/share/man/man9: pool_cache.9

Log Message:
Fix argument names in description of pool_cache_init().


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/share/man/man9/pool_cache.9

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

Modified files:

Index: src/share/man/man9/pool_cache.9
diff -u src/share/man/man9/pool_cache.9:1.13 src/share/man/man9/pool_cache.9:1.14
--- src/share/man/man9/pool_cache.9:1.13	Thu Oct 15 20:50:13 2009
+++ src/share/man/man9/pool_cache.9	Thu Dec 24 22:45:15 2009
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pool_cache.9,v 1.13 2009/10/15 20:50:13 thorpej Exp $
+.\"	$NetBSD: pool_cache.9,v 1.14 2009/12/24 22:45:15 bad Exp $
 .\"
 .\" Copyright (c)2003 YAMAMOTO Takashi,
 .\" All rights reserved.
@@ -132,7 +132,8 @@
 .Sh FUNCTIONS
 .Bl -tag -width compact
 .\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-.It Fn pool_cache_init "pc" "pp" "ctor" "dtor" "arg"
+.It Fn pool_cache_init "size" "align" "align_offset" "flags" \
+"name" "palloc" "ipl"  "ctor" "dtor" "arg"
 .Pp
 Allocate and initialize a pool cache.
 The arguments are:



CVS commit: src/sbin/raidctl

2015-09-08 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Tue Sep  8 08:59:09 UTC 2015

Modified Files:
src/sbin/raidctl: raidctl.c

Log Message:
Rename argument of rf_output_devname() from devname to name to avoid a
warning about shadowing a global symbol when compiled by buildrump.sh.
Discussed with mrg.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sbin/raidctl/raidctl.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/raidctl/raidctl.c
diff -u src/sbin/raidctl/raidctl.c:1.62 src/sbin/raidctl/raidctl.c:1.63
--- src/sbin/raidctl/raidctl.c:1.62	Tue Jul 21 05:54:44 2015
+++ src/sbin/raidctl/raidctl.c	Tue Sep  8 08:59:09 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: raidctl.c,v 1.62 2015/07/21 05:54:44 mrg Exp $   */
+/*  $NetBSD: raidctl.c,v 1.63 2015/09/08 08:59:09 bad Exp $   */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: raidctl.c,v 1.62 2015/07/21 05:54:44 mrg Exp $");
+__RCSID("$NetBSD: raidctl.c,v 1.63 2015/09/08 08:59:09 bad Exp $");
 #endif
 
 
@@ -577,12 +577,12 @@ rf_pm_configure(int fd, int raidID, char
 }
 
 /* convert "component0" into "absent" */
-static const char *rf_output_devname(const char *devname)
+static const char *rf_output_devname(const char *name)
 {
 
-	if (strncmp(devname, "component", 9) == 0)
+	if (strncmp(name, "component", 9) == 0)
 		return "absent";
-	return devname;
+	return name;
 }
 
 static void



CVS commit: src/share/man/man4

2015-10-26 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Mon Oct 26 22:18:58 UTC 2015

Modified Files:
src/share/man/man4: vlan.4

Log Message:
Explain how exactly tagged packets are processed.
While here remove a bit of non-techref wording and assume that people know
what VLANs are good for..

XXX: pullup-7, pullup-6


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/share/man/man4/vlan.4

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

Modified files:

Index: src/share/man/man4/vlan.4
diff -u src/share/man/man4/vlan.4:1.31 src/share/man/man4/vlan.4:1.32
--- src/share/man/man4/vlan.4:1.31	Thu Dec 16 18:29:47 2010
+++ src/share/man/man4/vlan.4	Mon Oct 26 22:18:57 2015
@@ -1,6 +1,6 @@
-.\"	$NetBSD: vlan.4,v 1.31 2010/12/16 18:29:47 wiz Exp $
+.\"	$NetBSD: vlan.4,v 1.32 2015/10/26 22:18:57 bad Exp $
 .\"
-.\" Copyright (c) 2000 The NetBSD Foundation, Inc.
+.\" Copyright (c) 2000, 2015 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to The NetBSD Foundation
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 16, 2010
+.Dd October 26, 2015
 .Dt VLAN 4
 .Os
 .Sh NAME
@@ -43,9 +43,8 @@ interface provides support for
 802.1Q Virtual Local Area Networks
 .Pq Tn VLAN .
 This supports the
-trunking of more than one network on a single network interface.
-This is particularly useful on routers or on hosts which must be
-connected to many different networks through a single physical interface.
+trunking of more than one network on a single network interface by using
+802.1Q tagged and untagged frames.
 .Pp
 To use a
 .Nm vlan
@@ -58,7 +57,9 @@ distinguishes each
 .Tn VLAN
 from any others
 .Pc
-and physical interface associated with the
+and
+.Pq parent
+physical interface associated with the
 .Tn VLAN .
 This can be done by using the
 .Xr ifconfig 8
@@ -75,6 +76,35 @@ and
 .Dv SIOCSIFVLAN
 arguments.
 .Pp
+Packets sent through a
+.Nm
+interface are tagged with the VID and passed to the parent interface for
+transmission.
+Tagged packets received on the parent interface are passed to the
+.Nm
+interface with the corresponding VID associated with the parent interface.
+Packets sent directly through the parent interface are transmitted as
+untagged frames.
+Untagged frames received on the parent interface are handled by the
+parent interface.
+Tagged frames received on the parent interface with a VID of 0 and an
+EtherType of IP or IPv6 are processed on the parent interface.
+Tagged frames received on the parent interface for which no
+.Nm
+interface with a matching VID exists are dropped and counted as
+.Dq unknown protocol .
+.Po
+These are displayed by the
+.Xr ifconfig 8
+.Fl -v
+option.
+.Pc
+.Pp
+If the 
+.Nm
+pseudo-device is not configured in the kernel only packets tagged with a
+VID of 0 are processed.
+.Pp
 To be compatible with other
 .Tn IEEE
 802.1Q devices, the



CVS commit: src/usr.bin/rump_allserver

2013-12-16 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Mon Dec 16 23:27:34 UTC 2013

Modified Files:
src/usr.bin/rump_allserver: rump_allserver.c

Log Message:
Don't hold back, tell us how you really feel when dlopen() fails.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/rump_allserver/rump_allserver.c

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

Modified files:

Index: src/usr.bin/rump_allserver/rump_allserver.c
diff -u src/usr.bin/rump_allserver/rump_allserver.c:1.28 src/usr.bin/rump_allserver/rump_allserver.c:1.29
--- src/usr.bin/rump_allserver/rump_allserver.c:1.28	Wed Nov 13 17:47:27 2013
+++ src/usr.bin/rump_allserver/rump_allserver.c	Mon Dec 16 23:27:33 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_allserver.c,v 1.28 2013/11/13 17:47:27 pooka Exp $	*/
+/*	$NetBSD: rump_allserver.c,v 1.29 2013/12/16 23:27:33 bad Exp $	*/
 
 /*-
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: rump_allserver.c,v 1.28 2013/11/13 17:47:27 pooka Exp $");
+__RCSID("$NetBSD: rump_allserver.c,v 1.29 2013/12/16 23:27:33 bad Exp $");
 #endif /* !lint */
 
 #include 
@@ -65,7 +65,11 @@ __dead static void
 die(int sflag, int error, const char *reason)
 {
 
-	fprintf(stderr, "%s: %s", reason, strerror(error));
+	if (reason != NULL)
+		fputs(reason, stderr);
+	if (error > 0)
+		fprintf(stderr, ": %s", strerror(error));
+	fputc('\n', stderr);
 	if (!sflag)
 		rump_daemonize_done(error);
 	exit(1);
@@ -295,7 +299,8 @@ main(int argc, char *argv[])
 
 snprintf(pb, sizeof(pb), "lib%s.so", optarg);
 if (dlopen(pb, RTLD_LAZY|RTLD_GLOBAL) == NULL) {
-	die(1, 0, "dlopen lib");
+	fprintf(stderr, "dlopen: %s", dlerror());
+	die(1, 0, NULL);
 }
 			}
 			break;



CVS commit: src/sys/dev/pci

2013-12-25 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Thu Dec 26 00:51:23 UTC 2013

Modified Files:
src/sys/dev/pci: ubsec.c

Log Message:
Also disable MCR4INT in ubsec_detach() when appropriate.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/pci/ubsec.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/pci/ubsec.c
diff -u src/sys/dev/pci/ubsec.c:1.34 src/sys/dev/pci/ubsec.c:1.35
--- src/sys/dev/pci/ubsec.c:1.34	Sun Nov 17 23:20:18 2013
+++ src/sys/dev/pci/ubsec.c	Thu Dec 26 00:51:23 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsec.c,v 1.34 2013/11/17 23:20:18 bad Exp $	*/
+/*	$NetBSD: ubsec.c,v 1.35 2013/12/26 00:51:23 bad Exp $	*/
 /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
 /*	$OpenBSD: ubsec.c,v 1.127 2003/06/04 14:04:58 jason Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.34 2013/11/17 23:20:18 bad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.35 2013/12/26 00:51:23 bad Exp $");
 
 #undef UBSEC_DEBUG
 
@@ -544,11 +544,17 @@ ubsec_detach(device_t self, int flags)
 {
 	struct ubsec_softc *sc = device_private(self);
 	struct ubsec_q *q, *qtmp;
+	volatile u_int32_t ctrl;
 
 	/* disable interrupts */
 	/* XXX wait/abort current ops? where is DMAERR enabled? */
-	WRITE_REG(sc, BS_CTRL, READ_REG(sc, BS_CTRL) &~
-	(BS_CTRL_MCR2INT | BS_CTRL_MCR1INT | BS_CTRL_DMAERR));
+	ctrl = READ_REG(sc, BS_CTRL);
+
+	ctrl &= ~(BS_CTRL_MCR2INT | BS_CTRL_MCR1INT | BS_CTRL_DMAERR);
+	if (sc->sc_flags & UBS_FLAGS_MULTIMCR)
+		ctrl &= ~BS_CTRL_MCR4INT;
+
+	WRITE_REG(sc, BS_CTRL, ctrl);
 
 #ifndef UBSEC_NO_RNG
 	if (sc->sc_flags & UBS_FLAGS_RNG) {



CVS commit: src

2014-08-09 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sat Aug  9 12:34:05 UTC 2014

Modified Files:
src/distrib/sets/lists/modules: ad.arm ad.mips md.alpha md.amd64
md.hppa md.i386 md.ia64 md.sparc md.sparc64
src/sys/modules: Makefile

Log Message:
Build ubsec(4) as a module on all arches where it was obivous how to do so.
That excludes powerpc because evppc OEA is missing definitions for
PPC_INTR_IMPL and PPC_PCI_MACHDEP_IMPL.
Adjust set lists.

Compile tested for most arches only.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/distrib/sets/lists/modules/ad.arm \
src/distrib/sets/lists/modules/md.sparc64
cvs rdiff -u -r1.1 -r1.2 src/distrib/sets/lists/modules/ad.mips \
src/distrib/sets/lists/modules/md.alpha \
src/distrib/sets/lists/modules/md.hppa \
src/distrib/sets/lists/modules/md.ia64
cvs rdiff -u -r1.38 -r1.39 src/distrib/sets/lists/modules/md.amd64
cvs rdiff -u -r1.43 -r1.44 src/distrib/sets/lists/modules/md.i386
cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/modules/md.sparc
cvs rdiff -u -r1.136 -r1.137 src/sys/modules/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/modules/ad.arm
diff -u src/distrib/sets/lists/modules/ad.arm:1.2 src/distrib/sets/lists/modules/ad.arm:1.3
--- src/distrib/sets/lists/modules/ad.arm:1.2	Sun Aug 11 22:29:03 2013
+++ src/distrib/sets/lists/modules/ad.arm	Sat Aug  9 12:34:05 2014
@@ -1,4 +1,6 @@
-# $NetBSD: ad.arm,v 1.2 2013/08/11 22:29:03 joerg Exp $
+# $NetBSD: ad.arm,v 1.3 2014/08/09 12:34:05 bad Exp $
 
 ./@MODULEDIR@/exec_elf32			base-kernel-modules	kmod
 ./@MODULEDIR@/exec_elf32/exec_elf32.kmod	base-kernel-modules	kmod
+./@MODULEDIR@/ubsecbase-kernel-modules	kmod
+./@MODULEDIR@/ubsec/ubsec.kmod			base-kernel-modules	kmod
Index: src/distrib/sets/lists/modules/md.sparc64
diff -u src/distrib/sets/lists/modules/md.sparc64:1.2 src/distrib/sets/lists/modules/md.sparc64:1.3
--- src/distrib/sets/lists/modules/md.sparc64:1.2	Thu Aug 11 12:03:58 2011
+++ src/distrib/sets/lists/modules/md.sparc64	Sat Aug  9 12:34:05 2014
@@ -1,7 +1,9 @@
-# $NetBSD: md.sparc64,v 1.2 2011/08/11 12:03:58 mbalmer Exp $
+# $NetBSD: md.sparc64,v 1.3 2014/08/09 12:34:05 bad Exp $
 ./@MODULEDIR@/exec_elf32			base-kernel-modules	kmod
 ./@MODULEDIR@/exec_elf32/exec_elf32.kmod	base-kernel-modules	kmod
 ./@MODULEDIR@/exec_elf64			base-kernel-modules	kmod
 ./@MODULEDIR@/exec_elf64/exec_elf64.kmod	base-kernel-modules	kmod
 ./@MODULEDIR@/pwdogbase-kernel-modules	kmod
 ./@MODULEDIR@/pwdog/pwdog.kmod			base-kernel-modules	kmod
+./@MODULEDIR@/ubsecbase-kernel-modules	kmod
+./@MODULEDIR@/ubsec/ubsec.kmod			base-kernel-modules	kmod

Index: src/distrib/sets/lists/modules/ad.mips
diff -u src/distrib/sets/lists/modules/ad.mips:1.1 src/distrib/sets/lists/modules/ad.mips:1.2
--- src/distrib/sets/lists/modules/ad.mips:1.1	Tue Apr 30 23:41:24 2013
+++ src/distrib/sets/lists/modules/ad.mips	Sat Aug  9 12:34:05 2014
@@ -1,3 +1,5 @@
-# $NetBSD: ad.mips,v 1.1 2013/04/30 23:41:24 matt Exp $
+# $NetBSD: ad.mips,v 1.2 2014/08/09 12:34:05 bad Exp $
 ./@MODULEDIR@/exec_elf32			base-kernel-modules	kmod
 ./@MODULEDIR@/exec_elf32/exec_elf32.kmod	base-kernel-modules	kmod
+./@MODULEDIR@/ubsecbase-kernel-modules	kmod
+./@MODULEDIR@/ubsec/ubsec.kmod			base-kernel-modules	kmod
Index: src/distrib/sets/lists/modules/md.alpha
diff -u src/distrib/sets/lists/modules/md.alpha:1.1 src/distrib/sets/lists/modules/md.alpha:1.2
--- src/distrib/sets/lists/modules/md.alpha:1.1	Mon Sep  7 02:27:29 2009
+++ src/distrib/sets/lists/modules/md.alpha	Sat Aug  9 12:34:05 2014
@@ -1,3 +1,5 @@
-# $NetBSD: md.alpha,v 1.1 2009/09/07 02:27:29 jnemeth Exp $
+# $NetBSD: md.alpha,v 1.2 2014/08/09 12:34:05 bad Exp $
 ./@MODULEDIR@/exec_elf64			base-kernel-modules	kmod
 ./@MODULEDIR@/exec_elf64/exec_elf64.kmod	base-kernel-modules	kmod
+./@MODULEDIR@/ubsecbase-kernel-modules	kmod
+./@MODULEDIR@/ubsec/ubsec.kmod			base-kernel-modules	kmod
Index: src/distrib/sets/lists/modules/md.hppa
diff -u src/distrib/sets/lists/modules/md.hppa:1.1 src/distrib/sets/lists/modules/md.hppa:1.2
--- src/distrib/sets/lists/modules/md.hppa:1.1	Mon Feb 24 07:23:39 2014
+++ src/distrib/sets/lists/modules/md.hppa	Sat Aug  9 12:34:05 2014
@@ -1,3 +1,5 @@
-# $NetBSD: md.hppa,v 1.1 2014/02/24 07:23:39 skrll Exp $
+# $NetBSD: md.hppa,v 1.2 2014/08/09 12:34:05 bad Exp $
 ./@MODULEDIR@/exec_elf32			base-kernel-modules	kmod
 ./@MODULEDIR@/exec_elf32/exec_elf32.kmod	base-kernel-modules	kmod
+./@MODULEDIR@/ubsecbase-kernel-modules	kmod
+./@MODULEDIR@/ubsec/ubsec.kmod			base-kernel-modules	kmod
Index: src/distrib/sets/lists/modules/md.ia64
diff -u src/distrib/sets/lists/modules/md.ia64:1.1 src/distrib/sets/lists/modules/md.ia64:1.2
--- src/distrib/sets/lists/modules/md.ia64:1.1	Mon May 31 20:32:28 2010
+++ src/distrib/sets/lists/modules/md.ia64	Sat Aug  9 12:34:05 2014
@@ -1,3 +1,5 @@
-# $NetBSD

CVS commit: src/usr.bin/config

2014-08-09 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sat Aug  9 12:40:14 UTC 2014

Modified Files:
src/usr.bin/config: main.c

Log Message:
Treat an undefined option as a warning instead of an error when undoing an
option.

Allows one to win with declarations like:
no options  MSGBUFSIZE
options MSGBUFSIZE="128*1024"

Briefly discussed with cube@, lukem@ and martin@.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/usr.bin/config/main.c

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

Modified files:

Index: src/usr.bin/config/main.c
diff -u src/usr.bin/config/main.c:1.53 src/usr.bin/config/main.c:1.54
--- src/usr.bin/config/main.c:1.53	Mon May  5 21:04:09 2014
+++ src/usr.bin/config/main.c	Sat Aug  9 12:40:14 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.53 2014/05/05 21:04:09 wiz Exp $	*/
+/*	$NetBSD: main.c,v 1.54 2014/08/09 12:40:14 bad Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -1093,9 +1093,8 @@ undo_option(struct hashtab *ht, struct n
 		/*
 		 * -U command line option removals are always silent
 		 */
-		if (handling_cmdlineopts)
-			return 0;
-		cfgerror("%s `%s' is not defined", type, name);
+		if (!handling_cmdlineopts)
+			cfgwarn("%s `%s' is not defined", type, name);
 		return (1);
 	}
 	if (npp == NULL)



CVS commit: src/distrib/sets/lists/modules

2014-08-10 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sun Aug 10 11:51:40 UTC 2014

Modified Files:
src/distrib/sets/lists/modules: ad.arm ad.mips md.alpha md.hppa md.ia64
md.sparc md.sparc64

Log Message:
Build ubsec module only for i386 and amd64 and punt on the other arches.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/modules/ad.arm \
src/distrib/sets/lists/modules/md.sparc64
cvs rdiff -u -r1.2 -r1.3 src/distrib/sets/lists/modules/ad.mips \
src/distrib/sets/lists/modules/md.alpha \
src/distrib/sets/lists/modules/md.hppa \
src/distrib/sets/lists/modules/md.ia64
cvs rdiff -u -r1.4 -r1.5 src/distrib/sets/lists/modules/md.sparc

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/modules/ad.arm
diff -u src/distrib/sets/lists/modules/ad.arm:1.3 src/distrib/sets/lists/modules/ad.arm:1.4
--- src/distrib/sets/lists/modules/ad.arm:1.3	Sat Aug  9 12:34:05 2014
+++ src/distrib/sets/lists/modules/ad.arm	Sun Aug 10 11:51:40 2014
@@ -1,6 +1,4 @@
-# $NetBSD: ad.arm,v 1.3 2014/08/09 12:34:05 bad Exp $
+# $NetBSD: ad.arm,v 1.4 2014/08/10 11:51:40 bad Exp $
 
 ./@MODULEDIR@/exec_elf32			base-kernel-modules	kmod
 ./@MODULEDIR@/exec_elf32/exec_elf32.kmod	base-kernel-modules	kmod
-./@MODULEDIR@/ubsecbase-kernel-modules	kmod
-./@MODULEDIR@/ubsec/ubsec.kmod			base-kernel-modules	kmod
Index: src/distrib/sets/lists/modules/md.sparc64
diff -u src/distrib/sets/lists/modules/md.sparc64:1.3 src/distrib/sets/lists/modules/md.sparc64:1.4
--- src/distrib/sets/lists/modules/md.sparc64:1.3	Sat Aug  9 12:34:05 2014
+++ src/distrib/sets/lists/modules/md.sparc64	Sun Aug 10 11:51:40 2014
@@ -1,9 +1,7 @@
-# $NetBSD: md.sparc64,v 1.3 2014/08/09 12:34:05 bad Exp $
+# $NetBSD: md.sparc64,v 1.4 2014/08/10 11:51:40 bad Exp $
 ./@MODULEDIR@/exec_elf32			base-kernel-modules	kmod
 ./@MODULEDIR@/exec_elf32/exec_elf32.kmod	base-kernel-modules	kmod
 ./@MODULEDIR@/exec_elf64			base-kernel-modules	kmod
 ./@MODULEDIR@/exec_elf64/exec_elf64.kmod	base-kernel-modules	kmod
 ./@MODULEDIR@/pwdogbase-kernel-modules	kmod
 ./@MODULEDIR@/pwdog/pwdog.kmod			base-kernel-modules	kmod
-./@MODULEDIR@/ubsecbase-kernel-modules	kmod
-./@MODULEDIR@/ubsec/ubsec.kmod			base-kernel-modules	kmod

Index: src/distrib/sets/lists/modules/ad.mips
diff -u src/distrib/sets/lists/modules/ad.mips:1.2 src/distrib/sets/lists/modules/ad.mips:1.3
--- src/distrib/sets/lists/modules/ad.mips:1.2	Sat Aug  9 12:34:05 2014
+++ src/distrib/sets/lists/modules/ad.mips	Sun Aug 10 11:51:40 2014
@@ -1,5 +1,3 @@
-# $NetBSD: ad.mips,v 1.2 2014/08/09 12:34:05 bad Exp $
+# $NetBSD: ad.mips,v 1.3 2014/08/10 11:51:40 bad Exp $
 ./@MODULEDIR@/exec_elf32			base-kernel-modules	kmod
 ./@MODULEDIR@/exec_elf32/exec_elf32.kmod	base-kernel-modules	kmod
-./@MODULEDIR@/ubsecbase-kernel-modules	kmod
-./@MODULEDIR@/ubsec/ubsec.kmod			base-kernel-modules	kmod
Index: src/distrib/sets/lists/modules/md.alpha
diff -u src/distrib/sets/lists/modules/md.alpha:1.2 src/distrib/sets/lists/modules/md.alpha:1.3
--- src/distrib/sets/lists/modules/md.alpha:1.2	Sat Aug  9 12:34:05 2014
+++ src/distrib/sets/lists/modules/md.alpha	Sun Aug 10 11:51:40 2014
@@ -1,5 +1,3 @@
-# $NetBSD: md.alpha,v 1.2 2014/08/09 12:34:05 bad Exp $
+# $NetBSD: md.alpha,v 1.3 2014/08/10 11:51:40 bad Exp $
 ./@MODULEDIR@/exec_elf64			base-kernel-modules	kmod
 ./@MODULEDIR@/exec_elf64/exec_elf64.kmod	base-kernel-modules	kmod
-./@MODULEDIR@/ubsecbase-kernel-modules	kmod
-./@MODULEDIR@/ubsec/ubsec.kmod			base-kernel-modules	kmod
Index: src/distrib/sets/lists/modules/md.hppa
diff -u src/distrib/sets/lists/modules/md.hppa:1.2 src/distrib/sets/lists/modules/md.hppa:1.3
--- src/distrib/sets/lists/modules/md.hppa:1.2	Sat Aug  9 12:34:05 2014
+++ src/distrib/sets/lists/modules/md.hppa	Sun Aug 10 11:51:40 2014
@@ -1,5 +1,3 @@
-# $NetBSD: md.hppa,v 1.2 2014/08/09 12:34:05 bad Exp $
+# $NetBSD: md.hppa,v 1.3 2014/08/10 11:51:40 bad Exp $
 ./@MODULEDIR@/exec_elf32			base-kernel-modules	kmod
 ./@MODULEDIR@/exec_elf32/exec_elf32.kmod	base-kernel-modules	kmod
-./@MODULEDIR@/ubsecbase-kernel-modules	kmod
-./@MODULEDIR@/ubsec/ubsec.kmod			base-kernel-modules	kmod
Index: src/distrib/sets/lists/modules/md.ia64
diff -u src/distrib/sets/lists/modules/md.ia64:1.2 src/distrib/sets/lists/modules/md.ia64:1.3
--- src/distrib/sets/lists/modules/md.ia64:1.2	Sat Aug  9 12:34:05 2014
+++ src/distrib/sets/lists/modules/md.ia64	Sun Aug 10 11:51:40 2014
@@ -1,5 +1,3 @@
-# $NetBSD: md.ia64,v 1.2 2014/08/09 12:34:05 bad Exp $
+# $NetBSD: md.ia64,v 1.3 2014/08/10 11:51:40 bad Exp $
 ./@MODULEDIR@/acpiverbose			base-kernel-modules	kmod
 ./@MODULEDIR@/acpiverbose/acpiverbose.kmod	base-kernel-modules	kmod
-./@MODULEDIR@/ubsecbase-kernel-modules	kmod
-./@MODULEDIR@/ubsec/ubsec.kmod			base-kernel-modules	kmod

Index: src/distrib/sets/lists/modules/md.sparc
diff -u src/distrib/sets/lists/modul

CVS commit: src/sys/modules

2014-08-10 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sun Aug 10 11:50:15 UTC 2014

Modified Files:
src/sys/modules: Makefile

Log Message:
Revert most of rev 1.137.  Build ubsec module only for i386 and amd64 and
punt on the other arches.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/modules/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/modules/Makefile
diff -u src/sys/modules/Makefile:1.139 src/sys/modules/Makefile:1.140
--- src/sys/modules/Makefile:1.139	Sun Aug 10 05:57:31 2014
+++ src/sys/modules/Makefile	Sun Aug 10 11:50:15 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.139 2014/08/10 05:57:31 matt Exp $
+#	$NetBSD: Makefile,v 1.140 2014/08/10 11:50:15 bad Exp $
 
 .include 
 
@@ -143,14 +143,7 @@ SUBDIR+=	tprof_amdpmi
 SUBDIR+=	vmt
 .endif
 
-.if ${MACHINE_ARCH} == "alpha" || \
-!empty(MACHINE_ARCH:Mearm*) || !empty(MACHINE_ARCH:Marm*) || \
-${MACHINE_ARCH} == "i386" || \
-${MACHINE_ARCH} == "ia64" || \
-${MACHINE_ARCH} == "hppa" || \
-!empty(MACHINE_ARCH:Mmips*) || \
-${MACHINE_ARCH} == "sparc" || \
-${MACHINE_ARCH} == "sparc64" || \
+.if ${MACHINE_ARCH} == "i386" || \
 ${MACHINE_ARCH} == "x86_64"
 SUBDIR+=	ubsec		# Builds on architectures with PCI bus
 .endif



CVS commit: src/usr.bin/systat

2013-10-14 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Mon Oct 14 22:23:22 UTC 2013

Modified Files:
src/usr.bin/systat: keyboard.c

Log Message:
No David, '\?' is not the del character.  Broken in rev 1.21.
XXX pullup-5, pullup-6.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/systat/keyboard.c

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

Modified files:

Index: src/usr.bin/systat/keyboard.c
diff -u src/usr.bin/systat/keyboard.c:1.24 src/usr.bin/systat/keyboard.c:1.25
--- src/usr.bin/systat/keyboard.c:1.24	Mon Dec 31 00:22:14 2007
+++ src/usr.bin/systat/keyboard.c	Mon Oct 14 22:23:22 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: keyboard.c,v 1.24 2007/12/31 00:22:14 christos Exp $	*/
+/*	$NetBSD: keyboard.c,v 1.25 2013/10/14 22:23:22 bad Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1992, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)keyboard.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: keyboard.c,v 1.24 2007/12/31 00:22:14 christos Exp $");
+__RCSID("$NetBSD: keyboard.c,v 1.25 2013/10/14 22:23:22 bad Exp $");
 #endif /* not lint */
 
 #include 
@@ -121,7 +121,7 @@ keyboard(void)
 }
 continue;
 			}
-			if (ch == '\b' || ch == '\?' || ch == erasechar()) {
+			if (ch == '\b' || ch == '\177' || ch == erasechar()) {
 if (col > 0)
 	col--;
 goto doerase;



CVS commit: src/usr.bin/netstat

2013-10-18 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Fri Oct 18 22:18:14 UTC 2013

Modified Files:
src/usr.bin/netstat: main.c netstat.1

Log Message:
Make the -f option accept multiple address families.
Bump man page date.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/usr.bin/netstat/main.c
cvs rdiff -u -r1.66 -r1.67 src/usr.bin/netstat/netstat.1

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/netstat/main.c
diff -u src/usr.bin/netstat/main.c:1.86 src/usr.bin/netstat/main.c:1.87
--- src/usr.bin/netstat/main.c:1.86	Wed Jun 19 21:12:03 2013
+++ src/usr.bin/netstat/main.c	Fri Oct 18 22:18:14 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.86 2013/06/19 21:12:03 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.87 2013/10/18 22:18:14 bad Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "from: @(#)main.c	8.4 (Berkeley) 3/1/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.86 2013/06/19 21:12:03 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.87 2013/10/18 22:18:14 bad Exp $");
 #endif
 #endif /* not lint */
 
@@ -395,6 +395,7 @@ main(int argc, char *argv[])
 	struct protox *tp;	/* for printing cblocks & stats */
 	int ch;
 	char *cp;
+	char *afname, *afnames;
 	u_long pcbaddr;
 
 	if (prog_init) {
@@ -407,6 +408,7 @@ main(int argc, char *argv[])
 	(void)setegid(getgid());
 	tp = NULL;
 	af = AF_UNSPEC;
+	afnames = NULL;
 	pcbaddr = 0;
 
 	while ((ch = getopt(argc, argv,
@@ -428,24 +430,7 @@ main(int argc, char *argv[])
 			dflag = 1;
 			break;
 		case 'f':
-			if (strcmp(optarg, "inet") == 0)
-af = AF_INET;
-			else if (strcmp(optarg, "inet6") == 0)
-af = AF_INET6;
-			else if (strcmp(optarg, "arp") == 0)
-af = AF_ARP;
-			else if (strcmp(optarg, "pfkey") == 0)
-af = PF_KEY;
-			else if (strcmp(optarg, "unix") == 0
-			|| strcmp(optarg, "local") == 0)
-af = AF_LOCAL;
-			else if (strcmp(optarg, "atalk") == 0)
-af = AF_APPLETALK;
-			else if (strcmp(optarg, "mpls") == 0)
-af = AF_MPLS;
-			else
-errx(1, "%s: unknown address family",
-optarg);
+			afnames = optarg;
 			break;
 #ifndef SMALL
 		case 'g':
@@ -603,91 +588,124 @@ main(int argc, char *argv[])
 	 */
 	sethostent(1);
 	setnetent(1);
-	if (iflag) {
-		if (af != AF_UNSPEC)
-			goto protostat;
+	/*
+	 * If -f was used afnames != NULL, loop over the address families.
+	 * Otherwise do this at least once (with af == AF_UNSPEC).
+	 */
+	afname = NULL;
+	do {
+		if (afnames != NULL) {
+			afname = strsep(&afnames, ",");
+			if (afname == NULL)
+break;		/* Exit early */
+			if (strcmp(afname, "inet") == 0)
+af = AF_INET;
+			else if (strcmp(afname, "inet6") == 0)
+af = AF_INET6;
+			else if (strcmp(afname, "arp") == 0)
+af = AF_ARP;
+			else if (strcmp(afname, "pfkey") == 0)
+af = PF_KEY;
+			else if (strcmp(afname, "unix") == 0
+			|| strcmp(afname, "local") == 0)
+af = AF_LOCAL;
+			else if (strcmp(afname, "atalk") == 0)
+af = AF_APPLETALK;
+			else if (strcmp(afname, "mpls") == 0)
+af = AF_MPLS;
+			else {
+warnx("%s: unknown address family",
+afname);
+continue;
+			}
+		}
 
-		intpr(interval, nl[N_IFNET].n_value, NULL);
-		exit(0);
-	}
-	if (rflag) {
-		if (sflag)
-			rt_stats(use_sysctl ? 0 : nl[N_RTSTAT].n_value);
-		else {
-			if (!use_sysctl)
-err(1, "-r is not supported "
-"for post-mortem analysis.");
-			p_rttables(af);
+		if (iflag) {
+			if (af != AF_UNSPEC)
+goto protostat;
+
+			intpr(interval, nl[N_IFNET].n_value, NULL);
+			break;
+		}
+		if (rflag) {
+			if (sflag)
+rt_stats(use_sysctl ? 0 : nl[N_RTSTAT].n_value);
+			else {
+if (!use_sysctl)
+	err(1, "-r is not supported "
+	"for post-mortem analysis.");
+p_rttables(af);
+			}
+			break;
 		}
-		exit(0);
-	}
 #ifndef SMALL
-	if (gflag) {
-		if (sflag) {
-			if (af == AF_INET || af == AF_UNSPEC)
-mrt_stats(nl[N_MRTPROTO].n_value,
-	  nl[N_MRTSTAT].n_value);
+		if (gflag) {
+			if (sflag) {
+if (af == AF_INET || af == AF_UNSPEC)
+	mrt_stats(nl[N_MRTPROTO].n_value,
+		  nl[N_MRTSTAT].n_value);
 #ifdef INET6
-			if (af == AF_INET6 || af == AF_UNSPEC)
-mrt6_stats(nl[N_MRT6PROTO].n_value,
-	   nl[N_MRT6STAT].n_value);
+if (af == AF_INET6 || af == AF_UNSPEC)
+	mrt6_stats(nl[N_MRT6PROTO].n_value,
+		   nl[N_MRT6STAT].n_value);
 #endif
-		}
-		else {
-			if (af == AF_INET || af == AF_UNSPEC)
-mroutepr(nl[N_MRTPROTO].n_value,
-	 nl[N_MFCHASHTBL].n_value,
-	 nl[N_MFCHASH].n_value,
-	 nl[N_VIFTABLE].n_value);
+			}
+			else {
+if (af == AF_INET || af == AF_UNSPEC)
+	mroutepr(nl[N_MRTPROTO].n_value,
+		 nl[N_MFCHASHTBL].n_value,
+		 nl[N_MFCHASH].n_value,
+		 nl[N_VIFTABLE].n_value);
 #ifdef INET6
-			if (af == AF_INET6 || af == AF_UNSPEC)
-mroute6pr(nl[N_MRT6PROTO].n_value,
-	  nl[N_

CVS commit: src/usr.bin/systat

2013-10-18 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Fri Oct 18 22:42:31 UTC 2013

Modified Files:
src/usr.bin/systat: disks.c systat.1

Log Message:
Make :drives, :display, :ignore accept fnmatch(3) patterns to specify drives.
Bump man page date.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/systat/disks.c
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/systat/systat.1

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/systat/disks.c
diff -u src/usr.bin/systat/disks.c:1.17 src/usr.bin/systat/disks.c:1.18
--- src/usr.bin/systat/disks.c:1.17	Mon Apr 13 23:20:27 2009
+++ src/usr.bin/systat/disks.c	Fri Oct 18 22:42:31 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.17 2009/04/13 23:20:27 lukem Exp $	*/
+/*	$NetBSD: disks.c,v 1.18 2013/10/18 22:42:31 bad Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1992, 1993
@@ -34,11 +34,12 @@
 #if 0
 static char sccsid[] = "@(#)disks.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: disks.c,v 1.17 2009/04/13 23:20:27 lukem Exp $");
+__RCSID("$NetBSD: disks.c,v 1.18 2013/10/18 22:42:31 bad Exp $");
 #endif /* not lint */
 
 #include 
 #include 
+#include 
 
 #include "systat.h"
 #include "extern.h"
@@ -99,9 +100,8 @@ drvselect(char *args, int truefalse, int
 		if (cp - args == 0)
 			break;
 		for (i = 0; i < ndrive; i++)
-			if (strcmp(args, dr_name[i]) == 0) {
+			if (fnmatch(args, dr_name[i], 0) == 0) {
 selections[i] = truefalse;
-break;
 			}
 		if (i >= ndrive)
 			error("%s: unknown drive", args);

Index: src/usr.bin/systat/systat.1
diff -u src/usr.bin/systat/systat.1:1.42 src/usr.bin/systat/systat.1:1.43
--- src/usr.bin/systat/systat.1:1.42	Thu Mar 22 07:58:20 2012
+++ src/usr.bin/systat/systat.1	Fri Oct 18 22:42:31 2013
@@ -1,4 +1,4 @@
-.\"	$NetBSD: systat.1,v 1.42 2012/03/22 07:58:20 wiz Exp $
+.\"	$NetBSD: systat.1,v 1.43 2013/10/18 22:42:31 bad Exp $
 .\"
 .\" Copyright (c) 1985, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)systat.1	8.2 (Berkeley) 12/30/93
 .\"
-.Dd January 5, 2012
+.Dd October 19, 2012
 .Dt SYSTAT 1
 .Os
 .Sh NAME
@@ -500,6 +500,9 @@ information about disk drives.
 These commands are used to select a set of drives to report on,
 should your system have more drives configured than can normally
 be displayed on the screen.
+Drives may be specified as drive names or as patterns specified in the
+notation described by
+.Xr fnmatch 3 .
 .Pp
 .Bl -tag -width Ar -compact
 .It Cm display Op Ar drives



CVS commit: src/doc

2013-10-18 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Fri Oct 18 22:49:40 UTC 2013

Modified Files:
src/doc: CHANGES

Log Message:
netstat -f takes multiple address families.
systat now allows fnmatch(3) patterns to select drives.


To generate a diff of this commit:
cvs rdiff -u -r1.1853 -r1.1854 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1853 src/doc/CHANGES:1.1854
--- src/doc/CHANGES:1.1853	Sun Oct 13 17:03:00 2013
+++ src/doc/CHANGES	Fri Oct 18 22:49:40 2013
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1853 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1854 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -288,4 +288,5 @@ Changes from NetBSD 6.0 to NetBSD 7.0:
 	binutils: updated to FSF binutils 2.23.2.  [christos 20130929]
 	gdb(1): Updated to 7.6.1.  [christos 20131003]
 	httpd(8): Added Lua scripting for content creation. [mbalmer 20131012]
-
+	netstat(1): Accept -faddress_family[,family ...]. [bad 20131019]
+	systat(1): Accept shell patterns to select drives. [bad 20131019]



CVS commit: src/sys/ufs/ffs

2013-10-28 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Mon Oct 28 21:32:52 UTC 2013

Modified Files:
src/sys/ufs/ffs: ffs_alloc.c

Log Message:
Pull in fix from FreeBSD ffs_alloc.c r121785:
Consider only cylinder groups with at least 75% of the average free space
per cylinder group and 75% of the average free inodes per cylinder group
as candidates for the creation of a new directory.  Avoids excessive I/O
scanning for a suitable cylinder group on relatively full file systems.

Tested by sborril and me.

Pullup: netbsd-6, netbsd-5

Original commit message:

Tweak the calculation of minbfree in ffs_dirpref() so that only
those cylinder groups that have at least 75% of the average free
space per cylinder group for that file system are considered as
candidates for the creation of a new directory.  The previous formula
for minbfree would set it to zero if the file system was more than
75% full, which allowed cylinder groups with no free space at all
to be chosen as candidates for directory creation, which resulted
in an expensive search for free blocks for each file that was
subsequently created in that directory.

Modify the calculation of minifree in the same way.

Decrease maxcontigdirs as the file system fills to decrease the
likelyhood that a cluster of directories will overflow the available
space in a cylinder group.

Reviewed by:mckusick
Tested by:  km...@vicor.com
MFC after:  2 weeks


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/ufs/ffs/ffs_alloc.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/ufs/ffs/ffs_alloc.c
diff -u src/sys/ufs/ffs/ffs_alloc.c:1.143 src/sys/ufs/ffs/ffs_alloc.c:1.144
--- src/sys/ufs/ffs/ffs_alloc.c:1.143	Sun Oct 20 00:20:53 2013
+++ src/sys/ufs/ffs/ffs_alloc.c	Mon Oct 28 21:32:52 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_alloc.c,v 1.143 2013/10/20 00:20:53 christos Exp $	*/
+/*	$NetBSD: ffs_alloc.c,v 1.144 2013/10/28 21:32:52 bad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.143 2013/10/20 00:20:53 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.144 2013/10/28 21:32:52 bad Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -720,14 +720,17 @@ ffs_dirpref(struct inode *pip)
 	/*
 	 * Count various limits which used for
 	 * optimal allocation of a directory inode.
+	 * Try cylinder groups with >75% avgifree and avgbfree.
+	 * Avoid cylinder groups with no free blocks or inodes as that
+	 * triggers an I/O-expensive cylinder group scan.
 	 */
 	maxndir = min(avgndir + fs->fs_ipg / 16, fs->fs_ipg);
-	minifree = avgifree - fs->fs_ipg / 4;
-	if (minifree < 0)
-		minifree = 0;
-	minbfree = avgbfree - ffs_fragstoblks(fs, fs->fs_fpg) / 4;
-	if (minbfree < 0)
-		minbfree = 0;
+	minifree = avgifree - avgifree / 4;
+	if (minifree < 1)
+		minifree = 1;
+	minbfree = avgbfree - avgbfree / 4;
+	if (minbfree < 1)
+		minbfree = 1;
 	cgsize = (int64_t)fs->fs_fsize * fs->fs_fpg;
 	dirsize = (int64_t)fs->fs_avgfilesize * fs->fs_avgfpdir;
 	if (avgndir != 0) {
@@ -736,7 +739,7 @@ ffs_dirpref(struct inode *pip)
 			dirsize = curdsz;
 	}
 	if (cgsize < dirsize * 255)
-		maxcontigdirs = cgsize / dirsize;
+		maxcontigdirs = (avgbfree * fs->fs_bsize) / dirsize;
 	else
 		maxcontigdirs = 255;
 	if (fs->fs_avgfpdir > 0)



CVS commit: src/sys/dev/pci

2013-11-17 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sun Nov 17 16:54:02 UTC 2013

Modified Files:
src/sys/dev/pci: ubsec.c

Log Message:
Use callout_setfunc()/callout_schedule() instead of callout_reset(), it is 
cheaper.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/pci/ubsec.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/pci/ubsec.c
diff -u src/sys/dev/pci/ubsec.c:1.29 src/sys/dev/pci/ubsec.c:1.30
--- src/sys/dev/pci/ubsec.c:1.29	Thu Jun 13 00:55:01 2013
+++ src/sys/dev/pci/ubsec.c	Sun Nov 17 16:54:02 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsec.c,v 1.29 2013/06/13 00:55:01 tls Exp $	*/
+/*	$NetBSD: ubsec.c,v 1.30 2013/11/17 16:54:02 bad Exp $	*/
 /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
 /*	$OpenBSD: ubsec.c,v 1.127 2003/06/04 14:04:58 jason Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.29 2013/06/13 00:55:01 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.30 2013/11/17 16:54:02 bad Exp $");
 
 #undef UBSEC_DEBUG
 
@@ -448,7 +448,8 @@ ubsec_attach(device_t parent, device_t s
 		timeout_add(&sc->sc_rngto, sc->sc_rnghz);
 #else
 		callout_init(&sc->sc_rngto, 0);
-		callout_reset(&sc->sc_rngto, sc->sc_rnghz, ubsec_rng, sc);
+		callout_setfunc(&sc->sc_rngto, ubsec_rng, sc);
+		callout_schedule(&sc->sc_rngto, sc->sc_rnghz);
 #endif
  skip_rng:
 		if (sc->sc_rnghz)
@@ -1659,8 +1660,7 @@ ubsec_callback2(struct ubsec_softc *sc, 
 		timeout_add(&sc->sc_rngto, sc->sc_rnghz);
 #else
 		if (sc->sc_rng_need > 0) {
-			callout_reset(&sc->sc_rngto, sc->sc_rnghz,
-  ubsec_rng, sc);
+			callout_schedule(&sc->sc_rngto, sc->sc_rnghz);
 		}
 #endif
 		break;
@@ -1828,7 +1828,7 @@ out:
 #ifdef __OpenBSD__
 	timeout_add(&sc->sc_rngto, sc->sc_rnghz);
 #else
-	callout_reset(&sc->sc_rngto, sc->sc_rnghz, ubsec_rng, sc);
+	callout_schedule(&sc->sc_rngto, sc->sc_rnghz);
 #endif
 }
 #endif /* UBSEC_NO_RNG */



CVS commit: src/sys/dev/pci

2013-11-17 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sun Nov 17 17:01:44 UTC 2013

Modified Files:
src/sys/dev/pci: ubsec.c

Log Message:
Fix locking botch. Callers of ubsec_rng_locked() lock and release sc_mtx 
already.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/pci/ubsec.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/pci/ubsec.c
diff -u src/sys/dev/pci/ubsec.c:1.30 src/sys/dev/pci/ubsec.c:1.31
--- src/sys/dev/pci/ubsec.c:1.30	Sun Nov 17 16:54:02 2013
+++ src/sys/dev/pci/ubsec.c	Sun Nov 17 17:01:44 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsec.c,v 1.30 2013/11/17 16:54:02 bad Exp $	*/
+/*	$NetBSD: ubsec.c,v 1.31 2013/11/17 17:01:44 bad Exp $	*/
 /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
 /*	$OpenBSD: ubsec.c,v 1.127 2003/06/04 14:04:58 jason Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.30 2013/11/17 16:54:02 bad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.31 2013/11/17 17:01:44 bad Exp $");
 
 #undef UBSEC_DEBUG
 
@@ -1774,15 +1774,15 @@ ubsec_rng_locked(void *vsc)
 	struct ubsec_mcr *mcr;
 	struct ubsec_ctx_rngbypass *ctx;
 
-	mutex_spin_enter(&sc->sc_mtx);
+	/* Caller is responsible to lock and release sc_mtx. */
+	KASSERT(mutex_owned(&sc->sc_mtx));
+
 	if (rng->rng_used) {
-		mutex_spin_exit(&sc->sc_mtx);
 		return;
 	}
 
 	if (sc->sc_rng_need < 1) {
 		callout_stop(&sc->sc_rngto);
-		mutex_spin_exit(&sc->sc_mtx);
 		return;
 	}
 
@@ -1815,7 +1815,6 @@ ubsec_rng_locked(void *vsc)
 	rng->rng_used = 1;
 	ubsec_feed2(sc);
 	ubsecstats.hst_rng++;
-	mutex_spin_exit(&sc->sc_mtx);
 
 	return;
 
@@ -1824,7 +1823,6 @@ out:
 	 * Something weird happened, generate our own call back.
 	 */
 	sc->sc_nqueue2--;
-	mutex_spin_exit(&sc->sc_mtx);
 #ifdef __OpenBSD__
 	timeout_add(&sc->sc_rngto, sc->sc_rnghz);
 #else



CVS commit: src

2013-11-17 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sun Nov 17 17:16:25 UTC 2013

Modified Files:
src/distrib/sets/lists/modules: md.evbppc mi
src/sys/dev/pci: ubsec.c ubsecvar.h
src/sys/modules: Makefile
Added Files:
src/sys/modules/ubsec: Makefile ubsec.ioconf

Log Message:
Make ubsec(4) loadable as kmod.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/distrib/sets/lists/modules/md.evbppc
cvs rdiff -u -r1.57 -r1.58 src/distrib/sets/lists/modules/mi
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/pci/ubsec.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/ubsecvar.h
cvs rdiff -u -r1.124 -r1.125 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/ubsec/Makefile \
src/sys/modules/ubsec/ubsec.ioconf

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/modules/md.evbppc
diff -u src/distrib/sets/lists/modules/md.evbppc:1.34 src/distrib/sets/lists/modules/md.evbppc:1.35
--- src/distrib/sets/lists/modules/md.evbppc:1.34	Tue Oct 29 20:11:52 2013
+++ src/distrib/sets/lists/modules/md.evbppc	Sun Nov 17 17:16:24 2013
@@ -1,4 +1,4 @@
-# $NetBSD: md.evbppc,v 1.34 2013/10/29 20:11:52 mbalmer Exp $
+# $NetBSD: md.evbppc,v 1.35 2013/11/17 17:16:24 bad Exp $
 ./stand/powerpc-4xx			base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@		base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules	base-kernel-modules	kmod,compatmodules
@@ -188,6 +188,8 @@
 ./stand/powerpc-4xx/@OSRELEASE@/modules/tprof/tprof.kmod			base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules/uatpbase-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules/uatp/uatp.kmod			base-kernel-modules	kmod,compatmodules
+./stand/powerpc-4xx/@OSRELEASE@/modules/ubsecbase-kernel-modules	kmod,compatmodules
+./stand/powerpc-4xx/@OSRELEASE@/modules/ubsec/ubsec.kmod			base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules/udfbase-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules/udf/udf.kmod			base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules/umapbase-kernel-modules	kmod,compatmodules
@@ -393,6 +395,8 @@
 ./stand/powerpc-booke/@OSRELEASE@/modules/tprof/tprof.kmod		base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-booke/@OSRELEASE@/modules/uatpbase-kernel-modules	kmod,compatmodules
 ./stand/powerpc-booke/@OSRELEASE@/modules/uatp/uatp.kmod		base-kernel-modules	kmod,compatmodules
+./stand/powerpc-booke/@OSRELEASE@/modules/ubsecbase-kernel-modules	kmod,compatmodules
+./stand/powerpc-booke/@OSRELEASE@/modules/ubsec/ubsec.kmod			base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-booke/@OSRELEASE@/modules/udfbase-kernel-modules	kmod,compatmodules
 ./stand/powerpc-booke/@OSRELEASE@/modules/udf/udf.kmod			base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-booke/@OSRELEASE@/modules/umapbase-kernel-modules	kmod,compatmodules

Index: src/distrib/sets/lists/modules/mi
diff -u src/distrib/sets/lists/modules/mi:1.57 src/distrib/sets/lists/modules/mi:1.58
--- src/distrib/sets/lists/modules/mi:1.57	Sat Nov 16 16:59:03 2013
+++ src/distrib/sets/lists/modules/mi	Sun Nov 17 17:16:24 2013
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.57 2013/11/16 16:59:03 skrll Exp $
+# $NetBSD: mi,v 1.58 2013/11/17 17:16:24 bad Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -194,6 +194,8 @@
 ./@MODULEDIR@/tprof/tprof.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/uatpbase-kernel-modules	kmod
 ./@MODULEDIR@/uatp/uatp.kmod			base-kernel-modules	kmod
+./@MODULEDIR@/ubsecbase-kernel-modules	kmod
+./@MODULEDIR@/ubsec/ubsec.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/udfbase-kernel-modules	kmod
 ./@MODULEDIR@/udf/udf.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/umapbase-kernel-modules	kmod

Index: src/sys/dev/pci/ubsec.c
diff -u src/sys/dev/pci/ubsec.c:1.31 src/sys/dev/pci/ubsec.c:1.32
--- src/sys/dev/pci/ubsec.c:1.31	Sun Nov 17 17:01:44 2013
+++ src/sys/dev/pci/ubsec.c	Sun Nov 17 17:16:25 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsec.c,v 1.31 2013/11/17 17:01:44 bad Exp $	*/
+/*	$NetBSD: ubsec.c,v 1.32 2013/11/17 17:16:25 bad Exp $	*/
 /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
 /*	$OpenBSD: ubsec.c,v 1.127 2003/06/04 14:04:58 jason Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.31 2013/11/17 17:01:44 bad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.32 2013/11/17 17:16:25 bad Exp $");
 
 #undef UBSEC_DEBUG
 
@@ -57,6 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -82,6 +83,7 @@ __KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.
  */
 static	int ubsec_probe(device_t, cfdata_t, void *);
 static	void ubsec_attach(device_t, device_t, void 

CVS commit: src/sys/dev/pci

2013-11-17 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sun Nov 17 22:52:14 UTC 2013

Modified Files:
src/sys/dev/pci: ubsec.c

Log Message:
Create the sysctl variables on module initialization.
Create them under hw.ubsec as is hip these days.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/ubsec.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/pci/ubsec.c
diff -u src/sys/dev/pci/ubsec.c:1.32 src/sys/dev/pci/ubsec.c:1.33
--- src/sys/dev/pci/ubsec.c:1.32	Sun Nov 17 17:16:25 2013
+++ src/sys/dev/pci/ubsec.c	Sun Nov 17 22:52:14 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsec.c,v 1.32 2013/11/17 17:16:25 bad Exp $	*/
+/*	$NetBSD: ubsec.c,v 1.33 2013/11/17 22:52:14 bad Exp $	*/
 /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
 /*	$OpenBSD: ubsec.c,v 1.127 2003/06/04 14:04:58 jason Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.32 2013/11/17 17:16:25 bad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.33 2013/11/17 22:52:14 bad Exp $");
 
 #undef UBSEC_DEBUG
 
@@ -59,6 +59,7 @@ __KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -84,6 +85,7 @@ __KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.
 static	int ubsec_probe(device_t, cfdata_t, void *);
 static	void ubsec_attach(device_t, device_t, void *);
 static	int  ubsec_detach(device_t, int);
+static	int  ubsec_sysctl_init(void);
 static	void ubsec_reset_board(struct ubsec_softc *);
 static	void ubsec_init_board(struct ubsec_softc *);
 static	void ubsec_init_pciregs(struct pci_attach_args *pa);
@@ -161,6 +163,8 @@ static	void	ubsec_dump_ctx2(volatile str
 
 struct ubsec_stats ubsecstats;
 
+static struct sysctllog *ubsec_sysctllog;
+
 /*
  * ubsec_maxbatch controls the number of crypto ops to voluntarily
  * collect into one submission to the hardware.  This batching happens
@@ -169,10 +173,6 @@ struct ubsec_stats ubsecstats;
  * with a ``no delay'' flag.
  */
 static	int ubsec_maxbatch = 1;
-#ifdef SYSCTL_INT
-SYSCTL_INT(_kern, OID_AUTO, ubsec_maxbatch, CTLFLAG_RW, &ubsec_maxbatch,
-	0, "Broadcom driver: max ops to batch w/o interrupt");
-#endif
 
 /*
  * ubsec_maxaggr controls the number of crypto ops to submit to the
@@ -182,10 +182,6 @@ SYSCTL_INT(_kern, OID_AUTO, ubsec_maxbat
  * performance but at the expense of more interrupt processing.
  */
 static	int ubsec_maxaggr = 1;
-#ifdef SYSCTL_INT
-SYSCTL_INT(_kern, OID_AUTO, ubsec_maxaggr, CTLFLAG_RW, &ubsec_maxaggr,
-	0, "Broadcom driver: max ops to aggregate under one interrupt");
-#endif
 
 static const struct ubsec_product {
 	pci_vendor_id_t		ubsec_vendor;
@@ -540,8 +536,12 @@ ubsec_modcmd(modcmd_t cmd, void *data)
 		error = config_init_component(cfdriver_ioconf_ubsec,
 		cfattach_ioconf_ubsec, cfdata_ioconf_ubsec);
 #endif
+		if (error == 0)
+			error = ubsec_sysctl_init();
 		return error;
 	case MODULE_CMD_FINI:
+		if (ubsec_sysctllog != NULL)
+			sysctl_teardown(&ubsec_sysctllog);
 #ifdef _MODULE
 		error = config_fini_component(cfdriver_ioconf_ubsec,
 		cfattach_ioconf_ubsec, cfdata_ioconf_ubsec);
@@ -552,6 +552,40 @@ ubsec_modcmd(modcmd_t cmd, void *data)
 	}
 }
 
+static int
+ubsec_sysctl_init(void)
+{
+	const struct sysctlnode *node = NULL;
+
+	ubsec_sysctllog = NULL;
+
+	sysctl_createv(&ubsec_sysctllog, 0, NULL, NULL,
+		CTLFLAG_PERMANENT,
+		CTLTYPE_NODE, "hw", NULL,
+		NULL, 0, NULL, 0,
+		CTL_HW, CTL_EOL);
+	sysctl_createv(&ubsec_sysctllog, 0, NULL, &node,
+		CTLFLAG_PERMANENT,
+		CTLTYPE_NODE, "ubsec", 
+		SYSCTL_DESCR("ubsec opetions"),
+		NULL, 0, NULL, 0,
+		CTL_HW, CTL_CREATE, CTL_EOL);
+	sysctl_createv(&ubsec_sysctllog, 0, &node, NULL,
+		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
+		CTLTYPE_INT, "maxbatch",
+		SYSCTL_DESCR("max ops to batch w/o interrupt"),
+		NULL, 0, &ubsec_maxbatch, 0,
+		CTL_CREATE, CTL_EOL);
+	sysctl_createv(&ubsec_sysctllog, 0, &node, NULL,
+		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
+		CTLTYPE_INT, "maxaggr",
+		SYSCTL_DESCR("max ops to aggregate under one interrupt"),
+		NULL, 0, &ubsec_maxaggr, 0,
+		CTL_CREATE, CTL_EOL);
+
+	return 0;
+}
+
 /*
  * UBSEC Interrupt routine
  */



CVS commit: src/sys/dev/pci

2013-11-17 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sun Nov 17 23:20:18 UTC 2013

Modified Files:
src/sys/dev/pci: ubsec.c ubsecreg.h ubsecvar.h

Log Message:
Add support for BCM5825, and BCM5860, 5861, 5862 from OpenBSD rev 1.143:
  Add support for the BCM5825 and the next-generation BCM5860, 5861,
  5862 Broadcom CryptoNetX IPSec/SSL Security Processors.  The 5825 is a
  faster version of the already supported 5823, and the even faster 586x
  series is a bit different and needed some more changes.

AES support hasn't been pulled in yet.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/ubsec.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/ubsecreg.h
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/ubsecvar.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/ubsec.c
diff -u src/sys/dev/pci/ubsec.c:1.33 src/sys/dev/pci/ubsec.c:1.34
--- src/sys/dev/pci/ubsec.c:1.33	Sun Nov 17 22:52:14 2013
+++ src/sys/dev/pci/ubsec.c	Sun Nov 17 23:20:18 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsec.c,v 1.33 2013/11/17 22:52:14 bad Exp $	*/
+/*	$NetBSD: ubsec.c,v 1.34 2013/11/17 23:20:18 bad Exp $	*/
 /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
 /*	$OpenBSD: ubsec.c,v 1.127 2003/06/04 14:04:58 jason Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.33 2013/11/17 22:52:14 bad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.34 2013/11/17 23:20:18 bad Exp $");
 
 #undef UBSEC_DEBUG
 
@@ -122,6 +122,7 @@ static	void	ubsec_feed(struct ubsec_soft
 static	void	ubsec_mcopy(struct mbuf *, struct mbuf *, int, int);
 static	void	ubsec_callback2(struct ubsec_softc *, struct ubsec_q2 *);
 static	void	ubsec_feed2(struct ubsec_softc *);
+static	void	ubsec_feed4(struct ubsec_softc *);
 #ifndef UBSEC_NO_RNG
 static  void	ubsec_rng(void *);
 static  void	ubsec_rng_locked(void *);
@@ -188,34 +189,40 @@ static const struct ubsec_product {
 	pci_product_id_t	ubsec_product;
 	int			ubsec_flags;
 	int			ubsec_statmask;
+	int			ubsec_maxaggr;
 	const char		*ubsec_name;
 } ubsec_products[] = {
 	{ PCI_VENDOR_BLUESTEEL,	PCI_PRODUCT_BLUESTEEL_5501,
 	  0,
 	  BS_STAT_MCR1_DONE | BS_STAT_DMAERR,
+	  UBS_MIN_AGGR,
 	  "Bluesteel 5501"
 	},
 	{ PCI_VENDOR_BLUESTEEL,	PCI_PRODUCT_BLUESTEEL_5601,
 	  UBS_FLAGS_KEY | UBS_FLAGS_RNG,
 	  BS_STAT_MCR1_DONE | BS_STAT_DMAERR,
+	  UBS_MIN_AGGR,
 	  "Bluesteel 5601"
 	},
 
 	{ PCI_VENDOR_BROADCOM,	PCI_PRODUCT_BROADCOM_5801,
 	  0,
 	  BS_STAT_MCR1_DONE | BS_STAT_DMAERR,
+	  UBS_MIN_AGGR,
 	  "Broadcom BCM5801"
 	},
 
 	{ PCI_VENDOR_BROADCOM,	PCI_PRODUCT_BROADCOM_5802,
 	  UBS_FLAGS_KEY | UBS_FLAGS_RNG,
 	  BS_STAT_MCR1_DONE | BS_STAT_DMAERR,
+	  UBS_MIN_AGGR,
 	  "Broadcom BCM5802"
 	},
 
 	{ PCI_VENDOR_BROADCOM,	PCI_PRODUCT_BROADCOM_5805,
 	  UBS_FLAGS_KEY | UBS_FLAGS_RNG,
 	  BS_STAT_MCR1_DONE | BS_STAT_DMAERR,
+	  UBS_MIN_AGGR,
 	  "Broadcom BCM5805"
 	},
 
@@ -223,6 +230,7 @@ static const struct ubsec_product {
 	  UBS_FLAGS_KEY | UBS_FLAGS_RNG | UBS_FLAGS_LONGCTX |
 	  UBS_FLAGS_HWNORM | UBS_FLAGS_BIGKEY,
 	  BS_STAT_MCR1_DONE | BS_STAT_DMAERR,
+	  UBS_MIN_AGGR,
 	  "Broadcom BCM5820"
 	},
 
@@ -231,6 +239,7 @@ static const struct ubsec_product {
 	  UBS_FLAGS_HWNORM | UBS_FLAGS_BIGKEY,
 	  BS_STAT_MCR1_DONE | BS_STAT_DMAERR |
 	  BS_STAT_MCR1_ALLEMPTY | BS_STAT_MCR2_ALLEMPTY,
+	  UBS_MIN_AGGR,
 	  "Broadcom BCM5821"
 	},
 	{ PCI_VENDOR_SUN,	PCI_PRODUCT_SUN_SCA1K,
@@ -238,6 +247,7 @@ static const struct ubsec_product {
 	  UBS_FLAGS_HWNORM | UBS_FLAGS_BIGKEY,
 	  BS_STAT_MCR1_DONE | BS_STAT_DMAERR |
 	  BS_STAT_MCR1_ALLEMPTY | BS_STAT_MCR2_ALLEMPTY,
+	  UBS_MIN_AGGR,
 	  "Sun Crypto Accelerator 1000"
 	},
 	{ PCI_VENDOR_SUN,	PCI_PRODUCT_SUN_5821,
@@ -245,6 +255,7 @@ static const struct ubsec_product {
 	  UBS_FLAGS_HWNORM | UBS_FLAGS_BIGKEY,
 	  BS_STAT_MCR1_DONE | BS_STAT_DMAERR |
 	  BS_STAT_MCR1_ALLEMPTY | BS_STAT_MCR2_ALLEMPTY,
+	  UBS_MIN_AGGR,
 	  "Broadcom BCM5821 (Sun)"
 	},
 
@@ -253,6 +264,7 @@ static const struct ubsec_product {
 	  UBS_FLAGS_HWNORM | UBS_FLAGS_BIGKEY,
 	  BS_STAT_MCR1_DONE | BS_STAT_DMAERR |
 	  BS_STAT_MCR1_ALLEMPTY | BS_STAT_MCR2_ALLEMPTY,
+	  UBS_MIN_AGGR,
 	  "Broadcom BCM5822"
 	},
 
@@ -261,12 +273,59 @@ static const struct ubsec_product {
 	  UBS_FLAGS_HWNORM | UBS_FLAGS_BIGKEY,
 	  BS_STAT_MCR1_DONE | BS_STAT_DMAERR |
 	  BS_STAT_MCR1_ALLEMPTY | BS_STAT_MCR2_ALLEMPTY,
+	  UBS_MIN_AGGR,
 	  "Broadcom BCM5823"
 	},
 
+	{ PCI_VENDOR_BROADCOM,	PCI_PRODUCT_BROADCOM_5825,
+	  UBS_FLAGS_KEY | UBS_FLAGS_RNG | UBS_FLAGS_LONGCTX |
+	  UBS_FLAGS_HWNORM | UBS_FLAGS_BIGKEY,
+	  BS_STAT_MCR1_DONE | BS_STAT_DMAERR |
+	  BS_STAT_MCR1_ALLEMPTY | BS_STAT_MCR2_ALLEMPTY,
+	  UBS_MIN_AGGR,
+	  "Broadcom BCM5825"
+	},
+
+	{ PCI_VENDOR_BROADCOM,	PCI_PRODUCT_BROADCOM_5860,
+	  UBS_FLAGS_MULTIMCR | UBS_FLAGS_HWNORM |
+	  UBS_FLAGS_LONGCTX |
+	

CVS commit: src

2013-11-18 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Mon Nov 18 16:23:47 UTC 2013

Modified Files:
src/distrib/sets/lists/modules: md.evbppc mi
src/sys/modules: Makefile

Log Message:
ubsec is not a MI buildable module. disable it for now.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/distrib/sets/lists/modules/md.evbppc
cvs rdiff -u -r1.58 -r1.59 src/distrib/sets/lists/modules/mi
cvs rdiff -u -r1.126 -r1.127 src/sys/modules/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/modules/md.evbppc
diff -u src/distrib/sets/lists/modules/md.evbppc:1.35 src/distrib/sets/lists/modules/md.evbppc:1.36
--- src/distrib/sets/lists/modules/md.evbppc:1.35	Sun Nov 17 17:16:24 2013
+++ src/distrib/sets/lists/modules/md.evbppc	Mon Nov 18 16:23:47 2013
@@ -1,4 +1,4 @@
-# $NetBSD: md.evbppc,v 1.35 2013/11/17 17:16:24 bad Exp $
+# $NetBSD: md.evbppc,v 1.36 2013/11/18 16:23:47 bad Exp $
 ./stand/powerpc-4xx			base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@		base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules	base-kernel-modules	kmod,compatmodules
@@ -188,8 +188,6 @@
 ./stand/powerpc-4xx/@OSRELEASE@/modules/tprof/tprof.kmod			base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules/uatpbase-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules/uatp/uatp.kmod			base-kernel-modules	kmod,compatmodules
-./stand/powerpc-4xx/@OSRELEASE@/modules/ubsecbase-kernel-modules	kmod,compatmodules
-./stand/powerpc-4xx/@OSRELEASE@/modules/ubsec/ubsec.kmod			base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules/udfbase-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules/udf/udf.kmod			base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules/umapbase-kernel-modules	kmod,compatmodules
@@ -395,8 +393,6 @@
 ./stand/powerpc-booke/@OSRELEASE@/modules/tprof/tprof.kmod		base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-booke/@OSRELEASE@/modules/uatpbase-kernel-modules	kmod,compatmodules
 ./stand/powerpc-booke/@OSRELEASE@/modules/uatp/uatp.kmod		base-kernel-modules	kmod,compatmodules
-./stand/powerpc-booke/@OSRELEASE@/modules/ubsecbase-kernel-modules	kmod,compatmodules
-./stand/powerpc-booke/@OSRELEASE@/modules/ubsec/ubsec.kmod			base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-booke/@OSRELEASE@/modules/udfbase-kernel-modules	kmod,compatmodules
 ./stand/powerpc-booke/@OSRELEASE@/modules/udf/udf.kmod			base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-booke/@OSRELEASE@/modules/umapbase-kernel-modules	kmod,compatmodules

Index: src/distrib/sets/lists/modules/mi
diff -u src/distrib/sets/lists/modules/mi:1.58 src/distrib/sets/lists/modules/mi:1.59
--- src/distrib/sets/lists/modules/mi:1.58	Sun Nov 17 17:16:24 2013
+++ src/distrib/sets/lists/modules/mi	Mon Nov 18 16:23:47 2013
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.58 2013/11/17 17:16:24 bad Exp $
+# $NetBSD: mi,v 1.59 2013/11/18 16:23:47 bad Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -194,8 +194,6 @@
 ./@MODULEDIR@/tprof/tprof.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/uatpbase-kernel-modules	kmod
 ./@MODULEDIR@/uatp/uatp.kmod			base-kernel-modules	kmod
-./@MODULEDIR@/ubsecbase-kernel-modules	kmod
-./@MODULEDIR@/ubsec/ubsec.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/udfbase-kernel-modules	kmod
 ./@MODULEDIR@/udf/udf.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/umapbase-kernel-modules	kmod

Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.126 src/sys/modules/Makefile:1.127
--- src/sys/modules/Makefile:1.126	Sun Nov 17 18:58:28 2013
+++ src/sys/modules/Makefile	Mon Nov 18 16:23:47 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.126 2013/11/17 18:58:28 alnsn Exp $
+#	$NetBSD: Makefile,v 1.127 2013/11/18 16:23:47 bad Exp $
 
 .include 
 
@@ -82,7 +82,6 @@ SUBDIR+=	suser
 SUBDIR+=	swsensor
 SUBDIR+=	tmpfs
 SUBDIR+=	uatp
-SUBDIR+=	ubsec
 SUBDIR+=	udf
 SUBDIR+=	umap
 SUBDIR+=	union



CVS commit: src/sys/dev/pci

2014-04-18 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Fri Apr 18 22:25:58 UTC 2014

Modified Files:
src/sys/dev/pci: ubsec.c ubsecvar.h

Log Message:
Rewrite the dmamap handling to allocate and cache the dmamaps beforehand.
Calling bus_dmamap_create/destroy is no longer possible in interrupt context.
Move the dmamaps to the end of struct ubsec_q so the rest of the struct
can be cleared with one call to memset().

As a bonus we get a 25% increase in throughput encrypting 8K blocks.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/pci/ubsec.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/ubsecvar.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/ubsec.c
diff -u src/sys/dev/pci/ubsec.c:1.38 src/sys/dev/pci/ubsec.c:1.39
--- src/sys/dev/pci/ubsec.c:1.38	Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/ubsec.c	Fri Apr 18 22:25:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsec.c,v 1.38 2014/03/29 19:28:25 christos Exp $	*/
+/*	$NetBSD: ubsec.c,v 1.39 2014/04/18 22:25:58 bad Exp $	*/
 /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
 /*	$OpenBSD: ubsec.c,v 1.127 2003/06/04 14:04:58 jason Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.38 2014/03/29 19:28:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.39 2014/04/18 22:25:58 bad Exp $");
 
 #undef UBSEC_DEBUG
 
@@ -435,7 +435,7 @@ ubsec_attach(device_t parent, device_t s
 		struct ubsec_q *q;
 
 		q = (struct ubsec_q *)malloc(sizeof(struct ubsec_q),
-		M_DEVBUF, M_NOWAIT);
+		M_DEVBUF, M_ZERO|M_NOWAIT);
 		if (q == NULL) {
 			aprint_error_dev(self, "can't allocate queue buffers\n");
 			break;
@@ -575,6 +575,10 @@ ubsec_detach(device_t self, int flags)
 
 	SIMPLEQ_FOREACH_SAFE(q, &sc->sc_freequeue, q_next, qtmp) {
 		ubsec_dma_free(sc, &q->q_dma->d_alloc);
+		if (q->q_src_map != NULL)
+			bus_dmamap_destroy(sc->sc_dmat, q->q_src_map);
+		if (q->q_cached_dst_map != NULL)
+			bus_dmamap_destroy(sc->sc_dmat, q->q_cached_dst_map);
 		free(q, M_DEVBUF);
 	}
 
@@ -1198,7 +1202,8 @@ ubsec_process(void *arg, struct cryptop 
 	mutex_spin_exit(&sc->sc_mtx);
 
 	dmap = q->q_dma; /* Save dma pointer */
-	memset(q, 0, sizeof(struct ubsec_q));
+	/* don't lose the cached dmamaps q_src_map and q_cached_dst_map */
+	memset(q, 0, offsetof(struct ubsec_q, q_src_map));
 	memset(&ctx, 0, sizeof(ctx));
 
 	q->q_sesn = UBSEC_SESSION(crp->crp_sid);
@@ -1378,17 +1383,17 @@ ubsec_process(void *arg, struct cryptop 
 	}
 	ctx.pc_offset = htole16(coffset >> 2);
 
-	/* XXX FIXME: jonathan asks, what the heck's that 0xfff0?  */
-	if (bus_dmamap_create(sc->sc_dmat, 0xfff0, UBS_MAX_SCATTER,
-		0xfff0, 0, BUS_DMA_NOWAIT, &q->q_src_map) != 0) {
-		err = ENOMEM;
-		goto errout;
+	if (q->q_src_map == NULL) {
+		/* XXX FIXME: jonathan asks, what the heck's that 0xfff0?  */
+		if (bus_dmamap_create(sc->sc_dmat, 0xfff0, UBS_MAX_SCATTER,
+			0xfff0, 0, BUS_DMA_NOWAIT, &q->q_src_map) != 0) {
+			err = ENOMEM;
+			goto errout;
+		}
 	}
 	if (crp->crp_flags & CRYPTO_F_IMBUF) {
 		if (bus_dmamap_load_mbuf(sc->sc_dmat, q->q_src_map,
 		q->q_src_m, BUS_DMA_NOWAIT) != 0) {
-			bus_dmamap_destroy(sc->sc_dmat, q->q_src_map);
-			q->q_src_map = NULL;
 			ubsecstats.hst_noload++;
 			err = ENOMEM;
 			goto errout;
@@ -1396,8 +1401,6 @@ ubsec_process(void *arg, struct cryptop 
 	} else if (crp->crp_flags & CRYPTO_F_IOV) {
 		if (bus_dmamap_load_uio(sc->sc_dmat, q->q_src_map,
 		q->q_src_io, BUS_DMA_NOWAIT) != 0) {
-			bus_dmamap_destroy(sc->sc_dmat, q->q_src_map);
-			q->q_src_map = NULL;
 			ubsecstats.hst_noload++;
 			err = ENOMEM;
 			goto errout;
@@ -1476,18 +1479,21 @@ ubsec_process(void *arg, struct cryptop 
 err = EINVAL;
 goto errout;
 			}
-			/* XXX: ``what the heck's that'' 0xfff0? */
-			if (bus_dmamap_create(sc->sc_dmat, 0xfff0,
-			UBS_MAX_SCATTER, 0xfff0, 0, BUS_DMA_NOWAIT,
-			&q->q_dst_map) != 0) {
-ubsecstats.hst_nomap++;
-err = ENOMEM;
-goto errout;
+			if (q->q_dst_map == NULL) {
+if (q->q_cached_dst_map == NULL) {
+	/* XXX: ``what the heck's that'' 0xfff0? */
+	if (bus_dmamap_create(sc->sc_dmat, 0xfff0,
+	UBS_MAX_SCATTER, 0xfff0, 0, BUS_DMA_NOWAIT,
+	&q->q_cached_dst_map) != 0) {
+		ubsecstats.hst_nomap++;
+		err = ENOMEM;
+		goto errout;
+	}
+}
+q->q_dst_map = q->q_cached_dst_map;
 			}
 			if (bus_dmamap_load_uio(sc->sc_dmat, q->q_dst_map,
 			q->q_dst_io, BUS_DMA_NOWAIT) != 0) {
-bus_dmamap_destroy(sc->sc_dmat, q->q_dst_map);
-q->q_dst_map = NULL;
 ubsecstats.hst_noload++;
 err = ENOMEM;
 goto errout;
@@ -1566,20 +1572,22 @@ ubsec_process(void *arg, struct cryptop 
 q->q_dst_m = top;
 ubsec_mcopy(q->q_src_m, q->q_dst_m,
 cpskip, cpoffset);
-/* XXX again, what the heck is that 0xfff0? */
-if (bus_dmamap_create(sc->sc_dmat, 0xfff0,
-UB

CVS commit: src

2014-04-19 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sat Apr 19 12:29:25 UTC 2014

Modified Files:
src/doc: CHANGES
src/share/man/man4: ubsec.4
src/sys/dev/pci: ubsec.c ubsecreg.h ubsecvar.h

Log Message:
Add support for accelerated AES_CBC in ubsec(4) for BCM5823 and newer.
Update man-page and bump date.
Adjust OpenBSD RCS IDs to reflect roughly the version we are in sync with.


To generate a diff of this commit:
cvs rdiff -u -r1.1915 -r1.1916 src/doc/CHANGES
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/ubsec.4
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pci/ubsec.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/ubsecreg.h
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/ubsecvar.h

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1915 src/doc/CHANGES:1.1916
--- src/doc/CHANGES:1.1915	Sat Apr 19 06:20:51 2014
+++ src/doc/CHANGES	Sat Apr 19 12:29:25 2014
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1915 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1916 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -390,3 +390,5 @@ Changes from NetBSD 6.0 to NetBSD 7.0:
 	hp300: Add sti(4) at sgc screen console support to bootloader.
 		[tsutsui 20140413]
 	hp300: Add HP9000/425e RTC support. [tsutsui 20140419]
+	ubsec(4): Add support for AES-CBC modes and BCM586x chips.
+		[bad 20140419]

Index: src/share/man/man4/ubsec.4
diff -u src/share/man/man4/ubsec.4:1.4 src/share/man/man4/ubsec.4:1.5
--- src/share/man/man4/ubsec.4:1.4	Thu Apr 29 19:42:29 2004
+++ src/share/man/man4/ubsec.4	Sat Apr 19 12:29:24 2014
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ubsec.4,v 1.4 2004/04/29 19:42:29 jonathan Exp $
+.\"	$NetBSD: ubsec.4,v 1.5 2014/04/19 12:29:24 bad Exp $
 .\"	$FreeBSD: src/share/man/man4/ubsec.4,v 1.1.2.1 2002/11/21 23:57:24 sam Exp $
 .\"	$OpenBSD: ubsec.4,v 1.26 2003/09/03 15:55:41 jason Exp $
 .\"
@@ -26,7 +26,7 @@
 .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 10, 2000
+.Dd April 19, 2014
 .Dt UBSEC 4
 .Os
 .Sh NAME
@@ -43,9 +43,6 @@ driver supports cards containing any of 
 The original chipset, no longer made.
 This extremely rare unit
 was not very fast, lacked an RNG, and had a number of other bugs.
-.It Bluesteel 5601
-A faster and fixed version of the original, with a random number
-unit and large number engine added.
 .It Broadcom BCM5801
 A BCM5805 without public key engine or random number generator.
 .It Broadcom BCM5802
@@ -56,13 +53,19 @@ Faster version of Bluesteel 5601.
 64 bit version of the chip, and significantly more advanced.
 .It Broadcom BCM5821
 Faster version of the BCM5820.
-(This is the chip found on the Sun Crypto Accelerator 1000.)
+This is the chip found on the Sun Crypto Accelerator 1000.
 .It Broadcom BCM5822
 Faster version of the BCM5820.
 .It Broadcom BCM5823
-Faster version of the BCM5822.
-.It Broadcom BCM5823
-Faster version of the BCM5821, with AES hardware.
+Faster version of the BCM5822 that also supports AES.
+.It Broadcom BCM5825
+Faster PCI Express or PCI-X version of the chip.
+.It Broadcom BCM5860
+IPSec/SSL Security Processor that is faster and has more features.
+.It Broadcom BCM5861
+Faster version of the BCM5860.
+.It Broadcom BCM5862
+Faster version of the BCM5861.
 .El
 .Pp
 The
@@ -74,6 +77,7 @@ and thus for
 .Xr fast_ipsec 4
 and
 .Xr crypto 4 .
+The driver also supports acceleration of AES-CBC with the BCM5823 or newer.
 .Pp
 On those models which contain a public key engine (almost all of the
 more recent ones), this feature is registered with the
@@ -105,5 +109,3 @@ and subsequently imported to
 .Nx 2.0 .
 .Sh BUGS
 The BCM5801 and BCM5802 have not actually been tested.
-.Pp
-Whilst some of the newer chips support AES, AES is not supported by the driver.

Index: src/sys/dev/pci/ubsec.c
diff -u src/sys/dev/pci/ubsec.c:1.39 src/sys/dev/pci/ubsec.c:1.40
--- src/sys/dev/pci/ubsec.c:1.39	Fri Apr 18 22:25:58 2014
+++ src/sys/dev/pci/ubsec.c	Sat Apr 19 12:29:24 2014
@@ -1,6 +1,6 @@
-/*	$NetBSD: ubsec.c,v 1.39 2014/04/18 22:25:58 bad Exp $	*/
+/*	$NetBSD: ubsec.c,v 1.40 2014/04/19 12:29:24 bad Exp $	*/
 /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
-/*	$OpenBSD: ubsec.c,v 1.127 2003/06/04 14:04:58 jason Exp $	*/
+/*	$OpenBSD: ubsec.c,v 1.143 2009/03/27 13:31:30 reyk Exp$	*/
 
 /*
  * Copyright (c) 2000 Jason L. Wright (ja...@thought.net)
@@ -35,12 +35,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.39 2014/04/18 22:25:58 bad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.40 2014/04/19 12:29:24 bad Exp $");
 
 #undef UBSEC_DEBUG
 
 /*
- * uBsec 5[56]01, bcm580xx, bcm582x hardware crypto accelerator
+ * uBsec 5[56]01, 58xx hardware crypto accelerator
  */
 
 #include 
@@ -270,7 +270,7 @@ static const struct ubsec_product {
 
 	{ PCI_VENDOR_BROADCOM,

CVS commit: src/usr.sbin/installboot

2017-03-14 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Tue Mar 14 13:50:40 UTC 2017

Modified Files:
src/usr.sbin/installboot: installboot.8

Log Message:
Document option console=auto. Works since at least NetBSD 6. [i386,amd64]


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/usr.sbin/installboot/installboot.8

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/installboot/installboot.8
diff -u src/usr.sbin/installboot/installboot.8:1.90 src/usr.sbin/installboot/installboot.8:1.91
--- src/usr.sbin/installboot/installboot.8:1.90	Tue Jun 21 21:53:55 2016
+++ src/usr.sbin/installboot/installboot.8	Tue Mar 14 13:50:40 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: installboot.8,v 1.90 2016/06/21 21:53:55 alnsn Exp $
+.\"	$NetBSD: installboot.8,v 1.91 2017/03/14 13:50:40 bad Exp $
 .\"
 .\" Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -265,7 +265,7 @@ Modify the default boot command line.
 .Sy [ amd64 ,
 .Sy i386 ]
 Set the console device, \*[Lt]console name\*[Gt] must be one of:
-pc, com0, com1, com2, com3, com0kbd, com1kbd, com2kbd or com3kbd.
+pc, com0, com1, com2, com3, com0kbd, com1kbd, com2kbd, com3kbd or auto.
 .
 .It Sy ioaddr=\*[Lt]ioaddr\*[Gt]
 .Sy [ amd64 ,



CVS commit: src/share/installboot/evbarm

2020-03-27 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Fri Mar 27 23:02:33 UTC 2020

Modified Files:
src/share/installboot/evbarm: boards.plist

Log Message:
Belatedly add NanoPi R1.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/share/installboot/evbarm/boards.plist

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

Modified files:

Index: src/share/installboot/evbarm/boards.plist
diff -u src/share/installboot/evbarm/boards.plist:1.6 src/share/installboot/evbarm/boards.plist:1.7
--- src/share/installboot/evbarm/boards.plist:1.6	Fri Mar 27 02:01:48 2020
+++ src/share/installboot/evbarm/boards.plist	Fri Mar 27 23:02:33 2020
@@ -1,4 +1,4 @@
-
+
 

CVS commit: src/lib/libc/gen

2019-05-08 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Wed May  8 15:37:41 UTC 2019

Modified Files:
src/lib/libc/gen: unvis.3

Log Message:
Clarify that strunvisx() and strnunvisx() take the same flags as unvis().
Document VIS_NOESCAPE for unvis().
Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libc/gen/unvis.3

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

Modified files:

Index: src/lib/libc/gen/unvis.3
diff -u src/lib/libc/gen/unvis.3:1.29 src/lib/libc/gen/unvis.3:1.30
--- src/lib/libc/gen/unvis.3:1.29	Tue Oct 24 19:14:55 2017
+++ src/lib/libc/gen/unvis.3	Wed May  8 15:37:41 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: unvis.3,v 1.29 2017/10/24 19:14:55 abhinav Exp $
+.\"	$NetBSD: unvis.3,v 1.30 2019/05/08 15:37:41 bad Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)unvis.3	8.2 (Berkeley) 12/11/93
 .\"
-.Dd March 12, 2011
+.Dd May 8, 2019
 .Dt UNVIS 3
 .Os
 .Sh NAME
@@ -99,16 +99,18 @@ should be equal to the size of
 .Pp
 The
 .Fn strunvisx
-function does the same as the
+and
+.Fn strnunvisx
+functions do the same as the
 .Fn strunvis
-function,
-but it allows you to add a flag that specifies the style the string
+and
+.Fn strnunvis
+functions,
+but take a flag that specifies the style the string
 .Ar src
 is encoded with.
-Currently, the supported flags are:
-.Dv VIS_HTTPSTYLE
-and
-.Dv VIS_MIMESTYLE .
+The meaning of the flag is the same as explained below for
+.Fn unvis .
 .Pp
 The
 .Fn unvis
@@ -157,6 +159,10 @@ The
 .Fa flag
 argument is also used to specify the encoding style of the source.
 If set to
+.Dv VIS_NOESCAPE
+.Fn unvis
+will not decode backslash escapes.
+If set to
 .Dv VIS_HTTPSTYLE
 or
 .Dv VIS_HTTP1808 ,



CVS commit: src/sys/dev/pci

2018-11-28 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Wed Nov 28 11:50:48 UTC 2018

Modified Files:
src/sys/dev/pci: if_ena.c

Log Message:
Adapt ena_rx_checksum() to NetBSD.
It wasn't ported to the NetBSD conventions of indicating hardware checkum
status.

Compile tested only.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/if_ena.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/pci/if_ena.c
diff -u src/sys/dev/pci/if_ena.c:1.5 src/sys/dev/pci/if_ena.c:1.6
--- src/sys/dev/pci/if_ena.c:1.5	Tue Jun 26 06:48:01 2018
+++ src/sys/dev/pci/if_ena.c	Wed Nov 28 11:50:48 2018
@@ -31,7 +31,7 @@
 #if 0
 __FBSDID("$FreeBSD: head/sys/dev/ena/ena.c 333456 2018-05-10 09:37:54Z mw $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.5 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.6 2018/11/28 11:50:48 bad Exp $");
 
 #include 
 #include 
@@ -1593,26 +1593,41 @@ ena_rx_checksum(struct ena_ring *rx_ring
 struct mbuf *mbuf)
 {
 
-	/* if IP and error */
-	if (unlikely((ena_rx_ctx->l3_proto == ENA_ETH_IO_L3_PROTO_IPV4) &&
-	ena_rx_ctx->l3_csum_err)) {
-		/* ipv4 checksum error */
-		mbuf->m_pkthdr.csum_flags = 0;
-		counter_u64_add(rx_ring->rx_stats.bad_csum, 1);
-		ena_trace(ENA_DBG, "RX IPv4 header checksum error");
-		return;
-	}
-
-	/* if TCP/UDP */
-	if ((ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_TCP) ||
-	(ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_UDP)) {
-		if (ena_rx_ctx->l4_csum_err) {
-			/* TCP/UDP checksum error */
-			mbuf->m_pkthdr.csum_flags = M_CSUM_IPv4_BAD;
+	/* IPv4 */
+	if ((ena_rx_ctx->l3_proto == ENA_ETH_IO_L3_PROTO_IPV4)) {
+		mbuf->m_pkthdr.csum_flags |= M_CSUM_IPv4;
+		if (ena_rx_ctx->l3_csum_err) {
+			/* ipv4 checksum error */
+			mbuf->m_pkthdr.csum_flags |= M_CSUM_IPv4_BAD;
 			counter_u64_add(rx_ring->rx_stats.bad_csum, 1);
-			ena_trace(ENA_DBG, "RX L4 checksum error");
-		} else {
-			mbuf->m_pkthdr.csum_flags = M_CSUM_IPv4;
+			ena_trace(ENA_DBG, "RX IPv4 header checksum error");
+			return;
+		}
+
+		/*  TCP/UDP */
+		if ((ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_TCP) ||
+		(ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_UDP)) {
+			mbuf->m_pkthdr.csum_flags |= (ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_TCP) ? M_CSUM_TCPv4 : M_CSUM_UDPv4;
+			if (ena_rx_ctx->l4_csum_err) {
+/* TCP/UDP checksum error */
+mbuf->m_pkthdr.csum_flags |= M_CSUM_TCP_UDP_BAD;
+counter_u64_add(rx_ring->rx_stats.bad_csum, 1);
+ena_trace(ENA_DBG, "RX L4 checksum error");
+			}
+		}
+	}
+	/* IPv6 */
+	else if ((ena_rx_ctx->l3_proto == ENA_ETH_IO_L3_PROTO_IPV6)) {
+		/*  TCP/UDP */
+		if ((ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_TCP) ||
+		(ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_UDP)) {
+			mbuf->m_pkthdr.csum_flags |= (ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_TCP) ? M_CSUM_TCPv6 : M_CSUM_UDPv6;
+			if (ena_rx_ctx->l4_csum_err) {
+/* TCP/UDP checksum error */
+mbuf->m_pkthdr.csum_flags |= M_CSUM_TCP_UDP_BAD;
+counter_u64_add(rx_ring->rx_stats.bad_csum, 1);
+ena_trace(ENA_DBG, "RX L4 checksum error");
+			}
 		}
 	}
 }



CVS commit: src/sys/kern

2019-01-20 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sun Jan 20 21:26:13 UTC 2019

Modified Files:
src/sys/kern: subr_tftproot.c

Log Message:
tftproot_getfile(): return E2BIG when bootfile is to long.

tftproot_getfile() must return something != 0 to indicate error when
the bootfile is to long.
error just got set to 0 when nfs_boot_setrecvtimo() was called.

found during code review. compile tested only.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/kern/subr_tftproot.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/subr_tftproot.c
diff -u src/sys/kern/subr_tftproot.c:1.22 src/sys/kern/subr_tftproot.c:1.23
--- src/sys/kern/subr_tftproot.c:1.22	Sat Oct 27 09:13:45 2018
+++ src/sys/kern/subr_tftproot.c	Sun Jan 20 21:26:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_tftproot.c,v 1.22 2018/10/27 09:13:45 mlelstv Exp $ */
+/*	$NetBSD: subr_tftproot.c,v 1.23 2019/01/20 21:26:13 bad Exp $ */
 
 /*-
  * Copyright (c) 2007 Emmanuel Dreyfus, all rights reserved.
@@ -39,7 +39,7 @@
 #include "opt_md.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_tftproot.c,v 1.22 2018/10/27 09:13:45 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_tftproot.c,v 1.23 2019/01/20 21:26:13 bad Exp $");
 
 #include 
 #include 
@@ -246,6 +246,7 @@ tftproot_getfile(struct tftproot_handle 
 	if (packetlen > MSIZE) {
 		DPRINTF(("%s():%d boot filename too long (%ld bytes)\n", 
 		__func__, __LINE__, (long)namelen));
+		error = E2BIG;
 		goto out;
 	}
 



CVS commit: src/sys/dev/raidframe

2019-01-28 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Mon Jan 28 21:14:08 UTC 2019

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
print additional debug information.  make rf_containsboot() return 0
if bdv == NULL, to aid in the former.

As discussed 1 week ago on tech-kern.


To generate a diff of this commit:
cvs rdiff -u -r1.358 -r1.359 src/sys/dev/raidframe/rf_netbsdkintf.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/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.358 src/sys/dev/raidframe/rf_netbsdkintf.c:1.359
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.358	Sun Jan 27 02:08:42 2019
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Mon Jan 28 21:14:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.358 2019/01/27 02:08:42 pgoyette Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.359 2019/01/28 21:14:08 bad Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.358 2019/01/27 02:08:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.359 2019/01/28 21:14:08 bad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -466,8 +466,15 @@ rf_autoconfig(device_t self)
 
 static int
 rf_containsboot(RF_Raid_t *r, device_t bdv) {
-	const char *bootname = device_xname(bdv);
-	size_t len = strlen(bootname);
+	const char *bootname;
+	size_t len;
+
+	/* if bdv is NULL, the set can't contain it. exit early. */
+	if (bdv == NULL)
+		return 0;
+
+	bootname = device_xname(bdv);
+	len = strlen(bootname);
 
 	for (int col = 0; col < r->numCol; col++) {
 		const char *devname = r->Disks[col].devname;
@@ -506,8 +513,8 @@ rf_buildroothack(RF_ConfigSet_t *config_
 		cset->ac->clabel->autoconfigure == 1) {
 			sc = rf_auto_config_set(cset);
 			if (sc != NULL) {
-aprint_debug("raid%d: configured ok\n",
-sc->sc_unit);
+aprint_debug("raid%d: configured ok, rootable %d\n",
+sc->sc_unit, cset->rootable);
 if (cset->rootable) {
 	rsc = sc;
 	num_root++;
@@ -531,8 +538,10 @@ rf_buildroothack(RF_ConfigSet_t *config_
 	/* if the user has specified what the root device should be
 	   then we don't touch booted_device or boothowto... */
 
-	if (rootspec != NULL)
+	if (rootspec != NULL) {
+		DPRINTF("%s: rootspec %s\n", __func__, rootspec);
 		return;
+	}
 
 	/* we found something bootable... */
 
@@ -574,9 +583,12 @@ rf_buildroothack(RF_ConfigSet_t *config_
 			candidate_root = dksc->sc_dev;
 		DPRINTF("%s: candidate root=%p\n", __func__, candidate_root);
 		DPRINTF("%s: booted_device=%p root_partition=%d "
-		   "contains_boot=%d\n", __func__, booted_device,
-		   rsc->sc_r.root_partition,
-		   rf_containsboot(&rsc->sc_r, booted_device));
+			"contains_boot=%d",
+		__func__, booted_device, rsc->sc_r.root_partition,
+			   rf_containsboot(&rsc->sc_r, booted_device));
+		/* XXX the check for booted_device == NULL can probably be
+		 * dropped, now that rf_containsboot handles that case.
+		 */
 		if (booted_device == NULL ||
 		rsc->sc_r.root_partition == 1 ||
 		rf_containsboot(&rsc->sc_r, booted_device)) {



CVS commit: src/sys/arch/xen/x86

2019-01-28 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Mon Jan 28 21:19:09 UTC 2019

Modified Files:
src/sys/arch/xen/x86: autoconf.c

Log Message:
Sprinkle DPRINTF #ifdef DEBUG_GEOM and set booted_method like 
arch/x86/x86/x86_autoconf.c

As discussed 1 week ago on port-xen.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/xen/x86/autoconf.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/xen/x86/autoconf.c
diff -u src/sys/arch/xen/x86/autoconf.c:1.21 src/sys/arch/xen/x86/autoconf.c:1.22
--- src/sys/arch/xen/x86/autoconf.c:1.21	Sat Dec 22 07:45:58 2018
+++ src/sys/arch/xen/x86/autoconf.c	Mon Jan 28 21:19:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.21 2018/12/22 07:45:58 cherry Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.22 2019/01/28 21:19:09 bad Exp $	*/
 /*	NetBSD: autoconf.c,v 1.75 2003/12/30 12:33:22 pk Exp 	*/
 
 /*-
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.21 2018/12/22 07:45:58 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.22 2019/01/28 21:19:09 bad Exp $");
 
 #include "opt_xen.h"
 #include "opt_multiprocessor.h"
@@ -101,6 +101,12 @@ extern void platform_init(void);
 #include 
 #endif
 
+#ifdef DEBUG_GEOM
+#define DPRINTF(a) printf a
+#else
+#define DPRINTF(a)
+#endif
+
 /*
  * Determine i/o configuration for a machine.
  */
@@ -170,8 +176,10 @@ cpu_bootconf(void)
 	union xen_cmdline_parseinfo xcp;
 	static char bootspecbuf[sizeof(xcp.xcp_bootdev)];
 
-	if (booted_device)
+	if (booted_device) {
+		DPRINTF(("%s: preset booted_device: %s\n", __func__, device_xname(booted_device)));
 		return;
+	}
 
 	xen_parse_cmdline(XEN_PARSE_BOOTDEV, &xcp);
 
@@ -197,17 +205,22 @@ cpu_bootconf(void)
 			continue;
 
 		if (is_disk && strlen(xcp.xcp_bootdev) > strlen(devname)) {
+			/* XXX check device_cfdata as in x86_autoconf.c? */
 			booted_partition = toupper(
 xcp.xcp_bootdev[strlen(devname)]) - 'A';
+			DPRINTF(("%s: booted_partition: %d\n", __func__, booted_partition));
 		}
 
 		booted_device = dv;
+		booted_method = "bootinfo/bootdev";
 		break;
 	}
 	deviter_release(&di);
 
-	if (booted_device)
+	if (booted_device) {
+		DPRINTF(("%s: booted_device: %s\n", __func__, device_xname(booted_device)));
 		return;
+	}
 
 	/*
 	 * not a boot device name, pass through to MI code
@@ -215,6 +228,8 @@ cpu_bootconf(void)
 	if (xcp.xcp_bootdev[0] != '\0') {
 		strlcpy(bootspecbuf, xcp.xcp_bootdev, sizeof(bootspecbuf));
 		bootspec = bootspecbuf;
+		booted_method = "bootinfo/bootspec";
+		DPRINTF(("%s: bootspec: %s\n", __func__, bootspec));
 		return;
 	}
 }
@@ -359,7 +374,6 @@ found:
 static int
 is_valid_disk(device_t dv)
 {
-
 	if (device_class(dv) != DV_DISK)
 		return (0);
 



CVS commit: src/sys/kern

2019-02-17 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sun Feb 17 23:17:42 UTC 2019

Modified Files:
src/sys/kern: subr_bufq.c

Log Message:
rename module_name to strategy_module_name to avoid fatal shadowing of
module_name() when compiled with older external gcc. NFC


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/kern/subr_bufq.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/subr_bufq.c
diff -u src/sys/kern/subr_bufq.c:1.26 src/sys/kern/subr_bufq.c:1.27
--- src/sys/kern/subr_bufq.c:1.26	Tue Jan 23 22:08:55 2018
+++ src/sys/kern/subr_bufq.c	Sun Feb 17 23:17:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_bufq.c,v 1.26 2018/01/23 22:08:55 pgoyette Exp $	*/
+/*	$NetBSD: subr_bufq.c,v 1.27 2019/02/17 23:17:41 bad Exp $	*/
 /*	NetBSD: subr_disk.c,v 1.70 2005/08/20 12:00:01 yamt Exp $	*/
 
 /*-
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_bufq.c,v 1.26 2018/01/23 22:08:55 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_bufq.c,v 1.27 2019/02/17 23:17:41 bad Exp $");
 
 #include 
 #include 
@@ -135,7 +135,7 @@ bufq_alloc(struct bufq_state **bufqp, co
 	int error = 0;
 	u_int gen;
 	bool found_exact;
-	char module_name[MAXPATHLEN];
+	char strategy_module_name[MAXPATHLEN];
 
 	KASSERT((flags & BUFQ_EXACT) == 0 || strategy != BUFQ_STRAT_ANY);
 
@@ -179,10 +179,12 @@ bufq_alloc(struct bufq_state **bufqp, co
 			break;
 
 		/* Try to autoload the bufq strategy module */
-		strlcpy(module_name, "bufq_", sizeof(module_name));
-		strlcat(module_name, strategy, sizeof(module_name));
+		strlcpy(strategy_module_name, "bufq_",
+			sizeof(strategy_module_name));
+		strlcat(strategy_module_name, strategy,
+			sizeof(strategy_module_name));
 		mutex_exit(&bufq_mutex);
-		(void) module_autoload(module_name, MODULE_CLASS_BUFQ);
+		(void) module_autoload(strategy_module_name, MODULE_CLASS_BUFQ);
 		mutex_enter(&bufq_mutex);
 	} while (gen != module_gen);
 



CVS commit: src/lib/librumphijack

2019-02-17 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sun Feb 17 23:33:20 UTC 2019

Modified Files:
src/lib/librumphijack: Makefile

Log Message:
compile hijack.c with -D_INCOMPLETE_XOPEN_C063 so that AT_FDCWD is alwasy
defined for rumpkernels.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/librumphijack/Makefile

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

Modified files:

Index: src/lib/librumphijack/Makefile
diff -u src/lib/librumphijack/Makefile:1.20 src/lib/librumphijack/Makefile:1.21
--- src/lib/librumphijack/Makefile:1.20	Thu May 11 04:33:14 2017
+++ src/lib/librumphijack/Makefile	Sun Feb 17 23:33:20 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.20 2017/05/11 04:33:14 sevan Exp $
+#	$NetBSD: Makefile,v 1.21 2019/02/17 23:33:20 bad Exp $
 #
 
 LIB=		rumphijack
@@ -11,6 +11,7 @@ MAN=		rumphijack.3
 SRCS=		hijack.c hijackdlsym.c
 
 CPPFLAGS+=	-D_DIAGNOSTIC -D_REENTRANT
+CPPFLAGS.hijack.c+= -D_INCOMPLETE_XOPEN_C063
 
 WARNS?=		5
 



CVS commit: src/lib/librumphijack

2019-02-17 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sun Feb 17 23:35:50 UTC 2019

Modified Files:
src/lib/librumphijack: hijack.c

Log Message:
Linux doesn't have paccept().


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/lib/librumphijack/hijack.c

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

Modified files:

Index: src/lib/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.126 src/lib/librumphijack/hijack.c:1.127
--- src/lib/librumphijack/hijack.c:1.126	Sun Dec 16 14:03:37 2018
+++ src/lib/librumphijack/hijack.c	Sun Feb 17 23:35:50 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: hijack.c,v 1.126 2018/12/16 14:03:37 hannken Exp $	*/
+/*  $NetBSD: hijack.c,v 1.127 2019/02/17 23:35:50 bad Exp $	*/
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -34,7 +34,7 @@
 #include 
 
 #if !defined(lint)
-__RCSID("$NetBSD: hijack.c,v 1.126 2018/12/16 14:03:37 hannken Exp $");
+__RCSID("$NetBSD: hijack.c,v 1.127 2019/02/17 23:35:50 bad Exp $");
 #endif
 
 #include 
@@ -89,7 +89,10 @@ __RCSID("$NetBSD: hijack.c,v 1.126 2018/
 enum dualcall {
 	DUALCALL_WRITE, DUALCALL_WRITEV, DUALCALL_PWRITE, DUALCALL_PWRITEV,
 	DUALCALL_IOCTL, DUALCALL_FCNTL,
-	DUALCALL_SOCKET, DUALCALL_ACCEPT, DUALCALL_PACCEPT,
+	DUALCALL_SOCKET, DUALCALL_ACCEPT,
+#ifndef __linux__
+	DUALCALL_PACCEPT,
+#endif
 	DUALCALL_BIND, DUALCALL_CONNECT,
 	DUALCALL_GETPEERNAME, DUALCALL_GETSOCKNAME, DUALCALL_LISTEN,
 	DUALCALL_RECVFROM, DUALCALL_RECVMSG,
@@ -272,7 +275,9 @@ struct sysnames {
 } syscnames[] = {
 	{ DUALCALL_SOCKET,	S(REALSOCKET),	RSYS_NAME(SOCKET)	},
 	{ DUALCALL_ACCEPT,	"accept",	RSYS_NAME(ACCEPT)	},
+#ifndef __linux__
 	{ DUALCALL_PACCEPT,	"paccept",	RSYS_NAME(PACCEPT)	},
+#endif
 	{ DUALCALL_BIND,	"bind",		RSYS_NAME(BIND)		},
 	{ DUALCALL_CONNECT,	"connect",	RSYS_NAME(CONNECT)	},
 	{ DUALCALL_GETPEERNAME,	"getpeername",	RSYS_NAME(GETPEERNAME)	},
@@ -1382,6 +1387,7 @@ accept(int s, struct sockaddr *addr, soc
 	return fd;
 }
 
+#ifndef __linux__
 int
 paccept(int s, struct sockaddr *addr, socklen_t *addrlen,
 const sigset_t * restrict sigmask, int flags)
@@ -1410,6 +1416,7 @@ paccept(int s, struct sockaddr *addr, so
 
 	return fd;
 }
+#endif
 
 /*
  * ioctl() and fcntl() are varargs calls and need special treatment.



CVS commit: src/sys/rump

2019-02-17 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sun Feb 17 23:50:53 UTC 2019

Modified Files:
src/sys/rump: listsrcdirs

Log Message:
npfctl needs externalbsd/libnv.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/rump/listsrcdirs

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

Modified files:

Index: src/sys/rump/listsrcdirs
diff -u src/sys/rump/listsrcdirs:1.35 src/sys/rump/listsrcdirs:1.36
--- src/sys/rump/listsrcdirs:1.35	Sun Apr  1 04:35:06 2018
+++ src/sys/rump/listsrcdirs	Sun Feb 17 23:50:53 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: listsrcdirs,v 1.35 2018/04/01 04:35:06 ryo Exp $
+#	$NetBSD: listsrcdirs,v 1.36 2019/02/17 23:50:53 bad Exp $
 #
 
 #
@@ -109,7 +109,7 @@ lsrc usr /sbin/			rndctl route setkey sy
 lsrc usr /usr.bin/		kdump ktrace mixerctl sockstat
 lsrc usr /usr.sbin/		arp dumpfs mdconfig ndp npf pcictl
 lsrc usr /usr.sbin/		rtadvd vnconfig wlanctl
-lsrc usr /external/bsd/		libelf libpcap tcpdump wpa
+lsrc usr /external/bsd/		libelf libnv libpcap tcpdump wpa
 lsrc usr /crypto/		Makefile.openssl
 lsrc usr /crypto/dist/		ipsec-tools
 lsrc usr /crypto/external/bsd/	openssl



CVS commit: src/external/bsd/libnv/lib

2019-02-17 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sun Feb 17 23:54:08 UTC 2019

Modified Files:
src/external/bsd/libnv/lib: Makefile

Log Message:
make libnv not LIBISPRIVATE when RUMPRUN=yes.

include bsd.init.mk earlier to pick up MAKECONF for RUMPRUN.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/bsd/libnv/lib/Makefile

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

Modified files:

Index: src/external/bsd/libnv/lib/Makefile
diff -u src/external/bsd/libnv/lib/Makefile:1.1 src/external/bsd/libnv/lib/Makefile:1.2
--- src/external/bsd/libnv/lib/Makefile:1.1	Sat Sep  8 14:11:11 2018
+++ src/external/bsd/libnv/lib/Makefile	Sun Feb 17 23:54:08 2019
@@ -1,15 +1,17 @@
-# $NetBSD: Makefile,v 1.1 2018/09/08 14:11:11 christos Exp $
+# $NetBSD: Makefile,v 1.2 2019/02/17 23:54:08 bad Exp $
 
-LIBISPRIVATE=	yes
+WARNS?=		5
+
+.include 
+
+.if ${RUMPRUN:Uno} != "yes"
+LIBISPRIVATE?=	yes
+.endif
 LIB=		nv
 #USE_SHLIBDIR=	yes
 #SHLIB_MAJOR=	1
 #SHLIB_MINOR=	0
 
-WARNS?=		5
-
-.include 
-
 #INCS=		nv.h dnv.h
 #INCSDIR=	/usr/include
 #MAN=		nv.3



CVS commit: src/sys/rump

2019-03-26 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Tue Mar 26 08:56:17 UTC 2019

Modified Files:
src/sys/rump/dev/lib/libnetsmb: netsmb_user.c
src/sys/rump/dev/lib/libugenhc: ugenhc_user.c
src/sys/rump/net/lib/libshmif: shmif_user.c
src/sys/rump/net/lib/libsockin: sockin_user.c
src/sys/rump/net/lib/libvirtif: virtif_user.c

Log Message:
Protect __KERNEL_RCSID. It isn't available when compile rumpkernels under e.g. 
Linux.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/rump/dev/lib/libnetsmb/netsmb_user.c
cvs rdiff -u -r1.3 -r1.4 src/sys/rump/dev/lib/libugenhc/ugenhc_user.c
cvs rdiff -u -r1.4 -r1.5 src/sys/rump/net/lib/libshmif/shmif_user.c
cvs rdiff -u -r1.3 -r1.4 src/sys/rump/net/lib/libsockin/sockin_user.c
cvs rdiff -u -r1.5 -r1.6 src/sys/rump/net/lib/libvirtif/virtif_user.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/rump/dev/lib/libnetsmb/netsmb_user.c
diff -u src/sys/rump/dev/lib/libnetsmb/netsmb_user.c:1.5 src/sys/rump/dev/lib/libnetsmb/netsmb_user.c:1.6
--- src/sys/rump/dev/lib/libnetsmb/netsmb_user.c:1.5	Sun Jan 27 02:08:48 2019
+++ src/sys/rump/dev/lib/libnetsmb/netsmb_user.c	Tue Mar 26 08:56:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netsmb_user.c,v 1.5 2019/01/27 02:08:48 pgoyette Exp $	*/
+/*	$NetBSD: netsmb_user.c,v 1.6 2019/03/26 08:56:17 bad Exp $	*/
 
 /*
  * Copyright (c) 2014 Takeshi Nakayama.
@@ -26,7 +26,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netsmb_user.c,v 1.5 2019/01/27 02:08:48 pgoyette Exp $");
+#ifdef __KERNEL_RCSID
+__KERNEL_RCSID(0, "$NetBSD: netsmb_user.c,v 1.6 2019/03/26 08:56:17 bad Exp $");
+#endif
 
 #ifndef _KERNEL
 #include 

Index: src/sys/rump/dev/lib/libugenhc/ugenhc_user.c
diff -u src/sys/rump/dev/lib/libugenhc/ugenhc_user.c:1.3 src/sys/rump/dev/lib/libugenhc/ugenhc_user.c:1.4
--- src/sys/rump/dev/lib/libugenhc/ugenhc_user.c:1.3	Sun Jan 27 02:08:49 2019
+++ src/sys/rump/dev/lib/libugenhc/ugenhc_user.c	Tue Mar 26 08:56:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugenhc_user.c,v 1.3 2019/01/27 02:08:49 pgoyette Exp $	*/
+/*	$NetBSD: ugenhc_user.c,v 1.4 2019/03/26 08:56:17 bad Exp $	*/
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ugenhc_user.c,v 1.3 2019/01/27 02:08:49 pgoyette Exp $");
+#ifdef __KERNEL_RCSID
+__KERNEL_RCSID(0, "$NetBSD: ugenhc_user.c,v 1.4 2019/03/26 08:56:17 bad Exp $");
+#endif
 
 #ifndef _KERNEL
 #include 

Index: src/sys/rump/net/lib/libshmif/shmif_user.c
diff -u src/sys/rump/net/lib/libshmif/shmif_user.c:1.4 src/sys/rump/net/lib/libshmif/shmif_user.c:1.5
--- src/sys/rump/net/lib/libshmif/shmif_user.c:1.4	Sun Jan 27 02:08:49 2019
+++ src/sys/rump/net/lib/libshmif/shmif_user.c	Tue Mar 26 08:56:17 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: shmif_user.c,v 1.4 2019/01/27 02:08:49 pgoyette Exp $	*/
+/*  $NetBSD: shmif_user.c,v 1.5 2019/03/26 08:56:17 bad Exp $	*/
 
 /*-
  * Copyright (c) 2009, 2010 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: shmif_user.c,v 1.4 2019/01/27 02:08:49 pgoyette Exp $");
+#ifdef __KERNEL_RCSID
+__KERNEL_RCSID(0, "$NetBSD: shmif_user.c,v 1.5 2019/03/26 08:56:17 bad Exp $");
+#endif
 
 #ifndef _KERNEL
 #include 

Index: src/sys/rump/net/lib/libsockin/sockin_user.c
diff -u src/sys/rump/net/lib/libsockin/sockin_user.c:1.3 src/sys/rump/net/lib/libsockin/sockin_user.c:1.4
--- src/sys/rump/net/lib/libsockin/sockin_user.c:1.3	Sun Jan 27 02:08:50 2019
+++ src/sys/rump/net/lib/libsockin/sockin_user.c	Tue Mar 26 08:56:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sockin_user.c,v 1.3 2019/01/27 02:08:50 pgoyette Exp $	*/
+/*	$NetBSD: sockin_user.c,v 1.4 2019/03/26 08:56:17 bad Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sockin_user.c,v 1.3 2019/01/27 02:08:50 pgoyette Exp $");
+#ifdef __KERNEL_RCSID
+__KERNEL_RCSID(0, "$NetBSD: sockin_user.c,v 1.4 2019/03/26 08:56:17 bad Exp $");
+#endif
 
 /* for struct msghdr content visibility */
 #define _XOPEN_SOURCE 4

Index: src/sys/rump/net/lib/libvirtif/virtif_user.c
diff -u src/sys/rump/net/lib/libvirtif/virtif_user.c:1.5 src/sys/rump/net/lib/libvirtif/virtif_user.c:1.6
--- src/sys/rump/net/lib/libvirtif/virtif_user.c:1.5	Sun Jan 27 02:08:50 2019
+++ src/sys/rump/net/lib/libvirtif/virtif_user.c	Tue Mar 26 08:56:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtif_user.c,v 1.5 2019/01/27 02:08:50 pgoyette Exp $	*/
+/*	$NetBSD: virtif_user.c,v 1.6 2019/03/26 08:56:17 bad Exp $	*/
 
 /*
  * Copyright (c) 2013 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtif_user.c,v 1.5 2019/01/27 02:08:50 pgoyette Exp $");
+#ifdef __KERNEL_RCSID
+__KERNEL_RCSID(0, "$NetBSD: virtif_user.c,v 1.6 2019/03/26 08:56:17 bad Exp $");
+#endif
 
 #ifndef _KERNEL
 #include 



CVS commit: src/sys/dev/sysmon

2019-03-26 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Tue Mar 26 15:50:23 UTC 2019

Modified Files:
src/sys/dev/sysmon: sysmon_envsys.c

Log Message:
in sysmon_envsys_unregister(): loop over sme_sensors_list with TAILQ_FIRST
instead of TAILQ_FOREACH.

sysmon_envsys_sensor_detach() removes the sensor from sme_sensors_list.
Hence using TAILQ_FOREACH is not safe.

Suggested by thorpej and jmcneill.  Thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/dev/sysmon/sysmon_envsys.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/sysmon/sysmon_envsys.c
diff -u src/sys/dev/sysmon/sysmon_envsys.c:1.143 src/sys/dev/sysmon/sysmon_envsys.c:1.144
--- src/sys/dev/sysmon/sysmon_envsys.c:1.143	Sat May 26 21:15:46 2018
+++ src/sys/dev/sysmon/sysmon_envsys.c	Tue Mar 26 15:50:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_envsys.c,v 1.143 2018/05/26 21:15:46 thorpej Exp $	*/
+/*	$NetBSD: sysmon_envsys.c,v 1.144 2019/03/26 15:50:23 bad Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.143 2018/05/26 21:15:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.144 2019/03/26 15:50:23 bad Exp $");
 
 #include 
 #include 
@@ -993,7 +993,7 @@ sysmon_envsys_unregister(struct sysmon_e
 	LIST_REMOVE(sme, sme_list);
 	mutex_exit(&sme_global_mtx);
 
-	TAILQ_FOREACH(edata, &sme->sme_sensors_list, sensors_head) {
+	while ((edata = TAILQ_FIRST(&sme->sme_sensors_list)) != NULL) {
 		sysmon_envsys_sensor_detach(sme, edata);
 	}