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

2011-02-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb  3 10:06:07 UTC 2011

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

Log Message:
* fix blkno-offset calculation for simulated non-512 devices
* allows transfers only in multiples of block size
* g/c unused struct member


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/rump/librump/rumpvfs/rumpblk.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/rumpblk.c
diff -u src/sys/rump/librump/rumpvfs/rumpblk.c:1.43 src/sys/rump/librump/rumpvfs/rumpblk.c:1.44
--- src/sys/rump/librump/rumpvfs/rumpblk.c:1.43	Wed Feb  2 15:55:22 2011
+++ src/sys/rump/librump/rumpvfs/rumpblk.c	Thu Feb  3 10:06:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpblk.c,v 1.43 2011/02/02 15:55:22 pooka Exp $	*/
+/*	$NetBSD: rumpblk.c,v 1.44 2011/02/03 10:06:06 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rumpblk.c,v 1.43 2011/02/02 15:55:22 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: rumpblk.c,v 1.44 2011/02/03 10:06:06 pooka Exp $);
 
 #include sys/param.h
 #include sys/buf.h
@@ -99,7 +99,6 @@
 static struct rblkdev {
 	char *rblk_path;
 	int rblk_fd;
-	int rblk_opencnt;
 #ifdef HAS_ODIRECT
 	int rblk_dfd;
 #endif
@@ -467,7 +466,6 @@
 
 	rblk = minors[i];
 	KASSERT(rblk-rblk_fd == -1);
-	KASSERT(rblk-rblk_opencnt == 0);
 
 	wincleanup(rblk);
 	free(rblk-rblk_path, M_TEMP);
@@ -632,6 +630,11 @@
 	int async = bp-b_flags  B_ASYNC;
 	int error;
 
+	if (bp-b_bcount % (1sectshift) != 0) {
+		rump_biodone(bp, 0, EINVAL);
+		return;
+	}
+
 	/* collect statistics */
 	ev_io_total.ev_count++;
 	if (async)
@@ -644,7 +647,13 @@
 		ev_bread_total.ev_count++;
 	}
 
-	off = bp-b_blkno  sectshift;
+	/*
+	 * b_blkno is always in terms of DEV_BSIZE, and since we need
+	 * to translate to a byte offset for the host read, this
+	 * calculation does not need sectshift.
+	 */
+	off = bp-b_blkno  DEV_BSHIFT;
+
 	/*
 	 * Do bounds checking if we're working on a file.  Otherwise
 	 * invalid file systems might attempt to read beyond EOF.  This



CVS commit: src/lib/librumpvfs

2011-02-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb  3 10:21:58 UTC 2011

Modified Files:
src/lib/librumpvfs: rump_etfs.3

Log Message:
fix prototype, document RUMP_ETFS_SIZE_ENDOFF


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/librumpvfs/rump_etfs.3

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

Modified files:

Index: src/lib/librumpvfs/rump_etfs.3
diff -u src/lib/librumpvfs/rump_etfs.3:1.4 src/lib/librumpvfs/rump_etfs.3:1.5
--- src/lib/librumpvfs/rump_etfs.3:1.4	Tue Nov 30 22:00:01 2010
+++ src/lib/librumpvfs/rump_etfs.3	Thu Feb  3 10:21:58 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: rump_etfs.3,v 1.4 2010/11/30 22:00:01 wiz Exp $
+.\ $NetBSD: rump_etfs.3,v 1.5 2011/02/03 10:21:58 pooka Exp $
 .\
 .\ Copyright (c) 2010 Antti Kantee.  All rights reserved.
 .\
@@ -23,7 +23,7 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd November 30, 2010
+.Dd February 3, 2011
 .Dt RUMP_ETFS 3
 .Os
 .Sh NAME
@@ -40,7 +40,7 @@
 .Ft int
 .Fo rump_pub_etfs_register_withsize
 .Fa const char *key const char *hostpath enum rump_etfs_type ftype
-.Fa uint64_t begin uint64_t end
+.Fa uint64_t begin uint64_t size
 .Fc
 .Ft int
 .Fn rump_pub_etfs_remove const char *key
@@ -115,6 +115,13 @@
 .Fa hostpath .
 This is useful when mapping disk images where only one partition is
 relevant to the application.
+If
+.Ar size
+is given the special value
+.Dv RUMP_ETFS_SIZE_ENDOFF ,
+the underlying file is mapped from
+.Ar begin
+to the end of the file.
 .It Fn rump_pub_etfs_remove key
 Remove etfs mapping for
 .Fa key .



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

2011-02-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb  3 11:01:52 UTC 2011

Modified Files:
src/sys/rump/librump/rumpkern: rump.c

Log Message:
weakalias the withsize variant of rump_pub_etfs_register too


To generate a diff of this commit:
cvs rdiff -u -r1.227 -r1.228 src/sys/rump/librump/rumpkern/rump.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/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.227 src/sys/rump/librump/rumpkern/rump.c:1.228
--- src/sys/rump/librump/rumpkern/rump.c:1.227	Sun Jan 30 16:31:42 2011
+++ src/sys/rump/librump/rumpkern/rump.c	Thu Feb  3 11:01:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.227 2011/01/30 16:31:42 bouyer Exp $	*/
+/*	$NetBSD: rump.c,v 1.228 2011/02/03 11:01:51 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rump.c,v 1.227 2011/01/30 16:31:42 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: rump.c,v 1.228 2011/02/03 11:01:51 pooka Exp $);
 
 #include sys/systm.h
 #define ELFSIZE ARCH_ELFSIZE
@@ -155,6 +155,7 @@
 
 /* easier to write vfs-less clients */
 __weak_alias(rump_pub_etfs_register,rump__unavailable);
+__weak_alias(rump_pub_etfs_register_withsize,rump__unavailable);
 __weak_alias(rump_pub_etfs_remove,rump__unavailable);
 
 rump_proc_vfs_init_fn rump_proc_vfs_init;



CVS commit: src/usr.bin/rump_allserver

2011-02-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb  3 11:21:16 UTC 2011

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

Log Message:
* make it possible to specify an offset in -d
* truncate -d hostpath only if it's a regular file and smaller
  than offset+size


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/rump_allserver/rump_allserver.1
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/rump_allserver/rump_allserver.c

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

Modified files:

Index: src/usr.bin/rump_allserver/rump_allserver.1
diff -u src/usr.bin/rump_allserver/rump_allserver.1:1.8 src/usr.bin/rump_allserver/rump_allserver.1:1.9
--- src/usr.bin/rump_allserver/rump_allserver.1:1.8	Sat Jan  8 09:36:26 2011
+++ src/usr.bin/rump_allserver/rump_allserver.1	Thu Feb  3 11:21:16 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: rump_allserver.1,v 1.8 2011/01/08 09:36:26 pooka Exp $
+.\	$NetBSD: rump_allserver.1,v 1.9 2011/02/03 11:21:16 pooka Exp $
 .\
 .\ Copyright (c) 2010 Antti Kantee.  All rights reserved.
 .\
@@ -91,6 +91,25 @@
 .Xr dd 1 ,
 this argument accepts a suffix as the multiplier for the number.
 .El
+.Pp
+The following specifier is optional:
+.Bl -tag -width hostpath1234
+.It Ar offset
+Offset of the mapping.
+The window into
+.Ar hostpath
+therefore is
+.Fa [ offset , offset+size ] .
+In case this parameter is not given, the default value 0 is used.
+.El
+.Pp
+In case
+.Ar hostpath
+does not exist, it will be created as a regular file.
+In case
+.Ar hostpath
+is a regular file and is not large enough to accommodate the
+specified size, it will be extended to the specified size.
 .It Fl l Ar library
 Call
 .Fn dlopen

Index: src/usr.bin/rump_allserver/rump_allserver.c
diff -u src/usr.bin/rump_allserver/rump_allserver.c:1.13 src/usr.bin/rump_allserver/rump_allserver.c:1.14
--- src/usr.bin/rump_allserver/rump_allserver.c:1.13	Mon Jan  3 12:18:25 2011
+++ src/usr.bin/rump_allserver/rump_allserver.c	Thu Feb  3 11:21:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_allserver.c,v 1.13 2011/01/03 12:18:25 wiz Exp $	*/
+/*	$NetBSD: rump_allserver.c,v 1.14 2011/02/03 11:21:16 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: rump_allserver.c,v 1.13 2011/01/03 12:18:25 wiz Exp $);
+__RCSID($NetBSD: rump_allserver.c,v 1.14 2011/02/03 11:21:16 pooka Exp $);
 #endif /* !lint */
 
 #include sys/types.h
@@ -81,6 +81,8 @@
 	hostpath,
 #define DSIZE 2
 	size,
+#define DOFFSET 3
+	offset,
 	NULL
 };
 
@@ -88,6 +90,7 @@
 	const char *key;
 	const char *hostpath;
 	off_t flen;
+	off_t foffset;
 	enum rump_etfs_type type;
 };
 
@@ -119,9 +122,9 @@
 		case 'd': {
 			char *options, *value;
 			char *key, *hostpath;
-			long long flen;
+			long long flen, foffset;
 
-			flen = 0;
+			flen = foffset = 0;
 			key = hostpath = NULL;
 			options = optarg;
 			while (*options) {
@@ -153,6 +156,16 @@
 	flen = strsuftoll(-d size, value,
 	0, LLONG_MAX);
 	break;
+case DOFFSET:
+	if (foffset != 0) {
+		fprintf(stderr,
+		offset already given\n);
+		usage();
+	}
+	/* XXX: off_t max? */
+	foffset = strsuftoll(-d offset, value,
+	0, LLONG_MAX);
+	break;
 default:
 	fprintf(stderr, invalid dtoken\n);
 	usage();
@@ -175,6 +188,7 @@
 			etfs[curetfs].key = key;
 			etfs[curetfs].hostpath = hostpath;
 			etfs[curetfs].flen = flen;
+			etfs[curetfs].foffset = foffset;
 			etfs[curetfs].type = RUMP_ETFS_BLK;
 			curetfs++;
 
@@ -247,17 +261,25 @@
 
 	/* register host drives */
 	for (i = 0; i  curetfs; i++) {
+		struct stat sb;
+		off_t fsize;
 		int fd;
 
+		fsize = etfs[i].foffset + etfs[i].flen;
 		fd = open(etfs[i].hostpath, O_RDWR | O_CREAT, 0755);
 		if (fd == -1)
-			die(sflag, error, etfs hostpath create);
-		if (ftruncate(fd, etfs[i].flen) == -1)
-			die(sflag, error, truncate);
+			die(sflag, errno, etfs hostpath create);
+		if (fstat(fd, sb) == -1)
+			die(sflag, errno, fstat etfs hostpath);
+		if (S_ISREG(sb.st_mode)  sb.st_size  fsize) {
+			if (ftruncate(fd, fsize) == -1)
+die(sflag, errno, truncate);
+		}
 		close(fd);
 
-		if ((error = rump_pub_etfs_register(etfs[i].key,
-		etfs[i].hostpath, etfs[i].type)) != 0)
+		if ((error = rump_pub_etfs_register_withsize(etfs[i].key,
+		etfs[i].hostpath, etfs[i].type,
+		etfs[i].foffset, etfs[i].flen)) != 0)
 			die(sflag, error, etfs register);
 	}
 



CVS commit: src/usr.bin/rump_allserver

2011-02-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb  3 11:21:43 UTC 2011

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

Log Message:
whoopsie, bump date


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/rump_allserver/rump_allserver.1

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

Modified files:

Index: src/usr.bin/rump_allserver/rump_allserver.1
diff -u src/usr.bin/rump_allserver/rump_allserver.1:1.9 src/usr.bin/rump_allserver/rump_allserver.1:1.10
--- src/usr.bin/rump_allserver/rump_allserver.1:1.9	Thu Feb  3 11:21:16 2011
+++ src/usr.bin/rump_allserver/rump_allserver.1	Thu Feb  3 11:21:43 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: rump_allserver.1,v 1.9 2011/02/03 11:21:16 pooka Exp $
+.\	$NetBSD: rump_allserver.1,v 1.10 2011/02/03 11:21:43 pooka Exp $
 .\
 .\ Copyright (c) 2010 Antti Kantee.  All rights reserved.
 .\
@@ -23,7 +23,7 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd January 3, 2011
+.Dd February 3, 2011
 .Dt RUMP_SERVER 1
 .Os
 .Sh NAME



CVS commit: src/usr.bin/rump_allserver

2011-02-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb  3 11:25:27 UTC 2011

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

Log Message:
Create backing image with mode 0644 instead of 0755  document this.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/rump_allserver/rump_allserver.1
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/rump_allserver/rump_allserver.c

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

Modified files:

Index: src/usr.bin/rump_allserver/rump_allserver.1
diff -u src/usr.bin/rump_allserver/rump_allserver.1:1.10 src/usr.bin/rump_allserver/rump_allserver.1:1.11
--- src/usr.bin/rump_allserver/rump_allserver.1:1.10	Thu Feb  3 11:21:43 2011
+++ src/usr.bin/rump_allserver/rump_allserver.1	Thu Feb  3 11:25:27 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: rump_allserver.1,v 1.10 2011/02/03 11:21:43 pooka Exp $
+.\	$NetBSD: rump_allserver.1,v 1.11 2011/02/03 11:25:27 pooka Exp $
 .\
 .\ Copyright (c) 2010 Antti Kantee.  All rights reserved.
 .\
@@ -105,7 +105,8 @@
 .Pp
 In case
 .Ar hostpath
-does not exist, it will be created as a regular file.
+does not exist, it will be created as a regular file with mode
+0644 (plus any restrictions placed by umask).
 In case
 .Ar hostpath
 is a regular file and is not large enough to accommodate the

Index: src/usr.bin/rump_allserver/rump_allserver.c
diff -u src/usr.bin/rump_allserver/rump_allserver.c:1.14 src/usr.bin/rump_allserver/rump_allserver.c:1.15
--- src/usr.bin/rump_allserver/rump_allserver.c:1.14	Thu Feb  3 11:21:16 2011
+++ src/usr.bin/rump_allserver/rump_allserver.c	Thu Feb  3 11:25:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_allserver.c,v 1.14 2011/02/03 11:21:16 pooka Exp $	*/
+/*	$NetBSD: rump_allserver.c,v 1.15 2011/02/03 11:25:27 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: rump_allserver.c,v 1.14 2011/02/03 11:21:16 pooka Exp $);
+__RCSID($NetBSD: rump_allserver.c,v 1.15 2011/02/03 11:25:27 pooka Exp $);
 #endif /* !lint */
 
 #include sys/types.h
@@ -266,7 +266,7 @@
 		int fd;
 
 		fsize = etfs[i].foffset + etfs[i].flen;
-		fd = open(etfs[i].hostpath, O_RDWR | O_CREAT, 0755);
+		fd = open(etfs[i].hostpath, O_RDWR | O_CREAT, 0644);
 		if (fd == -1)
 			die(sflag, errno, etfs hostpath create);
 		if (fstat(fd, sb) == -1)



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

2011-02-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb  3 15:36:30 UTC 2011

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

Log Message:
* open backend device once when the rumpblk is registered instead of
  every time the virtual device is opened.  this takes care of e.g.
  a midlife chmod crisis
* when mapping initial windows, consistently look at host size and
  host offset.  otherwise we might end up in a situation with 0
  initial windows mapped, and that will cause a crash later.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/rump/librump/rumpvfs/rumpblk.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/rumpblk.c
diff -u src/sys/rump/librump/rumpvfs/rumpblk.c:1.44 src/sys/rump/librump/rumpvfs/rumpblk.c:1.45
--- src/sys/rump/librump/rumpvfs/rumpblk.c:1.44	Thu Feb  3 10:06:06 2011
+++ src/sys/rump/librump/rumpvfs/rumpblk.c	Thu Feb  3 15:36:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpblk.c,v 1.44 2011/02/03 10:06:06 pooka Exp $	*/
+/*	$NetBSD: rumpblk.c,v 1.45 2011/02/03 15:36:30 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rumpblk.c,v 1.44 2011/02/03 10:06:06 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: rumpblk.c,v 1.45 2011/02/03 15:36:30 pooka Exp $);
 
 #include sys/param.h
 #include sys/buf.h
@@ -71,6 +71,15 @@
 #include rump_private.h
 #include rump_vfs_private.h
 
+/*
+ * O_DIRECT is the fastest alternative, but since it falls back to
+ * non-direct writes silently, I am not sure it will always be 100% safe.
+ * Use it and play with it, but do that with caution.
+ */
+#if 0
+#define HAS_ODIRECT
+#endif
+
 #if 0
 #define DPRINTF(x) printf x
 #else
@@ -99,6 +108,7 @@
 static struct rblkdev {
 	char *rblk_path;
 	int rblk_fd;
+	int rblk_mode;
 #ifdef HAS_ODIRECT
 	int rblk_dfd;
 #endif
@@ -152,6 +162,9 @@
 	rumpblk_ioctl, nostop, notty, nopoll, nommap, nokqfilter, D_DISK
 };
 
+static int backend_open(struct rblkdev *, const char *);
+static int backend_close(struct rblkdev *);
+
 /* fail every n out of BLKFAIL_MAX */
 #define BLKFAIL_MAX 1
 static int blkfail;
@@ -422,10 +435,12 @@
 	}
 
 	rblk = minors[i];
+	rblk-rblk_path = __UNCONST(taken);
+	mutex_exit(rumpblk_lock);
+
 	len = strlen(path);
 	rblk-rblk_path = malloc(len + 1, M_TEMP, M_WAITOK);
 	strcpy(rblk-rblk_path, path);
-	rblk-rblk_fd = -1;
 	rblk-rblk_hostoffset = offset;
 	if (size != RUMPBLK_SIZENOTSET) {
 		KASSERT(size + offset = flen);
@@ -437,7 +452,13 @@
 	rblk-rblk_hostsize = flen;
 	rblk-rblk_ftype = ftype;
 	makedefaultlabel(rblk-rblk_label, rblk-rblk_size, i);
-	mutex_exit(rumpblk_lock);
+
+	if ((error = backend_open(rblk, path)) != 0) {
+		memset(rblk-rblk_label, 0, sizeof(rblk-rblk_label));
+		free(rblk-rblk_path, M_TEMP);
+		rblk-rblk_path = NULL;
+		return error;
+	}
 
 	*dmin = i;
 	return 0;
@@ -465,41 +486,52 @@
 		return ENOENT;
 
 	rblk = minors[i];
-	KASSERT(rblk-rblk_fd == -1);
+	backend_close(rblk);
 
 	wincleanup(rblk);
 	free(rblk-rblk_path, M_TEMP);
-	rblk-rblk_path = NULL;
 	memset(rblk-rblk_label, 0, sizeof(rblk-rblk_label));
+	rblk-rblk_path = NULL;
 
 	return 0;
 }
 
-int
-rumpblk_open(dev_t dev, int flag, int fmt, struct lwp *l)
+static int
+backend_open(struct rblkdev *rblk, const char *path)
 {
-	struct rblkdev *rblk = minors[minor(dev)];
 	int error, fd;
 
-	if (rblk-rblk_path == NULL)
-		return ENXIO;
+	KASSERT(rblk-rblk_fd != -1);
+	fd = rumpuser_open(path, O_RDWR, error);
+	if (error) {
+		fd = rumpuser_open(path, O_RDONLY, error);
+		if (error)
+			return error;
+		rblk-rblk_mode = FREAD;
 
-	if (rblk-rblk_fd != -1)
-		return 0; /* XXX: refcount, open mode */
-	flag = ~O_TRUNC;
-	fd = rumpuser_open(rblk-rblk_path, OFLAGS(flag), error);
-	if (error)
-		return error;
+#ifdef HAS_ODIRECT
+		rblk-rblk_dfd = rumpuser_open(path,
+		O_RDONLY | O_DIRECT, error);
+		if (error) {
+			close(fd);
+			return error;
+		}
+#endif
+	} else {
+		rblk-rblk_mode = FREAD|FWRITE;
 
 #ifdef HAS_ODIRECT
-	rblk-rblk_dfd = rumpuser_open(rblk-rblk_path,
-	OFLAGS(flag) | O_DIRECT, error);
-	if (error)
-		return error;
+		rblk-rblk_dfd = rumpuser_open(path,
+		O_RDWR | O_DIRECT, error);
+		if (error) {
+			close(fd);
+			return error;
+		}
 #endif
+	}
 
 	if (rblk-rblk_ftype == RUMPUSER_FT_REG) {
-		uint64_t fsize = rblk-rblk_size, off = rblk-rblk_hostoffset;
+		uint64_t fsize= rblk-rblk_hostsize, off= rblk-rblk_hostoffset;
 		struct blkwin *win;
 		int i, winsize;
 
@@ -510,9 +542,9 @@
 		 */
 
 		rblk-rblk_mmflags = 0;
-		if (flag  FREAD)
+		if (rblk-rblk_mode  FREAD)
 			rblk-rblk_mmflags |= RUMPUSER_FILEMMAP_READ;
-		if (flag  FWRITE) {
+		if (rblk-rblk_mode  FWRITE) {
 			rblk-rblk_mmflags |= RUMPUSER_FILEMMAP_WRITE;
 			rblk-rblk_mmflags |= RUMPUSER_FILEMMAP_SHARED;
 		}
@@ -548,10 +580,9 @@
 	return 0;
 }
 
-int
-rumpblk_close(dev_t 

CVS commit: src/tests

2011-02-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb  3 15:38:19 UTC 2011

Modified Files:
src/tests: Makefile
Added Files:
src/tests/usr.bin/rump_server: Makefile t_disk.sh

Log Message:
add tests for the -d functionality of rump_server(1)


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/rump_server/Makefile \
src/tests/usr.bin/rump_server/t_disk.sh

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

Modified files:

Index: src/tests/Makefile
diff -u src/tests/Makefile:1.28 src/tests/Makefile:1.29
--- src/tests/Makefile:1.28	Fri Jan  7 01:07:31 2011
+++ src/tests/Makefile	Thu Feb  3 15:38:18 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.28 2011/01/07 01:07:31 pgoyette Exp $
+# $NetBSD: Makefile,v 1.29 2011/02/03 15:38:18 pooka Exp $
 
 .include bsd.own.mk
 
@@ -8,7 +8,7 @@
 ATFFILE=	yes
 
 SUBDIR=		crypto dev fs games include ipf kernel lib libexec net
-SUBDIR+=	rump sbin sys syscall usr.sbin util
+SUBDIR+=	rump sbin sys syscall usr.bin usr.sbin util
 
 . if ${MACHINE} != evbppc  ${MKKMOD} != no
 SUBDIR+= modules

Added files:

Index: src/tests/usr.bin/rump_server/Makefile
diff -u /dev/null src/tests/usr.bin/rump_server/Makefile:1.1
--- /dev/null	Thu Feb  3 15:38:19 2011
+++ src/tests/usr.bin/rump_server/Makefile	Thu Feb  3 15:38:18 2011
@@ -0,0 +1,10 @@
+#	$NetBSD: Makefile,v 1.1 2011/02/03 15:38:18 pooka Exp $
+#
+
+.include bsd.own.mk
+
+TESTSDIR=	${TESTSBASE}/usr.bin/rump_server
+
+TESTS_SH=	t_disk
+
+.include bsd.test.mk
Index: src/tests/usr.bin/rump_server/t_disk.sh
diff -u /dev/null src/tests/usr.bin/rump_server/t_disk.sh:1.1
--- /dev/null	Thu Feb  3 15:38:19 2011
+++ src/tests/usr.bin/rump_server/t_disk.sh	Thu Feb  3 15:38:18 2011
@@ -0,0 +1,95 @@
+#	$NetBSD: t_disk.sh,v 1.1 2011/02/03 15:38:18 pooka Exp $
+#
+# Copyright (c) 2011 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+server='rump_server -lrumpvfs'
+export RUMP_SERVER='unix://commsock'
+
+startsrv()
+{
+
+	atf_check -s exit:0 ${server} $@ ${RUMP_SERVER}
+}
+
+test_case()
+{
+	local name=${1}; shift
+
+	atf_test_case ${name} cleanup
+	eval ${name}_head() {  }
+	eval ${name}_body() { \
+		${name}_prefun ; \
+		startsrv $@ ; \
+		${name} ; \
+	}
+	eval ${name}_cleanup() { \
+		[ -f halted ]  return 0 ; rump.halt ;
+	}
+}
+
+test_case size -d key=/img,hostpath=the.img,size=32k
+size()
+{
+	atf_check -s exit:0 -o inline:'32768\n' stat -f %z the.img
+}
+
+test_case offset -d key=/img,hostpath=the.img,size=32k,offset=16k
+offset()
+{
+	atf_check -s exit:0 -o inline:'49152\n' stat -f %z the.img
+}
+
+test_case notrunc -d key=/img,hostpath=the.img,size=8k,offset=16k
+notrunc_prefun()
+{
+	dd if=/dev/zero of=the.img bs=1 oseek=65535 count=1 
+}
+notrunc()
+{
+	atf_check -s exit:0 -o inline:'65536\n' stat -f %z the.img
+}
+
+test_case data -d key=/img,hostpath=the.img,size=8k,offset=16k
+data()
+{
+	echo 'test string' | dd of=testfile ibs=512 count=1 conv=sync
+	atf_check -s exit:0 -e ignore dd if=testfile rof=/img bs=512 count=1
+
+	# cheap fsync
+	atf_check -s exit:0 rump.halt
+	touch halted
+	atf_check -s exit:0 -e ignore -o file:testfile \
+	dd if=the.img iseek=16k bs=1 count=512
+}
+
+atf_init_test_cases()
+{
+
+	atf_add_test_case size
+	atf_add_test_case offset
+	atf_add_test_case notrunc
+	atf_add_test_case data
+}



CVS commit: src

2011-02-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb  3 15:39:50 UTC 2011

Modified Files:
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests

Log Message:
+ tests/usr.bin
+ tests/usr.bin/rump_server


To generate a diff of this commit:
cvs rdiff -u -r1.241 -r1.242 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.23 -r1.24 src/etc/mtree/NetBSD.dist.tests

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.241 src/distrib/sets/lists/tests/mi:1.242
--- src/distrib/sets/lists/tests/mi:1.241	Mon Jan 24 17:52:07 2011
+++ src/distrib/sets/lists/tests/mi	Thu Feb  3 15:39:50 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.241 2011/01/24 17:52:07 pooka Exp $
+# $NetBSD: mi,v 1.242 2011/02/03 15:39:50 pooka Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -533,6 +533,7 @@
 ./usr/libdata/debug/usr/tests/syscall	tests-syscall-debug
 ./usr/libdata/debug/usr/tests/syscall/t_cmsg.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall/t_timer.debug			tests-syscall-debug	debug,atf
+./usr/libdata/debug/usr/tests/usr.bin	tests-sbin-tests
 ./usr/libdata/debug/usr/tests/usr.sbin	tests-sbin-tests
 ./usr/libdata/debug/usr/tests/util	tests-util-debug
 ./usr/libdata/debug/usr/tests/util/df	tests-util-debug
@@ -1989,6 +1990,11 @@
 ./usr/tests/syscall/Atffile			tests-syscall-tests	atf
 ./usr/tests/syscall/t_cmsg			tests-syscall-tests	atf
 ./usr/tests/syscall/t_timer			tests-syscall-tests	atf
+./usr/tests/usr.bintests-util-tests
+./usr/tests/usr.bin/Atffile			tests-sbin-tests	atf
+./usr/tests/usr.bin/rump_server			tests-util-tests
+./usr/tests/usr.bin/rump_server/Atffile		tests-util-tests	atf
+./usr/tests/usr.bin/rump_server/t_disk	tests-util-tests	atf
 ./usr/tests/usr.sbintests-util-tests
 ./usr/tests/usr.sbin/Atffile			tests-sbin-tests	atf
 ./usr/tests/usr.sbin/traceroute			tests-util-tests

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.23 src/etc/mtree/NetBSD.dist.tests:1.24
--- src/etc/mtree/NetBSD.dist.tests:1.23	Fri Jan 14 13:24:45 2011
+++ src/etc/mtree/NetBSD.dist.tests	Thu Feb  3 15:39:50 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.23 2011/01/14 13:24:45 pooka Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.24 2011/02/03 15:39:50 pooka Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -97,6 +97,7 @@
 ./usr/libdata/debug/usr/tests/sbin
 ./usr/libdata/debug/usr/tests/sbin/resize_ffs
 ./usr/libdata/debug/usr/tests/syscall
+./usr/libdata/debug/usr/tests/usr.bin
 ./usr/libdata/debug/usr/tests/usr.sbin
 ./usr/libdata/debug/usr/tests/util
 ./usr/libdata/debug/usr/tests/util/df
@@ -209,6 +210,8 @@
 ./usr/tests/sys
 ./usr/tests/sys/rc
 ./usr/tests/syscall
+./usr/tests/usr.bin
+./usr/tests/usr.bin/rump_server
 ./usr/tests/usr.sbin
 ./usr/tests/usr.sbin/traceroute
 ./usr/tests/util



CVS commit: [bouyer-quota2] src/usr.sbin/edquota

2011-02-03 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Feb  3 15:53:26 UTC 2011

Modified Files:
src/usr.sbin/edquota [bouyer-quota2]: edquota.c

Log Message:
Avoid core dump when a filesystem is specified and not found in
mounted filesystems.


To generate a diff of this commit:
cvs rdiff -u -r1.29.16.6 -r1.29.16.7 src/usr.sbin/edquota/edquota.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/edquota/edquota.c
diff -u src/usr.sbin/edquota/edquota.c:1.29.16.6 src/usr.sbin/edquota/edquota.c:1.29.16.7
--- src/usr.sbin/edquota/edquota.c:1.29.16.6	Mon Jan 31 15:26:31 2011
+++ src/usr.sbin/edquota/edquota.c	Thu Feb  3 15:53:25 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: edquota.c,v 1.29.16.6 2011/01/31 15:26:31 bouyer Exp $ */
+/*  $NetBSD: edquota.c,v 1.29.16.7 2011/02/03 15:53:25 bouyer Exp $ */
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = from: @(#)edquota.c	8.3 (Berkeley) 4/27/95;
 #else
-__RCSID($NetBSD: edquota.c,v 1.29.16.6 2011/01/31 15:26:31 bouyer Exp $);
+__RCSID($NetBSD: edquota.c,v 1.29.16.7 2011/02/03 15:53:25 bouyer Exp $);
 #endif
 #endif /* not lint */
 
@@ -401,11 +401,13 @@
 		qup-next = 0;
 	}
 
-	if (filesys) {
+	if (filesys  quphead == NULL) {
 		if (defaultq)
 			errx(1, no default quota for version 1);
 		/* if we get there, filesys is not mounted. try the old way */
 		qup = getprivs1(id, quotatype, filesys);
+		if (qup == NULL)
+			return NULL;
 		if (quphead == NULL)
 			quphead = qup;
 		else



CVS commit: [bouyer-quota2] src

2011-02-03 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Feb  3 15:56:16 UTC 2011

Modified Files:
src/sys/ufs/ufs [bouyer-quota2]: quota2.h quota2_subr.c ufs_quota2.c
src/tests/fs/ffs/clients [bouyer-quota2]: Makefile
src/usr.bin/quota [bouyer-quota2]: Makefile quota.c
src/usr.sbin/repquota [bouyer-quota2]: Makefile repquota.c

Log Message:
factor out code to chech a quota against its limits.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/ufs/ufs/quota2.h
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/ufs/ufs/quota2_subr.c
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/ufs/ufs/ufs_quota2.c
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/tests/fs/ffs/clients/Makefile
cvs rdiff -u -r1.6.64.3 -r1.6.64.4 src/usr.bin/quota/Makefile
cvs rdiff -u -r1.33.2.6 -r1.33.2.7 src/usr.bin/quota/quota.c
cvs rdiff -u -r1.5.64.2 -r1.5.64.3 src/usr.sbin/repquota/Makefile
cvs rdiff -u -r1.25.2.5 -r1.25.2.6 src/usr.sbin/repquota/repquota.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/ufs/quota2.h
diff -u src/sys/ufs/ufs/quota2.h:1.1.2.5 src/sys/ufs/ufs/quota2.h:1.1.2.6
--- src/sys/ufs/ufs/quota2.h:1.1.2.5	Mon Jan 31 15:19:21 2011
+++ src/sys/ufs/ufs/quota2.h	Thu Feb  3 15:56:16 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: quota2.h,v 1.1.2.5 2011/01/31 15:19:21 bouyer Exp $ */
+/* $NetBSD: quota2.h,v 1.1.2.6 2011/02/03 15:56:16 bouyer Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -57,7 +57,7 @@
 };
 
 /*
- * Description of a user or group quota
+ * On-disk description of a user or group quota
  * These entries are keept as linked list, either in one of the hash HEAD,
  * or in the free list.
  */
@@ -100,4 +100,16 @@
 void quota2_create_blk0(uint64_t, void *bp, int, int, int);
 void quota2_ufs_rwq2v(const struct quota2_val *, struct quota2_val *, int);
 void quota2_ufs_rwq2e(const struct quota2_entry *, struct quota2_entry *, int);
+
+int quota2_check_limit(struct quota2_val *, uint64_t, time_t);
+#define QL_S_ALLOW_OK	0x00 /* below soft limit */
+#define QL_S_ALLOW_SOFT	0x01 /* over soft limit */
+#define QL_S_DENY_GRACE	0x02 /* over soft limit, grace time expired */
+#define QL_S_DENY_HARD	0x03 /* over hard limit */
+
+#define QL_F_CROSS	0x80 /* crossing soft limit */
+
+#define QL_STATUS(x)	((x)  0x0f)
+#define QL_FLAGS(x)	((x)  0xf0)
+
 #endif /*  _UFS_UFS_QUOTA2_H_ */

Index: src/sys/ufs/ufs/quota2_subr.c
diff -u src/sys/ufs/ufs/quota2_subr.c:1.1.2.4 src/sys/ufs/ufs/quota2_subr.c:1.1.2.5
--- src/sys/ufs/ufs/quota2_subr.c:1.1.2.4	Mon Jan 31 15:24:10 2011
+++ src/sys/ufs/ufs/quota2_subr.c	Thu Feb  3 15:56:16 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: quota2_subr.c,v 1.1.2.4 2011/01/31 15:24:10 bouyer Exp $ */
+/* $NetBSD: quota2_subr.c,v 1.1.2.5 2011/02/03 15:56:16 bouyer Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -28,7 +28,7 @@
   */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: quota2_subr.c,v 1.1.2.4 2011/01/31 15:24:10 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: quota2_subr.c,v 1.1.2.5 2011/02/03 15:56:16 bouyer Exp $);
 
 #include sys/param.h
 #include sys/time.h
@@ -108,3 +108,21 @@
 	needswap);
 	d-q2e_uid = ufs_rw32(s-q2e_uid, needswap);
 }
+
+int
+quota2_check_limit(struct quota2_val *q2v, uint64_t change, time_t now)
+{
+	if (q2v-q2v_cur + change = q2v-q2v_hardlimit) {
+		if (q2v-q2v_cur  q2v-q2v_softlimit) 
+			return (QL_F_CROSS | QL_S_DENY_HARD);
+		return QL_S_DENY_HARD;
+	} else if (q2v-q2v_cur + change = q2v-q2v_softlimit) {
+		if (q2v-q2v_cur  q2v-q2v_softlimit)
+			return (QL_F_CROSS | QL_S_ALLOW_SOFT);
+		if (now  q2v-q2v_time) {
+			return QL_S_DENY_GRACE;
+		}
+		return QL_S_ALLOW_SOFT;
+	}
+	return QL_S_ALLOW_OK;
+}

Index: src/sys/ufs/ufs/ufs_quota2.c
diff -u src/sys/ufs/ufs/ufs_quota2.c:1.1.2.6 src/sys/ufs/ufs/ufs_quota2.c:1.1.2.7
--- src/sys/ufs/ufs/ufs_quota2.c:1.1.2.6	Mon Jan 31 15:24:11 2011
+++ src/sys/ufs/ufs/ufs_quota2.c	Thu Feb  3 15:56:16 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.1.2.6 2011/01/31 15:24:11 bouyer Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.1.2.7 2011/02/03 15:56:16 bouyer Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -28,7 +28,7 @@
   */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.1.2.6 2011/01/31 15:24:11 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.1.2.7 2011/02/03 15:56:16 bouyer Exp $);
 
 #include sys/buf.h
 #include sys/param.h
@@ -357,10 +357,11 @@
 	int error;
 	struct buf *bp[MAXQUOTAS];
 	struct quota2_entry *q2e[MAXQUOTAS];
-	struct quota2_val *q2v;
+	struct quota2_val *q2vp;
 	struct dquot *dq;
-	uint64_t ncurblks, soft, hard;
+	uint64_t ncurblks;
 	struct ufsmount *ump = ip-i_ump;
+	struct mount *mp = ump-um_mountp;
 	const int needswap = UFS_MPNEEDSWAP(ump);
 	int i;
 
@@ -386,13 +387,13 @@
 mutex_exit(dq-dq_interlock);
 continue;
 			}
-			q2v = q2e[i]-q2e_val[vtype];

CVS commit: src/tests/usr.bin

2011-02-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb  3 17:21:18 UTC 2011

Added Files:
src/tests/usr.bin: Makefile

Log Message:
commit works better when you cvs add first


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/Makefile

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

Added files:

Index: src/tests/usr.bin/Makefile
diff -u /dev/null src/tests/usr.bin/Makefile:1.1
--- /dev/null	Thu Feb  3 17:21:18 2011
+++ src/tests/usr.bin/Makefile	Thu Feb  3 17:21:17 2011
@@ -0,0 +1,10 @@
+#	$NetBSD: Makefile,v 1.1 2011/02/03 17:21:17 pooka Exp $
+#
+
+.include bsd.own.mk
+
+TESTSDIR=   ${TESTSBASE}/usr.bin
+
+TESTS_SUBDIRS+= rump_server
+
+.include bsd.test.mk



CVS commit: [bouyer-quota2] src

2011-02-03 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Feb  3 17:36:31 UTC 2011

Modified Files:
src/sys/ufs/ufs [bouyer-quota2]: quota1_subr.c quota2_subr.c
src/tests/fs/ffs [bouyer-quota2]: h_quota2_tests.c t_quotalimit.sh

Log Message:
Change semantic of limits to allow up to the limit inclued (instead of
up to one less than the limit: I feel that if my limit is 1000 inodes
I should be able to create 1000 files, not 999).
Keep the previous semantic for quota1 dquot, the conversion functions
will add or remove 1 when converting limits from/to the new format.

Adjust test for this change.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/ufs/ufs/quota1_subr.c
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/ufs/ufs/quota2_subr.c
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/tests/fs/ffs/h_quota2_tests.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/tests/fs/ffs/t_quotalimit.sh

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/ufs/quota1_subr.c
diff -u src/sys/ufs/ufs/quota1_subr.c:1.1.2.2 src/sys/ufs/ufs/quota1_subr.c:1.1.2.3
--- src/sys/ufs/ufs/quota1_subr.c:1.1.2.2	Mon Jan 31 15:24:10 2011
+++ src/sys/ufs/ufs/quota1_subr.c	Thu Feb  3 17:36:30 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: quota1_subr.c,v 1.1.2.2 2011/01/31 15:24:10 bouyer Exp $ */
+/* $NetBSD: quota1_subr.c,v 1.1.2.3 2011/02/03 17:36:30 bouyer Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -28,7 +28,7 @@
   */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: quota1_subr.c,v 1.1.2.2 2011/01/31 15:24:10 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: quota1_subr.c,v 1.1.2.3 2011/02/03 17:36:30 bouyer Exp $);
 
 #include sys/types.h
 #include machine/limits.h
@@ -41,10 +41,8 @@
 {
 	if (lim == 0)
 		return UQUAD_MAX;
-	else if (lim == 1)
-		return 0;
 	else
-		return lim;
+		return (lim - 1);
 }
 
 static uint32_t
@@ -52,10 +50,8 @@
 {
 	if (lim == UQUAD_MAX)
 		return 0;
-	else if (lim == 0)
-		return 1;
 	else
-		return lim;
+		return (lim + 1);
 }
 
 void

Index: src/sys/ufs/ufs/quota2_subr.c
diff -u src/sys/ufs/ufs/quota2_subr.c:1.1.2.5 src/sys/ufs/ufs/quota2_subr.c:1.1.2.6
--- src/sys/ufs/ufs/quota2_subr.c:1.1.2.5	Thu Feb  3 15:56:16 2011
+++ src/sys/ufs/ufs/quota2_subr.c	Thu Feb  3 17:36:30 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: quota2_subr.c,v 1.1.2.5 2011/02/03 15:56:16 bouyer Exp $ */
+/* $NetBSD: quota2_subr.c,v 1.1.2.6 2011/02/03 17:36:30 bouyer Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -28,7 +28,7 @@
   */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: quota2_subr.c,v 1.1.2.5 2011/02/03 15:56:16 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: quota2_subr.c,v 1.1.2.6 2011/02/03 17:36:30 bouyer Exp $);
 
 #include sys/param.h
 #include sys/time.h
@@ -112,12 +112,12 @@
 int
 quota2_check_limit(struct quota2_val *q2v, uint64_t change, time_t now)
 {
-	if (q2v-q2v_cur + change = q2v-q2v_hardlimit) {
-		if (q2v-q2v_cur  q2v-q2v_softlimit) 
+	if (q2v-q2v_cur + change  q2v-q2v_hardlimit) {
+		if (q2v-q2v_cur = q2v-q2v_softlimit) 
 			return (QL_F_CROSS | QL_S_DENY_HARD);
 		return QL_S_DENY_HARD;
-	} else if (q2v-q2v_cur + change = q2v-q2v_softlimit) {
-		if (q2v-q2v_cur  q2v-q2v_softlimit)
+	} else if (q2v-q2v_cur + change  q2v-q2v_softlimit) {
+		if (q2v-q2v_cur = q2v-q2v_softlimit)
 			return (QL_F_CROSS | QL_S_ALLOW_SOFT);
 		if (now  q2v-q2v_time) {
 			return QL_S_DENY_GRACE;

Index: src/tests/fs/ffs/h_quota2_tests.c
diff -u src/tests/fs/ffs/h_quota2_tests.c:1.1.2.1 src/tests/fs/ffs/h_quota2_tests.c:1.1.2.2
--- src/tests/fs/ffs/h_quota2_tests.c:1.1.2.1	Wed Feb  2 19:17:08 2011
+++ src/tests/fs/ffs/h_quota2_tests.c	Thu Feb  3 17:36:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_quota2_tests.c,v 1.1.2.1 2011/02/02 19:17:08 bouyer Exp $	*/
+/*	$NetBSD: h_quota2_tests.c,v 1.1.2.2 2011/02/03 17:36:31 bouyer Exp $	*/
 
 /*
  * rump server for advanced quota tests
@@ -87,8 +87,8 @@
 		 */
 		int i;
 
-		/* write 1.5k: with the directory this makes 2K */
-		for (i = 0; i  3; i++) {
+		/* write 2k: with the directory this makes 2.5K */
+		for (i = 0; i  4; i++) {
 			error = rump_sys_write(fd, buf, sizeof(buf));
 			if (error != sizeof(buf))
 err(1, write failed early);
@@ -162,10 +162,10 @@
 	}
 
 	/*
-	 * create files up to the soft limit: one less as we already own the
+	 * create files one past the soft limit: one less as we already own the
 	 * root directory
 	 */
-	for (i = 0; i  3; i++) {
+	for (i = 0; i  4; i++) {
 		sprintf(buf, file%d, i);
 		fd = rump_sys_open(buf, O_EXCL| O_CREAT | O_RDWR, 0644);
 		if (fd  0)

Index: src/tests/fs/ffs/t_quotalimit.sh
diff -u src/tests/fs/ffs/t_quotalimit.sh:1.1.2.2 src/tests/fs/ffs/t_quotalimit.sh:1.1.2.3
--- src/tests/fs/ffs/t_quotalimit.sh:1.1.2.2	Wed Feb  2 21:01:08 2011
+++ src/tests/fs/ffs/t_quotalimit.sh	Thu Feb  3 17:36:31 2011
@@ -1,4 +1,4 @@
-# $NetBSD: t_quotalimit.sh,v 1.1.2.2 2011/02/02 21:01:08 bouyer Exp $ 

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

2011-02-03 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Thu Feb  3 19:44:05 UTC 2011

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/engine: eng_cryptodev.c

Log Message:
fix some merge botch and enable cryptodev support on NetBSD again


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/crypto/external/bsd/openssl/dist/crypto/engine/eng_cryptodev.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/crypto/engine/eng_cryptodev.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/engine/eng_cryptodev.c:1.3 src/crypto/external/bsd/openssl/dist/crypto/engine/eng_cryptodev.c:1.4
--- src/crypto/external/bsd/openssl/dist/crypto/engine/eng_cryptodev.c:1.3	Wed Aug  5 18:38:21 2009
+++ src/crypto/external/bsd/openssl/dist/crypto/engine/eng_cryptodev.c	Thu Feb  3 19:44:05 2011
@@ -33,7 +33,7 @@
 #include openssl/bn.h
 
 #if (defined(__unix__) || defined(unix))  !defined(USG)  \
-	(defined(OpenBSD) || defined(__FreeBSD__))
+	(defined(OpenBSD) || defined(__FreeBSD__)) || defined(__NetBSD__)
 #include sys/param.h
 # if (OpenBSD = 200112) || ((__FreeBSD_version = 470101  __FreeBSD_version  50) || __FreeBSD_version = 500041) || defined(__NetBSD__)
 #  define HAVE_CRYPTODEV
@@ -193,8 +193,6 @@
 	static int fd = -1;
 
 	if (fd == -1)
-		fd = get_dev_crypto();
-	if (fd == -1)
 		fd = open_dev_crypto();
 	return fd;
 }
@@ -910,7 +908,7 @@
 		return (-1);
 
 	for (i = 0; i  bytes; i++)
-		pd[i] = crp-crp_p[bytes - i - 1];
+		pd[i] = ((char *)crp-crp_p)[bytes - i - 1];
 
 	BN_bin2bn(pd, bytes, a);
 	free(pd);
@@ -936,7 +934,7 @@
 {
 	int fd, ret = -1;
 
-	if ((fd = get_asym_dev_crypto())  0)
+	if ((fd = get_dev_crypto())  0)
 		return (ret);
 
 	if (r) {



CVS commit: src/sys/arch/hp700/hp700

2011-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb  3 20:37:09 UTC 2011

Modified Files:
src/sys/arch/hp700/hp700: mainbus.c

Log Message:
Replace -1 with HP700CF_IRQ_UNDEF


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/hp700/hp700/mainbus.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/hp700/hp700/mainbus.c
diff -u src/sys/arch/hp700/hp700/mainbus.c:1.77 src/sys/arch/hp700/hp700/mainbus.c:1.78
--- src/sys/arch/hp700/hp700/mainbus.c:1.77	Sun Jan 23 21:53:40 2011
+++ src/sys/arch/hp700/hp700/mainbus.c	Thu Feb  3 20:37:09 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.77 2011/01/23 21:53:40 skrll Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.78 2011/02/03 20:37:09 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.77 2011/01/23 21:53:40 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.78 2011/02/03 20:37:09 skrll Exp $);
 
 #include locators.h
 #include power.h
@@ -1401,7 +1401,7 @@
 	/* get some power */
 	memset(nca, 0, sizeof(nca));
 	nca.ca_name = power;
-	nca.ca_irq = -1;
+	nca.ca_irq = HP700CF_IRQ_UNDEF;
 	nca.ca_iot = hppa_bustag;
 	config_found(self, nca, mbprint);
 #endif
@@ -1414,7 +1414,7 @@
 		nca.ca_dp.dp_bc[0] = nca.ca_dp.dp_bc[1] = nca.ca_dp.dp_bc[2] = 
 		nca.ca_dp.dp_bc[3] = nca.ca_dp.dp_bc[4] = nca.ca_dp.dp_bc[5] = -1;
 		nca.ca_dp.dp_mod = -1;
-		nca.ca_irq = -1;
+		nca.ca_irq = HP700CF_IRQ_UNDEF;
 		nca.ca_iot = hppa_bustag;
 		nca.ca_hpa = nca.ca_pcl.cmd_addr;
 



CVS commit: src/distrib/notes/sandpoint

2011-02-03 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Thu Feb  3 21:04:52 UTC 2011

Modified Files:
src/distrib/notes/sandpoint: hardware install prep

Log Message:
Reworked preparation instructions and installation via altboot.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/distrib/notes/sandpoint/hardware
cvs rdiff -u -r1.7 -r1.8 src/distrib/notes/sandpoint/install
cvs rdiff -u -r1.6 -r1.7 src/distrib/notes/sandpoint/prep

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

Modified files:

Index: src/distrib/notes/sandpoint/hardware
diff -u src/distrib/notes/sandpoint/hardware:1.10 src/distrib/notes/sandpoint/hardware:1.11
--- src/distrib/notes/sandpoint/hardware:1.10	Sun Jan 30 21:18:51 2011
+++ src/distrib/notes/sandpoint/hardware	Thu Feb  3 21:04:52 2011
@@ -1,4 +1,4 @@
-.\$NetBSD: hardware,v 1.10 2011/01/30 21:18:51 phx Exp $
+.\$NetBSD: hardware,v 1.11 2011/02/03 21:04:52 phx Exp $
 .
 .Nx*M
 is a port based on Motorola's
@@ -73,6 +73,8 @@
 .
 .Ss2 824x NAS supported boot devices and media
 .Nx
-is booted by
+is booted using the
 .Pa altboot
-, which can load the kernel from NFS or from the local disk.
+bootloader, which can load the kernel via TFTP, from NFS or from the
+local disk. You will have to transfer the bootloader into memory by
+any means the firmware offers (serial upload, TFTP, Flash ROM).

Index: src/distrib/notes/sandpoint/install
diff -u src/distrib/notes/sandpoint/install:1.7 src/distrib/notes/sandpoint/install:1.8
--- src/distrib/notes/sandpoint/install:1.7	Sun Jan 30 18:04:41 2011
+++ src/distrib/notes/sandpoint/install	Thu Feb  3 21:04:52 2011
@@ -1,13 +1,34 @@
-.\	$NetBSD: install,v 1.7 2011/01/30 18:04:41 phx Exp $
+.\	$NetBSD: install,v 1.8 2011/02/03 21:04:52 phx Exp $
 .
-.Ss2 Prepare the NFS server
+.Ss2 Prepare the NFS or TFTP server
 .
 Set up an NFS server and copy the install kernel renamed into
 .Pa netbsd
-to its root partition.
+to its root partition. Optionally copy the kernel into your TFTP directory
+and make sure the
+.Pa tftpd
+service is running.
+.
+.Ss2 The altboot bootloader
+The
+.Pa altboot.bin
+binary file loads a
+.Nx
+kernel from the root partition of a local disk, from TFTP or from NFS.
+This bootloader binary should be made available by one of the following
+methods (depending on the firmware):
+.(bullet -compact
+TFTP server
+.It
+NFS server
+.It
+Serial line upload
+.It
+Flash ROM
+.bullet)
 .
 .Ss2 Booting the installer
-Depending whether the serial console is attached to the first or the
+Depending on whether the serial console is attached to the first or the
 second UART you will have to boot
 .Pa netbsd-INSTALL
 (1st UART at 0x4500)
@@ -17,8 +38,27 @@
 KuroBox and LinkStation systems are known to have the console on the
 second UART.
 .Pp
-Now boot the kernel by running
-.Pa altboot .
+In most cases your NAS will run
+.Tn PPCBoot
+or
+.Tn U-Boot
+as firmware. You can access its command line via the serial adapter cable.
+When auto-booting is enabled this will usually require to press a key
+quickly after the system was switched on.
+Then load the
+.Pa altboot.bin
+file into memory at
+.Pa 0x100
+and boot the installation kernel with
+.Pp
+.Dl  Ic go 0x100 tftp:
+.Pp
+for TFTP, or with
+.Pp
+.Dl  Ic go 0x100 nfs:
+.Pp
+when the kernel resides on NFS.
+.Pp
 The installation kernel will run
 .Pa sysinst
 from an internal memory disk image.

Index: src/distrib/notes/sandpoint/prep
diff -u src/distrib/notes/sandpoint/prep:1.6 src/distrib/notes/sandpoint/prep:1.7
--- src/distrib/notes/sandpoint/prep:1.6	Sun Jan 30 18:04:41 2011
+++ src/distrib/notes/sandpoint/prep	Thu Feb  3 21:04:52 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: prep,v 1.6 2011/01/30 18:04:41 phx Exp $
+.\	$NetBSD: prep,v 1.7 2011/02/03 21:04:52 phx Exp $
 .
 To install
 .Nx \*V
@@ -8,37 +8,8 @@
 .Tn MAX232
 based) RS/232 cable to it, which you will
 connect to a terminal.
-The detailed procedure to build such a cable for your NAS system is not
-part of this documentation.
-.
-.Ss2 altboot
-The
-.Pa altboot.bin
-binary loads a
-.Nx
-kernel from the root partition of a local disk or from NFS.
-This file should be made available by one of the following methods
-(depending on the firmware):
-.(bullet -compact
-TFTP server
-.It
-Serial line upload
-.It
-Flash ROM
-.bullet)
-.Pp
-In most cases the Flash ROM of your NAS will contain
-.Tn PPCBoot
-or
-.Tn U-Boot
-as firmware. You have to find a way to get access to its command line.
-When auto-booting is enabled this will usually require to press a key
-quickly after the system is switched on.
-Then load the
-.Pa altboot.bin
-file into memory at
-.Pa 0x100
-and start it with
-.Pp
-.Dl  Ic go 0x100
-.Pp
+The procedure how to build such a cable for your NAS system is not
+part of this documentation. Please refer to
+.Lk http://www.NetBSD.org/ports/\*M/ttl2rs232.html
+for schematics and detailed instructions, if you wish to solder such an

CVS commit: src/sys

2011-02-03 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Feb  3 21:45:32 UTC 2011

Modified Files:
src/sys/compat/irix: irix_signal.c
src/sys/compat/netbsd32: netbsd32_signal.c
src/sys/compat/svr4: svr4_signal.c
src/sys/kern: sys_sig.c

Log Message:
Explicitly initialize ucontext before calling getmcontext.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/compat/irix/irix_signal.c
cvs rdiff -u -r1.34 -r1.35 src/sys/compat/netbsd32/netbsd32_signal.c
cvs rdiff -u -r1.64 -r1.65 src/sys/compat/svr4/svr4_signal.c
cvs rdiff -u -r1.30 -r1.31 src/sys/kern/sys_sig.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/irix/irix_signal.c
diff -u src/sys/compat/irix/irix_signal.c:1.55 src/sys/compat/irix/irix_signal.c:1.56
--- src/sys/compat/irix/irix_signal.c:1.55	Fri Jan 14 02:06:33 2011
+++ src/sys/compat/irix/irix_signal.c	Thu Feb  3 21:45:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: irix_signal.c,v 1.55 2011/01/14 02:06:33 rmind Exp $ */
+/*	$NetBSD: irix_signal.c,v 1.56 2011/02/03 21:45:31 joerg Exp $ */
 
 /*-
  * Copyright (c) 1994, 2001-2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: irix_signal.c,v 1.55 2011/01/14 02:06:33 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: irix_signal.c,v 1.56 2011/02/03 21:45:31 joerg Exp $);
 
 #include sys/types.h
 #include sys/signal.h
@@ -707,6 +707,8 @@
 
 	f = (struct frame *)l-l_md.md_regs;
 
+	memset(kucp, 0, sizeof(kucp));
+
 	kucp.iuc_flags = IRIX_UC_ALL;
 	kucp.iuc_link = NULL;		/* XXX */
 

Index: src/sys/compat/netbsd32/netbsd32_signal.c
diff -u src/sys/compat/netbsd32/netbsd32_signal.c:1.34 src/sys/compat/netbsd32/netbsd32_signal.c:1.35
--- src/sys/compat/netbsd32/netbsd32_signal.c:1.34	Fri Apr 23 15:19:20 2010
+++ src/sys/compat/netbsd32/netbsd32_signal.c	Thu Feb  3 21:45:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_signal.c,v 1.34 2010/04/23 15:19:20 rmind Exp $	*/
+/*	$NetBSD: netbsd32_signal.c,v 1.35 2011/02/03 21:45:31 joerg Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netbsd32_signal.c,v 1.34 2010/04/23 15:19:20 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: netbsd32_signal.c,v 1.35 2011/02/03 21:45:31 joerg Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -361,6 +361,8 @@
 	struct proc *p = l-l_proc;
 	ucontext32_t uc;
 
+	memset(uc, 0, sizeof(uc));
+
 	mutex_enter(p-p_lock);
 	getucontext32(l, uc);
 	mutex_exit(p-p_lock);

Index: src/sys/compat/svr4/svr4_signal.c
diff -u src/sys/compat/svr4/svr4_signal.c:1.64 src/sys/compat/svr4/svr4_signal.c:1.65
--- src/sys/compat/svr4/svr4_signal.c:1.64	Mon Apr 28 20:23:45 2008
+++ src/sys/compat/svr4/svr4_signal.c	Thu Feb  3 21:45:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_signal.c,v 1.64 2008/04/28 20:23:45 martin Exp $	 */
+/*	$NetBSD: svr4_signal.c,v 1.65 2011/02/03 21:45:31 joerg Exp $	 */
 
 /*-
  * Copyright (c) 1994, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: svr4_signal.c,v 1.64 2008/04/28 20:23:45 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: svr4_signal.c,v 1.65 2011/02/03 21:45:31 joerg Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -462,6 +462,8 @@
 	svr4_ucontext_t uc;
 	*retval = 0;
 
+	memset(uc, 0, sizeof(uc));
+
 	switch (SCARG(uap, func)) {
 	case SVR4_GETCONTEXT:
 		DPRINTF((getcontext(%p)\n, SCARG(uap, uc)));

Index: src/sys/kern/sys_sig.c
diff -u src/sys/kern/sys_sig.c:1.30 src/sys/kern/sys_sig.c:1.31
--- src/sys/kern/sys_sig.c:1.30	Mon Jan 10 04:39:18 2011
+++ src/sys/kern/sys_sig.c	Thu Feb  3 21:45:32 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_sig.c,v 1.30 2011/01/10 04:39:18 christos Exp $	*/
+/*	$NetBSD: sys_sig.c,v 1.31 2011/02/03 21:45:32 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sys_sig.c,v 1.30 2011/01/10 04:39:18 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: sys_sig.c,v 1.31 2011/02/03 21:45:32 joerg Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -317,6 +317,8 @@
 	struct proc *p = l-l_proc;
 	ucontext_t uc;
 
+	memset(uc, 0, sizeof(uc));
+
 	mutex_enter(p-p_lock);
 	getucontext(l, uc);
 	mutex_exit(p-p_lock);



CVS commit: src/sys/dev/pci

2011-02-03 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Thu Feb  3 22:03:09 UTC 2011

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add a few Nvidia devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1056 -r1.1057 src/sys/dev/pci/pcidevs

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1056 src/sys/dev/pci/pcidevs:1.1057
--- src/sys/dev/pci/pcidevs:1.1056	Wed Jan 26 18:37:06 2011
+++ src/sys/dev/pci/pcidevs	Thu Feb  3 22:03:09 2011
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1056 2011/01/26 18:37:06 bouyer Exp $
+$NetBSD: pcidevs,v 1.1057 2011/02/03 22:03:09 njoly Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -3507,6 +3507,11 @@
 product NVIDIA	NFORCE430_HDA	0x026c	nForce430 High Definition Audio Controller
 product NVIDIA	NFORCE430_OHCI	0x026d	nForce430 USB Controller
 product NVIDIA	NFORCE430_EHCI	0x026e	nForce430 USB2 Controller
+product NVIDIA	NFORCE430_PPB	0x026f	nForce430 PCI-PCI Bridge
+product NVIDIA	NFORCE430_HB	0x0270	nForce430 Host Bridge
+product NVIDIA	NFORCE430_MC	0x0272	nForce430 Memory Controller
+product NVIDIA	C51_MC2		0x027e	C51 Memory Controller 2
+product NVIDIA	C51_MC3		0x027f	C51 Memory Controller 3
 product NVIDIA	GF4_TI_4800	0x0280	GeForce4 Ti 4800
 product NVIDIA	GF4_TI_4200_8X	0x0281	GeForce4 Ti 4200 (AGP8X)
 product NVIDIA	GF4_TI_4800_SE	0x0282	GeForce4 Ti 4800 SE



CVS commit: src/sys/dev/pci

2011-02-03 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Thu Feb  3 22:04:10 UTC 2011

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
Regen for Nvidia devices addition.


To generate a diff of this commit:
cvs rdiff -u -r1.1053 -r1.1054 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1052 -r1.1053 src/sys/dev/pci/pcidevs_data.h

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

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1053 src/sys/dev/pci/pcidevs.h:1.1054
--- src/sys/dev/pci/pcidevs.h:1.1053	Wed Jan 26 18:37:52 2011
+++ src/sys/dev/pci/pcidevs.h	Thu Feb  3 22:04:09 2011
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1053 2011/01/26 18:37:52 bouyer Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1054 2011/02/03 22:04:09 njoly Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1056 2011/01/26 18:37:06 bouyer Exp
+ *	NetBSD: pcidevs,v 1.1057 2011/02/03 22:03:09 njoly Exp
  */
 
 /*
@@ -3514,6 +3514,11 @@
 #define	PCI_PRODUCT_NVIDIA_NFORCE430_HDA	0x026c		/* nForce430 High Definition Audio Controller */
 #define	PCI_PRODUCT_NVIDIA_NFORCE430_OHCI	0x026d		/* nForce430 USB Controller */
 #define	PCI_PRODUCT_NVIDIA_NFORCE430_EHCI	0x026e		/* nForce430 USB2 Controller */
+#define	PCI_PRODUCT_NVIDIA_NFORCE430_PPB	0x026f		/* nForce430 PCI-PCI Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE430_HB	0x0270		/* nForce430 Host Bridge */
+#define	PCI_PRODUCT_NVIDIA_NFORCE430_MC	0x0272		/* nForce430 Memory Controller */
+#define	PCI_PRODUCT_NVIDIA_C51_MC2	0x027e		/* C51 Memory Controller 2 */
+#define	PCI_PRODUCT_NVIDIA_C51_MC3	0x027f		/* C51 Memory Controller 3 */
 #define	PCI_PRODUCT_NVIDIA_GF4_TI_4800	0x0280		/* GeForce4 Ti 4800 */
 #define	PCI_PRODUCT_NVIDIA_GF4_TI_4200_8X	0x0281		/* GeForce4 Ti 4200 (AGP8X) */
 #define	PCI_PRODUCT_NVIDIA_GF4_TI_4800_SE	0x0282		/* GeForce4 Ti 4800 SE */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1052 src/sys/dev/pci/pcidevs_data.h:1.1053
--- src/sys/dev/pci/pcidevs_data.h:1.1052	Wed Jan 26 18:37:52 2011
+++ src/sys/dev/pci/pcidevs_data.h	Thu Feb  3 22:04:09 2011
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1052 2011/01/26 18:37:52 bouyer Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1053 2011/02/03 22:04:09 njoly Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1056 2011/01/26 18:37:06 bouyer Exp
+ *	NetBSD: pcidevs,v 1.1057 2011/02/03 22:03:09 njoly Exp
  */
 
 /*
@@ -5607,54 +5607,64 @@
 	20901, 6624, 6139, 0,
 	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_EHCI, 
 	20901, 8788, 6139, 0,
+	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_PPB, 
+	20901, 7775, 6242, 0,
+	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_HB, 
+	20901, 6632, 6242, 0,
+	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_NFORCE430_MC, 
+	20901, 13199, 6139, 0,
+	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_MC2, 
+	20911, 13199, 6139, 6095, 0,
+	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_MC3, 
+	20911, 13199, 6139, 6106, 0,
 	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF4_TI_4800, 
-	20750, 20849, 20911, 0,
+	20750, 20849, 20915, 0,
 	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF4_TI_4200_8X, 
 	20750, 20849, 20875, 20792, 0,
 	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF4_TI_4800_SE, 
-	20750, 20849, 20911, 20771, 0,
+	20750, 20849, 20915, 20771, 0,
 	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_GF4_TI_4200_GO, 
-	20750, 20849, 20875, 20708, 7788, 20916, 0,
+	20750, 20849, 20875, 20708, 7788, 20920, 0,
 	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO4_980_XGL, 
-	20654, 20919, 20804, 0,
-	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO4_780_XGL, 
 	20654, 20923, 20804, 0,
+	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_QUADRO4_780_XGL, 
+	20654, 20927, 20804, 0,
 	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_XBOXFB, 
-	20823, 20927, 20933, 0,
+	20823, 20931, 20937, 0,
 	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_XBOX_PCHB, 
 	20823, 20812, 6530, 6242, 0,
 	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_HB_02F0, 
-	20940, 6632, 6242, 20944, 0,
+	20911, 6632, 6242, 20944, 0,
 	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_HB_02F1, 
-	20940, 6632, 6242, 20953, 0,
+	20911, 6632, 6242, 20953, 0,
 	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_HB_02F2, 
-	20940, 6632, 6242, 20962, 0,
+	20911, 6632, 6242, 20962, 0,
 	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_HB_02F3, 
-	20940, 6632, 6242, 20971, 0,
+	20911, 6632, 6242, 20971, 0,
 	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_HB_02F4, 
-	20940, 6632, 6242, 20980, 0,
+	20911, 6632, 6242, 20980, 0,
 	PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_C51_HB_02F5, 
-	20940, 6632, 6242, 20989, 0,
+	20911, 6632, 6242, 20989, 0,
 	PCI_VENDOR_NVIDIA, 

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

2011-02-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb  3 22:16:11 UTC 2011

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

Log Message:
fix KASSERT snafu.  spotted by tests, as usual.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/rump/librump/rumpvfs/rumpblk.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/rumpblk.c
diff -u src/sys/rump/librump/rumpvfs/rumpblk.c:1.45 src/sys/rump/librump/rumpvfs/rumpblk.c:1.46
--- src/sys/rump/librump/rumpvfs/rumpblk.c:1.45	Thu Feb  3 15:36:30 2011
+++ src/sys/rump/librump/rumpvfs/rumpblk.c	Thu Feb  3 22:16:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpblk.c,v 1.45 2011/02/03 15:36:30 pooka Exp $	*/
+/*	$NetBSD: rumpblk.c,v 1.46 2011/02/03 22:16:11 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rumpblk.c,v 1.45 2011/02/03 15:36:30 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: rumpblk.c,v 1.46 2011/02/03 22:16:11 pooka Exp $);
 
 #include sys/param.h
 #include sys/buf.h
@@ -368,6 +368,7 @@
 	for (i = 0; i  RUMPBLK_SIZE; i++) {
 		mutex_init(minors[i].rblk_memmtx, MUTEX_DEFAULT, IPL_NONE);
 		cv_init(minors[i].rblk_memcv, rblkmcv);
+		minors[i].rblk_fd = -1;
 	}
 
 	evcnt_attach_dynamic(ev_io_total, EVCNT_TYPE_MISC, NULL,
@@ -501,7 +502,7 @@
 {
 	int error, fd;
 
-	KASSERT(rblk-rblk_fd != -1);
+	KASSERT(rblk-rblk_fd == -1);
 	fd = rumpuser_open(path, O_RDWR, error);
 	if (error) {
 		fd = rumpuser_open(path, O_RDONLY, error);



CVS commit: src/gnu/dist/gdb6/gdb

2011-02-03 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Feb  4 00:05:29 UTC 2011

Modified Files:
src/gnu/dist/gdb6/gdb: shnbsd-tdep.c

Log Message:
Branch with delay slot executes delay slot even if branch is not
taken, so adjust next_pc logic accordingly.  Fixes SIGILL
(breakpoint's trapa causes an illegal slot instruction exception)
when stepping through such branches.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/gnu/dist/gdb6/gdb/shnbsd-tdep.c

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

Modified files:

Index: src/gnu/dist/gdb6/gdb/shnbsd-tdep.c
diff -u src/gnu/dist/gdb6/gdb/shnbsd-tdep.c:1.5 src/gnu/dist/gdb6/gdb/shnbsd-tdep.c:1.6
--- src/gnu/dist/gdb6/gdb/shnbsd-tdep.c:1.5	Mon Oct 27 00:33:19 2008
+++ src/gnu/dist/gdb6/gdb/shnbsd-tdep.c	Fri Feb  4 00:05:29 2011
@@ -286,14 +286,14 @@
 {
   sr = read_register (SR_REGNUM);
 
+  delay_slot = CONDITIONAL_BRANCH_SLOT_P(insn);
   if (!CONDITIONAL_BRANCH_TAKEN_P(insn, sr))
-	next_pc = pc + 2;
+	next_pc = pc + (delay_slot ? 4 : 2);
   else
 	{
 	  displacement = shnbsd_displacement_8 (insn);
 
 	  next_pc = pc + 4 + (displacement  1);
-	  delay_slot = CONDITIONAL_BRANCH_SLOT_P(insn);
 	}
 }
 



CVS commit: src/usr.sbin

2011-02-03 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Fri Feb  4 00:19:52 UTC 2011

Modified Files:
src/usr.sbin/npf/npfctl: Makefile
src/usr.sbin/pf/ftp-proxy: Makefile

Log Message:
Fix sun2 builds.  Noted by joerg@.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/npf/npfctl/Makefile
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/pf/ftp-proxy/Makefile

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/npf/npfctl/Makefile
diff -u src/usr.sbin/npf/npfctl/Makefile:1.3 src/usr.sbin/npf/npfctl/Makefile:1.4
--- src/usr.sbin/npf/npfctl/Makefile:1.3	Wed Feb  2 02:20:25 2011
+++ src/usr.sbin/npf/npfctl/Makefile	Fri Feb  4 00:19:51 2011
@@ -1,12 +1,12 @@
-# $NetBSD: Makefile,v 1.3 2011/02/02 02:20:25 rmind Exp $
+# $NetBSD: Makefile,v 1.4 2011/02/04 00:19:51 rmind Exp $
 
 PROG=		npfctl
 MAN=		npfctl.8 npf.conf.5
 
 SRCS=		npfctl.c npf_parser.c npf_data.c npf_ncgen.c
 
-LDADD+=		-lnpf
-DPADD+=		${LIBNPF}
+LDADD+=		-lnpf -lprop
+DPADD+=		${LIBNPF} ${LIBPROP}
 
 WARNS?=		4
 NOLINT=		# defined (note: deliberately)

Index: src/usr.sbin/pf/ftp-proxy/Makefile
diff -u src/usr.sbin/pf/ftp-proxy/Makefile:1.5 src/usr.sbin/pf/ftp-proxy/Makefile:1.6
--- src/usr.sbin/pf/ftp-proxy/Makefile:1.5	Wed Feb  2 02:20:26 2011
+++ src/usr.sbin/pf/ftp-proxy/Makefile	Fri Feb  4 00:19:52 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2011/02/02 02:20:26 rmind Exp $
+#	$NetBSD: Makefile,v 1.6 2011/02/04 00:19:52 rmind Exp $
 #	$OpenBSD: Makefile,v 1.3 2006/11/26 11:31:13 deraadt Exp $
 
 PROG=	ftp-proxy
@@ -17,7 +17,7 @@
 .if (${MKNPF} != no)
 SRCS+=		npf.c
 CPPFLAGS+=	-DWITH_NPF
-LDADD+=		-lnpf
+LDADD+=		-lnpf -lprop
 .endif
 
 # IP Filter support



CVS commit: src/lib/libc/net

2011-02-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb  4 02:01:13 UTC 2011

Modified Files:
src/lib/libc/net: getifaddrs.c

Log Message:
Use RT_ROUNDUP instead of a private copy since that's what the kernel uses.
(t_getaddrinfo passes for both i386 (compat_netbsd32) and amd64 with this
change).


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/net/getifaddrs.c

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

Modified files:

Index: src/lib/libc/net/getifaddrs.c
diff -u src/lib/libc/net/getifaddrs.c:1.13 src/lib/libc/net/getifaddrs.c:1.14
--- src/lib/libc/net/getifaddrs.c:1.13	Fri Nov  5 16:23:56 2010
+++ src/lib/libc/net/getifaddrs.c	Fri Feb  4 02:01:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: getifaddrs.c,v 1.13 2010/11/05 16:23:56 pooka Exp $	*/
+/*	$NetBSD: getifaddrs.c,v 1.14 2011/02/04 02:01:12 matt Exp $	*/
 
 /*
  * Copyright (c) 1995, 1999
@@ -27,7 +27,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: getifaddrs.c,v 1.13 2010/11/05 16:23:56 pooka Exp $);
+__RCSID($NetBSD: getifaddrs.c,v 1.14 2011/02/04 02:01:12 matt Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #ifndef RUMP_ACTION
@@ -58,8 +58,7 @@
 #define sysctl(a,b,c,d,e,f) rump_sys___sysctl(a,b,c,d,e,f)
 #endif
 
-#define	SALIGN	(sizeof(long) - 1)
-#define	SA_RLEN(sa)	((sa)-sa_len ? (((sa)-sa_len + SALIGN)  ~SALIGN) : (SALIGN + 1))
+#define	SA_RLEN(sa)	RT_ROUNDUP((sa)-sa_len)
 
 int
 getifaddrs(struct ifaddrs **pif)



CVS commit: src/sys/arch/sh3

2011-02-03 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Feb  4 03:23:33 UTC 2011

Modified Files:
src/sys/arch/sh3/include: locore.h
src/sys/arch/sh3/sh3: exception_vector.S

Log Message:
__EXCEPTION_ENTRY - tst already does logical AND, so shave off extra
mov and and and just test PSL_MD bit directly.

While here - shuffle around instructions to construct PSL_MD to break
dependencies.

While still here - only interrupt vector uses SSR and SPC as function
args, so don't bother saving them here in r4 and r5.  Other vectors
don't need them and interrupt vector can just as well stc them
directly before exceptions are enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/sh3/include/locore.h
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/sh3/sh3/exception_vector.S

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/sh3/include/locore.h
diff -u src/sys/arch/sh3/include/locore.h:1.20 src/sys/arch/sh3/include/locore.h:1.21
--- src/sys/arch/sh3/include/locore.h:1.20	Tue Jan 18 00:26:57 2011
+++ src/sys/arch/sh3/include/locore.h	Fri Feb  4 03:23:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.h,v 1.20 2011/01/18 00:26:57 joerg Exp $	*/
+/*	$NetBSD: locore.h,v 1.21 2011/02/04 03:23:33 uwe Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -68,26 +68,24 @@
  *	+ save all registers to trapframe.
  *	+ setup kernel stack.
  *	+ change bank from 1 to 0
- *	+ set BANK0 (r4, r5, r6) = (ssr, spc, ssp)
+ *	+ NB: interrupt vector knows that r0_bank1 = ssp
  */
 #define	__EXCEPTION_ENTRY		;\
 	/* Check kernel/user mode. */	;\
 	mov	#0x40,	r3		;\
+	stc	ssr,	r2	/* r2 = SSR */;\
 	swap.b	r3,	r3		;\
-	stc	ssr,	r2		;\
-	swap.w	r3,	r3	/* r3 = 0x4000 */			;\
-	mov	r2,	r0	/* r2 = r0 = SSR */			;\
-	and	r3,	r0		;\
-	tst	r0,	r0	/* if (SSR.MD == 0) T = 1 */		;\
 	mov	r14,	r1		;\
-	mov	r6,	r14	/* frame pointer */			;\
+	swap.w	r3,	r3	/* r3 = PSL_MD */			;\
+	mov	r6,	r14	/* trapframe pointer */			;\
+	tst	r3,	r2	/* if (SSR.MD == 0) T = 1 */		;\
+	mov.l	r1,	@-r14	/* save tf_r14 */			;\
 	bf/s	1f		/* T==0 ...Exception from kernel mode */;\
 	 mov	r15,	r0		;\
 	/* Exception from user mode */	;\
 	mov	r7,	r15	/* change to kernel stack */		;\
 1:	;\
-	/* Save registers */		;\
-	mov.l	r1,	@-r14	/* tf_r14 */;\
+	/* Save remaining registers */	;\
 	mov.l	r0,	@-r14	/* tf_r15 */;\
 	stc.l	r0_bank,@-r14	/* tf_r0  */;\
 	stc.l	r1_bank,@-r14	/* tf_r1  */;\
@@ -112,14 +110,12 @@
 	add	#-8,	r14	/* skip tf_ubc, tf_expevt */		;\
 	mov	r14,	r6	/* store frame pointer */		;\
 	/* Change register bank to 0 */	;\
-	shlr	r3		/* r3 = 0x2000 */			;\
+	shlr	r3		/* r3 = PSL_RB */			;\
 	stc	sr,	r1	/* r1 = SR */;\
 	not	r3,	r3		;\
 	and	r1,	r3		;\
-	ldc	r3,	sr	/* SR.RB = 0 */;\
-	/* Set up arguments. r4 = ssr, r5 = spc */			;\
-	stc	r2_bank,r4		;\
-	stc	spc,	r5
+	ldc	r3,	sr	/* SR.RB = 0 */
+
 
 /*
  * __EXCEPTION_RETURN:

Index: src/sys/arch/sh3/sh3/exception_vector.S
diff -u src/sys/arch/sh3/sh3/exception_vector.S:1.47 src/sys/arch/sh3/sh3/exception_vector.S:1.48
--- src/sys/arch/sh3/sh3/exception_vector.S:1.47	Fri Jan 28 21:06:08 2011
+++ src/sys/arch/sh3/sh3/exception_vector.S	Fri Feb  4 03:23:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: exception_vector.S,v 1.47 2011/01/28 21:06:08 uwe Exp $	*/
+/*	$NetBSD: exception_vector.S,v 1.48 2011/02/04 03:23:33 uwe Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
 #define _ALIGN_TEXT	.align 5
 #include sh3/asm.h
 
-__KERNEL_RCSID(0, $NetBSD: exception_vector.S,v 1.47 2011/01/28 21:06:08 uwe Exp $)
+__KERNEL_RCSID(0, $NetBSD: exception_vector.S,v 1.48 2011/02/04 03:23:33 uwe Exp $)
 
 
 /*
@@ -458,7 +458,10 @@
  */
 NENTRY(sh_vector_interrupt)
 	__EXCEPTION_ENTRY
-	stc	r0_bank, r6		! ssp - 3rd arg to intc_intr()
+	!! arguments for intc_intr(): for struct clockframe
+	stc	ssr, r4
+	stc	spc, r5
+	stc	r0_bank, r6		! ssp
 
 	__INTR_MASK(r0, r1)
 	__EXCEPTION_UNBLOCK(r0, r1)	! enable exceptions for P3 access



CVS commit: src/sys/arch/sh3/include

2011-02-03 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Feb  4 04:13:52 UTC 2011

Modified Files:
src/sys/arch/sh3/include: locore.h

Log Message:
Since __INTR_MASK + __EXCEPTION_UNBLOCK is common sequence, provide
__INTR_MASK_EXCEPTION_UNBLOCK combo version that does stc/ldc just once.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sh3/include/locore.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/sh3/include/locore.h
diff -u src/sys/arch/sh3/include/locore.h:1.21 src/sys/arch/sh3/include/locore.h:1.22
--- src/sys/arch/sh3/include/locore.h:1.21	Fri Feb  4 03:23:33 2011
+++ src/sys/arch/sh3/include/locore.h	Fri Feb  4 04:13:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.h,v 1.21 2011/02/04 03:23:33 uwe Exp $	*/
+/*	$NetBSD: locore.h,v 1.22 2011/02/04 04:13:52 uwe Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -201,6 +201,23 @@
 	and	Rn,	Rm		;\
 	ldc	Rm,	sr	/* unmask all interrupts */
 
+
+/*
+ * Since __INTR_MASK + __EXCEPTION_UNBLOCK is common sequence, provide
+ * this combo version that does stc/ldc just once.
+ */
+#define __INTR_MASK_EXCEPTION_UNBLOCK(Rs, Ri, Rb)			 \
+	mov	#0x78, Ri	/* 0xf0  1 */;\
+	mov	#0xef, Rb	/* ~0x10 */;\
+	shll	Ri		/* Ri = PSL_IMASK */			;\
+	swap.b	Rb, Rb			;\
+	stc	sr, Rs			;\
+	swap.w	Rb, Rb		/* Rb = ~PSL_BL */			;\
+	or	Ri, Rs		/* SR |= PSL_IMASK */			;\
+	and	Rb, Rs		/* SR = ~PSL_BL */			;\
+	ldc	Rs, sr
+
+
 #else /* !_LOCORE */
 
 void sh3_switch_setup(struct lwp *);



CVS commit: src/sys/arch/sh3/sh3

2011-02-03 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Feb  4 04:14:25 UTC 2011

Modified Files:
src/sys/arch/sh3/sh3: exception_vector.S

Log Message:
Use __INTR_MASK_EXCEPTION_UNBLOCK combo.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/sh3/sh3/exception_vector.S

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/sh3/sh3/exception_vector.S
diff -u src/sys/arch/sh3/sh3/exception_vector.S:1.48 src/sys/arch/sh3/sh3/exception_vector.S:1.49
--- src/sys/arch/sh3/sh3/exception_vector.S:1.48	Fri Feb  4 03:23:33 2011
+++ src/sys/arch/sh3/sh3/exception_vector.S	Fri Feb  4 04:14:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: exception_vector.S,v 1.48 2011/02/04 03:23:33 uwe Exp $	*/
+/*	$NetBSD: exception_vector.S,v 1.49 2011/02/04 04:14:25 uwe Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
 #define _ALIGN_TEXT	.align 5
 #include sh3/asm.h
 
-__KERNEL_RCSID(0, $NetBSD: exception_vector.S,v 1.48 2011/02/04 03:23:33 uwe Exp $)
+__KERNEL_RCSID(0, $NetBSD: exception_vector.S,v 1.49 2011/02/04 04:14:25 uwe Exp $)
 
 
 /*
@@ -73,7 +73,6 @@
  */
 NENTRY(sh_vector_generic)
 	__EXCEPTION_ENTRY
-	__INTR_MASK(r0, r1)
 	/* Identify exception cause */
 	MOV	(EXPEVT, r0)
 	mov.l	@r0, r0
@@ -90,7 +89,7 @@
 	bt	1f
 
 	/* tlb_exception(curlwp, tf, TEA); */
-	__EXCEPTION_UNBLOCK(r0, r1)
+	__INTR_MASK_EXCEPTION_UNBLOCK(r0, r1, r3)
 	mov.l	.Lg_tlb_exception, r0
 	jsr	@r0
 	 mov	r14, r5			/* 2nd arg */
@@ -105,7 +104,7 @@
 	mov.l	r2, @(TF_UBC, r14)	/* clear tf-tf_ubc */
 	mov.w	r2, @r1			/* disable UBC channel A */
 #endif
-	__EXCEPTION_UNBLOCK(r0, r1)
+	__INTR_MASK_EXCEPTION_UNBLOCK(r0, r1, r3)
 	mov.l	.Lg_general_exception, r0
 	jsr	@r0
 	 mov	r14, r5			/* 2nd arg */
@@ -270,8 +269,7 @@
 	mov.l	@r2, r2			! *SH3_EXPEVT
 	mov.l	@r0, r6			! arg3: va = *SH3_TEA
 	mov.l	@r1, r4			! arg1: curlwp
-	__INTR_MASK(r0, r1)
-	__EXCEPTION_UNBLOCK(r0, r1)
+	__INTR_MASK_EXCEPTION_UNBLOCK(r0, r1, r3)
 	mov.l	.L3_tlb_exception, r0
 	mov.l	r2, @(TF_EXPEVT, r14)	! tf-tf_expevt = EXPEVT
 	jsr	@r0
@@ -421,8 +419,7 @@
 	mov.l	@(0x24, r0), r2		! *SH4_EXPEVT
 	mov.l	@(0x0c, r0), r6		! arg3: va = *SH4_TEA
 	mov.l	@r1, r4			! arg1: curlwp
-	__INTR_MASK(r0, r1)
-	__EXCEPTION_UNBLOCK(r0, r1)
+	__INTR_MASK_EXCEPTION_UNBLOCK(r0, r1, r3)
 	mov.l	.L4_tlb_exception, r0
 	mov.l	r2, @(TF_EXPEVT, r14)	! tf-tf_expevt = EXPEVT
 	jsr	@r0
@@ -462,9 +459,7 @@
 	stc	ssr, r4
 	stc	spc, r5
 	stc	r0_bank, r6		! ssp
-
-	__INTR_MASK(r0, r1)
-	__EXCEPTION_UNBLOCK(r0, r1)	! enable exceptions for P3 access
+	__INTR_MASK_EXCEPTION_UNBLOCK(r0, r1, r3)
 
 	mov.l	.Li_ci_idepth, r8	! callee-saved
 	mov.l	.Li_intc_intr, r0



CVS commit: src/usr.bin/less/less

2011-02-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Feb  4 07:26:17 UTC 2011

Modified Files:
src/usr.bin/less/less: less.1

Log Message:
Fix typo, from Henning Petersen in PR 44510.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/less/less/less.1

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

Modified files:

Index: src/usr.bin/less/less/less.1
diff -u src/usr.bin/less/less/less.1:1.17 src/usr.bin/less/less/less.1:1.18
--- src/usr.bin/less/less/less.1:1.17	Sun Dec 17 16:16:53 2006
+++ src/usr.bin/less/less/less.1	Fri Feb  4 07:26:17 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: less.1,v 1.17 2006/12/17 16:16:53 jmmv Exp $
+.\	$NetBSD: less.1,v 1.18 2011/02/04 07:26:17 wiz Exp $
 .\
 .TH LESS 1 Version 394: 03 Dec 2005
 .SH NAME
@@ -1223,7 +1223,7 @@
 .PP
 If neither LESSCHARSET nor LESSCHARDEF is set,
 but any of the strings UTF-8, UTF8, utf-8 or utf8 
-is found in the LC_ALL, LC_TYPE or LANG
+is found in the LC_ALL, LC_CTYPE or LANG
 environment variables, then the default character set is utf-8.
 .PP
 If that string is not found, but your system supports the



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

2011-02-03 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Fri Feb  4 07:32:38 UTC 2011

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
add:
./usr/lib/librumpfs_zfs_g.a
./usr/lib/librumpkern_solaris_g.a


To generate a diff of this commit:
cvs rdiff -u -r1.1579 -r1.1580 src/distrib/sets/lists/comp/mi

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1579 src/distrib/sets/lists/comp/mi:1.1580
--- src/distrib/sets/lists/comp/mi:1.1579	Wed Feb  2 02:20:27 2011
+++ src/distrib/sets/lists/comp/mi	Fri Feb  4 07:32:37 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1579 2011/02/02 02:20:27 rmind Exp $
+#	$NetBSD: mi,v 1.1580 2011/02/04 07:32:37 yamt Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -2789,6 +2789,7 @@
 ./usr/lib/librumpfs_union_g.a			-unknown-		debuglib
 ./usr/lib/librumpfs_union_p.a			comp-c-proflib		profile
 ./usr/lib/librumpfs_zfs.a			comp-c-lib		zfs
+./usr/lib/librumpfs_zfs_g.a			-unknown-		debuglib
 ./usr/lib/librumpfs_zfs_p.a			comp-c-piclib		profile,zfs
 ./usr/lib/librumpkern_crypto.a			comp-c-lib
 ./usr/lib/librumpkern_crypto_g.a			-unknown-		debuglib
@@ -2797,6 +2798,7 @@
 ./usr/lib/librumpkern_ksem_g.a			-unknown-		debuglib
 ./usr/lib/librumpkern_ksem_p.a			comp-c-proflib		profile
 ./usr/lib/librumpkern_solaris.a			comp-c-lib		zfs
+./usr/lib/librumpkern_solaris_g.a		-unknown-		debuglib,zfs
 ./usr/lib/librumpkern_solaris_p.a		comp-c-proflib		profile,zfs
 ./usr/lib/librumpkern_tty.a			comp-c-lib
 ./usr/lib/librumpkern_tty_g.a			-unknown-		debuglib



CVS commit: src/sys/arch/hp700/gsc

2011-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb  4 07:44:53 UTC 2011

Modified Files:
src/sys/arch/hp700/gsc: harmony.c

Log Message:
Commit a hack workaround for PR 41448.

Not sure if this has any negative effects, but I'd rather have a system
that reboots than has working audio.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/hp700/gsc/harmony.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/hp700/gsc/harmony.c
diff -u src/sys/arch/hp700/gsc/harmony.c:1.19 src/sys/arch/hp700/gsc/harmony.c:1.20
--- src/sys/arch/hp700/gsc/harmony.c:1.19	Tue Feb  1 18:33:24 2011
+++ src/sys/arch/hp700/gsc/harmony.c	Fri Feb  4 07:44:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: harmony.c,v 1.19 2011/02/01 18:33:24 skrll Exp $	*/
+/*	$NetBSD: harmony.c,v 1.20 2011/02/04 07:44:53 skrll Exp $	*/
 
 /*	$OpenBSD: harmony.c,v 1.23 2004/02/13 21:28:19 mickey Exp $	*/
 
@@ -679,12 +679,14 @@
 	bus_space_write_4(sc-sc_bt, sc-sc_bh, HARMONY_CNTL,
 	sc-sc_cntlbits | CNTL_C);
 
+#if 0
 	for (;;) {
 		/* Wait for it to come out of control mode */
 		reg = READ_REG(sc, HARMONY_CNTL);
 		if ((reg  CNTL_C) == 0)
 			break;
 	}
+#endif
 
 	sc-sc_need_commit = 0;