CVS commit: src/share/mk

2017-05-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 29 03:52:43 UTC 2017

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

Log Message:
remove ugly profiling hack now that the compiler is fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.371 -r1.372 src/share/mk/bsd.lib.mk

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

Modified files:

Index: src/share/mk/bsd.lib.mk
diff -u src/share/mk/bsd.lib.mk:1.371 src/share/mk/bsd.lib.mk:1.372
--- src/share/mk/bsd.lib.mk:1.371	Mon May 22 20:54:13 2017
+++ src/share/mk/bsd.lib.mk	Sun May 28 23:52:43 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.lib.mk,v 1.371 2017/05/23 00:54:13 christos Exp $
+#	$NetBSD: bsd.lib.mk,v 1.372 2017/05/29 03:52:43 christos Exp $
 #	@(#)bsd.lib.mk	8.3 (Berkeley) 4/22/94
 
 .include 
@@ -42,9 +42,6 @@ realinstall:	checkver libinstall
 # XXX: This is needed for programs that link with .a libraries
 # Perhaps a more correct solution is to always generate _pic.a
 # files or always have a shared library.
-# XXX: This breaks profiling (__mcount relocation is wrong)
-# XXX: This is why we remove the PIE_CFLAGS from the profile
-# built-in rule below.
 # Another fix is to provide rcrt0.o like OpenBSD does and
 # do relocations for static PIE.
 .if defined(MKPIE) && (${MKPIE} != "no") && !defined(NOPIE)
@@ -224,8 +221,7 @@ LIBSTRIPSHLIBOBJS=	yes
 
 .c.po:
 	${_MKTARGET_COMPILE}
-	# XXX: See __mcount comment above
-	${COMPILE.c:S/${PIE_CFLAGS}//} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
+	${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
 .if defined(CTFCONVERT)
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif



CVS commit: src/external/gpl3/gcc/dist/gcc/config/i386

2017-05-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 29 03:51:24 UTC 2017

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/i386: netbsd64.h

Log Message:
remove bogus indirect call for profiling (mcount)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h
diff -u src/external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h:1.7 src/external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h:1.8
--- src/external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h:1.7	Fri Aug 19 01:11:09 2016
+++ src/external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h	Sun May 28 23:51:24 2017
@@ -50,9 +50,9 @@ along with GCC; see the file COPYING3.  
 #define FUNCTION_PROFILER(FILE, LABELNO)\
 {	\
   if (TARGET_64BIT && flag_pic)		\
-fprintf (FILE, "\tcall *__mcount@PLT\n");\
+fprintf (FILE, "\tcall __mcount@PLT\n");\
   else if (flag_pic)			\
-fprintf (FILE, "\tcall *__mcount@PLT\n");\
+fprintf (FILE, "\tcall __mcount@PLT\n");\
   else	\
 fprintf (FILE, "\tcall __mcount\n");\
 }



CVS commit: src/share/man/man4

2017-05-28 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon May 29 03:41:54 UTC 2017

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

Log Message:
Remove unmaintained (and probably unmaintainable) driver list

ok msaitoh@


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 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.34 src/share/man/man4/vlan.4:1.35
--- src/share/man/man4/vlan.4:1.34	Fri Nov 20 17:02:58 2015
+++ src/share/man/man4/vlan.4	Mon May 29 03:41:53 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: vlan.4,v 1.34 2015/11/20 17:02:58 christos Exp $
+.\"	$NetBSD: vlan.4,v 1.35 2017/05/29 03:41:53 ozaki-r Exp $
 .\"
 .\" Copyright (c) 2000, 2015 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -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 November 20, 2015
+.Dd May 29, 2017
 .Dt VLAN 4
 .Os
 .Sh NAME
@@ -115,63 +115,6 @@ which means that the parent interface wi
 that are 4 bytes larger than the original
 .Tn Ethernet
 standard.
-Drivers supporting this increased
-.Tn MTU
-are:
-.Pp
-.Bl -dash -compact
-.It
-drivers using the DP8390 core
-.Po
-such as
-.Xr ec 4 ,
-.Xr ne 4 ,
-.Xr we 4 ,
-and possibly others
-.Pc
-.It
-.Xr bge 4
-.It
-.Xr bnx 4
-.It
-.Xr ea 4
-.It
-.Xr eb 4
-.It
-.Xr epic 4
-.It
-.Xr etherip 4
-.It
-.Xr ex 4
-.It
-.Xr fxp 4
-.It
-.Xr gem 4
-.It
-.Xr hme 4
-.It
-.Xr le 4
-.It
-.Xr sip 4
-.It
-.Xr ste 4
-.It
-.Xr stge 4
-.It
-.Xr ti 4
-.It
-.Xr tl 4
-.It
-.Xr tlp 4
-.It
-.Xr vge 4
-.It
-.Xr vr 4
-.It
-.Xr wm 4
-.It
-.Xr xi 4
-.El
 .Pp
 .Nm
 can be used with devices not supporting the



CVS commit: src/sys/net

2017-05-28 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon May 29 02:55:49 UTC 2017

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

Log Message:
Call in6_ifdetach only if in6_present (for rump)

Otherwise ifconfig -vlanif causes a panic on a rump_server without
the netinet6 library.

Reported by s-yamaguchi@IIJ


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/net/if_vlan.c

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

Modified files:

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.96 src/sys/net/if_vlan.c:1.97
--- src/sys/net/if_vlan.c:1.96	Wed Mar 15 09:51:08 2017
+++ src/sys/net/if_vlan.c	Mon May 29 02:55:49 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.96 2017/03/15 09:51:08 ozaki-r Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.97 2017/05/29 02:55:49 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.96 2017/03/15 09:51:08 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.97 2017/05/29 02:55:49 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -111,6 +111,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 
 #endif
 #ifdef INET6
 #include 
+#include 
 #endif
 
 #include "ioconf.h"
@@ -425,7 +426,8 @@ vlan_unconfig(struct ifnet *ifp)
 
 #ifdef INET6
 	/* To delete v6 link local addresses */
-	in6_ifdetach(ifp);
+	if (in6_present)
+		in6_ifdetach(ifp);
 #endif
 	if ((ifp->if_flags & IFF_PROMISC) != 0)
 		ifpromisc(ifp, 0);



CVS commit: src/sys/dev/ic

2017-05-28 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon May 29 02:25:37 UTC 2017

Modified Files:
src/sys/dev/ic: nvme.c

Log Message:
nvme(4): Don't set prp1 for DEL_IOCQ

> NVM_ADMIN_DEL_IOCQ does not need prp1 (just as NVM_ADMIN_DEL_IOSQ).
> Remove what is likely a cut'n'paste error from the *_ADD_* code.

from OpenBSD nvme.c r1.56.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/ic/nvme.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/ic/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.28 src/sys/dev/ic/nvme.c:1.29
--- src/sys/dev/ic/nvme.c:1.28	Mon May 29 02:24:00 2017
+++ src/sys/dev/ic/nvme.c	Mon May 29 02:25:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.28 2017/05/29 02:24:00 nonaka Exp $	*/
+/*	$NetBSD: nvme.c,v 1.29 2017/05/29 02:25:37 nonaka Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.28 2017/05/29 02:24:00 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.29 2017/05/29 02:25:37 nonaka Exp $");
 
 #include 
 #include 
@@ -1296,7 +1296,6 @@ nvme_q_delete(struct nvme_softc *sc, str
 
 	memset(, 0, sizeof(sqe));
 	sqe.opcode = NVM_ADMIN_DEL_IOCQ;
-	htolem64(, NVME_DMA_DVA(q->q_sq_dmamem));
 	htolem16(, q->q_id);
 
 	rv = nvme_poll(sc, sc->sc_admin_q, ccb, nvme_sqe_fill, NVME_TIMO_QOP);



CVS commit: src/sys/dev/ic

2017-05-28 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon May 29 02:24:00 UTC 2017

Modified Files:
src/sys/dev/ic: nvme.c

Log Message:
nvme(4): Do not use bus_space_{read,write}_8() even on LP64 archs.

> some (broken) controllers require ordered split transfers.
> From linux a310acd7a7ea53533886c11bb7edd11ffd61a036

from OpenBSD nvme.c r1.53.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/ic/nvme.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/ic/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.27 src/sys/dev/ic/nvme.c:1.28
--- src/sys/dev/ic/nvme.c:1.27	Mon May 29 02:20:34 2017
+++ src/sys/dev/ic/nvme.c	Mon May 29 02:24:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.27 2017/05/29 02:20:34 nonaka Exp $	*/
+/*	$NetBSD: nvme.c,v 1.28 2017/05/29 02:24:00 nonaka Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.27 2017/05/29 02:20:34 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.28 2017/05/29 02:24:00 nonaka Exp $");
 
 #include 
 #include 
@@ -121,12 +121,10 @@ static int	nvme_get_number_of_queues(str
 	bus_space_read_4((_s)->sc_iot, (_s)->sc_ioh, (_r))
 #define nvme_write4(_s, _r, _v) \
 	bus_space_write_4((_s)->sc_iot, (_s)->sc_ioh, (_r), (_v))
-#ifdef __LP64__
-#define nvme_read8(_s, _r) \
-	bus_space_read_8((_s)->sc_iot, (_s)->sc_ioh, (_r))
-#define nvme_write8(_s, _r, _v) \
-	bus_space_write_8((_s)->sc_iot, (_s)->sc_ioh, (_r), (_v))
-#else /* __LP64__ */
+/*
+ * Some controllers, at least Apple NVMe, always require split
+ * transfers, so don't use bus_space_{read,write}_8() on LP64.
+ */
 static inline uint64_t
 nvme_read8(struct nvme_softc *sc, bus_size_t r)
 {
@@ -157,7 +155,6 @@ nvme_write8(struct nvme_softc *sc, bus_s
 	nvme_write4(sc, r + 4, a[0]);
 #endif
 }
-#endif /* __LP64__ */
 #define nvme_barrier(_s, _r, _l, _f) \
 	bus_space_barrier((_s)->sc_iot, (_s)->sc_ioh, (_r), (_l), (_f))
 



CVS commit: src/sys/dev/ic

2017-05-28 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon May 29 02:20:34 UTC 2017

Modified Files:
src/sys/dev/ic: nvme.c nvmereg.h

Log Message:
nvme(4): Mask non relevant bits when pritting version number.

from OpenBSD nvme.c r1.52.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/ic/nvme.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/nvmereg.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/ic/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.26 src/sys/dev/ic/nvme.c:1.27
--- src/sys/dev/ic/nvme.c:1.26	Wed Apr  5 20:15:49 2017
+++ src/sys/dev/ic/nvme.c	Mon May 29 02:20:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.26 2017/04/05 20:15:49 jdolecek Exp $	*/
+/*	$NetBSD: nvme.c,v 1.27 2017/05/29 02:20:34 nonaka Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.26 2017/04/05 20:15:49 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.27 2017/05/29 02:20:34 nonaka Exp $");
 
 #include 
 #include 
@@ -50,7 +50,6 @@ static int	nvme_enable(struct nvme_softc
 static int	nvme_disable(struct nvme_softc *);
 static int	nvme_shutdown(struct nvme_softc *);
 
-static void	nvme_version(struct nvme_softc *, uint32_t);
 #ifdef NVME_DEBUG
 static void	nvme_dumpregs(struct nvme_softc *);
 #endif
@@ -162,32 +161,6 @@ nvme_write8(struct nvme_softc *sc, bus_s
 #define nvme_barrier(_s, _r, _l, _f) \
 	bus_space_barrier((_s)->sc_iot, (_s)->sc_ioh, (_r), (_l), (_f))
 
-static void
-nvme_version(struct nvme_softc *sc, uint32_t ver)
-{
-	const char *v = NULL;
-
-	switch (ver) {
-	case NVME_VS_1_0:
-		v = "1.0";
-		break;
-	case NVME_VS_1_1:
-		v = "1.1";
-		break;
-	case NVME_VS_1_2:
-		v = "1.2";
-		break;
-	case NVME_VS_1_2_1:
-		v = "1.2.1";
-		break;
-	default:
-		aprint_error_dev(sc->sc_dev, "unknown version 0x%08x\n", ver);
-		return;
-	}
-
-	aprint_normal_dev(sc->sc_dev, "NVMe %s\n", v);
-}
-
 #ifdef NVME_DEBUG
 static __used void
 nvme_dumpregs(struct nvme_softc *sc)
@@ -353,7 +326,12 @@ nvme_attach(struct nvme_softc *sc)
 		return 1;
 	}
 
-	nvme_version(sc, reg);
+	if (NVME_VS_TER(reg) == 0)
+		aprint_normal_dev(sc->sc_dev, "NVMe %d.%d\n", NVME_VS_MJR(reg),
+		NVME_VS_MNR(reg));
+	else
+		aprint_normal_dev(sc->sc_dev, "NVMe %d.%d.%d\n", NVME_VS_MJR(reg),
+		NVME_VS_MNR(reg), NVME_VS_TER(reg));
 
 	cap = nvme_read8(sc, NVME_CAP);
 	dstrd = NVME_CAP_DSTRD(cap);

Index: src/sys/dev/ic/nvmereg.h
diff -u src/sys/dev/ic/nvmereg.h:1.8 src/sys/dev/ic/nvmereg.h:1.9
--- src/sys/dev/ic/nvmereg.h:1.8	Tue Feb 28 20:53:50 2017
+++ src/sys/dev/ic/nvmereg.h	Mon May 29 02:20:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmereg.h,v 1.8 2017/02/28 20:53:50 jdolecek Exp $	*/
+/*	$NetBSD: nvmereg.h,v 1.9 2017/05/29 02:20:34 nonaka Exp $	*/
 /*	$OpenBSD: nvmereg.h,v 1.10 2016/04/14 11:18:32 dlg Exp $ */
 
 /*
@@ -37,11 +37,8 @@
 #define NVME_CAP_HI	0x0004
 #define NVME_VS		0x0008	/* Version */
 #define  NVME_VS_MJR(_r)	(((_r) >> 16) & 0x)
-#define  NVME_VS_MNR(_r)	((_r) & 0x)
-#define  NVME_VS_1_0		0x0001
-#define  NVME_VS_1_1		0x00010100
-#define  NVME_VS_1_2		0x00010200
-#define  NVME_VS_1_2_1		0x00010201
+#define  NVME_VS_MNR(_r)	(((_r) >> 8) & 0xff)
+#define  NVME_VS_TER(_r)	((_r) & 0xff)
 #define NVME_INTMS	0x000c	/* Interrupt Mask Set */
 #define NVME_INTMC	0x0010	/* Interrupt Mask Clear */
 #define NVME_CC		0x0014	/* Controller Configuration */



CVS commit: src/share/man/man9

2017-05-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May 29 01:51:55 UTC 2017

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

Log Message:
Omit description of fstrans_mount/unmount too.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/share/man/man9/fstrans.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/fstrans.9
diff -u src/share/man/man9/fstrans.9:1.22 src/share/man/man9/fstrans.9:1.23
--- src/share/man/man9/fstrans.9:1.22	Mon May 29 01:49:42 2017
+++ src/share/man/man9/fstrans.9	Mon May 29 01:51:55 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: fstrans.9,v 1.22 2017/05/29 01:49:42 riastradh Exp $
+.\" $NetBSD: fstrans.9,v 1.23 2017/05/29 01:51:55 riastradh Exp $
 .\"
 .\" Copyright (c) 2007 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -140,31 +140,6 @@ The copy-on-write callback must be dises
 when the file system is done with it.
 .Sh FUNCTIONS
 .Bl -tag -width abcd
-.It Fn fstrans_mount "mp"
-Initialize the
-.Nm
-subsystem for the file system mounted at
-.Fa mp .
-Sets
-.Dv IMNT_HAS_TRANS
-in
-.Fa mp Ns Li "->mnt_iflag" .
-Return zero on success, or error code if
-.Xr vfs_busy 9
-fails.
-.Pp
-May sleep.
-.It Fn fstrans_unmount "mp"
-Finalize the
-.Nm
-subsystem.
-Clears
-.Dv IMNT_HAS_TRANS
-in
-.Fa mp Ns Li "->mnt_iflag" .
-Caller is responsible for ensuring that no transactions are active.
-.Pp
-May sleep.
 .It Fn fstrans_start "mp" "lock_type"
 Enter a transaction of type
 .Fa lock_type



CVS commit: src/share/man/man9

2017-05-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May 29 01:49:42 UTC 2017

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

Log Message:
No more need to call fstrans_mount: vfs does for us now.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/share/man/man9/fstrans.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/fstrans.9
diff -u src/share/man/man9/fstrans.9:1.21 src/share/man/man9/fstrans.9:1.22
--- src/share/man/man9/fstrans.9:1.21	Sat Mar 18 19:01:01 2017
+++ src/share/man/man9/fstrans.9	Mon May 29 01:49:42 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: fstrans.9,v 1.21 2017/03/18 19:01:01 riastradh Exp $
+.\" $NetBSD: fstrans.9,v 1.22 2017/05/29 01:49:42 riastradh Exp $
 .\"
 .\" Copyright (c) 2007 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -45,10 +45,6 @@
 .Sh SYNOPSIS
 .In sys/mount.h
 .In sys/fstrans.h
-.Ft int
-.Fn fstrans_mount "struct mount *mp"
-.Ft void
-.Fn fstrans_unmount "struct mount *mp"
 .Ft void
 .Fn fstrans_start "struct mount *mp" "enum fstrans_lock_type lock_type"
 .Ft int
@@ -74,17 +70,6 @@ The
 .Nm
 subsystem assists file system suspension and copy-on-write snapshots.
 .Pp
-For a file system to use
-.Nm ,
-its
-.Xr VFS_MOUNT 9
-method must call
-.Fn fstrans_mount ,
-and its
-.Xr VFS_UNMOUNT 9
-method must call
-.Fn fstrans_unmount .
-.Pp
 The file system's normal operations, such as its
 .Xr vnodeops 9 ,
 must be bracketed by



CVS commit: src/sys/arch

2017-05-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun May 28 23:39:30 UTC 2017

Modified Files:
src/sys/arch/arm/fdt: armv7_fdt.c
src/sys/arch/arm/nvidia: files.tegra
src/sys/arch/evbarm/tegra: platform.h tegra_machdep.c
Added Files:
src/sys/arch/arm/fdt: armv7_fdtvar.h
src/sys/arch/arm/nvidia: tegra_platform.c

Log Message:
Add a facility for platform-specific callbacks and use it to remove most
of the Tegra-specific code from tegra_machdep.c.

Platform code matches on the compatible property of the root ("/") DT node
and allows for chip-specific implementations of the following:

 - devmap: Return a 0-terminated list of static device map entries.
 - bootstrap: Early initialization of platform-specific facilities.
 - early_putchar: Provides an implementation of putchar for use in early
 debug messages.
 - device_register: Platform-specific device register callback.
 - reset: Platform-specific CPU reset implementation.
 - consinit: Platform-specific console init implementation.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/fdt/armv7_fdt.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/fdt/armv7_fdtvar.h
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/arm/nvidia/files.tegra
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/nvidia/tegra_platform.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/tegra/platform.h
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/evbarm/tegra/tegra_machdep.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/arm/fdt/armv7_fdt.c
diff -u src/sys/arch/arm/fdt/armv7_fdt.c:1.1 src/sys/arch/arm/fdt/armv7_fdt.c:1.2
--- src/sys/arch/arm/fdt/armv7_fdt.c:1.1	Sun May 28 00:40:20 2017
+++ src/sys/arch/arm/fdt/armv7_fdt.c	Sun May 28 23:39:30 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: armv7_fdt.c,v 1.1 2017/05/28 00:40:20 jmcneill Exp $ */
+/* $NetBSD: armv7_fdt.c,v 1.2 2017/05/28 23:39:30 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: armv7_fdt.c,v 1.1 2017/05/28 00:40:20 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: armv7_fdt.c,v 1.2 2017/05/28 23:39:30 jmcneill Exp $");
 
 #include 
 #include 
@@ -39,6 +39,8 @@ __KERNEL_RCSID(0, "$NetBSD: armv7_fdt.c,
 #include 
 #include 
 
+#include 
+
 static int	armv7_fdt_match(device_t, cfdata_t, void *);
 static void	armv7_fdt_attach(device_t, device_t, void *);
 
@@ -51,6 +53,9 @@ extern struct bus_space armv7_generic_bs
 extern struct bus_space armv7_generic_a4x_bs_tag;
 extern struct arm32_bus_dma_tag armv7_generic_dma_tag;
 
+static struct armv7_platlist armv7_platform_list =
+TAILQ_HEAD_INITIALIZER(armv7_platform_list);
+
 int
 armv7_fdt_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -76,3 +81,30 @@ armv7_fdt_attach(device_t parent, device
 	};
 	config_found(self, , NULL);
 }
+
+const struct armv7_platform *
+armv7_fdt_platform(void)
+{
+	static const struct armv7_platform_info *booted_platform = NULL;
+
+	if (booted_platform == NULL) {
+		__link_set_decl(armv7_platforms, struct armv7_platform_info);
+		struct armv7_platform_info * const *info;
+		const struct armv7_platform_info *best_info = NULL;
+		const int phandle = OF_peer(0);
+		int match, best_match = 0;
+
+		__link_set_foreach(info, armv7_platforms) {
+			const char * const compat[] = { (*info)->compat, NULL };
+			match = of_match_compatible(phandle, compat);
+			if (match > best_match) {
+best_match = match;
+best_info = *info;
+			}
+		}
+
+		booted_platform = best_info;
+	}
+
+	return booted_platform == NULL ? NULL : booted_platform->ops;
+}

Index: src/sys/arch/arm/nvidia/files.tegra
diff -u src/sys/arch/arm/nvidia/files.tegra:1.37 src/sys/arch/arm/nvidia/files.tegra:1.38
--- src/sys/arch/arm/nvidia/files.tegra:1.37	Sun May 28 00:40:20 2017
+++ src/sys/arch/arm/nvidia/files.tegra	Sun May 28 23:39:30 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.tegra,v 1.37 2017/05/28 00:40:20 jmcneill Exp $
+#	$NetBSD: files.tegra,v 1.38 2017/05/28 23:39:30 jmcneill Exp $
 #
 # Configuration info for NVIDIA Tegra ARM Peripherals
 #
@@ -14,6 +14,7 @@ file	arch/arm/arm32/armv7_generic_space.
 file	arch/arm/arm32/armv7_generic_dma.c
 file	arch/arm/arm/bus_space_a4x.S
 
+file	arch/arm/nvidia/tegra_platform.c
 file	arch/arm/nvidia/tegra_soc.c
 file	arch/arm/nvidia/tegra_cpufreq.c
 

Index: src/sys/arch/evbarm/tegra/platform.h
diff -u src/sys/arch/evbarm/tegra/platform.h:1.2 src/sys/arch/evbarm/tegra/platform.h:1.3
--- src/sys/arch/evbarm/tegra/platform.h:1.2	Sun May 31 22:15:52 2015
+++ src/sys/arch/evbarm/tegra/platform.h	Sun May 28 23:39:30 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: platform.h,v 1.2 2015/05/31 22:15:52 matt Exp $ */
+/* $NetBSD: platform.h,v 1.3 2017/05/28 23:39:30 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -39,6 +39,4 @@
 #define KERNEL_VM_SIZE		0x5000 /* 0x5000 = 1.25GB */
 

CVS commit: src/sys/arch/arm

2017-05-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun May 28 23:31:41 UTC 2017

Modified Files:
src/sys/arch/arm/arm: bootconfig.c
src/sys/arch/arm/include: bootconfig.h

Log Message:
Add a few bootconfig helpers:
 - get_bootconf_string: returns a copy of the "value" part of a k=v pair
 as a string.
 - match_bootconf_option: returns true if the "value" part of a k=v pair
 exists and the supplied val param is present in the beginning of the
 k=v pair's value.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/arm/bootconfig.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/include/bootconfig.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/arch/arm/arm/bootconfig.c
diff -u src/sys/arch/arm/arm/bootconfig.c:1.9 src/sys/arch/arm/arm/bootconfig.c:1.10
--- src/sys/arch/arm/arm/bootconfig.c:1.9	Wed Mar  2 19:25:32 2016
+++ src/sys/arch/arm/arm/bootconfig.c	Sun May 28 23:31:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootconfig.c,v 1.9 2016/03/02 19:25:32 christos Exp $	*/
+/*	$NetBSD: bootconfig.c,v 1.10 2017/05/28 23:31:41 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -40,9 +40,10 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: bootconfig.c,v 1.9 2016/03/02 19:25:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bootconfig.c,v 1.10 2017/05/28 23:31:41 jmcneill Exp $");
 
 #include 
+#include 
 
 #include 
 
@@ -145,3 +146,37 @@ get_bootconf_option(char *opts, const ch
 	}
 	return 0;
 }
+
+char *
+get_bootconf_string(char *opts, const char *key)
+{
+	char *s, *ret;
+	int i = 0;
+
+	if (!get_bootconf_option(opts, key, BOOTOPT_TYPE_STRING, ))
+		return NULL;
+
+	for (;;) {
+		if (s[i] == ' ' || s[i] == '\t' || s[i] == '\0')
+			break;
+		++i;
+	}
+
+	ret = kmem_alloc(i + 1, KM_SLEEP);
+	if (ret == NULL)
+		return NULL;
+
+	strlcpy(ret, s, i + 1);
+	return ret;
+}
+
+bool
+match_bootconf_option(char *opts, const char *key, const char *val)
+{
+	char *s;
+
+	if (!get_bootconf_option(opts, key, BOOTOPT_TYPE_STRING, ))
+		return false;
+
+	return strncmp(s, val, strlen(val)) == 0;
+}

Index: src/sys/arch/arm/include/bootconfig.h
diff -u src/sys/arch/arm/include/bootconfig.h:1.7 src/sys/arch/arm/include/bootconfig.h:1.8
--- src/sys/arch/arm/include/bootconfig.h:1.7	Tue Jan  6 00:43:21 2015
+++ src/sys/arch/arm/include/bootconfig.h	Sun May 28 23:31:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootconfig.h,v 1.7 2015/01/06 00:43:21 jmcneill Exp $	*/
+/*	$NetBSD: bootconfig.h,v 1.8 2017/05/28 23:31:41 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1994 Mark Brinicombe.
@@ -54,6 +54,8 @@ struct boot_physmem {
 };
 
 int get_bootconf_option(char *, const char *, int, void *);
+bool match_bootconf_option(char *, const char *, const char *);
+char *get_bootconf_string(char *, const char *);
 
 extern char *boot_args;
 #endif	/* _KERNEL */



CVS commit: src/sys/arch/arm/nvidia

2017-05-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun May 28 23:32:14 UTC 2017

Modified Files:
src/sys/arch/arm/nvidia: tegra_soc.c

Log Message:
Remove unused tegra_dma_tag


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/nvidia/tegra_soc.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/arm/nvidia/tegra_soc.c
diff -u src/sys/arch/arm/nvidia/tegra_soc.c:1.12 src/sys/arch/arm/nvidia/tegra_soc.c:1.13
--- src/sys/arch/arm/nvidia/tegra_soc.c:1.12	Sat May 27 20:26:27 2017
+++ src/sys/arch/arm/nvidia/tegra_soc.c	Sun May 28 23:32:14 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_soc.c,v 1.12 2017/05/27 20:26:27 jmcneill Exp $ */
+/* $NetBSD: tegra_soc.c,v 1.13 2017/05/28 23:32:14 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -30,9 +30,8 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_soc.c,v 1.12 2017/05/27 20:26:27 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_soc.c,v 1.13 2017/05/28 23:32:14 jmcneill Exp $");
 
-#define	_ARM32_BUS_DMA_PRIVATE
 #include 
 #include 
 #include 
@@ -53,12 +52,6 @@ bus_space_handle_t tegra_ppsb_bsh;
 bus_space_handle_t tegra_apb_bsh;
 bus_space_handle_t tegra_ahb_a2_bsh;
 
-struct arm32_bus_dma_tag tegra_dma_tag = {
-	_BUS_DMAMAP_FUNCS,
-	_BUS_DMAMEM_FUNCS,
-	_BUS_DMATAG_FUNCS,
-};
-
 static void	tegra_mpinit(void);
 
 void



CVS commit: src/libexec/httpd

2017-05-28 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sun May 28 22:37:36 UTC 2017

Modified Files:
src/libexec/httpd: lua-bozo.c

Log Message:
Cosmetic changes to Lua binding in bozohttpd.

- Don't use negative indicies to read arguments of Lua functions.
- On error, return nil, "error string".
- Use ssize_t for return values from bozo_read() and bozo_write().
- Prefer lstring especially when if saves you from appending NUL and
  doing len + 1 which can potentially wraparound.
- Don't mix C allocations with Lua functions marked with "m" in the Lua
  manual. Those functions may throw (longjump) and leak data allocated
  by C function. In one case, I use luaL_Buffer, in the other case,
  I rearranged calls a bit.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/libexec/httpd/lua-bozo.c

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

Modified files:

Index: src/libexec/httpd/lua-bozo.c
diff -u src/libexec/httpd/lua-bozo.c:1.14 src/libexec/httpd/lua-bozo.c:1.15
--- src/libexec/httpd/lua-bozo.c:1.14	Mon Dec 28 07:37:59 2015
+++ src/libexec/httpd/lua-bozo.c	Sun May 28 22:37:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lua-bozo.c,v 1.14 2015/12/28 07:37:59 mrg Exp $	*/
+/*	$NetBSD: lua-bozo.c,v 1.15 2017/05/28 22:37:36 alnsn Exp $	*/
 
 /*
  * Copyright (c) 2013 Marc Balmer 
@@ -51,8 +51,8 @@
 
 #define FORM	"application/x-www-form-urlencoded"
 
-static int
-lua_flush(lua_State *L)
+static bozohttpd_t *
+httpd_instance(lua_State *L)
 {
 	bozohttpd_t *httpd;
 
@@ -61,6 +61,14 @@ lua_flush(lua_State *L)
 	httpd = lua_touserdata(L, -1);
 	lua_pop(L, 1);
 
+	return httpd;
+}
+
+static int
+lua_flush(lua_State *L)
+{
+	bozohttpd_t *httpd = httpd_instance(L);
+
 	bozo_flush(httpd, stdout);
 	return 0;
 }
@@ -68,63 +76,57 @@ lua_flush(lua_State *L)
 static int
 lua_print(lua_State *L)
 {
-	bozohttpd_t *httpd;
-
-	lua_pushstring(L, "bozohttpd");
-	lua_gettable(L, LUA_REGISTRYINDEX);
-	httpd = lua_touserdata(L, -1);
-	lua_pop(L, 1);
+	bozohttpd_t *httpd = httpd_instance(L);
 
-	bozo_printf(httpd, "%s\r\n", lua_tostring(L, -1));
+	bozo_printf(httpd, "%s\r\n", lua_tostring(L, 1));
 	return 0;
 }
 
 static int
 lua_read(lua_State *L)
 {
-	bozohttpd_t *httpd;
-	int n, len;
+	bozohttpd_t *httpd = httpd_instance(L);
+	luaL_Buffer lbuf;
 	char *data;
+	lua_Integer len;
+	ssize_t n;
 
-	lua_pushstring(L, "bozohttpd");
-	lua_gettable(L, LUA_REGISTRYINDEX);
-	httpd = lua_touserdata(L, -1);
-	lua_pop(L, 1);
+	len = luaL_checkinteger(L, 1);
+	data = luaL_buffinitsize(L, , (size_t)len);
 
-	len = luaL_checkinteger(L, -1);
-	data = bozomalloc(httpd, len + 1);
-	n = bozo_read(httpd, STDIN_FILENO, data, len);
-	if (n >= 0) {
-		data[n] = '\0';
-		lua_pushstring(L, data);
-	} else
+	if ((n = bozo_read(httpd, STDIN_FILENO, data, len)) >= 0) {
+		luaL_pushresultsize(, n);
+		return 1;
+	} else {
 		lua_pushnil(L);
-	free(data);
-	return 1;
+		lua_pushstring(L, "bozo_read() call failed");
+		return 2;
+	}
 }
 
 static int
 lua_register_handler(lua_State *L)
 {
+	bozohttpd_t *httpd = httpd_instance(L);
 	lua_state_map_t *map;
 	lua_handler_t *handler;
-	bozohttpd_t *httpd;
+	const char *name;
+	int ref;
 
 	lua_pushstring(L, "lua_state_map");
 	lua_gettable(L, LUA_REGISTRYINDEX);
 	map = lua_touserdata(L, -1);
-	lua_pushstring(L, "bozohttpd");
-	lua_gettable(L, LUA_REGISTRYINDEX);
-	httpd = lua_touserdata(L, -1);
-	lua_pop(L, 2);
+	lua_pop(L, 1);
+
+	name = luaL_checkstring(L, 1);
 
-	luaL_checkstring(L, 1);
 	luaL_checktype(L, 2, LUA_TFUNCTION);
+	lua_pushvalue(L, 2);
+	ref = luaL_ref(L, LUA_REGISTRYINDEX);
 
 	handler = bozomalloc(httpd, sizeof(lua_handler_t));
-
-	handler->name = bozostrdup(httpd, NULL, lua_tostring(L, 1));
-	handler->ref = luaL_ref(L, LUA_REGISTRYINDEX);
+	handler->name = bozostrdup(httpd, NULL, name);
+	handler->ref = ref;
 	SIMPLEQ_INSERT_TAIL(>handlers, handler, h_next);
 	httpd->process_lua = 1;
 	return 0;
@@ -133,23 +135,26 @@ lua_register_handler(lua_State *L)
 static int
 lua_write(lua_State *L)
 {
-	bozohttpd_t *httpd;
+	bozohttpd_t *httpd = httpd_instance(L);
 	const char *data;
+	size_t len;
+	ssize_t n;
 
-	lua_pushstring(L, "bozohttpd");
-	lua_gettable(L, LUA_REGISTRYINDEX);
-	httpd = lua_touserdata(L, -1);
-	lua_pop(L, 1);
-
-	data = luaL_checkstring(L, -1);
-	lua_pushinteger(L, bozo_write(httpd, STDIN_FILENO, data, strlen(data)));
-	return 1;
+	data = luaL_checklstring(L, 1, );
+	if ((n = bozo_write(httpd, STDIN_FILENO, data, len)) >= 0) {
+		lua_pushinteger(L, n);
+		return 1;
+	} else {
+		lua_pushnil(L);
+		lua_pushstring(L, "bozo_write() call failed");
+		return 2;
+	}
 }
 
 static int
 luaopen_httpd(lua_State *L)
 {
-	struct luaL_Reg functions[] = {
+	static struct luaL_Reg functions[] = {
 		{ "flush",		lua_flush },
 		{ "print",		lua_print },
 		{ "read",		lua_read },



CVS commit: src/sys/dev

2017-05-28 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun May 28 21:36:18 UTC 2017

Modified Files:
src/sys/dev: audio.c

Log Message:
Now that the scope of setting the gain is limited, the hack for /dev/sound
no longer applies.


To generate a diff of this commit:
cvs rdiff -u -r1.354 -r1.355 src/sys/dev/audio.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/audio.c
diff -u src/sys/dev/audio.c:1.354 src/sys/dev/audio.c:1.355
--- src/sys/dev/audio.c:1.354	Sun May 28 21:12:59 2017
+++ src/sys/dev/audio.c	Sun May 28 21:36:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.354 2017/05/28 21:12:59 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.355 2017/05/28 21:36:18 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.354 2017/05/28 21:12:59 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.355 2017/05/28 21:36:18 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -2113,7 +2113,6 @@ audio_open(dev_t dev, struct audio_softc
 	const struct audio_hw_if *hw;
 	struct virtual_channel *vc;
 	struct audio_chan *chan;
-	struct audio_info info;
 
 	KASSERT(mutex_owned(sc->sc_lock));
 
@@ -2240,9 +2239,6 @@ audio_open(dev_t dev, struct audio_softc
 	 */
 	error = audio_set_defaults(sc, mode, vc);
 	if (!error && ISDEVSOUND(dev) && sc->sc_aivalid == true) {
-		error = audiogetinfo(sc, , 0, vc);
-		sc->sc_ai.play.gain = info.play.gain;
-		sc->sc_ai.record.gain = info.record.gain;
 		sc->sc_ai.mode = mode;
 		error = audiosetinfo(sc, >sc_ai, true, vc);
 	}



CVS commit: src/sys/dev

2017-05-28 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun May 28 21:15:58 UTC 2017

Modified Files:
src/sys/dev: audiobell.c

Log Message:
Set the gain of play back, rather than altering the generated wave by a
factor of volume.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/audiobell.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/audiobell.c
diff -u src/sys/dev/audiobell.c:1.18 src/sys/dev/audiobell.c:1.19
--- src/sys/dev/audiobell.c:1.18	Sat May 27 12:04:44 2017
+++ src/sys/dev/audiobell.c	Sun May 28 21:15:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiobell.c,v 1.18 2017/05/27 12:04:44 nat Exp $	*/
+/*	$NetBSD: audiobell.c,v 1.19 2017/05/28 21:15:58 nat Exp $	*/
 
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.18 2017/05/27 12:04:44 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.19 2017/05/28 21:15:58 nat Exp $");
 
 #include 
 #include 
@@ -57,13 +57,12 @@ __KERNEL_RCSID(0, "$NetBSD: audiobell.c,
 #define BELL_SHIFT		19
 
 static inline void
-audiobell_expandwave(int16_t *buf, int volume)
+audiobell_expandwave(int16_t *buf)
 {
 	u_int i;
 
-	KASSERT(volume >= 0 && volume <= 100);
 	for (i = 0; i < __arraycount(sinewave); i++)
-		buf[i] = (int32_t)sinewave[i] * (int32_t)volume / 100;
+		buf[i] = sinewave[i];
 	for (i = __arraycount(sinewave); i < __arraycount(sinewave) * 2; i++)
 		 buf[i] = buf[__arraycount(sinewave) * 2 - i - 1];
 	for (i = __arraycount(sinewave) * 2; i < __arraycount(sinewave) * 4; i++)
@@ -82,7 +81,7 @@ audiobell_synthesize(int16_t *buf, u_int
 
 	wave = malloc(sizeof(sinewave) * 4, M_TEMP, M_WAITOK);
 	if (wave == NULL) return -1;
-	audiobell_expandwave(wave, volume);
+	audiobell_expandwave(wave);
 	pitch = pitch * ((sizeof(sinewave) * 4) << BELL_SHIFT) /
 	BELL_SAMPLE_RATE / 2;
 	period = period * BELL_SAMPLE_RATE / 1000 / 2;
@@ -107,6 +106,8 @@ audiobell(void *v, u_int pitch, u_int pe
 	struct file *fp;
 	int size, len;
 
+	KASSERT(volume <= 100);
+
 	fp = NULL;
 	dev_t audio = AUDIO_DEVICE | device_unit((device_t)v);
 
@@ -124,6 +125,7 @@ audiobell(void *v, u_int pitch, u_int pe
 
 	ai.play.sample_rate = BELL_SAMPLE_RATE;
 	ai.play.precision = 16;
+	ai.play.gain = 255 * 100 / volume;
 
 #if BYTE_ORDER == LITTLE_ENDIAN
 	ai.play.encoding = AUDIO_ENCODING_SLINEAR_LE;



CVS commit: src/sys/dev

2017-05-28 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun May 28 21:12:59 UTC 2017

Modified Files:
src/sys/dev: audio.c

Log Message:
The scope of setting the gain for playback or recording is now limited to
operating on the volume of its virtual channel.


To generate a diff of this commit:
cvs rdiff -u -r1.353 -r1.354 src/sys/dev/audio.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/audio.c
diff -u src/sys/dev/audio.c:1.353 src/sys/dev/audio.c:1.354
--- src/sys/dev/audio.c:1.353	Sat May 27 13:55:58 2017
+++ src/sys/dev/audio.c	Sun May 28 21:12:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.353 2017/05/27 13:55:58 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.354 2017/05/28 21:12:59 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.353 2017/05/27 13:55:58 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.354 2017/05/28 21:12:59 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -4734,18 +4734,11 @@ audiosetinfo(struct audio_softc *sc, str
 		if (error)
 			goto cleanup;
 	}
-	if (SPECIFIED(p->gain)) {
-		au_get_gain(sc, >sc_outports, , );
-		error = au_set_gain(sc, >sc_outports, p->gain, balance);
-		if (error)
-			goto cleanup;
-	}
-	if (SPECIFIED(r->gain)) {
-		au_get_gain(sc, >sc_inports, , );
-		error = au_set_gain(sc, >sc_inports, r->gain, balance);
-		if (error)
-			goto cleanup;
-	}
+	if (SPECIFIED(p->gain))
+		vc->sc_swvol = p->gain;
+
+	if (SPECIFIED(r->gain))
+		vc->sc_recswvol = r->gain;
 
 	if (SPECIFIED_CH(p->balance)) {
 		au_get_gain(sc, >sc_outports, , );



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

2017-05-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 28 18:39:58 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: CUBIETRUCK

Log Message:
Revert previous, the needed signals are not easily accessible on
CUBIETRUCK


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbarm/conf/CUBIETRUCK

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

Modified files:

Index: src/sys/arch/evbarm/conf/CUBIETRUCK
diff -u src/sys/arch/evbarm/conf/CUBIETRUCK:1.10 src/sys/arch/evbarm/conf/CUBIETRUCK:1.11
--- src/sys/arch/evbarm/conf/CUBIETRUCK:1.10	Sun May 28 11:15:59 2017
+++ src/sys/arch/evbarm/conf/CUBIETRUCK	Sun May 28 18:39:58 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: CUBIETRUCK,v 1.10 2017/05/28 11:15:59 martin Exp $
+#	$NetBSD: CUBIETRUCK,v 1.11 2017/05/28 18:39:58 martin Exp $
 #
 #	CUBIETRUCK - Cubieboard3 (mostly cubieboard2 with 2GB)
 #
@@ -37,9 +37,3 @@ awintve0 	at awinio0
 cinclude	"arch/evbarm/conf/CUBIETRUCK.local"
 
 #options 	VERBOSE_INIT_ARM # verbose bootstraping messages
-
-# CAN bus support
-#options 	CAN		# Controller Area Network protocol
-#pseudo-device	canloop		# CAN loopback interface
-#awincan0	at awinio0 port ? flags 1
-



CVS commit: src/share/man/man4

2017-05-28 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun May 28 18:23:22 UTC 2017

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

Log Message:
New sentence, new line. Punctuation fixes.
Get rid of unnecessary \*[Lt], \*[Gt].


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/share/man/man4/speaker.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/speaker.4
diff -u src/share/man/man4/speaker.4:1.20 src/share/man/man4/speaker.4:1.21
--- src/share/man/man4/speaker.4:1.20	Sat May 27 12:15:34 2017
+++ src/share/man/man4/speaker.4	Sun May 28 18:23:22 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: speaker.4,v 1.20 2017/05/27 12:15:34 nat Exp $
+.\" $NetBSD: speaker.4,v 1.21 2017/05/28 18:23:22 wiz Exp $
 .\"
 .\" Copyright (c) 2016 Nathanial Sloss 
 .\" All rights reserved.
@@ -55,12 +55,19 @@ The speaker device driver allows applica
 speaker on machines with a PC-like 8253 timer implementation or a synthesized
 speaker from an audio device/soundcard.
 .Pp
-Only one process may have this device open at any given time; open() and
-close() are used to lock and relinquish it. An attempt to open() when
-another process has the device locked will return -1 with an
+Only one process may have this device open at any given time;
+.Xr open 2
+and
+.Xr close 2
+are used to lock and relinquish it.
+An attempt to
+.Xr open 2
+when another process has the device locked will return \-1 with an
 .Er EBUSY
-error indication. Writes to the device are interpreted as 'play strings' in a
-simple ASCII melody notation. An
+error indication.
+Writes to the device are interpreted as 'play strings' in a
+simple ASCII melody notation.
+An
 .Fn ioctl
 for tone generation at arbitrary frequencies is also supported.
 .Pp
@@ -68,7 +75,8 @@ For the pcppi device sound-generation do
 .Em not
 monopolize the processor; in fact, the driver
 spends most of its time sleeping while the PC hardware is emitting
-tones. Other processes may emit beeps while the driver is running.
+tones.
+Other processes may emit beeps while the driver is running.
 .Pp
 For the audio device speaker, the speaker uses one of the virtual audio
 channels.
@@ -88,55 +96,70 @@ The tone_t structure used in these calls
 specifying a frequency (in hz) and a duration (in 1/100ths of a second).
 A frequency of zero is interpreted as a rest.
 .Pp
-At present there are two such ioctls. SPKRTONE accepts a pointer to a
-single tone structure as third argument and plays it. SPKRTUNE accepts a
+At present there are two such ioctls.
+SPKRTONE accepts a pointer to a
+single tone structure as third argument and plays it.
+SPKRTUNE accepts a
 pointer to the first of an array of tone structures and plays them in
 continuous sequence; this array must be terminated by a final member with
 a zero duration.
 .Pp
 The play-string language is modelled on the PLAY statement conventions of
-IBM BASIC 2.0. The MB, MF and X primitives of PLAY are not useful in a UNIX
-environment and are omitted. The `octave-tracking' feature is also new.
+IBM BASIC 2.0.
+The MB, MF and X primitives of PLAY are not useful in a UNIX
+environment and are omitted.
+The `octave-tracking' feature is also new.
 .Pp
 There are 84 accessible notes numbered 1-83 in 7 octaves, each running from
 C to B, numbered 0-6; the scale is equal-tempered A440 and octave 3 starts
-with middle C. By default, the play function emits half-second notes with the
+with middle C.
+By default, the play function emits half-second notes with the
 last 1/16th second being `rest time'.
 .Pp
 Play strings are interpreted left to right as a series of play command groups;
-letter case is ignored. Play command groups are as follows:
+letter case is ignored.
+Play command groups are as follows:
 .Pp
 CDEFGAB -- letters A through G cause the corresponding note to be played in the
-current octave. A note letter may optionally be followed by an
+current octave.
+A note letter may optionally be followed by an
 .Em accidental sign ,
 one of # + or -; the first two of these cause it to be sharped one
-half-tone, the last causes it to be flatted one half-tone. It may also be
-followed by a time value number and by sustain dots (see below). Time values
+half-tone, the last causes it to be flatted one half-tone.
+It may also be
+followed by a time value number and by sustain dots (see below).
+Time values
 are interpreted as for the L command below;.
 .Pp
-O \*[Lt]n\*[Gt] -- if \*[Lt]n\*[Gt] is numeric, this sets the current octave. \*[Lt]n\*[Gt] may also be one
+O  -- if  is numeric, this sets the current octave.
+ may also be one
 of 'L' or 'N' to enable or disable octave-tracking (it is disabled by default).
 When octave-tracking is on, interpretation of a pair of letter notes will
 change octaves if necessary in order to make the smallest possible jump between
-notes. Thus "olbc" will be played as 

CVS commit: src

2017-05-28 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun May 28 16:39:42 UTC 2017

Modified Files:
src/share/man/man9: vnode.9
src/sys/kern: vfs_vnode.c
src/sys/sys: param.h

Log Message:
Restrict vgone() to suspended file systems only.

Welcome to 7.99.75, old file system modules would cause a diagnostic
assertion with new kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/share/man/man9/vnode.9
cvs rdiff -u -r1.92 -r1.93 src/sys/kern/vfs_vnode.c
cvs rdiff -u -r1.541 -r1.542 src/sys/sys/param.h

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/vnode.9
diff -u src/share/man/man9/vnode.9:1.79 src/share/man/man9/vnode.9:1.80
--- src/share/man/man9/vnode.9:1.79	Mon Jan 23 11:49:03 2017
+++ src/share/man/man9/vnode.9	Sun May 28 16:39:41 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: vnode.9,v 1.79 2017/01/23 11:49:03 abhinav Exp $
+.\" $NetBSD: vnode.9,v 1.80 2017/05/28 16:39:41 hannken Exp $
 .\"
 .\" Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -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 January 11, 2017
+.Dd May 28, 2017
 .Dt VNODE 9
 .Os
 .Sh NAME
@@ -617,6 +617,9 @@ is a null operation if the reference cou
 Eliminate all activity associated with the unlocked vnode
 .Fa vp
 in preparation for recycling.
+This operation is restricted to suspended file systems.
+See
+.Xr vfs_suspend 9 .
 .It Fn vgonel "vp" "p"
 Eliminate all activity associated with the locked vnode
 .Fa vp

Index: src/sys/kern/vfs_vnode.c
diff -u src/sys/kern/vfs_vnode.c:1.92 src/sys/kern/vfs_vnode.c:1.93
--- src/sys/kern/vfs_vnode.c:1.92	Sun May 28 16:35:47 2017
+++ src/sys/kern/vfs_vnode.c	Sun May 28 16:39:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnode.c,v 1.92 2017/05/28 16:35:47 hannken Exp $	*/
+/*	$NetBSD: vfs_vnode.c,v 1.93 2017/05/28 16:39:41 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -156,7 +156,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.92 2017/05/28 16:35:47 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.93 2017/05/28 16:39:41 hannken Exp $");
 
 #include 
 #include 
@@ -1018,6 +1018,9 @@ void
 vgone(vnode_t *vp)
 {
 
+	KASSERT((vp->v_mount->mnt_iflag & IMNT_HAS_TRANS) == 0 ||
+	fstrans_is_owner(vp->v_mount));
+
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	mutex_enter(vp->v_interlock);
 	VSTATE_WAIT_STABLE(vp);

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.541 src/sys/sys/param.h:1.542
--- src/sys/sys/param.h:1.541	Fri May 26 14:22:53 2017
+++ src/sys/sys/param.h	Sun May 28 16:39:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.541 2017/05/26 14:22:53 riastradh Exp $	*/
+/*	$NetBSD: param.h,v 1.542 2017/05/28 16:39:42 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	799007400	/* NetBSD 7.99.74 */
+#define	__NetBSD_Version__	799007500	/* NetBSD 7.99.75 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/ufs/ext2fs

2017-05-28 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun May 28 16:38:55 UTC 2017

Modified Files:
src/sys/ufs/ext2fs: ext2fs_alloc.c ext2fs_extern.h ext2fs_vfsops.c
ext2fs_vnops.c

Log Message:
Change ext2fs to use vcache_new like we did for ffs:
- Change ext2fs_valloc to return an inode number.
- Make ext2fs_makeinode private to ext2fs_vnops.c and
  pass vattr instead of mode.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/ufs/ext2fs/ext2fs_alloc.c
cvs rdiff -u -r1.55 -r1.56 src/sys/ufs/ext2fs/ext2fs_extern.h
cvs rdiff -u -r1.208 -r1.209 src/sys/ufs/ext2fs/ext2fs_vfsops.c
cvs rdiff -u -r1.127 -r1.128 src/sys/ufs/ext2fs/ext2fs_vnops.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/ext2fs/ext2fs_alloc.c
diff -u src/sys/ufs/ext2fs/ext2fs_alloc.c:1.51 src/sys/ufs/ext2fs/ext2fs_alloc.c:1.52
--- src/sys/ufs/ext2fs/ext2fs_alloc.c:1.51	Sat Aug 20 19:53:43 2016
+++ src/sys/ufs/ext2fs/ext2fs_alloc.c	Sun May 28 16:38:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext2fs_alloc.c,v 1.51 2016/08/20 19:53:43 jdolecek Exp $	*/
+/*	$NetBSD: ext2fs_alloc.c,v 1.52 2017/05/28 16:38:55 hannken Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_alloc.c,v 1.51 2016/08/20 19:53:43 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_alloc.c,v 1.52 2017/05/28 16:38:55 hannken Exp $");
 
 #include 
 #include 
@@ -167,16 +167,13 @@ nospace:
  *	  available inode is located.
  */
 int
-ext2fs_valloc(struct vnode *pvp, int mode, kauth_cred_t cred,
-struct vnode **vpp)
+ext2fs_valloc(struct vnode *pvp, int mode, kauth_cred_t cred, ino_t *inop)
 {
 	struct inode *pip;
 	struct m_ext2fs *fs;
-	struct inode *ip;
 	ino_t ino, ipref;
-	int cg, error;
+	int cg;
 
-	*vpp = NULL;
 	pip = VTOI(pvp);
 	fs = pip->i_e2fs;
 	if (fs->e2fs.e2fs_ficount == 0)
@@ -190,32 +187,10 @@ ext2fs_valloc(struct vnode *pvp, int mod
 	ino = (ino_t)ext2fs_hashalloc(pip, cg, (long)ipref, mode, ext2fs_nodealloccg);
 	if (ino == 0)
 		goto noinodes;
-	error = VFS_VGET(pvp->v_mount, ino, vpp);
-	if (error) {
-		ext2fs_vfree(pvp, ino, mode);
-		return error;
-	}
-	ip = VTOI(*vpp);
-
-	KASSERT(!E2FS_HAS_GD_CSUM(fs) || (fs->e2fs_gd[ino_to_cg(fs, ino)].ext2bgd_flags & h2fs16(E2FS_BG_INODE_ZEROED)) != 0);
-
-	/* check for already used inode; makes sense only for ZEROED itable */
-	if (__predict_false(ip->i_e2fs_mode && ip->i_e2fs_nlink != 0)) {
-		printf("mode = 0%o, nlinks %d, inum = %llu, fs = %s\n",
-		ip->i_e2fs_mode, ip->i_e2fs_nlink,
-		(unsigned long long)ip->i_number, fs->e2fs_fsmnt);
-		panic("ext2fs_valloc: dup alloc");
-	}
-
-	memset(ip->i_din.e2fs_din, 0, EXT2_DINODE_SIZE(fs));
 
-	/*
-	 * Set up a new generation number for this inode.
-	 */
-	if (++ext2gennumber < time_second)
-		ext2gennumber = time_second;
-	ip->i_e2fs_gen = ext2gennumber;
+	*inop = ino;
 	return 0;
+
 noinodes:
 	ext2fs_fserr(fs, kauth_cred_geteuid(cred), "out of inodes");
 	uprintf("\n%s: create/symlink failed, no inodes free\n", fs->e2fs_fsmnt);

Index: src/sys/ufs/ext2fs/ext2fs_extern.h
diff -u src/sys/ufs/ext2fs/ext2fs_extern.h:1.55 src/sys/ufs/ext2fs/ext2fs_extern.h:1.56
--- src/sys/ufs/ext2fs/ext2fs_extern.h:1.55	Sat Aug 20 19:47:44 2016
+++ src/sys/ufs/ext2fs/ext2fs_extern.h	Sun May 28 16:38:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext2fs_extern.h,v 1.55 2016/08/20 19:47:44 jdolecek Exp $	*/
+/*	$NetBSD: ext2fs_extern.h,v 1.56 2017/05/28 16:38:55 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -95,7 +95,7 @@ int ext2fs_alloc(struct inode *, daddr_t
 		   daddr_t *);
 int ext2fs_realloccg(struct inode *, daddr_t, daddr_t, int, int ,
 			  kauth_cred_t, struct buf **);
-int ext2fs_valloc(struct vnode *, int, kauth_cred_t, struct vnode **);
+int ext2fs_valloc(struct vnode *, int, kauth_cred_t, ino_t *);
 /* XXX ondisk32 */
 daddr_t ext2fs_blkpref(struct inode *, daddr_t, int, int32_t *);
 void ext2fs_blkfree(struct inode *, daddr_t);
@@ -176,8 +176,6 @@ int ext2fs_advlock(void *);
 int ext2fs_fsync(void *);
 int ext2fs_vinit(struct mount *, int (**specops)(void *),
 		  int (**fifoops)(void *), struct vnode **);
-int ext2fs_makeinode(int, struct vnode *, struct vnode **,
-			  struct componentname *cnp, int);
 int ext2fs_reclaim(void *);
 
 /* ext2fs_hash.c */

Index: src/sys/ufs/ext2fs/ext2fs_vfsops.c
diff -u src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.208 src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.209
--- src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.208	Mon Apr 17 08:32:01 2017
+++ src/sys/ufs/ext2fs/ext2fs_vfsops.c	Sun May 28 16:38:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext2fs_vfsops.c,v 1.208 2017/04/17 08:32:01 hannken Exp $	*/
+/*	$NetBSD: ext2fs_vfsops.c,v 1.209 2017/05/28 16:38:55 hannken Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1994
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.208 2017/04/17 08:32:01 

CVS commit: src/sys/ufs/ffs

2017-05-28 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun May 28 16:37:55 UTC 2017

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

Log Message:
No need to call vgone() on the just created in file system log vnode,
vput() is sufficient.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/ufs/ffs/ffs_wapbl.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_wapbl.c
diff -u src/sys/ufs/ffs/ffs_wapbl.c:1.40 src/sys/ufs/ffs/ffs_wapbl.c:1.41
--- src/sys/ufs/ffs/ffs_wapbl.c:1.40	Wed Mar 22 21:30:59 2017
+++ src/sys/ufs/ffs/ffs_wapbl.c	Sun May 28 16:37:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_wapbl.c,v 1.40 2017/03/22 21:30:59 jdolecek Exp $	*/
+/*	$NetBSD: ffs_wapbl.c,v 1.41 2017/05/28 16:37:55 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.40 2017/03/22 21:30:59 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.41 2017/05/28 16:37:55 hannken Exp $");
 
 #define WAPBL_INTERNAL
 
@@ -686,8 +686,7 @@ wapbl_create_infs_log(struct mount *mp, 
 		 */
 		ip->i_nlink = 0;
 		DIP_ASSIGN(ip, nlink, 0);
-		VOP_UNLOCK(vp);
-		vgone(vp);
+		vput(vp);
 
 		return error;
 	}
@@ -696,8 +695,7 @@ wapbl_create_infs_log(struct mount *mp, 
 	 * Now that we have the place-holder inode for the journal,
 	 * we don't need the vnode ever again.
 	 */
-	VOP_UNLOCK(vp);
-	vgone(vp);
+	vput(vp);
 
 	return 0;
 }



CVS commit: src/sys/rump/librump/rumpvfs

2017-05-28 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun May 28 16:37:16 UTC 2017

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
Suspend file system for vgone().


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/rump/librump/rumpvfs/rumpfs.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/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.149 src/sys/rump/librump/rumpvfs/rumpfs.c:1.150
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.149	Fri May 26 14:21:00 2017
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Sun May 28 16:37:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.149 2017/05/26 14:21:00 riastradh Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.150 2017/05/28 16:37:16 hannken Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.149 2017/05/26 14:21:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.150 2017/05/28 16:37:16 hannken Exp $");
 
 #include 
 #include 
@@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -491,8 +492,12 @@ etfsremove(const char *key)
 			mp = NULL;
 		}
 		mutex_exit();
-		if (mp && vcache_get(mp, , sizeof(rn), ) == 0)
+		if (mp && vcache_get(mp, , sizeof(rn), ) == 0) {
+			rv = vfs_suspend(mp, 0);
+			KASSERT(rv == 0);
 			vgone(vp);
+			vfs_resume(mp);
+		}
 	}
 
 	if (et->et_rn->rn_hostpath != NULL)



CVS commit: src/sys/fs/smbfs

2017-05-28 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun May 28 16:36:37 UTC 2017

Modified Files:
src/sys/fs/smbfs: smbfs_node.c smbfs_node.h smbfs_vnops.c

Log Message:
When a vnode has an invalid type because the type changed on the
server replace vgone() with new operation smbfs_uncache() that
removes the vnode from the name cache and changes the vcache key
to an unique and illegal key to prevent further lookups.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/fs/smbfs/smbfs_node.c
cvs rdiff -u -r1.15 -r1.16 src/sys/fs/smbfs/smbfs_node.h
cvs rdiff -u -r1.94 -r1.95 src/sys/fs/smbfs/smbfs_vnops.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/fs/smbfs/smbfs_node.c
diff -u src/sys/fs/smbfs/smbfs_node.c:1.57 src/sys/fs/smbfs/smbfs_node.c:1.58
--- src/sys/fs/smbfs/smbfs_node.c:1.57	Fri May 26 14:34:20 2017
+++ src/sys/fs/smbfs/smbfs_node.c	Sun May 28 16:36:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: smbfs_node.c,v 1.57 2017/05/26 14:34:20 riastradh Exp $	*/
+/*	$NetBSD: smbfs_node.c,v 1.58 2017/05/28 16:36:37 hannken Exp $	*/
 
 /*
  * Copyright (c) 2000-2001 Boris Popov
@@ -35,10 +35,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.57 2017/05/26 14:34:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.58 2017/05/28 16:36:37 hannken Exp $");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -191,7 +192,8 @@ retry:
 		if ((vp->v_type == VDIR && (np->n_dosattr & SMB_FA_DIR) == 0) ||
 		(vp->v_type == VREG && (np->n_dosattr & SMB_FA_DIR) != 0)) {
 			mutex_exit(>n_lock);
-			vgone(vp);
+			vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+			smbfs_uncache(vp);
 			goto retry;
  		}
 	}
@@ -207,6 +209,54 @@ out:
 }
 
 /*
+ * Remove vnode that changed its type on the server from
+ * the vnode cache and the name cache.
+ */
+void
+smbfs_uncache(struct vnode *vp)
+{
+	static uint32_t gen = 0;
+	int error __diagused;
+	char newname[10];
+	struct mount *mp = vp->v_mount;
+	struct smbnode *np = VTOSMB(vp);
+	struct smbkey *key = np->n_key, *oldkey, *newkey;
+	int key_len = SMBFS_KEYSIZE(key->k_nmlen), newkey_len;
+
+	/* Setup old key as current key. */
+	oldkey = kmem_alloc(key_len, KM_SLEEP);
+	memcpy(oldkey, key, key_len);
+
+	/* Setup new key as unique and illegal name with colon. */
+	snprintf(newname, sizeof(newname), ":%08x", atomic_inc_uint_nv());
+	newkey = kmem_alloc(SMBFS_KEYSIZE(strlen(newname)), KM_SLEEP);
+	newkey->k_parent = NULL;
+	newkey->k_nmlen = strlen(newname);
+	memcpy(newkey->k_name, newname, newkey->k_nmlen);
+	newkey_len = SMBFS_KEYSIZE(newkey->k_nmlen);
+
+	/* Release parent and mark as gone. */
+	if (np->n_parent && (np->n_flag & NREFPARENT)) {
+		vrele(np->n_parent);
+		np->n_flag &= ~NREFPARENT;
+	}
+	np->n_flag |= NGONE;
+
+	/* Rekey the node. */
+	error = vcache_rekey_enter(mp, vp, oldkey, key_len, newkey, newkey_len);
+	KASSERT(error == 0);
+	np->n_key = newkey;
+	vcache_rekey_exit(mp, vp, oldkey, key_len, newkey, newkey_len);
+
+	/* Purge from name cache and cleanup. */
+	cache_purge(vp);
+	kmem_free(key, key_len);
+	kmem_free(oldkey, key_len);
+
+	vput(vp);
+}
+
+/*
  * Free smbnode, and give vnode back to system
  */
 int

Index: src/sys/fs/smbfs/smbfs_node.h
diff -u src/sys/fs/smbfs/smbfs_node.h:1.15 src/sys/fs/smbfs/smbfs_node.h:1.16
--- src/sys/fs/smbfs/smbfs_node.h:1.15	Fri Jan  2 09:48:01 2015
+++ src/sys/fs/smbfs/smbfs_node.h	Sun May 28 16:36:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: smbfs_node.h,v 1.15 2015/01/02 09:48:01 martin Exp $	*/
+/*	$NetBSD: smbfs_node.h,v 1.16 2017/05/28 16:36:37 hannken Exp $	*/
 
 /*
  * Copyright (c) 2000-2001, Boris Popov
@@ -97,6 +97,7 @@ int smbfs_loadvnode(struct mount *, stru
 const void *, size_t, const void **);
 int smbfs_nget(struct mount *, struct vnode *, const char *, int,
 struct smbfattr *, struct vnode **);
+void smbfs_uncache(struct vnode *);
 
 int  smbfs_readvnode(struct vnode *, struct uio *, kauth_cred_t);
 int  smbfs_writevnode(struct vnode *, struct uio *, kauth_cred_t, int);

Index: src/sys/fs/smbfs/smbfs_vnops.c
diff -u src/sys/fs/smbfs/smbfs_vnops.c:1.94 src/sys/fs/smbfs/smbfs_vnops.c:1.95
--- src/sys/fs/smbfs/smbfs_vnops.c:1.94	Wed Apr 26 03:02:48 2017
+++ src/sys/fs/smbfs/smbfs_vnops.c	Sun May 28 16:36:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: smbfs_vnops.c,v 1.94 2017/04/26 03:02:48 riastradh Exp $	*/
+/*	$NetBSD: smbfs_vnops.c,v 1.95 2017/05/28 16:36:37 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: smbfs_vnops.c,v 1.94 2017/04/26 03:02:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbfs_vnops.c,v 1.95 2017/05/28 16:36:37 hannken Exp $");
 
 #include 
 #include 
@@ -1269,8 +1269,7 @@ smbfs_lookup(void *v)
 		cache_purge(newvp);
 		if (newvp != dvp) {
 			if (killit) {
-VOP_UNLOCK(newvp);
-vgone(newvp);
+smbfs_uncache(newvp);
 			} 

CVS commit: src/sys/kern

2017-05-28 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun May 28 16:35:47 UTC 2017

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

Log Message:
Add a helper to propagate file system suspension for vrevoke().

Take care to retry suspension on interrupt as vrevoke must succeed.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/kern/vfs_vnode.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_vnode.c
diff -u src/sys/kern/vfs_vnode.c:1.91 src/sys/kern/vfs_vnode.c:1.92
--- src/sys/kern/vfs_vnode.c:1.91	Fri May 26 14:40:09 2017
+++ src/sys/kern/vfs_vnode.c	Sun May 28 16:35:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnode.c,v 1.91 2017/05/26 14:40:09 riastradh Exp $	*/
+/*	$NetBSD: vfs_vnode.c,v 1.92 2017/05/28 16:35:47 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -156,7 +156,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.91 2017/05/26 14:40:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.92 2017/05/28 16:35:47 hannken Exp $");
 
 #include 
 #include 
@@ -944,13 +944,42 @@ vrecycle(vnode_t *vp)
 }
 
 /*
+ * Helper for vrevoke() to propagate suspension from lastmp
+ * to thismp.  Both args may be NULL.
+ * Returns the currently suspended file system or NULL.
+ */
+static struct mount *
+vrevoke_suspend_next(struct mount *lastmp, struct mount *thismp)
+{
+	int error;
+
+	if (lastmp == thismp)
+		return thismp;
+
+	if (lastmp != NULL)
+		vfs_resume(lastmp);
+
+	if (thismp == NULL)
+		return NULL;
+
+	do {
+		error = vfs_suspend(thismp, 0);
+	} while (error == EINTR || error == ERESTART);
+
+	if (error == 0)
+		return thismp;
+
+	KASSERT(error == EOPNOTSUPP);
+	return NULL;
+}
+
+/*
  * Eliminate all activity associated with the requested vnode
  * and with all vnodes aliased to the requested vnode.
  */
 void
 vrevoke(vnode_t *vp)
 {
-	int error;
 	struct mount *mp;
 	vnode_t *vq;
 	enum vtype type;
@@ -958,11 +987,7 @@ vrevoke(vnode_t *vp)
 
 	KASSERT(vp->v_usecount > 0);
 
-	mp = vp->v_mount;
-	error = vfs_suspend(mp, 0);
-	KASSERT(error == 0 || error == EOPNOTSUPP);
-	if (error)
-		mp = NULL;
+	mp = vrevoke_suspend_next(NULL, vp->v_mount);
 
 	mutex_enter(vp->v_interlock);
 	VSTATE_WAIT_STABLE(vp);
@@ -978,20 +1003,11 @@ vrevoke(vnode_t *vp)
 		mutex_exit(vp->v_interlock);
 
 		while (spec_node_lookup_by_dev(type, dev, ) == 0) {
-			if (mp != vq->v_mount) {
-if (mp)
-	vfs_resume(mp);
-mp = vp->v_mount;
-error = vfs_suspend(mp, 0);
-KASSERT(error == 0 || error == EOPNOTSUPP);
-if (error)
-	mp = NULL;
-			}
+			mp = vrevoke_suspend_next(mp, vq->v_mount);
 			vgone(vq);
 		}
 	}
-	if (mp)
-		vfs_resume(mp);
+	vrevoke_suspend_next(mp, NULL);
 }
 
 /*



CVS commit: src/sys

2017-05-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun May 28 15:55:11 UTC 2017

Modified Files:
src/sys/arch/evbarm/tegra: tegra_machdep.c
src/sys/dev/fdt: fdtvar.h files.fdt
src/sys/dev/i2c: as3722.c
Added Files:
src/sys/dev/fdt: fdt_power.c

Log Message:
Add facility for fdt devices to register reset and poweroff handlers.
Use this to remove as3722-specific code in tegra_machdep.c


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/evbarm/tegra/tegra_machdep.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/fdt_power.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/fdt/fdtvar.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/fdt/files.fdt
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/i2c/as3722.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/evbarm/tegra/tegra_machdep.c
diff -u src/sys/arch/evbarm/tegra/tegra_machdep.c:1.44 src/sys/arch/evbarm/tegra/tegra_machdep.c:1.45
--- src/sys/arch/evbarm/tegra/tegra_machdep.c:1.44	Sun May 28 00:40:21 2017
+++ src/sys/arch/evbarm/tegra/tegra_machdep.c	Sun May 28 15:55:11 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_machdep.c,v 1.44 2017/05/28 00:40:21 jmcneill Exp $ */
+/* $NetBSD: tegra_machdep.c,v 1.45 2017/05/28 15:55:11 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.44 2017/05/28 00:40:21 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.45 2017/05/28 15:55:11 jmcneill Exp $");
 
 #include "opt_tegra.h"
 #include "opt_machdep.h"
@@ -40,7 +40,6 @@ __KERNEL_RCSID(0, "$NetBSD: tegra_machde
 #include "ukbd.h"
 #include "genfb.h"
 #include "ether.h"
-#include "as3722pmic.h"
 
 #include 
 #include 
@@ -89,10 +88,6 @@ __KERNEL_RCSID(0, "$NetBSD: tegra_machde
 #include 
 #include 
 
-#if NAS3722PMIC > 0
-#include 
-#endif
-
 #ifndef TEGRA_MAX_BOOT_STRING
 #define TEGRA_MAX_BOOT_STRING 1024
 #endif
@@ -503,30 +498,12 @@ tegra_device_register(device_t self, voi
 static void
 tegra_reset(void)
 {
-#if NAS3722PMIC > 0
-	device_t pmic = device_find_by_driver_unit("as3722pmic", 0);
-	if (pmic != NULL) {
-		delay(100);
-		if (as3722_reboot(pmic) != 0) {
-			printf("WARNING: AS3722 reset failed\n");
-			return;
-		}
-	}
-#endif
+	fdtbus_power_reset();
 	tegra_pmc_reset();
 }
 
 static void
 tegra_powerdown(void)
 {
-#if NAS3722PMIC > 0
-	device_t pmic = device_find_by_driver_unit("as3722pmic", 0);
-	if (pmic != NULL) {
-		delay(100);
-		if (as3722_poweroff(pmic) != 0) {
-			printf("WARNING: AS3722 poweroff failed\n");
-			return;
-		}
-	}
-#endif
+	fdtbus_power_poweroff();
 }

Index: src/sys/dev/fdt/fdtvar.h
diff -u src/sys/dev/fdt/fdtvar.h:1.17 src/sys/dev/fdt/fdtvar.h:1.18
--- src/sys/dev/fdt/fdtvar.h:1.17	Fri May 26 18:56:27 2017
+++ src/sys/dev/fdt/fdtvar.h	Sun May 28 15:55:11 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.17 2017/05/26 18:56:27 jmcneill Exp $ */
+/* $NetBSD: fdtvar.h,v 1.18 2017/05/28 15:55:11 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -164,6 +164,13 @@ struct fdtbus_dma_controller_func {
 	void	(*halt)(device_t, void *);
 };
 
+struct fdtbus_power_controller;
+
+struct fdtbus_power_controller_func {
+	void 	(*reset)(device_t);
+	void	(*poweroff)(device_t);
+};
+
 int		fdtbus_register_interrupt_controller(device_t, int,
 		const struct fdtbus_interrupt_controller_func *);
 int		fdtbus_register_i2c_controller(device_t, int,
@@ -180,6 +187,8 @@ int		fdtbus_register_reset_controller(de
 		const struct fdtbus_reset_controller_func *);
 int		fdtbus_register_dma_controller(device_t, int,
 		const struct fdtbus_dma_controller_func *);
+int		fdtbus_register_power_controller(device_t, int,
+		const struct fdtbus_power_controller_func *);
 
 int		fdtbus_get_reg(int, u_int, bus_addr_t *, bus_size_t *);
 int		fdtbus_get_reg64(int, u_int, uint64_t *, uint64_t *);
@@ -226,6 +235,9 @@ int		fdtbus_reset_deassert(struct fdtbus
 
 int		fdtbus_todr_attach(device_t, int, todr_chip_handle_t);
 
+void		fdtbus_power_reset(void);
+void		fdtbus_power_poweroff(void);
+
 bool		fdtbus_set_data(const void *);
 const void *	fdtbus_get_data(void);
 int		fdtbus_phandle2offset(int);

Index: src/sys/dev/fdt/files.fdt
diff -u src/sys/dev/fdt/files.fdt:1.13 src/sys/dev/fdt/files.fdt:1.14
--- src/sys/dev/fdt/files.fdt:1.13	Sun May 28 00:38:40 2017
+++ src/sys/dev/fdt/files.fdt	Sun May 28 15:55:11 2017
@@ -1,4 +1,4 @@
-# $NetBSD: files.fdt,v 1.13 2017/05/28 00:38:40 jmcneill Exp $
+# $NetBSD: files.fdt,v 1.14 2017/05/28 15:55:11 jmcneill Exp $
 
 include	"external/bsd/libfdt/conf/files.libfdt"
 
@@ -29,6 +29,7 @@ file	dev/fdt/fdt_dma.c			fdtbus
 file	dev/fdt/fdt_gpio.c			fdtbus
 file	dev/fdt/fdt_i2c.c			fdtbus
 file	dev/fdt/fdt_intr.c			fdtbus
+file	dev/fdt/fdt_power.c			fdtbus
 file	dev/fdt/fdt_regulator.c			fdtbus
 file	dev/fdt/fdt_reset.c			

CVS commit: src/tests/net/can

2017-05-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 28 14:53:13 UTC 2017

Modified Files:
src/tests/net/can: t_can.c

Log Message:
undo previous; we don't have any archs where socklen_t != uint32_t.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/can/t_can.c

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

Modified files:

Index: src/tests/net/can/t_can.c
diff -u src/tests/net/can/t_can.c:1.4 src/tests/net/can/t_can.c:1.5
--- src/tests/net/can/t_can.c:1.4	Sun May 28 10:49:00 2017
+++ src/tests/net/can/t_can.c	Sun May 28 10:53:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_can.c,v 1.4 2017/05/28 14:49:00 christos Exp $	*/
+/*	$NetBSD: t_can.c,v 1.5 2017/05/28 14:53:13 christos Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: t_can.c,v 1.4 2017/05/28 14:49:00 christos Exp $");
+__RCSID("$NetBSD: t_can.c,v 1.5 2017/05/28 14:53:13 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -686,8 +686,8 @@ ATF_TC_BODY(cannoloop, tc)
 		ATF_CHECK_MSG(sa.can_family == AF_CAN,
 		"recvfrom provided wrong %d family", sa.can_family);
 		ATF_CHECK_MSG(salen == sizeof(sa),
-		"recvfrom provided wrong size %ju (!= %zu)",
-		(uintmax_t)salen, sizeof(sa));
+		"recvfrom provided wrong size %u (!= %zu)",
+		salen, sizeof(sa));
 		ATF_CHECK_MSG(sa.can_ifindex == ifindex,
 		   "recvfrom provided wrong ifindex %d (!= %d)",
 		sa.can_ifindex, ifindex);



CVS commit: src/tests/net/can

2017-05-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 28 14:49:00 UTC 2017

Modified Files:
src/tests/net/can: t_can.c

Log Message:
fix format.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/net/can/t_can.c

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

Modified files:

Index: src/tests/net/can/t_can.c
diff -u src/tests/net/can/t_can.c:1.3 src/tests/net/can/t_can.c:1.4
--- src/tests/net/can/t_can.c:1.3	Sun May 28 05:35:01 2017
+++ src/tests/net/can/t_can.c	Sun May 28 10:49:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_can.c,v 1.3 2017/05/28 09:35:01 martin Exp $	*/
+/*	$NetBSD: t_can.c,v 1.4 2017/05/28 14:49:00 christos Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: t_can.c,v 1.3 2017/05/28 09:35:01 martin Exp $");
+__RCSID("$NetBSD: t_can.c,v 1.4 2017/05/28 14:49:00 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -686,8 +686,8 @@ ATF_TC_BODY(cannoloop, tc)
 		ATF_CHECK_MSG(sa.can_family == AF_CAN,
 		"recvfrom provided wrong %d family", sa.can_family);
 		ATF_CHECK_MSG(salen == sizeof(sa),
-		"recvfrom provided wrong size %u (!= %zu)",
-		salen, sizeof(sa));
+		"recvfrom provided wrong size %ju (!= %zu)",
+		(uintmax_t)salen, sizeof(sa));
 		ATF_CHECK_MSG(sa.can_ifindex == ifindex,
 		   "recvfrom provided wrong ifindex %d (!= %d)",
 		sa.can_ifindex, ifindex);



CVS commit: src/sys/netipsec

2017-05-28 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun May 28 14:16:05 UTC 2017

Modified Files:
src/sys/netipsec: key.c

Log Message:
release key_mtx on return path.


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/sys/netipsec/key.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/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.145 src/sys/netipsec/key.c:1.146
--- src/sys/netipsec/key.c:1.145	Fri May 26 08:26:22 2017
+++ src/sys/netipsec/key.c	Sun May 28 14:16:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.145 2017/05/26 08:26:22 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.146 2017/05/28 14:16:05 mlelstv Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.145 2017/05/26 08:26:22 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.146 2017/05/28 14:16:05 mlelstv Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -6254,6 +6254,7 @@ key_acquire(const struct secasindex *sai
 		} else {
 			/* increment counter and do nothing. */
 			newacq->count++;
+			mutex_exit(_mtx);
 			return 0;
 		}
 	} else {



CVS commit: src/bin/sh

2017-05-28 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun May 28 14:14:22 UTC 2017

Modified Files:
src/bin/sh: Makefile mkoptions.sh option.list

Log Message:
Redo mkoptions.sh .. much better this way, now fully automated
option sorting (no longer required option.list to be manually
sorted by long option name) and properly handles conditional
options.   Cleaner output format as well.

This allows option.list to be reordered to group related options
together ... also added more comments to it.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/bin/sh/Makefile
cvs rdiff -u -r1.1 -r1.2 src/bin/sh/mkoptions.sh src/bin/sh/option.list

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

Modified files:

Index: src/bin/sh/Makefile
diff -u src/bin/sh/Makefile:1.108 src/bin/sh/Makefile:1.109
--- src/bin/sh/Makefile:1.108	Sun May 28 00:38:01 2017
+++ src/bin/sh/Makefile	Sun May 28 14:14:22 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.108 2017/05/28 00:38:01 kre Exp $
+#	$NetBSD: Makefile,v 1.109 2017/05/28 14:14:22 kre Exp $
 #	@(#)Makefile	8.4 (Berkeley) 5/5/95
 
 .include 
@@ -20,6 +20,7 @@ DPADD+=	${LIBEDIT} ${LIBTERMINFO}
 # Environment for scripts executed during build.
 SCRIPT_ENV= \
 	AWK=${TOOL_AWK:Q} \
+	MKTEMP=${TOOL_MKTEMP:Q} \
 	SED=${TOOL_SED:Q}
 
 CPPFLAGS+=-DSHELL -I. -I${.CURDIR}

Index: src/bin/sh/mkoptions.sh
diff -u src/bin/sh/mkoptions.sh:1.1 src/bin/sh/mkoptions.sh:1.2
--- src/bin/sh/mkoptions.sh:1.1	Sun May 28 00:38:01 2017
+++ src/bin/sh/mkoptions.sh	Sun May 28 14:14:22 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: mkoptions.sh,v 1.1 2017/05/28 00:38:01 kre Exp $
+# $NetBSD: mkoptions.sh,v 1.2 2017/05/28 14:14:22 kre Exp $
 
 #
 # It would be more sensible to generate 2 .h files, one which
@@ -17,36 +17,53 @@ IFS=' 	'	# blank, tab (no newline)
 IF="$1"
 OF="${3+$3/}$2"
 
+E_FILE=$(${MKTEMP:-mktemp} -t MKO.E.$$)
+O_FILE=$(${MKTEMP:-mktemp} -t MKO.O.$$)
+trap 'rm -f "${E_FILE}" "${O_FILE}"' EXIT
+
+exec 5> "${E_FILE}"
+exec 6> "${O_FILE}"
+
 {
 	printf '/*\n * File automatically generated by %s.\n' "$0"
 	printf ' * Do not edit, do not add to cvs.\n'
 	printf ' */\n\n'
 
 	printf '#ifdef DEFINE_OPTIONS\n'
-	printf '#define DEF_OPT(a,b,c,d,e) { a, b, c, d, e },\n'
 	printf 'struct optent optlist[] = {\n'
-	printf '#else\n'
-	printf '#define DEF_OPT(a,b,c,d,e)\n'
-	printf '#endif\n\n'
 } >"${OF}"
 
 FIRST=true
-I=0
 
+${SED:-sed} <"${IF}"			\
+	-e '/^$/d'			\
+	-e '/^#/d'			\
+	-e '/^[ 	]*\//d'		\
+	-e '/^[ 	]*\*/d'		\
+	-e '/^[ 	]*;/d'			|
+sort -k2,2f -k2,2r < "${IF}"			|
 while read line
 do
 	# Look for comments in various styles, and ignore them
-	# preprocessor statements are simply output verbatim
-	# but use them only first or last. one #ifdef/#endif at end is OK
+	# (these should generally be already removed by sed above)
 
 	case "${line}" in
 	'')	continue;;
 	/*)	continue;;
 	\**)	continue;;
 	\;*)	continue;;
-	\#*)	printf '%s\n\n' "${line}" >&4; continue;;
+	\#*)	continue;;
 	esac
 
+	case "${line}" in
+	*'#if'*)
+		COND="${line#*#}"
+		COND="#${COND%%#*}"
+		;;
+	*)
+		COND=
+		;;
+	esac
 	set -- ${line%%[ 	]#*}
 
 	var="$1" name="$2"
@@ -59,7 +76,6 @@ do
 	esac
 
 	case "${name}" in
-#	=)	name=${var};;		# probably not a good idea
 	?) 	set -- ${var} '' $name $3 $4; name= ;;
 	esac
 
@@ -76,57 +92,90 @@ do
 
 	case "${set}" in
 	-)	set= ;;
-	[01])	dflt="${set}"; set= ;;
+	[01] | [Oo][Nn] | [Oo][Ff][Ff])	dflt="${set}"; set= ;;
 	''|?)	;;
 	*)	printf >&2 'set "%s": Not a character\n' "${set}"; continue;;
 	esac
 
+	case "${dflt}" in
+	'')		;;
+	[Oo][Nn])	dflt=1;;
+	[Oo][Ff][Ff])	dflt=0;;
+	[01])		;;
+	*)	printf >&2 'default "%s" invalid, use 0 off 1 on\n'; continue;;
+	esac
+
+	# validation complete, now to generate output
+
+	if [ -n "${COND}" ]
+	then
+		printf '%s\n' "${COND}" >&4
+		printf '%s\n' "${COND}" >&5
+		printf '%s\n' "${COND}" >&6
+	fi
+
+	printf '\t_SH_OPT_%s,\n' "${var}" >&5
 
 	if [ -n "${name}" ]
 	then
-		printf 'DEF_OPT("%s", ' "${name}" >&4
+		printf '{ "%s", ' "${name}"	>&4
 	else
-		printf 'DEF_OPT(0, ' >&4
+		printf '{ 0, '		>&4
 	fi
 
 	if [ -n "${chr}" ]
 	then
-		printf "'%s', " "${chr}" >&4
+		printf "'%s', " "${chr}"	>&4
 	else
-		printf '0, ' >&4
+		chr=
+		printf '0, '			>&4
 	fi
 
 	if [ -n "${set}" ]
 	then
-		printf "'%s', 0, " "${set}" >&4
+		printf "'%s', 0, " "${set}"	>&4
 	else
-		printf '0, 0, ' >&4
+		printf '0, 0, '			>&4
 	fi
 
 	if [ -n "${dflt}" ]
 	then
-		printf '%s )\n' "${dflt}" >&4
+		printf '%s },\n' "${dflt}"	>&4
 	else
-		printf '0 )\n' >&4
+		printf '0 },\n'			>&4
 	fi
 
-	printf '#define	%s	optlist[%d].val\n\n' "${var}" "${I}" >&4
-	I=$((I + 1))
+	printf '#define %s\toptlist[_SH_OPT_%s].val\n' "${var}" "${var}" >&6
+
+	if [ -n "${COND}" ]
+	then
+		printf '#endif\n' >&4
+		printf '#endif\n' >&5
+		printf '#endif\n' >&6
+	fi
 
 	test -z "${chr}" && continue
 
-	printf '%s %d\n' "${chr}" $((I - 1))
+	printf '%s _SH_OPT_%s %s\n' 

CVS commit: src/tests/net/can

2017-05-28 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun May 28 13:55:07 UTC 2017

Modified Files:
src/tests/net/can: h_canutils.c

Log Message:
Needs %zu fix for sizeof as well.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/can/h_canutils.c

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

Modified files:

Index: src/tests/net/can/h_canutils.c
diff -u src/tests/net/can/h_canutils.c:1.2 src/tests/net/can/h_canutils.c:1.3
--- src/tests/net/can/h_canutils.c:1.2	Sat May 27 21:02:56 2017
+++ src/tests/net/can/h_canutils.c	Sun May 28 13:55:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_canutils.c,v 1.2 2017/05/27 21:02:56 bouyer Exp $	*/
+/*	$NetBSD: h_canutils.c,v 1.3 2017/05/28 13:55:07 kre Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: h_canutils.c,v 1.2 2017/05/27 21:02:56 bouyer Exp $");
+__RCSID("$NetBSD: h_canutils.c,v 1.3 2017/05/28 13:55:07 kre Exp $");
 #endif /* not lint */
 
 #include 
@@ -124,7 +124,7 @@ can_recvfrom(int s, struct can_frame *cf
 	ATF_CHECK_MSG(sa->can_family == AF_CAN,
 	"recvfrom provided wrong %d family", sa->can_family);   
 ATF_CHECK_MSG(salen == sizeof(struct sockaddr_can),
-"recvfrom provided wrong size %d (!= %ld)", salen, sizeof(sa));
+"recvfrom provided wrong size %d (!= %zu)", salen, sizeof(sa));
 	return 0;
 }
 



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

2017-05-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 28 11:15:59 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: CUBIETRUCK

Log Message:
Add (commented out) can bus options, CUBIETRUCK is also A20 based.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/conf/CUBIETRUCK

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

Modified files:

Index: src/sys/arch/evbarm/conf/CUBIETRUCK
diff -u src/sys/arch/evbarm/conf/CUBIETRUCK:1.9 src/sys/arch/evbarm/conf/CUBIETRUCK:1.10
--- src/sys/arch/evbarm/conf/CUBIETRUCK:1.9	Sun Dec 27 06:24:25 2015
+++ src/sys/arch/evbarm/conf/CUBIETRUCK	Sun May 28 11:15:59 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: CUBIETRUCK,v 1.9 2015/12/27 06:24:25 macallan Exp $
+#	$NetBSD: CUBIETRUCK,v 1.10 2017/05/28 11:15:59 martin Exp $
 #
 #	CUBIETRUCK - Cubieboard3 (mostly cubieboard2 with 2GB)
 #
@@ -37,3 +37,9 @@ awintve0 	at awinio0
 cinclude	"arch/evbarm/conf/CUBIETRUCK.local"
 
 #options 	VERBOSE_INIT_ARM # verbose bootstraping messages
+
+# CAN bus support
+#options 	CAN		# Controller Area Network protocol
+#pseudo-device	canloop		# CAN loopback interface
+#awincan0	at awinio0 port ? flags 1
+



CVS commit: src/tests/net/can

2017-05-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 28 09:35:02 UTC 2017

Modified Files:
src/tests/net/can: t_can.c

Log Message:
Fix size_t format strings


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/can/t_can.c

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

Modified files:

Index: src/tests/net/can/t_can.c
diff -u src/tests/net/can/t_can.c:1.2 src/tests/net/can/t_can.c:1.3
--- src/tests/net/can/t_can.c:1.2	Sat May 27 21:02:56 2017
+++ src/tests/net/can/t_can.c	Sun May 28 09:35:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_can.c,v 1.2 2017/05/27 21:02:56 bouyer Exp $	*/
+/*	$NetBSD: t_can.c,v 1.3 2017/05/28 09:35:01 martin Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: t_can.c,v 1.2 2017/05/27 21:02:56 bouyer Exp $");
+__RCSID("$NetBSD: t_can.c,v 1.3 2017/05/28 09:35:01 martin Exp $");
 #endif /* not lint */
 
 #include 
@@ -686,7 +686,7 @@ ATF_TC_BODY(cannoloop, tc)
 		ATF_CHECK_MSG(sa.can_family == AF_CAN,
 		"recvfrom provided wrong %d family", sa.can_family);
 		ATF_CHECK_MSG(salen == sizeof(sa),
-		"recvfrom provided wrong size %d (!= %ld)",
+		"recvfrom provided wrong size %u (!= %zu)",
 		salen, sizeof(sa));
 		ATF_CHECK_MSG(sa.can_ifindex == ifindex,
 		   "recvfrom provided wrong ifindex %d (!= %d)",
@@ -708,7 +708,7 @@ ATF_TC_BODY(cannoloop, tc)
 		ATF_CHECK_MSG(sa.can_family == AF_CAN,
 		"recvfrom provided wrong %d family", sa.can_family);
 		ATF_CHECK_MSG(salen == sizeof(sa),
-		"recvfrom provided wrong size %d (!= %ld)",
+		"recvfrom provided wrong size %u (!= %zu)",
 		salen, sizeof(sa));
 		ATF_CHECK_MSG(sa.can_ifindex == ifindex,
 		   "recvfrom provided wrong ifindex %d (!= %d)",