CVS commit: src/sys/dev/adb

2010-09-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep  8 04:48:03 UTC 2010

Modified Files:
src/sys/dev/adb: adb_bt.c

Log Message:
make debug code compile again


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/adb/adb_bt.c

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

Modified files:

Index: src/sys/dev/adb/adb_bt.c
diff -u src/sys/dev/adb/adb_bt.c:1.5 src/sys/dev/adb/adb_bt.c:1.6
--- src/sys/dev/adb/adb_bt.c:1.5	Thu May 15 19:19:50 2008
+++ src/sys/dev/adb/adb_bt.c	Wed Sep  8 04:48:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_bt.c,v 1.5 2008/05/15 19:19:50 macallan Exp $ */
+/*	$NetBSD: adb_bt.c,v 1.6 2010/09/08 04:48:03 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_bt.c,v 1.5 2008/05/15 19:19:50 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_bt.c,v 1.6 2010/09/08 04:48:03 macallan Exp $");
 
 #include 
 #include 
@@ -117,8 +117,9 @@
 	uint8_t k, scancode;
 
 #ifdef ADBBT_DEBUG
+	struct adbbt_softc *sc = cookie;
 	int i;
-	printf("%s: %02x - ", device_xname(&sc->sc_dev), sc->sc_us);
+	printf("%s: %02x - ", device_xname(sc->sc_dev), sc->sc_us);
 	for (i = 0; i < len; i++) {
 		printf(" %02x", data[i]);
 	}



CVS commit: src/crypto/external/bsd/netpgp/dist

2010-09-07 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Wed Sep  8 03:21:23 UTC 2010

Modified Files:
src/crypto/external/bsd/netpgp/dist: TODO
src/crypto/external/bsd/netpgp/dist/src/lib: crypto.c crypto.h netpgp.c
openssl_crypto.c packet-parse.c ssh2pgp.c version.h
src/crypto/external/bsd/netpgp/dist/src/libmj: libmj.3 mj.c mj.h
src/crypto/external/bsd/netpgp/dist/src/netpgp: netpgp.c
src/crypto/external/bsd/netpgp/dist/src/netpgpkeys: netpgpkeys.c

Log Message:
Changes to 3.99.12/20100907

+ add a pretty print function mj_pretty(3) to libmj
+ added netpgp_write_sshkey(3) to libnetpgp
+ added pgp2ssh(1)
+ added preliminary support for ElGamal decryption, needed for DSA keys
  as yet untested, unworking, and a WIP
+ add support for using all ssh keys, even those protected by a passphrase,
  for decryption and signing. This rounds off ssh key file support in netpgp.
+ add a single character alias [-S file] for [--sshkeyfile file] to
  netpgpkeys(1) and netpgp(1)

As far as ssh key file support goes, see the following example:

% cp configure a
% netpgp -S ~/.ssh/id_rsa.pub -e a
% netpgp -S ~/.ssh/id_rsa.pub -d a.gpg
Enter PEM pass phrase:
% ls -al a a.gpg
-rwxr-xr-x  1 agc  agc  758398 Sep  7 05:38 a
-rw---  1 agc  agc  156886 Sep  7 05:38 a.gpg
%


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/crypto/external/bsd/netpgp/dist/TODO
cvs rdiff -u -r1.27 -r1.28 \
src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c
cvs rdiff -u -r1.20 -r1.21 \
src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h
cvs rdiff -u -r1.74 -r1.75 \
src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
cvs rdiff -u -r1.28 -r1.29 \
src/crypto/external/bsd/netpgp/dist/src/lib/openssl_crypto.c
cvs rdiff -u -r1.41 -r1.42 \
src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c \
src/crypto/external/bsd/netpgp/dist/src/lib/version.h
cvs rdiff -u -r1.16 -r1.17 \
src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c
cvs rdiff -u -r1.1 -r1.2 \
src/crypto/external/bsd/netpgp/dist/src/libmj/libmj.3 \
src/crypto/external/bsd/netpgp/dist/src/libmj/mj.h
cvs rdiff -u -r1.3 -r1.4 src/crypto/external/bsd/netpgp/dist/src/libmj/mj.c
cvs rdiff -u -r1.14 -r1.15 \
src/crypto/external/bsd/netpgp/dist/src/netpgp/netpgp.c
cvs rdiff -u -r1.18 -r1.19 \
src/crypto/external/bsd/netpgp/dist/src/netpgpkeys/netpgpkeys.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/netpgp/dist/TODO
diff -u src/crypto/external/bsd/netpgp/dist/TODO:1.41 src/crypto/external/bsd/netpgp/dist/TODO:1.42
--- src/crypto/external/bsd/netpgp/dist/TODO:1.41	Sun Aug 15 07:52:26 2010
+++ src/crypto/external/bsd/netpgp/dist/TODO	Wed Sep  8 03:21:21 2010
@@ -6,7 +6,6 @@
 convert to and from ascii armored sigs
 gpgme compat lib
 get rid of public key free as part of seckey
-return userids from successful verify, and then print id out if required
 is get_passphrase_cb needed?
 error logging
 separate from libcrypto?
@@ -97,3 +96,6 @@
 make netpgpkeys work - add, import, commit, update, sign, passphrase
 fix ssh fingerprints not matching netpgp
 json/yaml output
+return userids from successful verify, and then print id out if required
+convert between pgp and ssh key formats
+PEM ssh keys and passphrases

Index: src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.27 src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.28
--- src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.27	Sun Aug 15 07:52:26 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c	Wed Sep  8 03:21:22 2010
@@ -54,7 +54,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: crypto.c,v 1.27 2010/08/15 07:52:26 agc Exp $");
+__RCSID("$NetBSD: crypto.c,v 1.28 2010/09/08 03:21:22 agc Exp $");
 #endif
 
 #include 
@@ -143,8 +143,43 @@
 		return n - i;
 	case OPS_PKA_DSA:
 	case OPS_PKA_ELGAMAL:
-		(void) fprintf(stderr, "XXX - no support for DSA/Elgamal yet\n");
-		return 0;
+		(void) fprintf(stderr, "XXX - preliminary support for DSA/Elgamal\n");
+		if (__ops_get_debug_level(__FILE__)) {
+			hexdump(stderr, "encrypted", encmpibuf, 16);
+		}
+		n = __ops_elgamal_private_decrypt(mpibuf, encmpibuf,
+	(unsigned)(BN_num_bits(encmpi) + 7) / 8,
+	&seckey->key.elgamal, &seckey->pubkey.key.elgamal);
+		if (n == -1) {
+			(void) fprintf(stderr, "ops_elgamal_private_decrypt failure\n");
+			return -1;
+		}
+		if (__ops_get_debug_level(__FILE__)) {
+			hexdump(stderr, "decrypted", mpibuf, 16);
+		}
+		if (n <= 0) {
+			return -1;
+		}
+		/* Decode EME-PKCS1_V1_5 (RFC 2437). */
+		if (mpib

CVS commit: src/libexec/httpd

2010-09-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Sep  8 00:47:45 UTC 2010

Modified Files:
src/libexec/httpd: bozohttpd.h

Log Message:
fix a compile error if NO_DIRINDEX_SUPPORT is defined.  from rudolf.


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

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

Modified files:

Index: src/libexec/httpd/bozohttpd.h
diff -u src/libexec/httpd/bozohttpd.h:1.14 src/libexec/httpd/bozohttpd.h:1.15
--- src/libexec/httpd/bozohttpd.h:1.14	Thu Jun 17 19:43:30 2010
+++ src/libexec/httpd/bozohttpd.h	Wed Sep  8 00:47:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: bozohttpd.h,v 1.14 2010/06/17 19:43:30 mrg Exp $	*/
+/*	$NetBSD: bozohttpd.h,v 1.15 2010/09/08 00:47:44 mrg Exp $	*/
 
 /*	$eterna: bozohttpd.h,v 1.35 2010/06/17 00:49:30 mrg Exp $	*/
 
@@ -256,7 +256,7 @@
 
 /* dir-index-bozo.c */
 #ifdef NO_DIRINDEX_SUPPORT
-#define bozo_dir_index(a, b, c, d)		0
+#define bozo_dir_index(a, b, c)0
 #else
 int	bozo_dir_index(bozo_httpreq_t *, const char *, int);
 #endif /* NO_DIRINDEX_SUPPORT */



CVS commit: src/sys/kern

2010-09-07 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Sep  7 21:32:03 UTC 2010

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

Log Message:
Remember the end of the last text segment and set up a fake data segment
if size 0 and starting after the text segments, if no data segment was
found. Unbreaks sbrk on platforms where all loaded segments are
executable (PR 43817). The cast of executable segments after data
segments is left out for now.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/kern/exec_elf.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/exec_elf.c
diff -u src/sys/kern/exec_elf.c:1.24 src/sys/kern/exec_elf.c:1.25
--- src/sys/kern/exec_elf.c:1.24	Fri Aug 20 14:59:53 2010
+++ src/sys/kern/exec_elf.c	Tue Sep  7 21:32:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf.c,v 1.24 2010/08/20 14:59:53 joerg Exp $	*/
+/*	$NetBSD: exec_elf.c,v 1.25 2010/09/07 21:32:03 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.24 2010/08/20 14:59:53 joerg Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.25 2010/09/07 21:32:03 joerg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -636,7 +636,7 @@
 {
 	Elf_Ehdr *eh = epp->ep_hdr;
 	Elf_Phdr *ph, *pp;
-	Elf_Addr phdr = 0, pos = 0;
+	Elf_Addr phdr = 0, pos = 0, end_text = 0;
 	int error, i, nload;
 	char *interp = NULL;
 	u_long phsize;
@@ -737,9 +737,6 @@
 			 * Consider this as text segment, if it is executable.
 			 * If there is more than one text segment, pick the
 			 * largest.
-			 *
-			 * If it is not executable, use the last section
-			 * as data segment to make break() happy.
 			 */
 			if (ph[i].p_flags & PF_X) {
 if (epp->ep_taddr == ELFDEFNNAME(NO_ADDR) ||
@@ -747,6 +744,7 @@
 	epp->ep_taddr = addr;
 	epp->ep_tsize = size;
 }
+end_text = addr + size;
 			} else {
 epp->ep_daddr = addr;
 epp->ep_dsize = size;
@@ -775,8 +773,8 @@
 	}
 
 	if (epp->ep_daddr == ELFDEFNNAME(NO_ADDR)) {
-		epp->ep_daddr = epp->ep_taddr;
-		epp->ep_dsize = epp->ep_tsize;
+		epp->ep_daddr = end_text;
+		epp->ep_dsize = 0;
 	}
 
 	/*



CVS commit: src/sys/rump/librump

2010-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Sep  7 21:11:10 UTC 2010

Modified Files:
src/sys/rump/librump/rumpkern: rump.c rump_private.h vm.c
src/sys/rump/librump/rumpvfs: rump_vfs.c rump_vfs_private.h

Log Message:
Make the Diabolical (Page)Daemon Director drain vfs buffers when
we are short of memory.

There are still some funnies left to iron out.  For example, with
a certain file system / memory size configuration it's still not
possible to create enough files to make the file system run out of
inodes before the kernel runs out of memory.  Also, with some other
configurations disk access slows down gargantually (though i'm sure
there are >0 buffers available).  Anyway, it ~works for now and
it's by no means worse than what it was before.


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/sys/rump/librump/rumpkern/rump.c
cvs rdiff -u -r1.57 -r1.58 src/sys/rump/librump/rumpkern/rump_private.h
cvs rdiff -u -r1.90 -r1.91 src/sys/rump/librump/rumpkern/vm.c
cvs rdiff -u -r1.57 -r1.58 src/sys/rump/librump/rumpvfs/rump_vfs.c
cvs rdiff -u -r1.13 -r1.14 src/sys/rump/librump/rumpvfs/rump_vfs_private.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/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.187 src/sys/rump/librump/rumpkern/rump.c:1.188
--- src/sys/rump/librump/rumpkern/rump.c:1.187	Tue Sep  7 18:25:38 2010
+++ src/sys/rump/librump/rumpkern/rump.c	Tue Sep  7 21:11:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.187 2010/09/07 18:25:38 pooka Exp $	*/
+/*	$NetBSD: rump.c,v 1.188 2010/09/07 21:11:10 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.187 2010/09/07 18:25:38 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.188 2010/09/07 21:11:10 pooka Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -153,6 +153,8 @@
 __weak_alias(biodone,rump__unavailable);
 __weak_alias(sopoll,rump__unavailable);
 
+__weak_alias(rump_vfs_drainbufs,rump__unavailable);
+
 void rump__unavailable_vfs_panic(void);
 void rump__unavailable_vfs_panic() {panic("vfs component not available");}
 __weak_alias(usermount_common_policy,rump__unavailable_vfs_panic);

Index: src/sys/rump/librump/rumpkern/rump_private.h
diff -u src/sys/rump/librump/rumpkern/rump_private.h:1.57 src/sys/rump/librump/rumpkern/rump_private.h:1.58
--- src/sys/rump/librump/rumpkern/rump_private.h:1.57	Tue Sep  7 18:25:38 2010
+++ src/sys/rump/librump/rumpkern/rump_private.h	Tue Sep  7 21:11:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_private.h,v 1.57 2010/09/07 18:25:38 pooka Exp $	*/
+/*	$NetBSD: rump_private.h,v 1.58 2010/09/07 21:11:10 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -87,6 +87,9 @@
 		panic("\"%s\" failed", #call);\
 } while (/*CONSTCOND*/0)
 
+#define RUMPMEM_UNLIMITED ((unsigned long)-1)
+extern unsigned long rump_physmemlimit;
+
 void		rump_component_init(enum rump_component_type);
 int		rump_component_count(enum rump_component_type);
 

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.90 src/sys/rump/librump/rumpkern/vm.c:1.91
--- src/sys/rump/librump/rumpkern/vm.c:1.90	Tue Sep  7 07:47:36 2010
+++ src/sys/rump/librump/rumpkern/vm.c	Tue Sep  7 21:11:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.90 2010/09/07 07:47:36 pooka Exp $	*/
+/*	$NetBSD: vm.c,v 1.91 2010/09/07 21:11:10 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.90 2010/09/07 07:47:36 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.91 2010/09/07 21:11:10 pooka Exp $");
 
 #include 
 #include 
@@ -63,6 +63,7 @@
 #include 
 
 #include "rump_private.h"
+#include "rump_vfs_private.h"
 
 kmutex_t uvm_pageqlock;
 kmutex_t uvm_swap_data_lock;
@@ -81,8 +82,7 @@
 static kmutex_t pdaemonmtx;
 static kcondvar_t pdaemoncv, oomwait;
 
-#define RUMPMEM_UNLIMITED ((unsigned long)-1)
-static unsigned long physmemlimit = RUMPMEM_UNLIMITED;
+unsigned long rump_physmemlimit = RUMPMEM_UNLIMITED;
 static unsigned long curphysmem;
 
 static int
@@ -199,13 +199,13 @@
 	int error;
 
 	if (rumpuser_getenv("RUMP_MEMLIMIT", buf, sizeof(buf), &error) == 0) {
-		physmemlimit = strtoll(buf, NULL, 10);
+		rump_physmemlimit = strtoll(buf, NULL, 10);
 		/* it's not like we'd get far with, say, 1 byte, but ... */
-		if (physmemlimit == 0)
+		if (rump_physmemlimit == 0)
 			panic("uvm_init: no memory available");
 #define HUMANIZE_BYTES 9
 		CTASSERT(sizeof(buf) >= HUMANIZE_BYTES);
-		format_bytes(buf, HUMANIZE_BYTES, physmemlimit);
+		format_bytes(buf, HUMANIZE_BYTES, rump_physmemlimit);
 #undef HUMANIZE_BYTES
 	} else {
 		strlcpy(buf, "unlimited (host limit)", sizeof(buf));
@@ -782,6 +782,7 @@
 		pool_drain_start(&pp_first, &where);
 		p

CVS commit: src/sys/lib/libkern/arch/i386

2010-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Sep  7 20:35:51 UTC 2010

Modified Files:
src/sys/lib/libkern/arch/i386: random.S

Log Message:
Rename jump label to something a little more negative.  No, I'm
not doing it for cosmetic value or out of angst.  See, PIC_PROLOGUE
on i386 uses the "1" label internally.  Now, everything would be
fine and dandy for the first 551245 calls to random.  After that
p+q is negative and the jump is taken.  However, it is taken into
the middle of PIC_PROLOGUE instead of where upon superficial
examination we assumed we are jumping.  This causes wrong(tm) things
to happen and "ret" triggers a jump into hyperspace.

(no, I did not see that coming)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/lib/libkern/arch/i386/random.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/lib/libkern/arch/i386/random.S
diff -u src/sys/lib/libkern/arch/i386/random.S:1.5 src/sys/lib/libkern/arch/i386/random.S:1.6
--- src/sys/lib/libkern/arch/i386/random.S:1.5	Sun Jan  4 17:10:46 2009
+++ src/sys/lib/libkern/arch/i386/random.S	Tue Sep  7 20:35:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: random.S,v 1.5 2009/01/04 17:10:46 pooka Exp $	*/
+/*	$NetBSD: random.S,v 1.6 2010/09/07 20:35:50 pooka Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -83,12 +83,12 @@
 	shld	$1,%eax,%edx
 	andl	$0x7fff,%eax
 	addl	%edx,%eax
-	js	1f
+	js	neg
 	PIC_PROLOGUE
 	movl	%eax,PIC_GOTOFF(randseed)
 	PIC_EPILOGUE
 	ret
-1:
+neg:
 	subl	$0x7fff,%eax
 	PIC_PROLOGUE
 	movl	%eax,PIC_GOTOFF(randseed)



CVS commit: [netbsd-5] src/doc

2010-09-07 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Sep  7 19:40:07 UTC 2010

Modified Files:
src/doc [netbsd-5]: CHANGES-5.1

Log Message:
Tickets 1447 - 1449


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.239 -r1.1.2.240 src/doc/CHANGES-5.1

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-5.1
diff -u src/doc/CHANGES-5.1:1.1.2.239 src/doc/CHANGES-5.1:1.1.2.240
--- src/doc/CHANGES-5.1:1.1.2.239	Tue Aug 31 10:56:03 2010
+++ src/doc/CHANGES-5.1	Tue Sep  7 19:40:07 2010
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.1,v 1.1.2.239 2010/08/31 10:56:03 bouyer Exp $
+# $NetBSD: CHANGES-5.1,v 1.1.2.240 2010/09/07 19:40:07 bouyer Exp $
 
 A complete list of changes from the NetBSD 5.0 release to the NetBSD 5.1
 release:
@@ -17443,3 +17443,31 @@
 	  wrap around.
 	[christos, ticket #1444]
 
+crypto/external/bsd/openssl/dist/ssl/s3_clnt.c	1.2 via patch
+
+	fix CVE-2010-2939:
+	a double free() in error case cause a SEGV, see the thread
+	"openssl-1.0.0a and glibc detected sthg ;)" in openssl-dev.
+	[drochner, ticket #1447]
+
+sys/miscfs/genfs/genfs_io.c			1.40 via patch
+sys/miscfs/genfs/genfs_node.h			1.20 via patch
+sys/miscfs/genfs/genfs_vnops.c			1.183 via patch
+sys/ufs/ufs/ufs_inode.c1.83 via patch
+sys/uvm/uvm_pager.h1.39 via patch
+
+	replace the earlier workaround for PR 40389 with a better fix.
+	the earlier change caused data corruption by freeing pages
+	without invaliding their mappings.  instead of the trylock/retry,
+	just take the genfs-node lock before calling VOP_GETPAGES()
+	and pass a new flag to tell it that we're already holding this lock.
+	[chs, ticket #1448]
+
+sys/arch/amd64/amd64/netbsd32_machdep.c		1.66, 1.67
+sys/arch/amd64/include/segments.h		1.21
+
+	in check_mcontext32(), accept the LDT selector for 32-bit user code
+	as well as the GDT selector.  fixes PR 43835.
+	accept the LDT selector in check_sigcontext32() too.
+	[chs, ticket #1449]
+



CVS commit: [netbsd-5-0] src/doc

2010-09-07 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Sep  7 19:39:57 UTC 2010

Modified Files:
src/doc [netbsd-5-0]: CHANGES-5.0.3

Log Message:
Tickets 1447 - 1449


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/doc/CHANGES-5.0.3

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-5.0.3
diff -u src/doc/CHANGES-5.0.3:1.1.2.17 src/doc/CHANGES-5.0.3:1.1.2.18
--- src/doc/CHANGES-5.0.3:1.1.2.17	Tue Aug 31 10:56:34 2010
+++ src/doc/CHANGES-5.0.3	Tue Sep  7 19:39:56 2010
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.0.3,v 1.1.2.17 2010/08/31 10:56:34 bouyer Exp $
+# $NetBSD: CHANGES-5.0.3,v 1.1.2.18 2010/09/07 19:39:56 bouyer Exp $
 
 A complete list of changes from the NetBSD 5.0.2 release to the NetBSD 5.0.3
 release:
@@ -306,3 +306,31 @@
 	  wrap around.
 	[christos, ticket #1444]
 
+crypto/external/bsd/openssl/dist/ssl/s3_clnt.c	1.2 via patch
+
+	fix CVE-2010-2939:
+	a double free() in error case cause a SEGV, see the thread
+	"openssl-1.0.0a and glibc detected sthg ;)" in openssl-dev.
+	[drochner, ticket #1447]
+
+sys/miscfs/genfs/genfs_io.c			1.40 via patch
+sys/miscfs/genfs/genfs_node.h			1.20 via patch
+sys/miscfs/genfs/genfs_vnops.c			1.183 via patch
+sys/ufs/ufs/ufs_inode.c1.83 via patch
+sys/uvm/uvm_pager.h1.39 via patch
+
+	replace the earlier workaround for PR 40389 with a better fix.
+	the earlier change caused data corruption by freeing pages
+	without invaliding their mappings.  instead of the trylock/retry,
+	just take the genfs-node lock before calling VOP_GETPAGES()
+	and pass a new flag to tell it that we're already holding this lock.
+	[chs, ticket #1448]
+
+sys/arch/amd64/amd64/netbsd32_machdep.c		1.66, 1.67
+sys/arch/amd64/include/segments.h		1.21
+
+	in check_mcontext32(), accept the LDT selector for 32-bit user code
+	as well as the GDT selector.  fixes PR 43835.
+	accept the LDT selector in check_sigcontext32() too.
+	[chs, ticket #1449]
+



CVS commit: [netbsd-5-0] src/sys/arch/amd64

2010-09-07 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Sep  7 19:38:45 UTC 2010

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-5-0]: netbsd32_machdep.c
src/sys/arch/amd64/include [netbsd-5-0]: segments.h

Log Message:
Pull up following revision(s) (requested by chs in ticket #1449):
sys/arch/amd64/amd64/netbsd32_machdep.c: revisions 1.66, 1.67
sys/arch/amd64/include/segments.h: revision 1.21
in check_mcontext32(), accept the LDT selector for 32-bit user code
as well as the GDT selector.  fixes PR 43835.
accept the LDT selector in check_sigcontext32() too.


To generate a diff of this commit:
cvs rdiff -u -r1.55.6.1 -r1.55.6.2 \
src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.19 -r1.19.10.1 src/sys/arch/amd64/include/segments.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/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.6.1 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.6.2
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.6.1	Fri Jul 16 18:43:58 2010
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Tue Sep  7 19:38:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.55.6.1 2010/07/16 18:43:58 riz Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.55.6.2 2010/09/07 19:38:44 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.55.6.1 2010/07/16 18:43:58 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.55.6.2 2010/09/07 19:38:44 bouyer Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_coredump.h"
@@ -938,7 +938,7 @@
 {
 
 	if (((scp->sc_eflags ^ tf->tf_rflags) & PSL_USERSTATIC) != 0 ||
-	scp->sc_cs != GSEL(GUCODE32_SEL, SEL_UPL))
+	!VALID_USER_CSEL32(scp->sc_cs))
 		return EINVAL;
 	if (scp->sc_fs != 0 && !VALID_USER_DSEL32(scp->sc_fs))
 		return EINVAL;
@@ -961,7 +961,7 @@
 	gr = mcp->__gregs;
 
 	if (((gr[_REG32_EFL] ^ tf->tf_rflags) & PSL_USERSTATIC) != 0 ||
-	gr[_REG32_CS] != GSEL(GUCODE32_SEL, SEL_UPL))
+	!VALID_USER_CSEL32(gr[_REG32_CS]))
 		return EINVAL;
 	if (gr[_REG32_FS] != 0 && !VALID_USER_DSEL32(gr[_REG32_FS]))
 		return EINVAL;

Index: src/sys/arch/amd64/include/segments.h
diff -u src/sys/arch/amd64/include/segments.h:1.19 src/sys/arch/amd64/include/segments.h:1.19.10.1
--- src/sys/arch/amd64/include/segments.h:1.19	Sun Oct 26 00:08:15 2008
+++ src/sys/arch/amd64/include/segments.h	Tue Sep  7 19:38:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: segments.h,v 1.19 2008/10/26 00:08:15 mrg Exp $	*/
+/*	$NetBSD: segments.h,v 1.19.10.1 2010/09/07 19:38:45 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -382,10 +382,8 @@
 #define VALID_USER_DSEL32(s) \
 (((s) & 0x) == GSEL(GUDATA32_SEL, SEL_UPL) || \
  ((s) & 0x) == LSEL(LUDATA32_SEL, SEL_UPL))
-#if 0 /* not used */
 #define VALID_USER_CSEL32(s) \
 ((s) == GSEL(GUCODE32_SEL, SEL_UPL) || (s) == LSEL(LUCODE32_SEL, SEL_UPL))
-#endif
 
 #define VALID_USER_CSEL(s) \
 ((s) == GSEL(GUCODE_SEL, SEL_UPL) || (s) == LSEL(LUCODE_SEL, SEL_UPL))



CVS commit: [netbsd-5] src/sys/arch/amd64

2010-09-07 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Sep  7 19:38:21 UTC 2010

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-5]: netbsd32_machdep.c
src/sys/arch/amd64/include [netbsd-5]: segments.h

Log Message:
Pull up following revision(s) (requested by chs in ticket #1449):
sys/arch/amd64/amd64/netbsd32_machdep.c: revisions 1.66, 1.67
sys/arch/amd64/include/segments.h: revision 1.21
in check_mcontext32(), accept the LDT selector for 32-bit user code
as well as the GDT selector.  fixes PR 43835.
accept the LDT selector in check_sigcontext32() too.


To generate a diff of this commit:
cvs rdiff -u -r1.55.4.2 -r1.55.4.3 \
src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.19 -r1.19.4.1 src/sys/arch/amd64/include/segments.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/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.4.2 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.4.3
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.55.4.2	Fri Jul 16 18:40:39 2010
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Tue Sep  7 19:38:20 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.55.4.2 2010/07/16 18:40:39 riz Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.55.4.3 2010/09/07 19:38:20 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.55.4.2 2010/07/16 18:40:39 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.55.4.3 2010/09/07 19:38:20 bouyer Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_coredump.h"
@@ -944,7 +944,7 @@
 {
 
 	if (((scp->sc_eflags ^ tf->tf_rflags) & PSL_USERSTATIC) != 0 ||
-	scp->sc_cs != GSEL(GUCODE32_SEL, SEL_UPL))
+	!VALID_USER_CSEL32(scp->sc_cs))
 		return EINVAL;
 	if (scp->sc_fs != 0 && !VALID_USER_DSEL32(scp->sc_fs))
 		return EINVAL;
@@ -967,7 +967,7 @@
 	gr = mcp->__gregs;
 
 	if (((gr[_REG32_EFL] ^ tf->tf_rflags) & PSL_USERSTATIC) != 0 ||
-	gr[_REG32_CS] != GSEL(GUCODE32_SEL, SEL_UPL))
+	!VALID_USER_CSEL32(gr[_REG32_CS]))
 		return EINVAL;
 	if (gr[_REG32_FS] != 0 && !VALID_USER_DSEL32(gr[_REG32_FS]))
 		return EINVAL;

Index: src/sys/arch/amd64/include/segments.h
diff -u src/sys/arch/amd64/include/segments.h:1.19 src/sys/arch/amd64/include/segments.h:1.19.4.1
--- src/sys/arch/amd64/include/segments.h:1.19	Sun Oct 26 00:08:15 2008
+++ src/sys/arch/amd64/include/segments.h	Tue Sep  7 19:38:21 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: segments.h,v 1.19 2008/10/26 00:08:15 mrg Exp $	*/
+/*	$NetBSD: segments.h,v 1.19.4.1 2010/09/07 19:38:21 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -382,10 +382,8 @@
 #define VALID_USER_DSEL32(s) \
 (((s) & 0x) == GSEL(GUDATA32_SEL, SEL_UPL) || \
  ((s) & 0x) == LSEL(LUDATA32_SEL, SEL_UPL))
-#if 0 /* not used */
 #define VALID_USER_CSEL32(s) \
 ((s) == GSEL(GUCODE32_SEL, SEL_UPL) || (s) == LSEL(LUCODE32_SEL, SEL_UPL))
-#endif
 
 #define VALID_USER_CSEL(s) \
 ((s) == GSEL(GUCODE_SEL, SEL_UPL) || (s) == LSEL(LUCODE_SEL, SEL_UPL))



CVS commit: [netbsd-5-0] src/sys

2010-09-07 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Sep  7 19:33:44 UTC 2010

Modified Files:
src/sys/miscfs/genfs [netbsd-5-0]: genfs_io.c genfs_node.h
genfs_vnops.c
src/sys/ufs/ufs [netbsd-5-0]: ufs_inode.c
src/sys/uvm [netbsd-5-0]: uvm_pager.h

Log Message:
Pull up following revision(s) (requested by chs in ticket #1448):
sys/uvm/uvm_pager.h: revision 1.39 via patch
sys/miscfs/genfs/genfs_vnops.c: revision 1.183 via patch
sys/ufs/ufs/ufs_inode.c: revision 1.83 via patch
sys/miscfs/genfs/genfs_io.c: revision 1.40 via patch
sys/miscfs/genfs/genfs_node.h: revision 1.20 via patch
replace the earlier workaround for PR 40389 with a better fix.
the earlier change caused data corruption by freeing pages
without invaliding their mappings.  instead of the trylock/retry,
just take the genfs-node lock before calling VOP_GETPAGES()
and pass a new flag to tell it that we're already holding this lock.


To generate a diff of this commit:
cvs rdiff -u -r1.13.4.2 -r1.13.4.2.2.1 src/sys/miscfs/genfs/genfs_io.c
cvs rdiff -u -r1.17 -r1.17.14.1 src/sys/miscfs/genfs/genfs_node.h
cvs rdiff -u -r1.167 -r1.167.16.1 src/sys/miscfs/genfs/genfs_vnops.c
cvs rdiff -u -r1.76.4.1 -r1.76.4.1.2.1 src/sys/ufs/ufs/ufs_inode.c
cvs rdiff -u -r1.38 -r1.38.10.1 src/sys/uvm/uvm_pager.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/miscfs/genfs/genfs_io.c
diff -u src/sys/miscfs/genfs/genfs_io.c:1.13.4.2 src/sys/miscfs/genfs/genfs_io.c:1.13.4.2.2.1
--- src/sys/miscfs/genfs/genfs_io.c:1.13.4.2	Sat Apr  4 18:14:50 2009
+++ src/sys/miscfs/genfs/genfs_io.c	Tue Sep  7 19:33:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_io.c,v 1.13.4.2 2009/04/04 18:14:50 snj Exp $	*/
+/*	$NetBSD: genfs_io.c,v 1.13.4.2.2.1 2010/09/07 19:33:44 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.13.4.2 2009/04/04 18:14:50 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.13.4.2.2.1 2010/09/07 19:33:44 bouyer Exp $");
 
 #include 
 #include 
@@ -126,6 +126,7 @@
 	bool has_trans = false;
 	const bool overwrite = (flags & PGO_OVERWRITE) != 0;
 	const bool blockalloc = write && (flags & PGO_NOBLOCKALLOC) == 0;
+	const bool glocked = (flags & PGO_GLOCKHELD) != 0;
 	voff_t origvsize;
 	UVMHIST_FUNC("genfs_getpages"); UVMHIST_CALLED(ubchist);
 
@@ -214,6 +215,7 @@
 	if (flags & PGO_LOCKED) {
 		int nfound;
 
+		KASSERT(!glocked);
 		npages = *ap->a_count;
 #if defined(DEBUG)
 		for (i = 0; i < npages; i++) {
@@ -228,7 +230,7 @@
 			error = EBUSY;
 			goto out_err;
 		}
-		if (!rw_tryenter(&gp->g_glock, RW_READER)) {
+		if (!genfs_node_rdtrylock(vp)) {
 			genfs_rel_pages(ap->a_m, npages);
 
 			/*
@@ -243,7 +245,7 @@
 }
 			}
 		} else {
-			rw_exit(&gp->g_glock);
+			genfs_node_unlock(vp);
 		}
 		error = (ap->a_m[ap->a_centeridx] == NULL ? EBUSY : 0);
 		goto out_err;
@@ -302,14 +304,19 @@
 	 * check if our idea of v_size is still valid.
 	 */
 
-	if (blockalloc) {
-		rw_enter(&gp->g_glock, RW_WRITER);
-	} else {
-		rw_enter(&gp->g_glock, RW_READER);
+	KASSERT(!glocked || genfs_node_wrlocked(vp));
+	if (!glocked) {
+		if (blockalloc) {
+			genfs_node_wrlock(vp);
+		} else {
+			genfs_node_rdlock(vp);
+		}
 	}
 	mutex_enter(&uobj->vmobjlock);
 	if (vp->v_size < origvsize) {
-		rw_exit(&gp->g_glock);
+		if (!glocked) {
+			genfs_node_unlock(vp);
+		}
 		if (pgs != pgs_onstack)
 			kmem_free(pgs, pgs_size);
 		goto startover;
@@ -317,7 +324,9 @@
 
 	if (uvn_findpages(uobj, origoffset, &npages, &pgs[ridx],
 	async ? UFP_NOWAIT : UFP_ALL) != orignpages) {
-		rw_exit(&gp->g_glock);
+		if (!glocked) {
+			genfs_node_unlock(vp);
+		}
 		KASSERT(async != 0);
 		genfs_rel_pages(&pgs[ridx], orignpages);
 		mutex_exit(&uobj->vmobjlock);
@@ -338,7 +347,9 @@
 		}
 	}
 	if (i == npages) {
-		rw_exit(&gp->g_glock);
+		if (!glocked) {
+			genfs_node_unlock(vp);
+		}
 		UVMHIST_LOG(ubchist, "returning cached pages", 0,0,0,0);
 		npages += ridx;
 		goto out;
@@ -349,7 +360,9 @@
 	 */
 
 	if (overwrite) {
-		rw_exit(&gp->g_glock);
+		if (!glocked) {
+			genfs_node_unlock(vp);
+		}
 		UVMHIST_LOG(ubchist, "PGO_OVERWRITE",0,0,0,0);
 
 		for (i = 0; i < npages; i++) {
@@ -384,7 +397,9 @@
 		npgs = npages;
 		if (uvn_findpages(uobj, startoffset, &npgs, pgs,
 		async ? UFP_NOWAIT : UFP_ALL) != npages) {
-			rw_exit(&gp->g_glock);
+			if (!glocked) {
+genfs_node_unlock(vp);
+			}
 			KASSERT(async != 0);
 			genfs_rel_pages(pgs, npages);
 			mutex_exit(&uobj->vmobjlock);
@@ -565,7 +580,9 @@
 	nestiobuf_done(mbp, skipbytes, error);
 	if (async) {
 		UVMHIST_LOG(ubchist, "returning 0 (async)",0,0,0,0);
-		rw_exit(&gp->g_glock);
+		if (!glocked) {
+			genfs_node_unlock(vp);
+		}
 		error = 0;
 		goto out_err;
 	}
@@ -613,7 +630,9 @@
 			}
 		}
 	}
-	rw_exit(&gp->g_glock);
+	if (!glocked) {
+		genfs_node_unlock(v

CVS commit: [netbsd-5] src/sys

2010-09-07 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Sep  7 19:33:35 UTC 2010

Modified Files:
src/sys/miscfs/genfs [netbsd-5]: genfs_io.c genfs_node.h genfs_vnops.c
src/sys/ufs/ufs [netbsd-5]: ufs_inode.c
src/sys/uvm [netbsd-5]: uvm_pager.h

Log Message:
Pull up following revision(s) (requested by chs in ticket #1448):
sys/uvm/uvm_pager.h: revision 1.39 via patch
sys/miscfs/genfs/genfs_vnops.c: revision 1.183 via patch
sys/ufs/ufs/ufs_inode.c: revision 1.83 via patch
sys/miscfs/genfs/genfs_io.c: revision 1.40 via patch
sys/miscfs/genfs/genfs_node.h: revision 1.20 via patch
replace the earlier workaround for PR 40389 with a better fix.
the earlier change caused data corruption by freeing pages
without invaliding their mappings.  instead of the trylock/retry,
just take the genfs-node lock before calling VOP_GETPAGES()
and pass a new flag to tell it that we're already holding this lock.


To generate a diff of this commit:
cvs rdiff -u -r1.13.4.2 -r1.13.4.3 src/sys/miscfs/genfs/genfs_io.c
cvs rdiff -u -r1.17 -r1.17.8.1 src/sys/miscfs/genfs/genfs_node.h
cvs rdiff -u -r1.167 -r1.167.10.1 src/sys/miscfs/genfs/genfs_vnops.c
cvs rdiff -u -r1.76.4.3 -r1.76.4.4 src/sys/ufs/ufs/ufs_inode.c
cvs rdiff -u -r1.38 -r1.38.4.1 src/sys/uvm/uvm_pager.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/miscfs/genfs/genfs_io.c
diff -u src/sys/miscfs/genfs/genfs_io.c:1.13.4.2 src/sys/miscfs/genfs/genfs_io.c:1.13.4.3
--- src/sys/miscfs/genfs/genfs_io.c:1.13.4.2	Sat Apr  4 18:14:50 2009
+++ src/sys/miscfs/genfs/genfs_io.c	Tue Sep  7 19:33:35 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_io.c,v 1.13.4.2 2009/04/04 18:14:50 snj Exp $	*/
+/*	$NetBSD: genfs_io.c,v 1.13.4.3 2010/09/07 19:33:35 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.13.4.2 2009/04/04 18:14:50 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.13.4.3 2010/09/07 19:33:35 bouyer Exp $");
 
 #include 
 #include 
@@ -126,6 +126,7 @@
 	bool has_trans = false;
 	const bool overwrite = (flags & PGO_OVERWRITE) != 0;
 	const bool blockalloc = write && (flags & PGO_NOBLOCKALLOC) == 0;
+	const bool glocked = (flags & PGO_GLOCKHELD) != 0;
 	voff_t origvsize;
 	UVMHIST_FUNC("genfs_getpages"); UVMHIST_CALLED(ubchist);
 
@@ -214,6 +215,7 @@
 	if (flags & PGO_LOCKED) {
 		int nfound;
 
+		KASSERT(!glocked);
 		npages = *ap->a_count;
 #if defined(DEBUG)
 		for (i = 0; i < npages; i++) {
@@ -228,7 +230,7 @@
 			error = EBUSY;
 			goto out_err;
 		}
-		if (!rw_tryenter(&gp->g_glock, RW_READER)) {
+		if (!genfs_node_rdtrylock(vp)) {
 			genfs_rel_pages(ap->a_m, npages);
 
 			/*
@@ -243,7 +245,7 @@
 }
 			}
 		} else {
-			rw_exit(&gp->g_glock);
+			genfs_node_unlock(vp);
 		}
 		error = (ap->a_m[ap->a_centeridx] == NULL ? EBUSY : 0);
 		goto out_err;
@@ -302,14 +304,19 @@
 	 * check if our idea of v_size is still valid.
 	 */
 
-	if (blockalloc) {
-		rw_enter(&gp->g_glock, RW_WRITER);
-	} else {
-		rw_enter(&gp->g_glock, RW_READER);
+	KASSERT(!glocked || genfs_node_wrlocked(vp));
+	if (!glocked) {
+		if (blockalloc) {
+			genfs_node_wrlock(vp);
+		} else {
+			genfs_node_rdlock(vp);
+		}
 	}
 	mutex_enter(&uobj->vmobjlock);
 	if (vp->v_size < origvsize) {
-		rw_exit(&gp->g_glock);
+		if (!glocked) {
+			genfs_node_unlock(vp);
+		}
 		if (pgs != pgs_onstack)
 			kmem_free(pgs, pgs_size);
 		goto startover;
@@ -317,7 +324,9 @@
 
 	if (uvn_findpages(uobj, origoffset, &npages, &pgs[ridx],
 	async ? UFP_NOWAIT : UFP_ALL) != orignpages) {
-		rw_exit(&gp->g_glock);
+		if (!glocked) {
+			genfs_node_unlock(vp);
+		}
 		KASSERT(async != 0);
 		genfs_rel_pages(&pgs[ridx], orignpages);
 		mutex_exit(&uobj->vmobjlock);
@@ -338,7 +347,9 @@
 		}
 	}
 	if (i == npages) {
-		rw_exit(&gp->g_glock);
+		if (!glocked) {
+			genfs_node_unlock(vp);
+		}
 		UVMHIST_LOG(ubchist, "returning cached pages", 0,0,0,0);
 		npages += ridx;
 		goto out;
@@ -349,7 +360,9 @@
 	 */
 
 	if (overwrite) {
-		rw_exit(&gp->g_glock);
+		if (!glocked) {
+			genfs_node_unlock(vp);
+		}
 		UVMHIST_LOG(ubchist, "PGO_OVERWRITE",0,0,0,0);
 
 		for (i = 0; i < npages; i++) {
@@ -384,7 +397,9 @@
 		npgs = npages;
 		if (uvn_findpages(uobj, startoffset, &npgs, pgs,
 		async ? UFP_NOWAIT : UFP_ALL) != npages) {
-			rw_exit(&gp->g_glock);
+			if (!glocked) {
+genfs_node_unlock(vp);
+			}
 			KASSERT(async != 0);
 			genfs_rel_pages(pgs, npages);
 			mutex_exit(&uobj->vmobjlock);
@@ -565,7 +580,9 @@
 	nestiobuf_done(mbp, skipbytes, error);
 	if (async) {
 		UVMHIST_LOG(ubchist, "returning 0 (async)",0,0,0,0);
-		rw_exit(&gp->g_glock);
+		if (!glocked) {
+			genfs_node_unlock(vp);
+		}
 		error = 0;
 		goto out_err;
 	}
@@ -613,7 +630,9 @@
 			}
 		}
 	}
-	rw_exit(&gp->g_glock);
+	if (!glocked) {
+		genfs_node_unlock(vp);
+	}
 	mutex_enter(&uobj->vmobjlock);

CVS commit: [netbsd-5] src/crypto/dist/openssl/ssl

2010-09-07 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Sep  7 19:31:14 UTC 2010

Modified Files:
src/crypto/dist/openssl/ssl [netbsd-5]: s3_clnt.c

Log Message:
Pull up following revision(s) (requested by drochner in ticket #1447):
crypto/external/bsd/openssl/dist/ssl/s3_clnt.c: revision 1.2 via patch
fix a double free() in error case, see the thread
"openssl-1.0.0a and glibc detected sthg ;)" in openssl-dev.
I was getting a SEGV with the example posted there.


To generate a diff of this commit:
cvs rdiff -u -r1.12.4.1 -r1.12.4.2 src/crypto/dist/openssl/ssl/s3_clnt.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/dist/openssl/ssl/s3_clnt.c
diff -u src/crypto/dist/openssl/ssl/s3_clnt.c:1.12.4.1 src/crypto/dist/openssl/ssl/s3_clnt.c:1.12.4.2
--- src/crypto/dist/openssl/ssl/s3_clnt.c:1.12.4.1	Tue Jan 20 21:28:09 2009
+++ src/crypto/dist/openssl/ssl/s3_clnt.c	Tue Sep  7 19:31:14 2010
@@ -1460,6 +1460,7 @@
 		s->session->sess_cert->peer_ecdh_tmp=ecdh;
 		ecdh=NULL;
 		BN_CTX_free(bn_ctx);
+		bn_ctx = NULL;
 		EC_POINT_free(srvr_ecpoint);
 		srvr_ecpoint = NULL;
 		}



CVS commit: [netbsd-5-0] src/crypto/dist/openssl/ssl

2010-09-07 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Sep  7 19:31:04 UTC 2010

Modified Files:
src/crypto/dist/openssl/ssl [netbsd-5-0]: s3_clnt.c

Log Message:
Pull up following revision(s) (requested by drochner in ticket #1447):
crypto/external/bsd/openssl/dist/ssl/s3_clnt.c: revision 1.2 via patch
fix a double free() in error case, see the thread
"openssl-1.0.0a and glibc detected sthg ;)" in openssl-dev.
I was getting a SEGV with the example posted there.


To generate a diff of this commit:
cvs rdiff -u -r1.12.4.1 -r1.12.4.1.2.1 src/crypto/dist/openssl/ssl/s3_clnt.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/dist/openssl/ssl/s3_clnt.c
diff -u src/crypto/dist/openssl/ssl/s3_clnt.c:1.12.4.1 src/crypto/dist/openssl/ssl/s3_clnt.c:1.12.4.1.2.1
--- src/crypto/dist/openssl/ssl/s3_clnt.c:1.12.4.1	Tue Jan 20 21:28:09 2009
+++ src/crypto/dist/openssl/ssl/s3_clnt.c	Tue Sep  7 19:31:04 2010
@@ -1460,6 +1460,7 @@
 		s->session->sess_cert->peer_ecdh_tmp=ecdh;
 		ecdh=NULL;
 		BN_CTX_free(bn_ctx);
+		bn_ctx = NULL;
 		EC_POINT_free(srvr_ecpoint);
 		srvr_ecpoint = NULL;
 		}



CVS commit: src/sys/arch/macppc/dev

2010-09-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Sep  7 18:47:25 UTC 2010

Modified Files:
src/sys/arch/macppc/dev: awacs.c

Log Message:
make this work with PMF hotkey events
Now the volume control buttons work on my Pismo


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/macppc/dev/awacs.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/macppc/dev/awacs.c
diff -u src/sys/arch/macppc/dev/awacs.c:1.36 src/sys/arch/macppc/dev/awacs.c:1.37
--- src/sys/arch/macppc/dev/awacs.c:1.36	Thu Nov  5 05:37:30 2009
+++ src/sys/arch/macppc/dev/awacs.c	Tue Sep  7 18:47:24 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: awacs.c,v 1.36 2009/11/05 05:37:30 dyoung Exp $	*/
+/*	$NetBSD: awacs.c,v 1.37 2010/09/07 18:47:24 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awacs.c,v 1.36 2009/11/05 05:37:30 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awacs.c,v 1.37 2010/09/07 18:47:24 macallan Exp $");
 
 #include 
 #include 
@@ -529,6 +529,7 @@
 	&sc->sc_thread, "%s", "awacs") != 0) {
 		printf("awacs: unable to create event kthread");
 	}
+	pmf_device_register(sc->sc_dev, NULL, NULL);
 }
 
 static int
@@ -952,7 +953,7 @@
 	switch (dip->index) {
 
 	case AWACS_OUTPUT_SELECT:
-		dip->mixer_class = AWACS_MONITOR_CLASS;
+		dip->mixer_class = AWACS_OUTPUT_CLASS;
 		strcpy(dip->label.name, AudioNoutput);
 		dip->type = AUDIO_MIXER_SET;
 		dip->prev = dip->next = AUDIO_MIXER_LAST;
@@ -964,11 +965,12 @@
 		return 0;
 
 	case AWACS_VOL_MASTER:
-		dip->mixer_class = AWACS_MONITOR_CLASS;
+		dip->mixer_class = AWACS_OUTPUT_CLASS;
 		strcpy(dip->label.name, AudioNmaster);
 		dip->type = AUDIO_MIXER_VALUE;
 		dip->prev = dip->next = AUDIO_MIXER_LAST;
 		dip->un.v.num_channels = 2;
+		dip->un.v.delta = 16;
 		strcpy(dip->un.v.units.name, AudioNvolume);
 		return 0;
 
@@ -985,7 +987,7 @@
 	case AWACS_BASS:
 		if (sc->sc_sgsmix == NULL)
 			return ENXIO;
-		dip->mixer_class = AWACS_MONITOR_CLASS;
+		dip->mixer_class = AWACS_OUTPUT_CLASS;
 		strcpy(dip->label.name, AudioNbass);
 		dip->type = AUDIO_MIXER_VALUE;
 		dip->prev = dip->next = AUDIO_MIXER_LAST;
@@ -996,7 +998,7 @@
 	case AWACS_TREBLE:
 		if (sc->sc_sgsmix == NULL)
 			return ENXIO;
-		dip->mixer_class = AWACS_MONITOR_CLASS;
+		dip->mixer_class = AWACS_OUTPUT_CLASS;
 		strcpy(dip->label.name, AudioNtreble);
 		dip->type = AUDIO_MIXER_VALUE;
 		dip->prev = dip->next = AUDIO_MIXER_LAST;



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

2010-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Sep  7 18:25:38 UTC 2010

Modified Files:
src/sys/rump/librump/rumpkern: intr.c rump.c rump_private.h

Log Message:
Allocate softint vectors for the final number of CPUs, not the
number currently attached.  Deals with a SNAFU in my commit earlier
today which would cause softints established early to lack a
softint context on non-bootstrap CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/rump/librump/rumpkern/intr.c
cvs rdiff -u -r1.186 -r1.187 src/sys/rump/librump/rumpkern/rump.c
cvs rdiff -u -r1.56 -r1.57 src/sys/rump/librump/rumpkern/rump_private.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/rump/librump/rumpkern/intr.c
diff -u src/sys/rump/librump/rumpkern/intr.c:1.33 src/sys/rump/librump/rumpkern/intr.c:1.34
--- src/sys/rump/librump/rumpkern/intr.c:1.33	Tue Sep  7 17:49:23 2010
+++ src/sys/rump/librump/rumpkern/intr.c	Tue Sep  7 18:25:38 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.33 2010/09/07 17:49:23 pooka Exp $	*/
+/*	$NetBSD: intr.c,v 1.34 2010/09/07 18:25:38 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.33 2010/09/07 17:49:23 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.34 2010/09/07 18:25:38 pooka Exp $");
 
 #include 
 #include 
@@ -74,6 +74,7 @@
 kcondvar_t lbolt; /* Oh Kath Ra */
 
 static u_int ticks;
+static int ncpu_final;
 
 static u_int
 rumptc_get(struct timecounter *tc)
@@ -198,10 +199,11 @@
 }
 
 void
-rump_intr_init()
+rump_intr_init(int numcpu)
 {
 
 	cv_init(&lbolt, "oh kath ra");
+	ncpu_final = numcpu;
 }
 
 void
@@ -256,9 +258,9 @@
 	si->si_flags = flags & SOFTINT_MPSAFE ? SI_MPSAFE : 0;
 	si->si_level = flags & SOFTINT_LVLMASK;
 	KASSERT(si->si_level < SOFTINT_COUNT);
-	si->si_entry = malloc(sizeof(*si->si_entry) * ncpu,
+	si->si_entry = malloc(sizeof(*si->si_entry) * ncpu_final,
 	M_TEMP, M_WAITOK | M_ZERO);
-	for (i = 0; i < ncpu; i++) {
+	for (i = 0; i < ncpu_final; i++) {
 		sip = &si->si_entry[i];
 		sip->sip_parent = si;
 	}
@@ -299,7 +301,7 @@
 	struct softint *si = cook;
 	int i;
 
-	for (i = 0; i < ncpu; i++) {
+	for (i = 0; i < ncpu_final; i++) {
 		struct softint_percpu *sip;
 
 		sip = &si->si_entry[i];

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.186 src/sys/rump/librump/rumpkern/rump.c:1.187
--- src/sys/rump/librump/rumpkern/rump.c:1.186	Tue Sep  7 07:59:48 2010
+++ src/sys/rump/librump/rumpkern/rump.c	Tue Sep  7 18:25:38 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.186 2010/09/07 07:59:48 pooka Exp $	*/
+/*	$NetBSD: rump.c,v 1.187 2010/09/07 18:25:38 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.186 2010/09/07 07:59:48 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.187 2010/09/07 18:25:38 pooka Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -269,7 +269,7 @@
 	}
 	rumpuser_thrinit(rump_user_schedule, rump_user_unschedule,
 	rump_threads);
-	rump_intr_init();
+	rump_intr_init(numcpu);
 	rump_tsleep_init();
 
 	/* init minimal lwp/cpu context */

Index: src/sys/rump/librump/rumpkern/rump_private.h
diff -u src/sys/rump/librump/rumpkern/rump_private.h:1.56 src/sys/rump/librump/rumpkern/rump_private.h:1.57
--- src/sys/rump/librump/rumpkern/rump_private.h:1.56	Tue Sep  7 07:59:48 2010
+++ src/sys/rump/librump/rumpkern/rump_private.h	Tue Sep  7 18:25:38 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_private.h,v 1.56 2010/09/07 07:59:48 pooka Exp $	*/
+/*	$NetBSD: rump_private.h,v 1.57 2010/09/07 18:25:38 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -135,7 +135,7 @@
 
 void	rump_tsleep_init(void);
 
-void	rump_intr_init(void);
+void	rump_intr_init(int);
 void	rump_softint_run(struct cpu_info *);
 
 void	*rump_hypermalloc(size_t, int, bool, const char *);



CVS commit: src/sys/dev/ic

2010-09-07 Thread Michael L. Hitch
Module Name:src
Committed By:   mhitch
Date:   Tue Sep  7 18:19:16 UTC 2010

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

Log Message:
Fix a performance problem with the ciss(4) driver.  NetBSD does common
queueing at the scsipi midlayer, and if the midlayer is not requested to
enable tagged queueing, the midlayer will only queue one command to the
adapter driver for each device.  The SmartArray adapter is capable of
handling multiple commands, and in the rather common case where there is
no battery backup and no write cache, doing single write commands is very
slow.  The SmartArray adapter runs much better when several commands can
be issued to a device.

This has been observed and discussed in several list threads, notably:
http://mail-index.NetBSD.org/netbsd-users/2008/10/01/msg002083.html
http://mail-index.NetBSD.org/tech-kern/2008/11/30/msg003704.html

This also addresses PR kern/39686.

To enable tagged queueing, the adapter driver responds to the midlayer
request to set the transfer mode.  However, the SmartArray does not respond
to the SCSI INQUIRY command with an ANSII field of 2 or more, so the
scsipi midlayer will ignore the CmdQue bit in the flags3 field of the
inquiry data.  This fix will patch the inquiry data so set the ANSII field
to 2, and responds to the midlayer request to set the transfer mode by
requesting tagged queueing.

In addition, the original port of the driver did not set up the adapter
parameters correctly as mentioned in the second list thread mentioned
above.  The adapt_openings is the total number of commands that the
adapter will accept rather than the number of commands divided by the
number of logical drives.  Also, the adapt_max_periph is the maximum number
of commands which can be queued per peripheral device, not the number of
logical drives [which in the case of a single logical drive limited the
number of commands queued to 1].

I'm also suppressing an error message for invalid commands if the error
was due to the SCSI_SYNCHRONIZE_CACHE_10 command, since that command is
not supported by the SmartArray adapter, but used with wapbl(4) meta-data
journaling.  Setting the ANSII version to 2 to allow enabling tagged queueing
also enables the use of the SCSI_SYNCHRONIZE_CACHE_10 command.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/ic/ciss.c

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

Modified files:

Index: src/sys/dev/ic/ciss.c
diff -u src/sys/dev/ic/ciss.c:1.22 src/sys/dev/ic/ciss.c:1.23
--- src/sys/dev/ic/ciss.c:1.22	Tue Jul 27 18:50:32 2010
+++ src/sys/dev/ic/ciss.c	Tue Sep  7 18:19:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ciss.c,v 1.22 2010/07/27 18:50:32 jakllsch Exp $	*/
+/*	$NetBSD: ciss.c,v 1.23 2010/09/07 18:19:16 mhitch Exp $	*/
 /*	$OpenBSD: ciss.c,v 1.14 2006/03/13 16:02:23 mickey Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.22 2010/07/27 18:50:32 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.23 2010/09/07 18:19:16 mhitch Exp $");
 
 #include "bio.h"
 
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -363,7 +364,7 @@
 	sc->sc_channel.chan_channel = 0;
 	sc->sc_channel.chan_ntargets = sc->maxunits;
 	sc->sc_channel.chan_nluns = 1;	/* ciss doesn't really have SCSI luns */
-	sc->sc_channel.chan_openings = sc->maxcmd / (sc->maxunits? sc->maxunits : 1);
+	sc->sc_channel.chan_openings = sc->maxcmd;
 #if NBIO > 0
 	/* XXX Reserve some ccb's for sensor and bioctl. */
 	if (sc->sc_channel.chan_openings > 2)
@@ -374,7 +375,7 @@
 
 	sc->sc_adapter.adapt_dev = (device_t) sc;
 	sc->sc_adapter.adapt_openings = sc->sc_channel.chan_openings;
-	sc->sc_adapter.adapt_max_periph = sc->maxunits;
+	sc->sc_adapter.adapt_max_periph = sc->sc_channel.chan_openings;
 	sc->sc_adapter.adapt_request = ciss_scsi_cmd;
 	sc->sc_adapter.adapt_minphys = cissminphys;
 	sc->sc_adapter.adapt_ioctl = ciss_scsi_ioctl;
@@ -617,6 +618,14 @@
 	if (xs) {
 		xs->resid = 0;
 		CISS_DPRINTF(CISS_D_CMD, ("scsipi_done(%p) ", xs));
+		if (xs->cmd->opcode == INQUIRY) {
+			struct scsipi_inquiry_data *inq;
+			inq = (struct scsipi_inquiry_data *)xs->data;
+			if ((inq->version & SID_ANSII) == 0 &&
+			(inq->flags3 & SID_CmdQue) != 0) {
+inq->version |= 2;
+			}
+		}
 		scsipi_done(xs);
 	}
 
@@ -636,9 +645,11 @@
 		break;
 
 	case CISS_ERR_INVCMD:
-		printf("%s: invalid cmd 0x%x: 0x%x is not valid @ 0x%x[%d]\n",
-		device_xname(&sc->sc_dev), ccb->ccb_cmd.id,
-		err->err_info, err->err_type[3], err->err_type[2]);
+		if (xs == NULL ||
+		xs->cmd->opcode != SCSI_SYNCHRONIZE_CACHE_10)
+			printf("%s: invalid cmd 0x%x: 0x%x is not valid @ 0x%x[%d]\n",
+			device_xname(&sc->sc_dev), ccb->ccb_cmd.id,
+			err->err_info, err->err_type[3], err->err_type[2]);
 		if (xs) {
 			memset(&xs->sense, 0, sizeof(xs->sense));
 			xs->sense.scsi_sense.response_code =
@@ -1002,7 +1013,8 @@
 ciss_scs

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

2010-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Sep  7 17:49:23 UTC 2010

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

Log Message:
update comments.  no code change.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/rump/librump/rumpkern/intr.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/intr.c
diff -u src/sys/rump/librump/rumpkern/intr.c:1.32 src/sys/rump/librump/rumpkern/intr.c:1.33
--- src/sys/rump/librump/rumpkern/intr.c:1.32	Sun Aug 15 21:28:33 2010
+++ src/sys/rump/librump/rumpkern/intr.c	Tue Sep  7 17:49:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.32 2010/08/15 21:28:33 pooka Exp $	*/
+/*	$NetBSD: intr.c,v 1.33 2010/09/07 17:49:23 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.32 2010/08/15 21:28:33 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.33 2010/09/07 17:49:23 pooka Exp $");
 
 #include 
 #include 
@@ -243,16 +243,6 @@
 		panic("clock thread creation failed: %d", rv);
 }
 
-/*
- * Soft interrupts bring two choices.  If we are running with thread
- * support enabled, defer execution, otherwise execute in place.
- * See softint_schedule().
- * 
- * As there is currently no clear concept of when a thread finishes
- * work (although rump_clear_curlwp() is close), simply execute all
- * softints in the timer thread.  This is probably not the most
- * efficient method, but good enough for now.
- */
 void *
 softint_establish(u_int flags, void (*func)(void *), void *arg)
 {
@@ -276,6 +266,11 @@
 	return si;
 }
 
+/*
+ * Soft interrupts bring two choices.  If we are running with thread
+ * support enabled, defer execution, otherwise execute in place.
+ */
+
 void
 softint_schedule(void *arg)
 {



CVS commit: src/lib/libp2k

2010-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Sep  7 17:22:53 UTC 2010

Modified Files:
src/lib/libp2k: p2k.c

Log Message:
Simplify now that ukfs deals with being called from a thread which
already has a rump lwp context.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/lib/libp2k/p2k.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/libp2k/p2k.c
diff -u src/lib/libp2k/p2k.c:1.43 src/lib/libp2k/p2k.c:1.44
--- src/lib/libp2k/p2k.c:1.43	Tue Sep  7 17:16:19 2010
+++ src/lib/libp2k/p2k.c	Tue Sep  7 17:22:53 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: p2k.c,v 1.43 2010/09/07 17:16:19 pooka Exp $	*/
+/*	$NetBSD: p2k.c,v 1.44 2010/09/07 17:22:53 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009  Antti Kantee.  All Rights Reserved.
@@ -560,14 +560,10 @@
 {
 	struct p2k_mount *p2m = puffs_getspecific(pu);
 	struct ukfs *fs = p2m->p2m_ukfs;
-	struct lwp *l;
 	int error = 0;
 
 	rump_pub_vp_rele(p2m->p2m_rvp);
 
-	l = rump_pub_lwproc_curlwp();
-	rump_pub_lwproc_switch(NULL); /* ukfs & curlwp tricks */
-
 	if (fs) {
 		if (ukfs_release(fs, 0) != 0) {
 			ukfs_release(fs, UKFS_RELFLAG_FORCE);
@@ -575,7 +571,6 @@
 		}
 	}
 	p2m->p2m_ukfs = NULL;
-	rump_pub_lwproc_switch(l);
 
 	if (p2m->p2m_hasdebug) {
 		printf("-- rump kernel event counters --\n");



CVS commit: src/lib

2010-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Sep  7 17:16:19 UTC 2010

Modified Files:
src/lib/libp2k: p2k.c
src/lib/libukfs: ukfs.c

Log Message:
Migrate from rump private interfaces to syscalls.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/lib/libp2k/p2k.c
cvs rdiff -u -r1.53 -r1.54 src/lib/libukfs/ukfs.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/libp2k/p2k.c
diff -u src/lib/libp2k/p2k.c:1.42 src/lib/libp2k/p2k.c:1.43
--- src/lib/libp2k/p2k.c:1.42	Wed Sep  1 19:40:35 2010
+++ src/lib/libp2k/p2k.c	Tue Sep  7 17:16:19 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: p2k.c,v 1.42 2010/09/01 19:40:35 pooka Exp $	*/
+/*	$NetBSD: p2k.c,v 1.43 2010/09/07 17:16:19 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009  Antti Kantee.  All Rights Reserved.
@@ -420,12 +420,6 @@
 			rv = -1;
 			goto out;
 		}
-		if ((rv = rump_pub_vfs_root(p2m->p2m_mp,
-		&p2m->p2m_rvp, 0)) != 0) {
-			errno = rv;
-			rv = -1;
-			goto out;
-		}
 	} else {
 		if (part != ukfs_part_na)
 			ukfs = ukfs_mount_disk(vfsname, devpath, part,
@@ -438,7 +432,11 @@
 		ukfs_setspecific(ukfs, p2m);
 		p2m->p2m_ukfs = ukfs;
 		p2m->p2m_mp = ukfs_getmp(ukfs);
-		p2m->p2m_rvp = ukfs_getrvp(ukfs);
+	}
+	if ((rv = rump_pub_vfs_root(p2m->p2m_mp, &p2m->p2m_rvp, 0)) != 0) {
+		errno = rv;
+		rv = -1;
+		goto out;
 	}
 
 	p2m->p2m_pu = pu;

Index: src/lib/libukfs/ukfs.c
diff -u src/lib/libukfs/ukfs.c:1.53 src/lib/libukfs/ukfs.c:1.54
--- src/lib/libukfs/ukfs.c:1.53	Wed Sep  1 19:40:34 2010
+++ src/lib/libukfs/ukfs.c	Tue Sep  7 17:16:18 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ukfs.c,v 1.53 2010/09/01 19:40:34 pooka Exp $	*/
+/*	$NetBSD: ukfs.c,v 1.54 2010/09/07 17:16:18 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009  Antti Kantee.  All Rights Reserved.
@@ -69,15 +69,18 @@
 #define UKFS_MODE_DEFAULT 0555
 
 struct ukfs {
+	pthread_spinlock_t ukfs_spin;
+
 	struct mount *ukfs_mp;
-	struct vnode *ukfs_rvp;
+	struct lwp *ukfs_lwp;
 	void *ukfs_specific;
 
-	pthread_spinlock_t ukfs_spin;
-	struct vnode *ukfs_cdir;
 	int ukfs_devfd;
+
 	char *ukfs_devpath;
 	char *ukfs_mountpath;
+	char *ukfs_cwd;
+
 	struct ukfs_part *ukfs_part;
 };
 
@@ -91,17 +94,6 @@
 	return ukfs->ukfs_mp;
 }
 
-struct vnode *
-ukfs_getrvp(struct ukfs *ukfs)
-{
-	struct vnode *rvp;
-
-	rvp = ukfs->ukfs_rvp;
-	rump_pub_vp_incref(rvp);
-
-	return rvp;
-}
-
 void
 ukfs_setspecific(struct ukfs *ukfs, void *priv)
 {
@@ -123,32 +115,45 @@
 #define pthread_spin_destroy(a)
 #endif
 
-static void
-precall(struct ukfs *ukfs)
+static int
+precall(struct ukfs *ukfs, struct lwp **curlwp)
 {
-	struct vnode *rvp, *cvp;
 
+	/* save previous.  ensure start from pristine context */
+	*curlwp = rump_pub_lwproc_curlwp();
+	if (*curlwp)
+		rump_pub_lwproc_switch(ukfs->ukfs_lwp);
 	rump_pub_lwproc_newproc();
-	rvp = ukfs_getrvp(ukfs);
-	pthread_spin_lock(&ukfs->ukfs_spin);
-	cvp = ukfs->ukfs_cdir;
-	pthread_spin_unlock(&ukfs->ukfs_spin);
-	rump_pub_rcvp_set(rvp, cvp); /* takes refs */
-	rump_pub_vp_rele(rvp);
+
+	if (rump_sys_chroot(ukfs->ukfs_mountpath) == -1)
+		return errno;
+	if (rump_sys_chdir(ukfs->ukfs_cwd) == -1)
+		return errno;
+
+	return 0;
 }
 
 static void
-postcall(struct ukfs *ukfs)
+postcall(struct lwp *curlwp)
 {
-	struct vnode *rvp;
-
-	rvp = ukfs_getrvp(ukfs);
-	rump_pub_rcvp_set(NULL, rvp);
-	rump_pub_vp_rele(rvp);
 
 	rump_pub_lwproc_releaselwp();
+	if (curlwp)
+		rump_pub_lwproc_switch(curlwp);
 }
 
+#define PRECALL()			\
+struct lwp *ukfs_curlwp;		\
+do {	\
+	int ukfs_rv;			\
+	if ((ukfs_rv = precall(ukfs, &ukfs_curlwp)) != 0) {		\
+		errno = ukfs_rv;	\
+		return -1;		\
+	}\
+} while (/*CONSTCOND*/0)
+
+#define POSTCALL() postcall(ukfs_curlwp);
+
 struct ukfs_part {
 	pthread_spinlock_t part_lck;
 	int part_refcount;
@@ -516,6 +521,7 @@
 	const char *mountpath, int mntflags, void *arg, size_t alen)
 {
 	struct ukfs *fs = NULL;
+	struct lwp *curlwp;
 	int rv = 0, devfd = -1;
 	int mounted = 0;
 	int regged = 0;
@@ -603,26 +609,25 @@
 	if (rv) {
 		goto out;
 	}
-	rv = rump_pub_vfs_root(fs->ukfs_mp, &fs->ukfs_rvp, 0);
-	if (rv) {
-		goto out;
-	}
 
 	if (regged) {
 		fs->ukfs_devpath = strdup(devpath);
 	}
 	fs->ukfs_mountpath = strdup(mountpath);
-	fs->ukfs_cdir = ukfs_getrvp(fs);
 	pthread_spin_init(&fs->ukfs_spin, PTHREAD_PROCESS_SHARED);
 	fs->ukfs_devfd = devfd;
 	fs->ukfs_part = part;
 	assert(rv == 0);
 
+	curlwp = rump_pub_lwproc_curlwp();
+	rump_pub_lwproc_newlwp(0);
+	fs->ukfs_lwp = rump_pub_lwproc_curlwp();
+	fs->ukfs_cwd = strdup("/");
+	rump_pub_lwproc_switch(curlwp);
+
  out:
 	if (rv) {
 		if (fs) {
-			if (fs->ukfs_rvp)
-rump_pub_vp_rele(fs->ukfs_rvp);
 			free(fs);
 			fs = NULL;
 		}
@@ -663,27 +668,28 @@
 int
 ukfs_release(struct ukfs *fs, int flags)
 {
+	struct lwp *curlwp = rump_pub_lwproc_curlwp();
+
+	/* get root lwp */
+	rump_pub_lwproc_switch(fs->ukfs_lwp);
+	rump_pub_lwproc_n

CVS commit: src/sys/rump

2010-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Sep  7 17:14:19 UTC 2010

Modified Files:
src/sys/rump/include/rump: rumpvfs_if_pub.h
src/sys/rump/librump/rumpvfs: rumpvfs_if_priv.h rumpvfs_if_wrappers.c

Log Message:
regen: rcvp/cdir interfaces go byebye in favour of rump syscalls


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/rump/include/rump/rumpvfs_if_pub.h
cvs rdiff -u -r1.7 -r1.8 src/sys/rump/librump/rumpvfs/rumpvfs_if_priv.h \
src/sys/rump/librump/rumpvfs/rumpvfs_if_wrappers.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/include/rump/rumpvfs_if_pub.h
diff -u src/sys/rump/include/rump/rumpvfs_if_pub.h:1.7 src/sys/rump/include/rump/rumpvfs_if_pub.h:1.8
--- src/sys/rump/include/rump/rumpvfs_if_pub.h:1.7	Mon Jul 19 15:30:43 2010
+++ src/sys/rump/include/rump/rumpvfs_if_pub.h	Tue Sep  7 17:14:18 2010
@@ -1,9 +1,9 @@
-/*	$NetBSD: rumpvfs_if_pub.h,v 1.7 2010/07/19 15:30:43 pooka Exp $	*/
+/*	$NetBSD: rumpvfs_if_pub.h,v 1.8 2010/09/07 17:14:18 pooka Exp $	*/
 
 /*
  * Automatically generated.  DO NOT EDIT.
- * from: NetBSD: rumpvfs.ifspec,v 1.5 2010/07/19 15:29:44 pooka Exp 
- * by:   NetBSD: makerumpif.sh,v 1.4 2009/10/15 00:29:19 pooka Exp 
+ * from: NetBSD: rumpvfs.ifspec,v 1.6 2010/09/07 17:13:03 pooka Exp 
+ * by:   NetBSD: makerumpif.sh,v 1.5 2010/09/01 19:32:11 pooka Exp 
  */
 
 void rump_pub_getvninfo(struct vnode *, enum vtype *, off_t *, dev_t *);
@@ -35,8 +35,6 @@
 void rump_pub_vfs_syncwait(struct mount *);
 int rump_pub_vfs_getmp(const char *, struct mount **);
 void rump_pub_vfs_mount_print(const char *, int);
-void rump_pub_rcvp_set(struct vnode *, struct vnode *);
-struct vnode * rump_pub_cdir_get(void);
 int rump_pub_syspuffs_glueinit(int, int *);
 void rump_pub_vattr50_to_vattr(const struct vattr *, struct vattr *);
 void rump_pub_vattr_to_vattr50(const struct vattr *, struct vattr *);

Index: src/sys/rump/librump/rumpvfs/rumpvfs_if_priv.h
diff -u src/sys/rump/librump/rumpvfs/rumpvfs_if_priv.h:1.7 src/sys/rump/librump/rumpvfs/rumpvfs_if_priv.h:1.8
--- src/sys/rump/librump/rumpvfs/rumpvfs_if_priv.h:1.7	Mon Jul 19 15:30:43 2010
+++ src/sys/rump/librump/rumpvfs/rumpvfs_if_priv.h	Tue Sep  7 17:14:19 2010
@@ -1,9 +1,9 @@
-/*	$NetBSD: rumpvfs_if_priv.h,v 1.7 2010/07/19 15:30:43 pooka Exp $	*/
+/*	$NetBSD: rumpvfs_if_priv.h,v 1.8 2010/09/07 17:14:19 pooka Exp $	*/
 
 /*
  * Automatically generated.  DO NOT EDIT.
- * from: NetBSD: rumpvfs.ifspec,v 1.5 2010/07/19 15:29:44 pooka Exp 
- * by:   NetBSD: makerumpif.sh,v 1.4 2009/10/15 00:29:19 pooka Exp 
+ * from: NetBSD: rumpvfs.ifspec,v 1.6 2010/09/07 17:13:03 pooka Exp 
+ * by:   NetBSD: makerumpif.sh,v 1.5 2010/09/01 19:32:11 pooka Exp 
  */
 
 void rump_getvninfo(struct vnode *, enum vtype *, off_t *, dev_t *);
@@ -35,8 +35,6 @@
 void rump_vfs_syncwait(struct mount *);
 int rump_vfs_getmp(const char *, struct mount **);
 void rump_vfs_mount_print(const char *, int);
-void rump_rcvp_set(struct vnode *, struct vnode *);
-struct vnode * rump_cdir_get(void);
 int rump_syspuffs_glueinit(int, int *);
 void rump_vattr50_to_vattr(const struct vattr *, struct vattr *);
 void rump_vattr_to_vattr50(const struct vattr *, struct vattr *);
Index: src/sys/rump/librump/rumpvfs/rumpvfs_if_wrappers.c
diff -u src/sys/rump/librump/rumpvfs/rumpvfs_if_wrappers.c:1.7 src/sys/rump/librump/rumpvfs/rumpvfs_if_wrappers.c:1.8
--- src/sys/rump/librump/rumpvfs/rumpvfs_if_wrappers.c:1.7	Mon Jul 19 15:30:43 2010
+++ src/sys/rump/librump/rumpvfs/rumpvfs_if_wrappers.c	Tue Sep  7 17:14:19 2010
@@ -1,9 +1,9 @@
-/*	$NetBSD: rumpvfs_if_wrappers.c,v 1.7 2010/07/19 15:30:43 pooka Exp $	*/
+/*	$NetBSD: rumpvfs_if_wrappers.c,v 1.8 2010/09/07 17:14:19 pooka Exp $	*/
 
 /*
  * Automatically generated.  DO NOT EDIT.
- * from: NetBSD: rumpvfs.ifspec,v 1.5 2010/07/19 15:29:44 pooka Exp 
- * by:   NetBSD: makerumpif.sh,v 1.4 2009/10/15 00:29:19 pooka Exp 
+ * from: NetBSD: rumpvfs.ifspec,v 1.6 2010/09/07 17:13:03 pooka Exp 
+ * by:   NetBSD: makerumpif.sh,v 1.5 2010/09/01 19:32:11 pooka Exp 
  */
 
 #include 
@@ -338,27 +338,6 @@
 	rump_unschedule();
 }
 
-void
-rump_pub_rcvp_set(struct vnode *arg1, struct vnode *arg2)
-{
-
-	rump_schedule();
-	rump_rcvp_set(arg1, arg2);
-	rump_unschedule();
-}
-
-struct vnode *
-rump_pub_cdir_get(void)
-{
-	struct vnode * rv;
-
-	rump_schedule();
-	rv = rump_cdir_get();
-	rump_unschedule();
-
-	return rv;
-}
-
 int
 rump_pub_syspuffs_glueinit(int arg1, int *arg2)
 {



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

2010-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Sep  7 17:13:04 UTC 2010

Modified Files:
src/sys/rump/librump/rumpvfs: rump_vfs.c rumpvfs.ifspec

Log Message:
Retire the prehistoric chroot/cwd interfaces now that there is a
process model in rump.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/rump/librump/rumpvfs/rump_vfs.c
cvs rdiff -u -r1.5 -r1.6 src/sys/rump/librump/rumpvfs/rumpvfs.ifspec

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/rump_vfs.c
diff -u src/sys/rump/librump/rumpvfs/rump_vfs.c:1.56 src/sys/rump/librump/rumpvfs/rump_vfs.c:1.57
--- src/sys/rump/librump/rumpvfs/rump_vfs.c:1.56	Wed Jun 30 15:48:59 2010
+++ src/sys/rump/librump/rumpvfs/rump_vfs.c	Tue Sep  7 17:13:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_vfs.c,v 1.56 2010/06/30 15:48:59 pooka Exp $	*/
+/*	$NetBSD: rump_vfs.c,v 1.57 2010/09/07 17:13:03 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump_vfs.c,v 1.56 2010/06/30 15:48:59 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_vfs.c,v 1.57 2010/09/07 17:13:03 pooka Exp $");
 
 #include 
 #include 
@@ -59,8 +59,6 @@
 struct cwdinfo cwdi0;
 const char *rootfstype = ROOT_FSTYPE_ANY;
 
-static void rump_rcvp_lwpset(struct vnode *, struct vnode *, struct lwp *);
-
 static void
 pvfs_init(struct proc *p)
 {
@@ -484,44 +482,3 @@
 
 	biodone(bp);
 }
-
-static void
-rump_rcvp_lwpset(struct vnode *rvp, struct vnode *cvp, struct lwp *l)
-{
-	struct cwdinfo *cwdi = l->l_proc->p_cwdi;
-
-	KASSERT(cvp);
-
-	rw_enter(&cwdi->cwdi_lock, RW_WRITER);
-	if (cwdi->cwdi_rdir)
-		vrele(cwdi->cwdi_rdir);
-	if (rvp)
-		vref(rvp);
-	cwdi->cwdi_rdir = rvp;
-
-	vrele(cwdi->cwdi_cdir);
-	vref(cvp);
-	cwdi->cwdi_cdir = cvp;
-	rw_exit(&cwdi->cwdi_lock);
-}
-
-void
-rump_rcvp_set(struct vnode *rvp, struct vnode *cvp)
-{
-
-	rump_rcvp_lwpset(rvp, cvp, curlwp);
-}
-
-struct vnode *
-rump_cdir_get(void)
-{
-	struct vnode *vp;
-	struct cwdinfo *cwdi = curlwp->l_proc->p_cwdi;
-
-	rw_enter(&cwdi->cwdi_lock, RW_READER);
-	vp = cwdi->cwdi_cdir;
-	rw_exit(&cwdi->cwdi_lock);
-	vref(vp);
-
-	return vp;
-}

Index: src/sys/rump/librump/rumpvfs/rumpvfs.ifspec
diff -u src/sys/rump/librump/rumpvfs/rumpvfs.ifspec:1.5 src/sys/rump/librump/rumpvfs/rumpvfs.ifspec:1.6
--- src/sys/rump/librump/rumpvfs/rumpvfs.ifspec:1.5	Mon Jul 19 15:29:44 2010
+++ src/sys/rump/librump/rumpvfs/rumpvfs.ifspec	Tue Sep  7 17:13:03 2010
@@ -1,4 +1,4 @@
-;   $NetBSD: rumpvfs.ifspec,v 1.5 2010/07/19 15:29:44 pooka Exp $
+;   $NetBSD: rumpvfs.ifspec,v 1.6 2010/09/07 17:13:03 pooka Exp $
 
 NAME|vfs
 PUBHDR|include/rump/rumpvfs_if_pub.h
@@ -10,7 +10,6 @@
 
 void		|getvninfo	|struct vnode *, enum vtype *, off_t *, dev_t *
 
-
 struct vfsops *	|vfslist_iterate|struct vfsops *
 struct vfsops *	|vfs_getopsbyname|const char *
 
@@ -53,9 +52,6 @@
 
 void		|vfs_mount_print|const char *, int
 
-void		|rcvp_set	|struct vnode *, struct vnode *
-struct vnode *	|cdir_get	|void
-
 ; I picked the wrong header to stop sniffin' glue
 int		|syspuffs_glueinit	|int, int *	|WEAK
 



CVS commit: src/sys/rump

2010-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Sep  7 17:10:48 UTC 2010

Modified Files:
src/sys/rump/include/rump: rump_syscalls.h
src/sys/rump/librump/rumpkern: rump_syscalls.c

Log Message:
regen: getcwd


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/rump/include/rump/rump_syscalls.h
cvs rdiff -u -r1.50 -r1.51 src/sys/rump/librump/rumpkern/rump_syscalls.c

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

Modified files:

Index: src/sys/rump/include/rump/rump_syscalls.h
diff -u src/sys/rump/include/rump/rump_syscalls.h:1.30 src/sys/rump/include/rump/rump_syscalls.h:1.31
--- src/sys/rump/include/rump/rump_syscalls.h:1.30	Mon Sep  6 20:01:31 2010
+++ src/sys/rump/include/rump/rump_syscalls.h	Tue Sep  7 17:10:48 2010
@@ -1,10 +1,10 @@
-/* $NetBSD: rump_syscalls.h,v 1.30 2010/09/06 20:01:31 pooka Exp $ */
+/* $NetBSD: rump_syscalls.h,v 1.31 2010/09/07 17:10:48 pooka Exp $ */
 
 /*
  * System call protos in rump namespace.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.237 2010/09/06 20:00:09 pooka Exp
+ * created from	NetBSD: syscalls.master,v 1.238 2010/09/07 17:10:08 pooka Exp
  */
 
 #ifndef _RUMP_RUMP_SYSCALLS_H_
@@ -114,6 +114,7 @@
 int rump_sys_lchmod(const char *, mode_t);
 int rump_sys_lchown(const char *, uid_t, gid_t);
 pid_t rump_sys_getsid(pid_t);
+int rump_sys___getcwd(char *, size_t);
 int rump_sys_fchroot(int);
 int rump_sys_lchflags(const char *, u_long);
 int rump_sys_issetugid(void);

Index: src/sys/rump/librump/rumpkern/rump_syscalls.c
diff -u src/sys/rump/librump/rumpkern/rump_syscalls.c:1.50 src/sys/rump/librump/rumpkern/rump_syscalls.c:1.51
--- src/sys/rump/librump/rumpkern/rump_syscalls.c:1.50	Mon Sep  6 20:01:31 2010
+++ src/sys/rump/librump/rumpkern/rump_syscalls.c	Tue Sep  7 17:10:48 2010
@@ -1,14 +1,14 @@
-/* $NetBSD: rump_syscalls.c,v 1.50 2010/09/06 20:01:31 pooka Exp $ */
+/* $NetBSD: rump_syscalls.c,v 1.51 2010/09/07 17:10:48 pooka Exp $ */
 
 /*
  * System call vector and marshalling for rump.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.237 2010/09/06 20:00:09 pooka Exp
+ * created from	NetBSD: syscalls.master,v 1.238 2010/09/07 17:10:08 pooka Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump_syscalls.c,v 1.50 2010/09/06 20:01:31 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_syscalls.c,v 1.51 2010/09/07 17:10:48 pooka Exp $");
 
 #include 
 #include 
@@ -2017,6 +2017,27 @@
 }
 __weak_alias(sys_getsid,rump_enosys);
 
+int rump_sys___getcwd(char *, size_t);
+int
+rump_sys___getcwd(char * bufp, size_t length)
+{
+	register_t rval[2] = {0, 0};
+	int error = 0;
+	struct sys___getcwd_args callarg;
+
+	SPARG(&callarg, bufp) = bufp;
+	SPARG(&callarg, length) = length;
+
+	error = rump_sysproxy(SYS___getcwd, rump_sysproxy_arg,
+	(uint8_t *)&callarg, sizeof(callarg), rval);
+	if (error) {
+		rval[0] = -1;
+		rumpuser_seterrno(error);
+	}
+	return rval[0];
+}
+__weak_alias(sys___getcwd,rump_enosys);
+
 int rump_sys_fchroot(int);
 int
 rump_sys_fchroot(int fd)
@@ -3823,8 +3844,8 @@
 	(sy_call_t *)rump_enosys },			/* 294 = unrumped */
 	{ 0, 0, 0,
 	(sy_call_t *)sys_nomodule },			/* 295 = unrumped */
-	{ 0, 0, 0,
-	(sy_call_t *)rump_enosys },			/* 296 = unrumped */
+	{ ns(struct sys___getcwd_args), 0,
+	(sy_call_t *)sys___getcwd },		/* 296 = __getcwd */
 	{ ns(struct sys_fchroot_args), 0,
 	(sy_call_t *)sys_fchroot },			/* 297 = fchroot */
 	{ 0, 0, 0,



CVS commit: src/sys/kern

2010-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Sep  7 17:10:08 UTC 2010

Modified Files:
src/sys/kern: syscalls.master

Log Message:
getcwd for rump


To generate a diff of this commit:
cvs rdiff -u -r1.237 -r1.238 src/sys/kern/syscalls.master

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/syscalls.master
diff -u src/sys/kern/syscalls.master:1.237 src/sys/kern/syscalls.master:1.238
--- src/sys/kern/syscalls.master:1.237	Mon Sep  6 20:00:09 2010
+++ src/sys/kern/syscalls.master	Tue Sep  7 17:10:08 2010
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.237 2010/09/06 20:00:09 pooka Exp $
+	$NetBSD: syscalls.master,v 1.238 2010/09/07 17:10:08 pooka Exp $
 
 ;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
 
@@ -561,7 +561,7 @@
 			sigset_t *oset); }
 294	STD 		{ int|sys|14|sigsuspend(const sigset_t *set); }
 295	COMPAT_16 MODULAR { int|sys|14|sigreturn(struct sigcontext *sigcntxp); }
-296	STD 		{ int|sys||__getcwd(char *bufp, size_t length); }
+296	STD 	 RUMP	{ int|sys||__getcwd(char *bufp, size_t length); }
 297	STD 	 RUMP	{ int|sys||fchroot(int fd); }
 298	COMPAT_30 MODULAR { int|sys||fhopen(const struct compat_30_fhandle *fhp, int flags); }
 299	COMPAT_30 MODULAR { int|sys||fhstat(const struct compat_30_fhandle *fhp, \



CVS commit: src/tests/rump/rumpkern

2010-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Sep  7 17:09:28 UTC 2010

Modified Files:
src/tests/rump/rumpkern: t_lwproc.c

Log Message:
+tc (turns out the bug was elsewhere, but a test is always a test)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/rump/rumpkern/t_lwproc.c

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

Modified files:

Index: src/tests/rump/rumpkern/t_lwproc.c
diff -u src/tests/rump/rumpkern/t_lwproc.c:1.2 src/tests/rump/rumpkern/t_lwproc.c:1.3
--- src/tests/rump/rumpkern/t_lwproc.c:1.2	Thu Sep  2 09:57:34 2010
+++ src/tests/rump/rumpkern/t_lwproc.c	Tue Sep  7 17:09:28 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_lwproc.c,v 1.2 2010/09/02 09:57:34 pooka Exp $	*/
+/*	$NetBSD: t_lwproc.c,v 1.3 2010/09/07 17:09:28 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -220,6 +220,26 @@
 	ATF_REQUIRE_EQ(rump_pub_lwproc_curlwp(), NULL);
 }
 
+ATF_TC(nullswitch);
+ATF_TC_HEAD(nullswitch, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr", "check that switching to NULL marks "
+	"current lwp as not running");
+}
+
+ATF_TC_BODY(nullswitch, tc)
+{
+	struct lwp *l;
+
+	rump_init();
+	RZ(rump_pub_lwproc_newlwp(0));
+	l = rump_pub_lwproc_curlwp();
+	rump_pub_lwproc_switch(NULL);
+	/* if remains LP_RUNNING, next call will panic */
+	rump_pub_lwproc_switch(l);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 
@@ -229,6 +249,7 @@
 	ATF_TP_ADD_TC(tp, lwps);
 	ATF_TP_ADD_TC(tp, nolwprelease);
 	ATF_TP_ADD_TC(tp, nolwp);
+	ATF_TP_ADD_TC(tp, nullswitch);
 
 	return atf_no_error();
 }



CVS commit: src/lib/libperfuse

2010-09-07 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Tue Sep  7 16:58:14 UTC 2010

Modified Files:
src/lib/libperfuse: ops.c

Log Message:
Mode argument must contain the file type (S_* items) for create and mknod


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libperfuse/ops.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/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.12 src/lib/libperfuse/ops.c:1.13
--- src/lib/libperfuse/ops.c:1.12	Tue Sep  7 02:11:04 2010
+++ src/lib/libperfuse/ops.c	Tue Sep  7 16:58:13 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.12 2010/09/07 02:11:04 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.13 2010/09/07 16:58:13 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -972,11 +972,13 @@
 	/*
 	 * flags should use O_WRONLY instead of O_RDWR, but it
 	 * breaks when the caller tries to read from file.
+	 * 
+	 * mode must contain file type (ie: S_IFREG), use VTTOIF(vap->va_type)
 	 */
 	pm = ps->ps_new_msg(pu, opc, FUSE_CREATE, len, pcn->pcn_cred);
 	fci = GET_INPAYLOAD(ps, pm, fuse_create_in);
 	fci->flags = O_CREAT | O_TRUNC | O_RDWR;
-	fci->mode = vap->va_mode;
+	fci->mode = vap->va_mode | VTTOIF(vap->va_type);
 	fci->umask = 0; 	/* Seems unused by libfuse */
 	(void)strlcpy((char*)(void *)(fci + 1), name, namelen);
 
@@ -1065,7 +1067,7 @@
 	len = sizeof(*fmi) + strlen(path) + 1; 
 
 	/*	
-	 * mode can contain file type (ie: S_IFREG), use VTTOIF(vap->va_type)
+	 * mode must contain file type (ie: S_IFREG), use VTTOIF(vap->va_type)
 	 */
 	pm = ps->ps_new_msg(pu, opc, FUSE_MKNOD, len, pcn->pcn_cred);
 	fmi = GET_INPAYLOAD(ps, pm, fuse_mknod_in);



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

2010-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Sep  7 07:59:49 UTC 2010

Modified Files:
src/sys/rump/librump/rumpkern: rump.c rump_private.h scheduler.c

Log Message:
Attach only one CPU for the bootstrap phase.


To generate a diff of this commit:
cvs rdiff -u -r1.185 -r1.186 src/sys/rump/librump/rumpkern/rump.c
cvs rdiff -u -r1.55 -r1.56 src/sys/rump/librump/rumpkern/rump_private.h
cvs rdiff -u -r1.19 -r1.20 src/sys/rump/librump/rumpkern/scheduler.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.185 src/sys/rump/librump/rumpkern/rump.c:1.186
--- src/sys/rump/librump/rumpkern/rump.c:1.185	Mon Sep  6 20:10:20 2010
+++ src/sys/rump/librump/rumpkern/rump.c	Tue Sep  7 07:59:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.185 2010/09/06 20:10:20 pooka Exp $	*/
+/*	$NetBSD: rump.c,v 1.186 2010/09/07 07:59:48 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.185 2010/09/06 20:10:20 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.186 2010/09/07 07:59:48 pooka Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -313,7 +313,7 @@
 	lwpinit_specificdata();
 	lwp_initspecific(&lwp0);
 
-	rump_scheduler_init();
+	rump_scheduler_init(numcpu);
 	/* revert temporary context and schedule a real context */
 	l->l_cpu = NULL;
 	rumpuser_set_curlwp(NULL);
@@ -329,9 +329,15 @@
 	tc_setclock(&ts);
 
 	/* we are mostly go.  do per-cpu subsystem init */
-	for (i = 0; i < ncpu; i++) {
+	for (i = 0; i < numcpu; i++) {
 		struct cpu_info *ci = cpu_lookup(i);
 
+		/* attach non-bootstrap CPUs */
+		if (i > 0) {
+			rump_cpu_attach(ci);
+			ncpu++;
+		}
+
 		callout_init_cpu(ci);
 		softint_init(ci);
 		xc_init_cpu(ci);

Index: src/sys/rump/librump/rumpkern/rump_private.h
diff -u src/sys/rump/librump/rumpkern/rump_private.h:1.55 src/sys/rump/librump/rumpkern/rump_private.h:1.56
--- src/sys/rump/librump/rumpkern/rump_private.h:1.55	Wed Sep  1 19:37:58 2010
+++ src/sys/rump/librump/rumpkern/rump_private.h	Tue Sep  7 07:59:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_private.h,v 1.55 2010/09/01 19:37:58 pooka Exp $	*/
+/*	$NetBSD: rump_private.h,v 1.56 2010/09/07 07:59:48 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -111,7 +111,7 @@
 struct lwp *	rump__lwproc_allockernlwp(void);
 
 void	rump_cpus_bootstrap(int);
-void	rump_scheduler_init(void);
+void	rump_scheduler_init(int);
 void	rump_schedule(void);
 void	rump_unschedule(void);
 void 	rump_schedule_cpu(struct lwp *);

Index: src/sys/rump/librump/rumpkern/scheduler.c
diff -u src/sys/rump/librump/rumpkern/scheduler.c:1.19 src/sys/rump/librump/rumpkern/scheduler.c:1.20
--- src/sys/rump/librump/rumpkern/scheduler.c:1.19	Wed Sep  1 19:37:59 2010
+++ src/sys/rump/librump/rumpkern/scheduler.c	Tue Sep  7 07:59:48 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: scheduler.c,v 1.19 2010/09/01 19:37:59 pooka Exp $	*/
+/*  $NetBSD: scheduler.c,v 1.20 2010/09/07 07:59:48 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.19 2010/09/01 19:37:59 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.20 2010/09/07 07:59:48 pooka Exp $");
 
 #include 
 #include 
@@ -136,13 +136,15 @@
 		rcpu = &rcpu_storage[i];
 		ci = &rump_cpus[i];
 		ci->ci_index = i;
-		rump_cpu_attach(ci);
-		ncpu++;
 	}
+
+	/* attach first cpu for bootstrap */
+	rump_cpu_attach(&rump_cpus[0]);
+	ncpu = 1;
 }
 
 void
-rump_scheduler_init()
+rump_scheduler_init(int numcpu)
 {
 	struct rumpcpu *rcpu;
 	struct cpu_info *ci;
@@ -150,7 +152,7 @@
 
 	rumpuser_mutex_init(&lwp0mtx);
 	rumpuser_cv_init(&lwp0cv);
-	for (i = 0; i < ncpu; i++) {
+	for (i = 0; i < numcpu; i++) {
 		rcpu = &rcpu_storage[i];
 		ci = &rump_cpus[i];
 		rcpu->rcpu_ci = ci;



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

2010-09-07 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Sep  7 07:47:36 UTC 2010

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

Log Message:
Improve page allocator performance by using pool_cache for the
structure itself and allocating the backing page directly from the
hypervisor.

* initial write to a large tmpfs file is almost 2x faster
* truncating the file to 0 length after write is over 50% faster
* rewrite of the file is just slightly faster (indicating that
  kmem does a good job with caching, as expected)


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/rump/librump/rumpkern/vm.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/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.89 src/sys/rump/librump/rumpkern/vm.c:1.90
--- src/sys/rump/librump/rumpkern/vm.c:1.89	Tue Sep  7 06:06:54 2010
+++ src/sys/rump/librump/rumpkern/vm.c	Tue Sep  7 07:47:36 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.89 2010/09/07 06:06:54 pooka Exp $	*/
+/*	$NetBSD: vm.c,v 1.90 2010/09/07 07:47:36 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.89 2010/09/07 06:06:54 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.90 2010/09/07 07:47:36 pooka Exp $");
 
 #include 
 #include 
@@ -115,6 +115,26 @@
  * vm pages 
  */
 
+static int
+pgctor(void *arg, void *obj, int flags)
+{
+	struct vm_page *pg = obj;
+
+	memset(pg, 0, sizeof(*pg));
+	pg->uanon = rump_hypermalloc(PAGE_SIZE, PAGE_SIZE, true, "pgalloc");
+	return 0;
+}
+
+static void
+pgdtor(void *arg, void *obj)
+{
+	struct vm_page *pg = obj;
+
+	rump_hyperfree(pg->uanon, PAGE_SIZE);
+}
+
+static struct pool_cache pagecache;
+
 /* called with the object locked */
 struct vm_page *
 uvm_pagealloc_strat(struct uvm_object *uobj, voff_t off, struct vm_anon *anon,
@@ -122,14 +142,14 @@
 {
 	struct vm_page *pg;
 
-	pg = kmem_zalloc(sizeof(struct vm_page), KM_SLEEP);
+	pg = pool_cache_get(&pagecache, PR_WAITOK);
 	pg->offset = off;
 	pg->uobject = uobj;
 
-	pg->uanon = (void *)kmem_alloc(PAGE_SIZE, KM_SLEEP);
-	if (flags & UVM_PGA_ZERO)
-		memset(pg->uanon, 0, PAGE_SIZE);
 	pg->flags = PG_CLEAN|PG_BUSY|PG_FAKE;
+	if (flags & UVM_PGA_ZERO) {
+		uvm_pagezero(pg);
+	}
 
 	TAILQ_INSERT_TAIL(&uobj->memq, pg, listq.queue);
 	rb_tree_insert_node(&uobj->rb_tree, &pg->rb_node);
@@ -155,8 +175,7 @@
 	uobj->uo_npages--;
 	rb_tree_remove_node(&uobj->rb_tree, &pg->rb_node);
 	TAILQ_REMOVE(&uobj->memq, pg, listq.queue);
-	kmem_free((void *)pg->uanon, PAGE_SIZE);
-	kmem_free(pg, sizeof(*pg));
+	pool_cache_put(&pagecache, pg);
 }
 
 void
@@ -207,6 +226,9 @@
 	callback_head_init(&kernel_map_store.vmk_reclaim_callback, IPL_VM);
 	kmem_map->pmap = pmap_kernel();
 	callback_head_init(&kmem_map_store.vmk_reclaim_callback, IPL_VM);
+
+	pool_cache_bootstrap(&pagecache, sizeof(struct vm_page), 0, 0, 0,
+	"page$", NULL, IPL_NONE, pgctor, pgdtor, NULL);
 }
 
 void



CVS commit: src/sys/dev/ieee1394

2010-09-07 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Tue Sep  7 07:26:54 UTC 2010

Modified Files:
src/sys/dev/ieee1394: firewire.c firewirereg.h

Log Message:
do not assume all fw devices speak sbp.
teach the fw attach code to deal with different fw device classes.
this allows other fw drivers than sbp to attach


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ieee1394/firewire.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ieee1394/firewirereg.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/ieee1394/firewire.c
diff -u src/sys/dev/ieee1394/firewire.c:1.37 src/sys/dev/ieee1394/firewire.c:1.38
--- src/sys/dev/ieee1394/firewire.c:1.37	Thu Aug 26 08:56:15 2010
+++ src/sys/dev/ieee1394/firewire.c	Tue Sep  7 07:26:54 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewire.c,v 1.37 2010/08/26 08:56:15 cegger Exp $	*/
+/*	$NetBSD: firewire.c,v 1.38 2010/09/07 07:26:54 cegger Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.37 2010/08/26 08:56:15 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.38 2010/09/07 07:26:54 cegger Exp $");
 
 #include 
 #include 
@@ -1959,6 +1959,45 @@
 	/* NOTREACHED */
 }
 
+static const char *
+fw_get_devclass(struct fw_device *fwdev)
+{
+	struct crom_context cc;
+	struct csrreg *reg;
+
+	crom_init_context(&cc, fwdev->csrrom);
+	reg = crom_search_key(&cc, CSRKEY_VER);
+	if (reg == NULL)
+		return "null";
+
+	switch (reg->val) {
+	case CSR_PROTAVC:
+		return "av/c";
+	case CSR_PROTCAL:
+		return "cal";
+	case CSR_PROTEHS:
+		return "ehs";
+	case CSR_PROTHAVI:
+		return "havi";
+	case CSR_PROTCAM104:
+		return "cam104";
+	case CSR_PROTCAM120:
+		return "cam120";
+	case CSR_PROTCAM130:
+		return "cam130";
+	case CSR_PROTDPP:
+		return "printer";
+	case CSR_PROTIICP:
+		return "iicp";
+	case CSRVAL_T10SBP2:
+		return "sbp";
+	default:
+		if (firewire_debug)
+			printf("%s: reg->val 0x%x\n",
+__func__, reg->val);
+		return "sbp";
+	}
+}
 
 /*
  * To attach sub-devices layer onto IEEE1394 bus.
@@ -1973,7 +2012,7 @@
 	struct fw_attach_args fwa;
 	int locs[IEEE1394IFCF_NLOCS];
 
-	fwa.name = "sbp";
+	fwa.name = "null";
 	fwa.fc = fc;
 
 	mutex_enter(&fc->fc_mtx);
@@ -1993,16 +2032,17 @@
 			locs[IEEE1394IFCF_EUIHI] = fwdev->eui.hi;
 			locs[IEEE1394IFCF_EUILO] = fwdev->eui.lo;
 
+			fwa.name = fw_get_devclass(fwdev);
 			fwa.fwdev = fwdev;
-			fwdev->sbp = config_found_sm_loc(sc->dev, "ieee1394if",
+			fwdev->dev = config_found_sm_loc(sc->dev, "ieee1394if",
 			locs, &fwa, firewire_print, config_stdsubmatch);
-			if (fwdev->sbp == NULL) {
+			if (fwdev->dev == NULL) {
 free(devlist, M_DEVBUF);
 break;
 			}
 
 			devlist->fwdev = fwdev;
-			devlist->dev = fwdev->sbp;
+			devlist->dev = fwdev->dev;
 
 			mutex_enter(&fc->fc_mtx);
 			if (SLIST_EMPTY(&sc->devlist))
@@ -2064,7 +2104,7 @@
 			link);
 			free(devlist, M_DEVBUF);
 
-			if (config_detach(fwdev->sbp, DETACH_FORCE) != 0)
+			if (config_detach(fwdev->dev, DETACH_FORCE) != 0)
 return;
 
 			STAILQ_REMOVE(&fc->devices, fwdev, fw_device, link);

Index: src/sys/dev/ieee1394/firewirereg.h
diff -u src/sys/dev/ieee1394/firewirereg.h:1.13 src/sys/dev/ieee1394/firewirereg.h:1.14
--- src/sys/dev/ieee1394/firewirereg.h:1.13	Sun May 23 18:56:58 2010
+++ src/sys/dev/ieee1394/firewirereg.h	Tue Sep  7 07:26:54 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: firewirereg.h,v 1.13 2010/05/23 18:56:58 christos Exp $	*/
+/*	$NetBSD: firewirereg.h,v 1.14 2010/09/07 07:26:54 cegger Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -63,7 +63,7 @@
 #define FWDEVATTACHED	2
 #define FWDEVINVAL	3
 	STAILQ_ENTRY(fw_device) link;
-	device_t sbp;
+	device_t dev;
 };
 
 struct firewire_softc {



CVS commit: src/sys/dev/ieee1394

2010-09-07 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Tue Sep  7 07:19:46 UTC 2010

Modified Files:
src/sys/dev/ieee1394: fwohci.c

Log Message:
convert tsleep to kpause


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/dev/ieee1394/fwohci.c

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

Modified files:

Index: src/sys/dev/ieee1394/fwohci.c
diff -u src/sys/dev/ieee1394/fwohci.c:1.129 src/sys/dev/ieee1394/fwohci.c:1.130
--- src/sys/dev/ieee1394/fwohci.c:1.129	Sun Aug 29 21:15:26 2010
+++ src/sys/dev/ieee1394/fwohci.c	Tue Sep  7 07:19:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwohci.c,v 1.129 2010/08/29 21:15:26 cegger Exp $	*/
+/*	$NetBSD: fwohci.c,v 1.130 2010/09/07 07:19:45 cegger Exp $	*/
 
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.129 2010/08/29 21:15:26 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.130 2010/09/07 07:19:45 cegger Exp $");
 
 #include 
 #include 
@@ -882,13 +882,12 @@
 fwohci_irx_disable(struct firewire_comm *fc, int dmach)
 {
 	struct fwohci_softc *sc = (struct fwohci_softc *)fc;
-	int sleepch;
 
 	OWRITE(sc, OHCI_IRCTLCLR(dmach), OHCI_CNTL_DMA_RUN);
 	OWRITE(sc, OHCI_IR_MASKCLR, 1 << dmach);
 	OWRITE(sc, OHCI_IR_STATCLR, 1 << dmach);
 	/* XXX we cannot free buffers until the DMA really stops */
-	tsleep((void *)&sleepch, FWPRI, "fwirxd", hz);
+	kpause("fwirxd", true, hz, NULL);
 	fwohci_db_free(sc, &sc->ir[dmach]);
 	sc->ir[dmach].xferq.flag &= ~FWXFERQ_RUNNING;
 	return 0;
@@ -1016,14 +1015,13 @@
 fwohci_itx_disable(struct firewire_comm *fc, int dmach)
 {
 	struct fwohci_softc *sc = (struct fwohci_softc *)fc;
-	int sleepch;
 
 	OWRITE(sc, OHCI_ITCTLCLR(dmach),
 	OHCI_CNTL_DMA_RUN | OHCI_CNTL_CYCMATCH_S);
 	OWRITE(sc, OHCI_IT_MASKCLR, 1 << dmach);
 	OWRITE(sc, OHCI_IT_STATCLR, 1 << dmach);
 	/* XXX we cannot free buffers until the DMA really stops */
-	tsleep((void *)&sleepch, FWPRI, "fwitxd", hz);
+	kpause("fwitxd", true, hz, NULL);
 	fwohci_db_free(sc, &sc->it[dmach]);
 	sc->it[dmach].xferq.flag &= ~FWXFERQ_RUNNING;
 	return 0;