CVS commit: src/sys/fs/puffs

2014-10-05 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Sun Oct  5 07:53:22 UTC 2014

Modified Files:
src/sys/fs/puffs: puffs_vnops.c

Log Message:
If we truncate the file, make sure we zero-fill the end of the last
page, otherwise if the file is later truncated to a larger size
(creating a hole), that area will not return zeroes as it should.


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/sys/fs/puffs/puffs_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/puffs/puffs_vnops.c
diff -u src/sys/fs/puffs/puffs_vnops.c:1.187 src/sys/fs/puffs/puffs_vnops.c:1.188
--- src/sys/fs/puffs/puffs_vnops.c:1.187	Tue Sep 30 10:15:03 2014
+++ src/sys/fs/puffs/puffs_vnops.c	Sun Oct  5 07:53:22 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_vnops.c,v 1.187 2014/09/30 10:15:03 hannken Exp $	*/
+/*	$NetBSD: puffs_vnops.c,v 1.188 2014/10/05 07:53:22 manu Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.187 2014/09/30 10:15:03 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.188 2014/10/05 07:53:22 manu Exp $");
 
 #include 
 #include 
@@ -1130,6 +1130,38 @@ puffs_vnop_getattr(void *v)
 	return error;
 }
 
+static void
+zerofill_lastpage(struct vnode *vp, voff_t off)
+{
+	char zbuf[PAGE_SIZE];
+	struct iovec iov;
+	struct uio uio;
+	vsize_t len;
+	int error;
+
+	if (trunc_page(off) == off)
+		return;
+
+	len = round_page(off) - off;
+	memset(zbuf, 0, len);
+
+	iov.iov_base = zbuf;
+	iov.iov_len = len;
+	UIO_SETUP_SYSSPACE(&uio);
+	uio.uio_iov = &iov;
+	uio.uio_iovcnt = 1;
+	uio.uio_offset = off;
+	uio.uio_resid = len;
+	uio.uio_rw = UIO_WRITE;
+
+	error = ubc_uiomove(&vp->v_uobj, &uio, len,
+			UVM_ADV_SEQUENTIAL, UBC_WRITE|UBC_UNMAP_FLAG(vp));
+	if (error)
+		DPRINTF(("zero-fill 0x%lx@0x%llx => %d\n", len, off, error));
+
+	return;
+}
+
 static int
 dosetattr(struct vnode *vp, struct vattr *vap, kauth_cred_t cred, int flags)
 {
@@ -1191,6 +1223,17 @@ dosetattr(struct vnode *vp, struct vattr
 	if ((flags & SETATTR_ASYNC) == 0)
 		error = puffs_msg_wait2(pmp, park_setattr, vp->v_data, NULL);
 
+	/*
+	 * If we truncate the file, make sure we zero-fill
+	 * the end of the last page, otherwise if the file
+	 * is later truncated to a larger size (creating a
+	 * a hole), that area will not return zeroes as it
+	 * should.
+	 */
+	if ((error == 0) && (flags & SETATTR_CHSIZE) &&
+	(vap->va_size != VNOVAL) && (vap->va_size < vp->v_size))
+		zerofill_lastpage(vp, vap->va_size);
+
 	if ((error == 0) && PUFFS_USE_FS_TTL(pmp)) {
 		struct timespec *va_ttl = &setattr_msg->pvnr_va_ttl;
 		struct vattr *rvap = &setattr_msg->pvnr_va;



CVS commit: src/sys/fs/puffs

2014-10-05 Thread Justin Cormack
Module Name:src
Committed By:   justin
Date:   Sun Oct  5 09:28:24 UTC 2014

Modified Files:
src/sys/fs/puffs: puffs_vnops.c

Log Message:
Use PRIx64 for printing offsets


To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 src/sys/fs/puffs/puffs_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/puffs/puffs_vnops.c
diff -u src/sys/fs/puffs/puffs_vnops.c:1.188 src/sys/fs/puffs/puffs_vnops.c:1.189
--- src/sys/fs/puffs/puffs_vnops.c:1.188	Sun Oct  5 07:53:22 2014
+++ src/sys/fs/puffs/puffs_vnops.c	Sun Oct  5 09:28:24 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_vnops.c,v 1.188 2014/10/05 07:53:22 manu Exp $	*/
+/*	$NetBSD: puffs_vnops.c,v 1.189 2014/10/05 09:28:24 justin Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.188 2014/10/05 07:53:22 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.189 2014/10/05 09:28:24 justin Exp $");
 
 #include 
 #include 
@@ -1157,7 +1157,7 @@ zerofill_lastpage(struct vnode *vp, voff
 	error = ubc_uiomove(&vp->v_uobj, &uio, len,
 			UVM_ADV_SEQUENTIAL, UBC_WRITE|UBC_UNMAP_FLAG(vp));
 	if (error)
-		DPRINTF(("zero-fill 0x%lx@0x%llx => %d\n", len, off, error));
+		DPRINTF(("zero-fill 0x%lx@0x%" PRIx64 " => %d\n", len, off, error));
 
 	return;
 }



CVS commit: src/sys/kern

2014-10-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Oct  5 10:00:03 UTC 2014

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

Log Message:
Get arguments in the right order for copyout.  (Oops!)


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/kern/kern_uuid.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/kern_uuid.c
diff -u src/sys/kern/kern_uuid.c:1.19 src/sys/kern/kern_uuid.c:1.20
--- src/sys/kern/kern_uuid.c:1.19	Sat Oct  4 11:15:44 2014
+++ src/sys/kern/kern_uuid.c	Sun Oct  5 10:00:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_uuid.c,v 1.19 2014/10/04 11:15:44 riastradh Exp $	*/
+/*	$NetBSD: kern_uuid.c,v 1.20 2014/10/05 10:00:03 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2002 Marcel Moolenaar
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_uuid.c,v 1.19 2014/10/04 11:15:44 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_uuid.c,v 1.20 2014/10/05 10:00:03 riastradh Exp $");
 
 #include 
 #include 
@@ -82,7 +82,7 @@ sys_uuidgen(struct lwp *l, const struct 
 	 count > 0;
 	 store++, count--) {
 		uuid_generate(&tmp);
-		error = copyout(store, &tmp, sizeof tmp);
+		error = copyout(&tmp, store, sizeof tmp);
 		if (error)
 			return error;
 	}



CVS commit: [netbsd-7] src/games

2014-10-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct  5 10:21:04 UTC 2014

Modified Files:
src/games/factor [netbsd-7]: factor.6 factor.c
src/games/primes [netbsd-7]: Makefile pattern.c pr_tbl.c primes.6
primes.c primes.h
Added Files:
src/games/primes [netbsd-7]: spsp.c

Log Message:
Pull up following revision(s) (requested by ast in ticket #128):
games/primes/pattern.c: revision 1.7
games/primes/primes.h: revision 1.6
games/primes/spsp.c: revision 1.1
games/primes/Makefile: revision 1.8
games/factor/factor.c: revision 1.27
games/factor/factor.6: revision 1.13
games/primes/primes.c: revision 1.20
games/primes/primes.c: revision 1.21
games/primes/pr_tbl.c: revision 1.8
games/primes/primes.6: revision 1.4
games/primes/primes.6: revision 1.5
Imported and adapted from FreeBSD svn r272166 and r272207; this fixes
false positives for products of primes larger than 2^16. For example,
before this commit:
  $ /usr/games/primes 4295360521 4295360522
  4295360521
but
  $ /usr/games/factor 4295360521
  4295360521: 65539 65539
or
  $ /usr/games/primes 3825123056546413049 3825123056546413050
  3825123056546413049
yet
  $ /usr/games/factor 3825123056546413049
  3825123056546413049: 165479 23115459100831
or
  $ /usr/games/primes 18446744073709551577
  18446744073709551577
although
  $ /usr/games/factor 18446744073709551577
  18446744073709551577: 139646831 132095686967
Incidentally, the above examples show the smallest and largest cases that
were erroneously stated as prime in the range 2^32 .. 3825123056546413049
.. 2^64; the primes(6) program now stops at 3825123056546413050 as
primality tests on larger integers would be by brute force factorization.
In addition, special to the NetBSD version:
. for -d option, skip first difference when start is >65537 as it is incorrect
. corrected usage to mention both the existing -d as well as the new -h option
For original FreeBSD commit message by Colin Percival, see:
http://svnweb.freebsd.org/base?view=revision&revision=272166
usage police


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.24.1 src/games/factor/factor.6
cvs rdiff -u -r1.26 -r1.26.18.1 src/games/factor/factor.c
cvs rdiff -u -r1.7 -r1.7.74.1 src/games/primes/Makefile \
src/games/primes/pr_tbl.c
cvs rdiff -u -r1.6 -r1.6.74.1 src/games/primes/pattern.c
cvs rdiff -u -r1.3 -r1.3.46.1 src/games/primes/primes.6
cvs rdiff -u -r1.19 -r1.19.20.1 src/games/primes/primes.c
cvs rdiff -u -r1.5 -r1.5.74.1 src/games/primes/primes.h
cvs rdiff -u -r0 -r1.1.2.2 src/games/primes/spsp.c

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

Modified files:

Index: src/games/factor/factor.6
diff -u src/games/factor/factor.6:1.12 src/games/factor/factor.6:1.12.24.1
--- src/games/factor/factor.6:1.12	Sat May 15 21:22:39 2010
+++ src/games/factor/factor.6	Sun Oct  5 10:21:04 2014
@@ -1,4 +1,4 @@
-.\"	$NetBSD: factor.6,v 1.12 2010/05/15 21:22:39 joerg Exp $
+.\"	$NetBSD: factor.6,v 1.12.24.1 2014/10/05 10:21:04 martin Exp $
 .\"
 .\" Copyright (c) 1989, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -33,9 +33,7 @@
 .\"	@(#)factor.6	8.1 (Berkeley) 5/31/93
 .\"
 .\"
-.\" By: Landon Curt Noll   cho...@toad.com,   ...!{sun,tolsoft}!hoptoad!chongo
-.\"
-.\"   chongo  /\oo/\
+.\" By Landon Curt Noll, http://www.isthe.com/chongo/index.html /\oo/\
 .\"
 .Dd May 15, 2010
 .Dt FACTOR 6
@@ -88,10 +86,7 @@ is compiled without OpenSSL it is limite
 .Vt unsigned long .
 .Sh DIAGNOSTICS
 Out of range or invalid input results in
-an appropriate error message
-being written to standard error.
-.\".Sh BUGS
-.\".Nm
-.\"cannot handle the
-.\".Dq 10 most wanted
-.\"factor list.
+an appropriate error message to standard error.
+.Sh AUTHORS
+Originally by
+.An Landon Curt Noll .

Index: src/games/factor/factor.c
diff -u src/games/factor/factor.c:1.26 src/games/factor/factor.c:1.26.18.1
--- src/games/factor/factor.c:1.26	Wed Nov  9 20:17:44 2011
+++ src/games/factor/factor.c	Sun Oct  5 10:21:04 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: factor.c,v 1.26 2011/11/09 20:17:44 drochner Exp $	*/
+/*	$NetBSD: factor.c,v 1.26.18.1 2014/10/05 10:21:04 martin Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -42,16 +42,14 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)factor.c	8.4 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: factor.c,v 1.26 2011/11/09 20:17:44 drochner Exp $");
+__RCSID("$NetBSD: factor.c,v 1.26.18.1 2014/10/05 10:21:04 martin Exp $");
 #endif
 #endif /* not lint */
 
 /*
  * factor - factor a number into primes
  *
- * By: Landon Curt Noll   cho...@toad.com,   ...!{sun,tolsoft}!hoptoad!chongo
- *
- *   chongo  /\oo/\
+ * By Landon Curt Noll, http://www.isthe.com/chongo/index.html /\oo/\
  *
  * usage:
  *	factor [number] ...
@@ -72,6 +70,7 @@ __RCSID("$NetBSD: factor.c,v 1.26 2011/1
 #include 

CVS commit: [netbsd-7] src/doc

2014-10-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct  5 10:22:50 UTC 2014

Modified Files:
src/doc [netbsd-7]: CHANGES-7.0

Log Message:
Ticket #128


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.44 -r1.1.2.45 src/doc/CHANGES-7.0

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-7.0
diff -u src/doc/CHANGES-7.0:1.1.2.44 src/doc/CHANGES-7.0:1.1.2.45
--- src/doc/CHANGES-7.0:1.1.2.44	Sat Oct  4 08:21:23 2014
+++ src/doc/CHANGES-7.0	Sun Oct  5 10:22:50 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0,v 1.1.2.44 2014/10/04 08:21:23 martin Exp $
+# $NetBSD: CHANGES-7.0,v 1.1.2.45 2014/10/05 10:22:50 martin Exp $
 
 A complete list of changes from the initial NetBSD 7.0 branch on 11 Aug 2014
 until the 7.0 release:
@@ -1041,3 +1041,16 @@ sys/dev/sdmmc/sdhc.c1.50
 	Fix divisor calculation for SDHC 3.0.
 	[skrll, ticket #127]
 
+games/factor/factor.61.13
+games/factor/factor.c1.27
+games/primes/Makefile1.8
+games/primes/pattern.c1.7
+games/primes/pr_tbl.c1.8
+games/primes/primes.61.4-1.5
+games/primes/primes.c1.20-1.21
+games/primes/primes.h1.6
+games/primes/spsp.c1.1
+
+	Fix primes(6) and factor(6) for 64bit numbers upto
+	3825123056546413050 (from FreeBSD).
+	[ast, ticket #128]



CVS commit: src/doc

2014-10-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct  5 13:27:33 UTC 2014

Modified Files:
src/doc: CHANGES.prev

Log Message:
Note about hp300 arcofi(4) audio driver pulled up to netbsd-7 recently.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/doc/CHANGES.prev

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.prev
diff -u src/doc/CHANGES.prev:1.121 src/doc/CHANGES.prev:1.122
--- src/doc/CHANGES.prev:1.121	Tue Sep  9 10:34:36 2014
+++ src/doc/CHANGES.prev	Sun Oct  5 13:27:33 2014
@@ -1,4 +1,4 @@
-LIST OF CHANGES FROM PREVIOUS RELEASES:			<$Revision: 1.121 $>
+LIST OF CHANGES FROM PREVIOUS RELEASES:			<$Revision: 1.122 $>
 
 
 Changes from 386bsd 0.1 + patchkit 0.2.2 to NetBSD 0.8:
@@ -11700,3 +11700,5 @@ Changes from NetBSD 6.0 to NetBSD 7.0:
 		[tls 20140810]
 	OpenSSL: Update to 1.0.1i. [spz 20140810]
 	kernel: Add MODULAR infrastructure for Xen kernels. [jnemeth 20140810]
+	hp300: Add arcofi(4) audio driver for the HP "Audio1" device found on
+		HP9000/425e.  Ported from OpenBSD.  [tsutsui 20140824]



CVS commit: src/sys/fs/puffs

2014-10-05 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Sun Oct  5 14:13:15 UTC 2014

Modified Files:
src/sys/fs/puffs: puffs_sys.h

Log Message:
Safer definitions of DPRINTF and DPRINTF_VERBOSE.

In the PUFFSDEBUG case, wrap do { ... } while (/*CONSTCOND*/0)
around the definitions.  In the non-PUFFSDEBUG case, define them
as ((void)0) instead of as empty.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/fs/puffs/puffs_sys.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/fs/puffs/puffs_sys.h
diff -u src/sys/fs/puffs/puffs_sys.h:1.86 src/sys/fs/puffs/puffs_sys.h:1.87
--- src/sys/fs/puffs/puffs_sys.h:1.86	Thu Aug 28 08:29:50 2014
+++ src/sys/fs/puffs/puffs_sys.h	Sun Oct  5 14:13:14 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_sys.h,v 1.86 2014/08/28 08:29:50 hannken Exp $	*/
+/*	$NetBSD: puffs_sys.h,v 1.87 2014/10/05 14:13:14 apb Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006  Antti Kantee.  All Rights Reserved.
@@ -63,11 +63,15 @@ extern struct pool puffs_vapool;
 
 #ifdef PUFFSDEBUG
 extern int puffsdebug; /* puffs_subr.c */
-#define DPRINTF(x) if (puffsdebug > 0) printf x
-#define DPRINTF_VERBOSE(x) if (puffsdebug > 1) printf x
+#define DPRINTF(x) do { \
+		if (puffsdebug > 0) printf x; \
+	while (/*CONSTCOND*/0)
+#define DPRINTF_VERBOSE(x) do { \
+		if (puffsdebug > 1) printf x; \
+	while (/*CONSTCOND*/0)
 #else
-#define DPRINTF(x)
-#define DPRINTF_VERBOSE(x)
+#define DPRINTF(x) ((void)0)
+#define DPRINTF_VERBOSE(x) ((void)0)
 #endif
 
 #define MPTOPUFFSMP(mp) ((struct puffs_mount *)((mp)->mnt_data))



CVS commit: src/share/mk

2014-10-05 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Sun Oct  5 17:08:46 UTC 2014

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

Log Message:
Use HAVE_LLVM, not MKLLVM, in tests related to the active compiler.

Fixes problems in a build with MKLLVM=yes HAVE_LLVM=no,
where this error interacted with settings in
src/external/gpl3/gcc/lib/libgcc/Makefile.inc to cause
some object files to be omitted from the libgcc_s library.


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

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.835 src/share/mk/bsd.own.mk:1.836
--- src/share/mk/bsd.own.mk:1.835	Fri Sep 19 17:45:42 2014
+++ src/share/mk/bsd.own.mk	Sun Oct  5 17:08:46 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.835 2014/09/19 17:45:42 matt Exp $
+#	$NetBSD: bsd.own.mk,v 1.836 2014/10/05 17:08:46 apb Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -98,7 +98,7 @@ _LIBC_COMPILER_RT.powerpc=	yes
 _LIBC_COMPILER_RT.powerpc64=	yes
 _LIBC_COMPILER_RT.x86_64=	yes
 
-.if ${MKLLVM:Uno} == "yes" && ${_LIBC_COMPILER_RT.${MACHINE_ARCH}:Uno} == "yes"
+.if ${HAVE_LLVM:Uno} == "yes" && ${_LIBC_COMPILER_RT.${MACHINE_ARCH}:Uno} == "yes"
 HAVE_LIBGCC?=	no
 .else
 HAVE_LIBGCC?=	yes
@@ -106,7 +106,7 @@ HAVE_LIBGCC?=	yes
 
 
 # ia64 is not support
-.if ${MKLLVM:Uno} == "yes" || !empty(MACHINE_ARCH:Mearm*)
+.if ${HAVE_LLVM:Uno} == "yes" || !empty(MACHINE_ARCH:Mearm*)
 HAVE_LIBGCC_EH?=	no
 .else
 HAVE_LIBGCC_EH?=	yes



CVS commit: [netbsd-7] src/sys

2014-10-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct  5 20:00:54 UTC 2014

Modified Files:
src/sys/arch/arm/broadcom [netbsd-7]: bcm2835_emmc.c
src/sys/dev/sdmmc [netbsd-7]: sdhc.c sdhcvar.h

Log Message:
Pull up following revision(s) (requested by skrll in ticket #129):
sys/dev/sdmmc/sdhcvar.h: revision 1.15
sys/dev/sdmmc/sdhc.c: revision 1.51
sys/arch/arm/broadcom/bcm2835_emmc.c: revision 1.19
Pass sdhc_softc instead of sdhc_host to sc_vendor_transfer_data_dma,
since the vendor specific code has no access to it otherwise,
but can easily do device_private(sdhc_softc->sc_dev).


To generate a diff of this commit:
cvs rdiff -u -r1.9.4.1 -r1.9.4.2 src/sys/arch/arm/broadcom/bcm2835_emmc.c
cvs rdiff -u -r1.44.2.4 -r1.44.2.5 src/sys/dev/sdmmc/sdhc.c
cvs rdiff -u -r1.13.12.1 -r1.13.12.2 src/sys/dev/sdmmc/sdhcvar.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/broadcom/bcm2835_emmc.c
diff -u src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.9.4.1 src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.9.4.2
--- src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.9.4.1	Fri Oct  3 18:53:56 2014
+++ src/sys/arch/arm/broadcom/bcm2835_emmc.c	Sun Oct  5 20:00:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_emmc.c,v 1.9.4.1 2014/10/03 18:53:56 martin Exp $	*/
+/*	$NetBSD: bcm2835_emmc.c,v 1.9.4.2 2014/10/05 20:00:54 martin Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.9.4.1 2014/10/03 18:53:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.9.4.2 2014/10/05 20:00:54 martin Exp $");
 
 #include "bcmdmac.h"
 
@@ -82,7 +82,7 @@ static int bcmemmc_match(device_t, struc
 static void bcmemmc_attach(device_t, device_t, void *);
 static void bcmemmc_attach_i(device_t);
 #if NBCMDMAC > 0
-static int bcmemmc_xfer_data_dma(struct sdhc_host *, struct sdmmc_command *);
+static int bcmemmc_xfer_data_dma(struct sdhc_softc *, struct sdmmc_command *);
 static void bcmemmc_dma_done(void *);
 #endif
 
@@ -239,9 +239,9 @@ fail:
 
 #if NBCMDMAC > 0
 static int
-bcmemmc_xfer_data_dma(struct sdhc_host *hp, struct sdmmc_command *cmd)
+bcmemmc_xfer_data_dma(struct sdhc_softc *sdhc_sc, struct sdmmc_command *cmd)
 {
-	struct bcmemmc_softc * const sc = *(void **)hp;	/* XXX XXX XXX */
+	struct bcmemmc_softc * const sc = device_private(sdhc_sc->sc_dev);
 	size_t seg;
 	int error;
 

Index: src/sys/dev/sdmmc/sdhc.c
diff -u src/sys/dev/sdmmc/sdhc.c:1.44.2.4 src/sys/dev/sdmmc/sdhc.c:1.44.2.5
--- src/sys/dev/sdmmc/sdhc.c:1.44.2.4	Sat Oct  4 08:20:11 2014
+++ src/sys/dev/sdmmc/sdhc.c	Sun Oct  5 20:00:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc.c,v 1.44.2.4 2014/10/04 08:20:11 martin Exp $	*/
+/*	$NetBSD: sdhc.c,v 1.44.2.5 2014/10/05 20:00:54 martin Exp $	*/
 /*	$OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $	*/
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.44.2.4 2014/10/04 08:20:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.44.2.5 2014/10/05 20:00:54 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -1272,6 +1272,7 @@ sdhc_start_command(struct sdhc_host *hp,
 static void
 sdhc_transfer_data(struct sdhc_host *hp, struct sdmmc_command *cmd)
 {
+	struct sdhc_softc *sc = hp->sc;
 	int error;
 
 	DPRINTF(1,("%s: data transfer: resp=%08x datalen=%u\n", HDEVNAME(hp),
@@ -1289,7 +1290,7 @@ sdhc_transfer_data(struct sdhc_host *hp,
 
 	if (cmd->c_dmamap != NULL) {
 		if (hp->sc->sc_vendor_transfer_data_dma != NULL) {
-			error = hp->sc->sc_vendor_transfer_data_dma(hp, cmd);
+			error = hp->sc->sc_vendor_transfer_data_dma(sc, cmd);
 			if (error == 0 && !sdhc_wait_intr(hp,
 			SDHC_TRANSFER_COMPLETE, SDHC_TRANSFER_TIMEOUT)) {
 error = ETIMEDOUT;

Index: src/sys/dev/sdmmc/sdhcvar.h
diff -u src/sys/dev/sdmmc/sdhcvar.h:1.13.12.1 src/sys/dev/sdmmc/sdhcvar.h:1.13.12.2
--- src/sys/dev/sdmmc/sdhcvar.h:1.13.12.1	Fri Oct  3 18:53:56 2014
+++ src/sys/dev/sdmmc/sdhcvar.h	Sun Oct  5 20:00:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhcvar.h,v 1.13.12.1 2014/10/03 18:53:56 martin Exp $	*/
+/*	$NetBSD: sdhcvar.h,v 1.13.12.2 2014/10/05 20:00:54 martin Exp $	*/
 /*	$OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg Exp $	*/
 
 /*
@@ -60,7 +60,7 @@ struct sdhc_softc {
 	int (*sc_vendor_write_protect)(struct sdhc_softc *);
 	int (*sc_vendor_card_detect)(struct sdhc_softc *);
 	int (*sc_vendor_bus_clock)(struct sdhc_softc *, int);
-	int (*sc_vendor_transfer_data_dma)(struct sdhc_host *, struct sdmmc_command *);
+	int (*sc_vendor_transfer_data_dma)(struct sdhc_softc *, struct sdmmc_command *);
 };
 
 /* Host controller functions called by the attachment driver. */



CVS commit: [netbsd-7] src/sys/arch/luna68k/dev

2014-10-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct  5 20:12:49 UTC 2014

Modified Files:
src/sys/arch/luna68k/dev [netbsd-7]: lunafb.c omrasops.c omrasopsvar.h

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #130):
sys/arch/luna68k/dev/omrasops.c: revision 1.17
sys/arch/luna68k/dev/omrasops.c: revision 1.18
sys/arch/luna68k/dev/omrasops.c: revision 1.19
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.3
sys/arch/luna68k/dev/lunafb.c: revision 1.36
Pull readability changes from OpenBSD/luna88k.
- prepare and use unpack_attr() function to get fg and bg from attribute
- use proper variable names to clarify meanings
Tested on LUNA-II with 8bpp framebuffer.
Put dumb optimizations to avoid conditionals in putchar drawing loops.
~10% improvements of time cat results on LUNA-II 8bpp framebuffer.
Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.
http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
> It makes 4bpp wscons putchar ~20% faster.
This Makes 4bpp wscons putchar ~30% on LUNA-II.
Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.
Tested on all 1bpp/4bpp/8bpp framebuffers.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.2.1 src/sys/arch/luna68k/dev/lunafb.c
cvs rdiff -u -r1.16 -r1.16.4.1 src/sys/arch/luna68k/dev/omrasops.c
cvs rdiff -u -r1.2 -r1.2.4.1 src/sys/arch/luna68k/dev/omrasopsvar.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/luna68k/dev/lunafb.c
diff -u src/sys/arch/luna68k/dev/lunafb.c:1.35 src/sys/arch/luna68k/dev/lunafb.c:1.35.2.1
--- src/sys/arch/luna68k/dev/lunafb.c:1.35	Fri Jul 25 16:40:12 2014
+++ src/sys/arch/luna68k/dev/lunafb.c	Sun Oct  5 20:12:49 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: lunafb.c,v 1.35 2014/07/25 16:40:12 tsutsui Exp $ */
+/* $NetBSD: lunafb.c,v 1.35.2.1 2014/10/05 20:12:49 martin Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.35 2014/07/25 16:40:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.35.2.1 2014/10/05 20:12:49 martin Exp $");
 
 #include 
 #include 
@@ -75,11 +75,8 @@ struct bt458 {
 };
 
 #define	OMFB_RFCNT	0xB100	/* video h-origin/v-origin */
-#define	OMFB_PLANEMASK	0xB104	/* planemask register */
-#define	OMFB_FB_WADDR	0xB1080008	/* common plane */
-#define	OMFB_FB_RADDR	0xB10C0008	/* plane #0 */
-#define	OMFB_ROPFUNC	0xB12C	/* ROP function code */
 #define	OMFB_RAMDAC	0xC110	/* Bt454/Bt458 RAMDAC */
+
 #define	OMFB_SIZE	(0xB130 - 0xB108 + PAGE_SIZE)
 
 struct hwcmap {

Index: src/sys/arch/luna68k/dev/omrasops.c
diff -u src/sys/arch/luna68k/dev/omrasops.c:1.16 src/sys/arch/luna68k/dev/omrasops.c:1.16.4.1
--- src/sys/arch/luna68k/dev/omrasops.c:1.16	Sat Dec 28 09:17:23 2013
+++ src/sys/arch/luna68k/dev/omrasops.c	Sun Oct  5 20:12:49 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: omrasops.c,v 1.16 2013/12/28 09:17:23 tsutsui Exp $ */
+/* $NetBSD: omrasops.c,v 1.16.4.1 2014/10/05 20:12:49 martin Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: omrasops.c,v 1.16 2013/12/28 09:17:23 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omrasops.c,v 1.16.4.1 2014/10/05 20:12:49 martin Exp $");
 
 /*
  * Designed speficically for 'm68k bitorder';
@@ -68,6 +68,7 @@ static void	om1_eraserows(void *, int, i
 static void	om4_eraserows(void *, int, int, long);
 static int	om1_allocattr(void *, int, int, int, long *);
 static int	om4_allocattr(void *, int, int, int, long *);
+static void	om4_unpack_attr(long, int *, int *, int *);
 
 static int	omrasops_init(struct rasops_info *, int, int);
 
@@ -77,13 +78,6 @@ static int	omrasops_init(struct rasops_i
 #define	ALIGNMASK	(0x1f)
 #define	BYTESDONE	(4)
 
-#define	W(p) (*(uint32_t *)(p))
-#define	R(p) (*(uint32_t *)((uint8_t *)(p) + 0x4))
-#define	P0(p) (*(uint32_t *)((uint8_t *)(p) + 0x4))
-#define	P1(p) (*(uint32_t *)((uint8_t *)(p) + 0x8))
-#define	P2(p) (*(uint32_t *)((uint8_t *)(p) + 0xc))
-#define	P3(p) (*(uint32_t *)((uint8_t *)(p) + 0x10))
-
 /*
  * macros to handle unaligned bit copy ops.
  * See src/sys/dev/rasops/rasops_mask.h for MI version.
@@ -95,13 +89,13 @@ static int	omrasops_init(struct rasops_i
 #define	FASTGETBITS(psrc, x, w, dst)	\
 	asm("bfextu %3{%1:%2},%0"	\
 	: "=d" (dst) 		\
-	: "di" (x), "di" (w), "o" ((uint32_t *)(psrc)))
+	: "di" (x), "di" (w), "o" (*(uint32_t *)(psrc)))
 
 /* luna68k version PUTBITS() that puts w bits from bit x at pdst memory */
 /* XXX this macro assumes (x + w) <= 32 to handle un

CVS commit: [netbsd-7] src/doc

2014-10-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct  5 20:15:10 UTC 2014

Modified Files:
src/doc [netbsd-7]: CHANGES-7.0

Log Message:
Tickets 129 and 130


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.45 -r1.1.2.46 src/doc/CHANGES-7.0

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-7.0
diff -u src/doc/CHANGES-7.0:1.1.2.45 src/doc/CHANGES-7.0:1.1.2.46
--- src/doc/CHANGES-7.0:1.1.2.45	Sun Oct  5 10:22:50 2014
+++ src/doc/CHANGES-7.0	Sun Oct  5 20:15:10 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0,v 1.1.2.45 2014/10/05 10:22:50 martin Exp $
+# $NetBSD: CHANGES-7.0,v 1.1.2.46 2014/10/05 20:15:10 martin Exp $
 
 A complete list of changes from the initial NetBSD 7.0 branch on 11 Aug 2014
 until the 7.0 release:
@@ -1054,3 +1054,21 @@ games/primes/spsp.c1.1
 	Fix primes(6) and factor(6) for 64bit numbers upto
 	3825123056546413050 (from FreeBSD).
 	[ast, ticket #128]
+
+sys/arch/arm/broadcom/bcm2835_emmc.c		1.19
+sys/dev/sdmmc/sdhc.c1.51
+sys/dev/sdmmc/sdhcvar.h1.15
+
+	Pass sdhc_softc instead of sdhc_host to sc_vendor_transfer_data_dma,
+	since the vendor specific code has no access to it otherwise,
+	but can easily do device_private(sdhc_softc->sc_dev).
+	[skrll, ticket #129]
+
+sys/arch/luna68k/dev/lunafb.c			1.36
+sys/arch/luna68k/dev/omrasops.c			1.17-1.19
+sys/arch/luna68k/dev/omrasopsvar.h		1.3
+
+	Various improvements to the luna68k framebuffer, partly from
+	OpenBSD/luna88k.
+	[tsutsui, ticket #130]
+



CVS commit: src/sys/compat/netbsd32

2014-10-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  5 20:17:28 UTC 2014

Modified Files:
src/sys/compat/netbsd32: netbsd32.h netbsd32_fs.c

Log Message:
add tmpfs.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/compat/netbsd32/netbsd32.h
cvs rdiff -u -r1.71 -r1.72 src/sys/compat/netbsd32/netbsd32_fs.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/compat/netbsd32/netbsd32.h
diff -u src/sys/compat/netbsd32/netbsd32.h:1.102 src/sys/compat/netbsd32/netbsd32.h:1.103
--- src/sys/compat/netbsd32/netbsd32.h:1.102	Sat Jun 28 18:27:50 2014
+++ src/sys/compat/netbsd32/netbsd32.h	Sun Oct  5 16:17:28 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32.h,v 1.102 2014/06/28 22:27:50 dholland Exp $	*/
+/*	$NetBSD: netbsd32.h,v 1.103 2014/10/05 20:17:28 christos Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008 Matthew R. Green
@@ -167,6 +167,7 @@ typedef netbsd32_intptr_t netbsd32_semid
 typedef netbsd32_pointer_t netbsd32_semidp_t;
 typedef netbsd32_uint64 netbsd32_dev_t;
 typedef netbsd32_int64 netbsd32_off_t;
+typedef netbsd32_uint64 netbsd32_ino_t;
 
 /* from  */
 typedef netbsd32_pointer_t netbsd32_iovecp_t;
@@ -909,6 +910,20 @@ struct netbsd32_kevent {
 typedef netbsd32_pointer_t netbsd32_sched_paramp_t;
 typedef netbsd32_pointer_t netbsd32_cpusetp_t;
 
+/* from  */
+struct netbsd32_tmpfs_args {
+int ta_version;
+
+/* Size counters. */
+netbsd32_ino_t  ta_nodes_max;
+netbsd32_off_t  ta_size_max;
+
+/* Root node attributes. */
+uid_t   ta_root_uid;
+gid_t   ta_root_gid;
+mode_t  ta_root_mode;
+};
+
 /* from  */
 struct netbsd32_iso_args {
 	netbsd32_charp fspec;

Index: src/sys/compat/netbsd32/netbsd32_fs.c
diff -u src/sys/compat/netbsd32/netbsd32_fs.c:1.71 src/sys/compat/netbsd32/netbsd32_fs.c:1.72
--- src/sys/compat/netbsd32/netbsd32_fs.c:1.71	Fri Sep  5 05:21:54 2014
+++ src/sys/compat/netbsd32/netbsd32_fs.c	Sun Oct  5 16:17:28 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_fs.c,v 1.71 2014/09/05 09:21:54 matt Exp $	*/
+/*	$NetBSD: netbsd32_fs.c,v 1.72 2014/10/05 20:17:28 christos Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.71 2014/09/05 09:21:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.72 2014/10/05 20:17:28 christos Exp $");
 
 #include 
 #include 
@@ -50,6 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -799,6 +800,7 @@ netbsd32___mount50(struct lwp *l, const 
 		struct netbsd32_iso_args iso_args;
 		struct netbsd32_nfs_args nfs_args;
 		struct netbsd32_msdosfs_args msdosfs_args;
+		struct netbsd32_tmpfs_args tmpfs_args;
 	} fs_args32;
 	union {
 		struct ufs_args ufs_args;
@@ -806,6 +808,7 @@ netbsd32___mount50(struct lwp *l, const 
 		struct iso_args iso_args;
 		struct nfs_args nfs_args;
 		struct msdosfs_args msdosfs_args;
+		struct tmpfs_args tmpfs_args;
 	} fs_args;
 	const char *type = SCARG_P32(uap, type);
 	const char *path = SCARG_P32(uap, path);
@@ -819,7 +822,31 @@ netbsd32___mount50(struct lwp *l, const 
 	error = copyinstr(type, mtype, sizeof(mtype), &len);
 	if (error)
 		return error;
-	if (strcmp(mtype, MOUNT_MFS) == 0) {
+	if (strcmp(mtype, MOUNT_TMPFS) == 0) {
+		if (data_len != sizeof(fs_args32.tmpfs_args))
+			return EINVAL;
+		if ((flags & MNT_GETARGS) == 0) {
+			error = copyin(data, &fs_args32.tmpfs_args, 
+			sizeof(fs_args32.tmpfs_args));
+			if (error)
+return error;
+			fs_args.tmpfs_args.ta_version =
+			fs_args32.tmpfs_args.ta_version;
+			fs_args.tmpfs_args.ta_nodes_max =
+			fs_args32.tmpfs_args.ta_nodes_max;
+			fs_args.tmpfs_args.ta_size_max =
+			fs_args32.tmpfs_args.ta_size_max;
+			fs_args.tmpfs_args.ta_root_uid =
+			fs_args32.tmpfs_args.ta_root_uid;
+			fs_args.tmpfs_args.ta_root_gid =
+			fs_args32.tmpfs_args.ta_root_gid;
+			fs_args.tmpfs_args.ta_root_mode =
+			fs_args32.tmpfs_args.ta_root_mode;
+		}
+		data_seg = UIO_SYSSPACE;
+		data = &fs_args.tmpfs_args;
+		data_len = sizeof(fs_args.tmpfs_args);
+	} else if (strcmp(mtype, MOUNT_MFS) == 0) {
 		if (data_len != sizeof(fs_args32.mfs_args))
 			return EINVAL;
 		if ((flags & MNT_GETARGS) == 0) {
@@ -937,7 +964,24 @@ netbsd32___mount50(struct lwp *l, const 
 		return error;
 	if (flags & MNT_GETARGS) {
 		data_len = *retval;
-		if (strcmp(mtype, MOUNT_MFS) == 0) {
+		if (strcmp(mtype, MOUNT_TMPFS) == 0) {
+			if (data_len != sizeof(fs_args.tmpfs_args))
+return EINVAL;
+			fs_args32.tmpfs_args.ta_version =
+			fs_args.tmpfs_args.ta_version;
+			fs_args32.tmpfs_args.ta_nodes_max =
+			fs_args.tmpfs_args.ta_nodes_max;
+			fs_args32.tmpfs_args.ta_size_max =
+			fs_args.tmpfs_args.ta_size_max;
+			fs_args32.

CVS commit: src/sys/fs/puffs

2014-10-05 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Sun Oct  5 20:40:46 UTC 2014

Modified Files:
src/sys/fs/puffs: puffs_sys.h

Log Message:
Add close brace, accidentally omitted from previous change.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/fs/puffs/puffs_sys.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/fs/puffs/puffs_sys.h
diff -u src/sys/fs/puffs/puffs_sys.h:1.87 src/sys/fs/puffs/puffs_sys.h:1.88
--- src/sys/fs/puffs/puffs_sys.h:1.87	Sun Oct  5 14:13:14 2014
+++ src/sys/fs/puffs/puffs_sys.h	Sun Oct  5 20:40:46 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_sys.h,v 1.87 2014/10/05 14:13:14 apb Exp $	*/
+/*	$NetBSD: puffs_sys.h,v 1.88 2014/10/05 20:40:46 apb Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006  Antti Kantee.  All Rights Reserved.
@@ -65,10 +65,10 @@ extern struct pool puffs_vapool;
 extern int puffsdebug; /* puffs_subr.c */
 #define DPRINTF(x) do { \
 		if (puffsdebug > 0) printf x; \
-	while (/*CONSTCOND*/0)
+	} while (/*CONSTCOND*/0)
 #define DPRINTF_VERBOSE(x) do { \
 		if (puffsdebug > 1) printf x; \
-	while (/*CONSTCOND*/0)
+	} while (/*CONSTCOND*/0)
 #else
 #define DPRINTF(x) ((void)0)
 #define DPRINTF_VERBOSE(x) ((void)0)



CVS commit: src/usr.sbin/crash

2014-10-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  5 22:58:43 UTC 2014

Modified Files:
src/usr.sbin/crash: crash.8 crash.c

Log Message:
add -w


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/crash/crash.8
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/crash/crash.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.sbin/crash/crash.8
diff -u src/usr.sbin/crash/crash.8:1.3 src/usr.sbin/crash/crash.8:1.4
--- src/usr.sbin/crash/crash.8:1.3	Sun Apr 10 18:49:52 2011
+++ src/usr.sbin/crash/crash.8	Sun Oct  5 18:58:43 2014
@@ -1,4 +1,4 @@
-.\"	$NetBSD: crash.8,v 1.3 2011/04/10 22:49:52 pgoyette Exp $
+.\"	$NetBSD: crash.8,v 1.4 2014/10/05 22:58:43 christos Exp $
 .\"
 .\" Copyright (c) 2009 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 March 7, 2009
+.Dd October 5, 2014
 .Dt CRASH 8
 .Os
 .Sh NAME
@@ -37,6 +37,7 @@
 .Nm
 .Op Fl M Ar core
 .Op Fl N Ar kernel
+.Op Fl w
 .Sh DESCRIPTION
 The
 .Nm
@@ -58,6 +59,8 @@ and must be uncompressed.
 .It Fl N Ar kernel
 Extract the name list from the specified kernel instead of the default
 .Pa /dev/ksyms .
+.It Fl w
+Enable writing.
 .El
 .Pp
 The command syntax used by

Index: src/usr.sbin/crash/crash.c
diff -u src/usr.sbin/crash/crash.c:1.5 src/usr.sbin/crash/crash.c:1.6
--- src/usr.sbin/crash/crash.c:1.5	Sun Mar 10 15:32:29 2013
+++ src/usr.sbin/crash/crash.c	Sun Oct  5 18:58:43 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: crash.c,v 1.5 2013/03/10 19:32:29 christos Exp $	*/
+/*	$NetBSD: crash.c,v 1.6 2014/10/05 22:58:43 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: crash.c,v 1.5 2013/03/10 19:32:29 christos Exp $");
+__RCSID("$NetBSD: crash.c,v 1.6 2014/10/05 22:58:43 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -329,19 +329,20 @@ main(int argc, char **argv)
 	struct stat sb;
 	size_t sz;
 	void *elf;
-	int fd, ch;
+	int fd, ch, flags;
 	char c;
 
 	nlistf = _PATH_KSYMS;
 	memf = _PATH_MEM;
 	ofp = stdout;
+	flags = O_RDONLY;
 
 	setprogname(argv[0]);
 
 	/*
 	 * Parse options.
 	 */
-	while ((ch = getopt(argc, argv, "M:N:")) != -1) {
+	while ((ch = getopt(argc, argv, "M:N:w")) != -1) {
 		switch (ch) {
 		case 'M':
 			memf = optarg;
@@ -349,6 +350,9 @@ main(int argc, char **argv)
 		case 'N':
 			nlistf = optarg;
 			break;
+		case 'w':
+			flags = O_RDWR;
+			break;
 		default:
 			usage();
 		}
@@ -364,7 +368,7 @@ main(int argc, char **argv)
 	/*
 	 * Open the images (crash dump and symbol table).
 	 */
-	kd = kvm_open(nlistf, memf, NULL, O_RDONLY, getprogname());
+	kd = kvm_open(nlistf, memf, NULL, flags, getprogname());
 	if (kd == NULL) {
 		return EXIT_FAILURE;
 	}



CVS commit: src/usr.sbin/crash

2014-10-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Oct  5 23:08:01 UTC 2014

Modified Files:
src/usr.sbin/crash: crash.8 crash.c

Log Message:
usage police
XXX: is the program usage correct? (/dev/ksyms)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/crash/crash.8
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/crash/crash.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.sbin/crash/crash.8
diff -u src/usr.sbin/crash/crash.8:1.4 src/usr.sbin/crash/crash.8:1.5
--- src/usr.sbin/crash/crash.8:1.4	Sun Oct  5 22:58:43 2014
+++ src/usr.sbin/crash/crash.8	Sun Oct  5 23:08:01 2014
@@ -1,4 +1,4 @@
-.\"	$NetBSD: crash.8,v 1.4 2014/10/05 22:58:43 christos Exp $
+.\"	$NetBSD: crash.8,v 1.5 2014/10/05 23:08:01 wiz Exp $
 .\"
 .\" Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -35,9 +35,9 @@
 .Nd examine and debug system images
 .Sh SYNOPSIS
 .Nm
+.Op Fl w
 .Op Fl M Ar core
 .Op Fl N Ar kernel
-.Op Fl w
 .Sh DESCRIPTION
 The
 .Nm

Index: src/usr.sbin/crash/crash.c
diff -u src/usr.sbin/crash/crash.c:1.6 src/usr.sbin/crash/crash.c:1.7
--- src/usr.sbin/crash/crash.c:1.6	Sun Oct  5 22:58:43 2014
+++ src/usr.sbin/crash/crash.c	Sun Oct  5 23:08:01 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: crash.c,v 1.6 2014/10/05 22:58:43 christos Exp $	*/
+/*	$NetBSD: crash.c,v 1.7 2014/10/05 23:08:01 wiz Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: crash.c,v 1.6 2014/10/05 22:58:43 christos Exp $");
+__RCSID("$NetBSD: crash.c,v 1.7 2014/10/05 23:08:01 wiz Exp $");
 #endif /* not lint */
 
 #include 
@@ -306,9 +306,9 @@ usage(void)
 {
 
 	fprintf(stderr,
-	"usage: %s [options]\n\n"
-	"-M mem\tspecify memory file\n"
-	"-N nlist\tspecify name list file (default /dev/ksyms)\n",
+	"usage: %s [-w] [-M core] [-N kernel]\n\n"
+	"-M core\tspecify memory file\n"
+	"-N kernel\tspecify name list file (default /dev/ksyms)\n",
 	getprogname());
 	exit(EXIT_FAILURE);
 }



CVS commit: src/sys/fs/puffs

2014-10-05 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Mon Oct  6 04:41:59 UTC 2014

Modified Files:
src/sys/fs/puffs: puffs_vnops.c

Log Message:
Improve zero-fill of last page after shrink fix:
1) do it only if the file is open for writing, otherwise we send write
requests to the FS on a file that has never been open.
2) do it inside existing if (vap->va_size != VNOVAL) block


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/sys/fs/puffs/puffs_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/puffs/puffs_vnops.c
diff -u src/sys/fs/puffs/puffs_vnops.c:1.189 src/sys/fs/puffs/puffs_vnops.c:1.190
--- src/sys/fs/puffs/puffs_vnops.c:1.189	Sun Oct  5 09:28:24 2014
+++ src/sys/fs/puffs/puffs_vnops.c	Mon Oct  6 04:41:59 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_vnops.c,v 1.189 2014/10/05 09:28:24 justin Exp $	*/
+/*	$NetBSD: puffs_vnops.c,v 1.190 2014/10/06 04:41:59 manu Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.189 2014/10/05 09:28:24 justin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.190 2014/10/06 04:41:59 manu Exp $");
 
 #include 
 #include 
@@ -1141,6 +1141,9 @@ zerofill_lastpage(struct vnode *vp, voff
 
 	if (trunc_page(off) == off)
 		return;
+ 
+	if (vp->v_writecount == 0)
+		return;
 
 	len = round_page(off) - off;
 	memset(zbuf, 0, len);
@@ -1157,7 +1160,7 @@ zerofill_lastpage(struct vnode *vp, voff
 	error = ubc_uiomove(&vp->v_uobj, &uio, len,
 			UVM_ADV_SEQUENTIAL, UBC_WRITE|UBC_UNMAP_FLAG(vp));
 	if (error)
-		DPRINTF(("zero-fill 0x%lx@0x%" PRIx64 " => %d\n", len, off, error));
+		DPRINTF(("zero-fill 0x%lx@0x%llx => %d\n", len, off, error));
 
 	return;
 }
@@ -1168,6 +1171,7 @@ dosetattr(struct vnode *vp, struct vattr
 	PUFFS_MSG_VARS(vn, setattr);
 	struct puffs_mount *pmp = MPTOPUFFSMP(vp->v_mount);
 	struct puffs_node *pn = vp->v_data;
+	vsize_t oldsize = vp->v_size;
 	int error = 0;
 
 	KASSERT(!(flags & SETATTR_CHSIZE) || mutex_owned(&pn->pn_sizemtx));
@@ -1223,17 +1227,6 @@ dosetattr(struct vnode *vp, struct vattr
 	if ((flags & SETATTR_ASYNC) == 0)
 		error = puffs_msg_wait2(pmp, park_setattr, vp->v_data, NULL);
 
-	/*
-	 * If we truncate the file, make sure we zero-fill
-	 * the end of the last page, otherwise if the file
-	 * is later truncated to a larger size (creating a
-	 * a hole), that area will not return zeroes as it
-	 * should.
-	 */
-	if ((error == 0) && (flags & SETATTR_CHSIZE) &&
-	(vap->va_size != VNOVAL) && (vap->va_size < vp->v_size))
-		zerofill_lastpage(vp, vap->va_size);
-
 	if ((error == 0) && PUFFS_USE_FS_TTL(pmp)) {
 		struct timespec *va_ttl = &setattr_msg->pvnr_va_ttl;
 		struct vattr *rvap = &setattr_msg->pvnr_va;
@@ -1251,6 +1244,17 @@ dosetattr(struct vnode *vp, struct vattr
 	}
 
 	if (vap->va_size != VNOVAL) {
+		/*
+		 * If we truncated the file, make sure the data beyond 
+		 * EOF in last page does not remain in cache, otherwise 
+		 * if the file is later truncated to a larger size (creating
+		 * a hole), that area will not return zeroes as it
+		 * should. 
+		 */
+		if ((flags & SETATTR_CHSIZE) && PUFFS_USE_PAGECACHE(pmp) && 
+		(vap->va_size < oldsize))
+			zerofill_lastpage(vp, vap->va_size);
+
 		pn->pn_serversize = vap->va_size;
 		if (flags & SETATTR_CHSIZE)
 			uvm_vnp_setsize(vp, vap->va_size);