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

2010-09-03 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Fri Sep  3 06:07:24 UTC 2010

Modified Files:
src/sys/arch/xen/include: xenio.h xenio3.h

Log Message:
match header protection with filename


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/xen/include/xenio.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/xen/include/xenio3.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/xen/include/xenio.h
diff -u src/sys/arch/xen/include/xenio.h:1.6 src/sys/arch/xen/include/xenio.h:1.7
--- src/sys/arch/xen/include/xenio.h:1.6	Sun Feb 17 16:21:19 2008
+++ src/sys/arch/xen/include/xenio.h	Fri Sep  3 06:07:24 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: xenio.h,v 1.6 2008/02/17 16:21:19 bouyer Exp $	*/
+/*	$NetBSD: xenio.h,v 1.7 2010/09/03 06:07:24 cegger Exp $	*/
 
 /**
  * privcmd.h
@@ -27,8 +27,8 @@
  * IN THE SOFTWARE.
  */
 
-#ifndef __XEN_XENIO3_H__
-#define __XEN_XENIO3_H__
+#ifndef __XEN_XENIO_H__
+#define __XEN_XENIO_H__
 
 /* Interface to /proc/xen/privcmd */
 
@@ -112,4 +112,4 @@
 /* EVTCHN_UNBIND: Unbind from the specified event-channel port. */
 #define EVTCHN_UNBIND _IOW('E', 3, unsigned long)
 
-#endif /* __XEN_XENIO3_H__ */
+#endif /* __XEN_XENIO_H__ */

Index: src/sys/arch/xen/include/xenio3.h
diff -u src/sys/arch/xen/include/xenio3.h:1.2 src/sys/arch/xen/include/xenio3.h:1.3
--- src/sys/arch/xen/include/xenio3.h:1.2	Sun Feb 17 16:21:19 2008
+++ src/sys/arch/xen/include/xenio3.h	Fri Sep  3 06:07:24 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: xenio3.h,v 1.2 2008/02/17 16:21:19 bouyer Exp $ */
+/* $NetBSD: xenio3.h,v 1.3 2010/09/03 06:07:24 cegger Exp $ */
 /**
  * evtchn.h
  * 
@@ -28,8 +28,8 @@
  * IN THE SOFTWARE.
  */
 
-#ifndef __XEN_XENIO_H__
-#define __XEN_XENIO_H__
+#ifndef __XEN_XENIO3_H__
+#define __XEN_XENIO3_H__
 
 /*
  * Bind a fresh port to VIRQ @virq.
@@ -86,4 +86,4 @@
 #define IOCTL_EVTCHN_RESET\
 	_IO('E', 9)
 
-#endif /* __XEN_XENIO_H__ */
+#endif /* __XEN_XENIO3_H__ */



CVS commit: src/lib/librump

2010-09-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Sep  3 07:12:51 UTC 2010

Modified Files:
src/lib/librump: rump_lwproc.3

Log Message:
Fix a typo, uppercase UID/GID.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/librump/rump_lwproc.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/librump/rump_lwproc.3
diff -u src/lib/librump/rump_lwproc.3:1.1 src/lib/librump/rump_lwproc.3:1.2
--- src/lib/librump/rump_lwproc.3:1.1	Thu Sep  2 12:29:49 2010
+++ src/lib/librump/rump_lwproc.3	Fri Sep  3 07:12:51 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: rump_lwproc.3,v 1.1 2010/09/02 12:29:49 pooka Exp $
+.\ $NetBSD: rump_lwproc.3,v 1.2 2010/09/03 07:12:51 wiz Exp $
 .\
 .\ Copyright (c) 2010 Antti Kantee.  All rights reserved.
 .\
@@ -49,14 +49,14 @@
 Every lwp is associated with exactly one process, and a process is
 associated with one or more lwps.
 The current lwp (curlwp) indicates the current process and determines
-which resources, such as uid/gid, current working directory, and
+which resources, such as UID/GID, current working directory, and
 file descriptor table, are currently used.
 These basic principles apply to rump kernels as well, but since
 rump uses the host's thread and process context directly, the rules
 for how thread context is determined are different.
 .Pp
 In the rump model, each host thread (pthread) is either bound to
-a rump kernel lwp or accesses the rump kernel with a implicit thread
+a rump kernel lwp or accesses the rump kernel with an implicit thread
 context associated with the system process proc0.
 The implicit thread context is created every time the rump kernel
 is entered and disbanded upon exit.



CVS commit: src/lib/libperfuse

2010-09-03 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Sep  3 07:15:18 UTC 2010

Modified Files:
src/lib/libperfuse: ops.c perfuse_priv.h subr.c

Log Message:
- Postpone file close at reclaim time, since NetBSD sends fsync and
setattr(mtime, ctime) after close, while FUSE expects the file
to be open for these operations

- remove unused argument to node_mk_common()

- remove requeued requests when they are executed, not when they
are tagged for schedule

- try to make filehandle management simplier, by keeping track of only
one read and one write filehandle (the latter being really read/write).

- when CREATE is not available, we use the MKNOD/OPEN path. Fix a
bug here where we opened the parent directory instead of the node:
add the missing lookup of the mknod'ed node.

- lookup file we just created: glusterfs does not really see them
otherwise.

- open file when doing setattr(mtime, ctime) on non open files, as
some filesystems seems to require it.

- Do not flush pagecache for removed nodes

- Keep track of read/write operations in progress, and at reclaim
time, make sure they are over before closing and forgeting the file.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libperfuse/ops.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libperfuse/perfuse_priv.h
cvs rdiff -u -r1.3 -r1.4 src/lib/libperfuse/subr.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.6 src/lib/libperfuse/ops.c:1.7
--- src/lib/libperfuse/ops.c:1.6	Thu Sep  2 08:58:06 2010
+++ src/lib/libperfuse/ops.c	Fri Sep  3 07:15:18 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.6 2010/09/02 08:58:06 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.7 2010/09/03 07:15:18 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -41,6 +41,7 @@
 #include perfuse_priv.h
 #include fuse.h
 
+static int node_close_common(struct puffs_usermount *, puffs_cookie_t, int);
 static int no_access(puffs_cookie_t, const struct puffs_cred *, mode_t);
 static void fuse_attr_to_vap(struct perfuse_state *,
 struct vattr *, struct fuse_attr *);
@@ -74,6 +75,7 @@
  */
 #define F_WAIT		0x010
 #define F_FLOCK		0x020
+#define OFLAGS(fflags)  ((fflags) - 1)
 
 /* 
  * Borrowed from src/sys/kern/vfs_subr.c and src/sys/sys/vnode.h 
@@ -90,6 +92,74 @@
 #define IFTOVT(mode) (iftovt_tab[((mode)  S_IFMT)  12])
 #define VTTOIF(indx) (vttoif_tab[(int)(indx)])
 
+static int
+node_close_common(pu, opc, mode)
+	struct puffs_usermount *pu;
+	puffs_cookie_t opc;
+	int mode;
+{
+	struct perfuse_state *ps;
+	perfuse_msg_t *pm;
+	int op;
+	uint64_t fh;
+	struct fuse_release_in *fri;
+	struct perfuse_node_data *pnd;
+	struct puffs_node *pn;
+	int error;
+
+	ps = puffs_getspecific(pu);
+	pn = (struct puffs_node *)opc;
+	pnd = PERFUSE_NODE_DATA(pn);
+
+	if (puffs_pn_getvap(pn)-va_type == VDIR) {
+		op = FUSE_RELEASEDIR;
+		mode = FREAD;
+	} else {
+		op = FUSE_RELEASE;
+	}
+
+	/*
+	 * Destroy the filehandle before sending the 
+	 * request to the FUSE filesystem, otherwise 
+	 * we may get a second close() while we wait
+	 * for the reply, and we would end up closing
+	 * the same fh twice instead of closng both.
+	 */
+	fh = perfuse_get_fh(opc, mode);
+	perfuse_destroy_fh(pn, fh);
+
+	/*
+	 * release_flags may be set to FUSE_RELEASE_FLUSH
+	 * to flush locks. lock_owner must be set in that case
+	 */
+	pm = ps-ps_new_msg(pu, opc, op, sizeof(*fri), NULL);
+	fri = GET_INPAYLOAD(ps, pm, fuse_release_in);
+	fri-fh = fh;
+	fri-flags = 0;
+	fri-release_flags = 0;
+	fri-lock_owner = pnd-pnd_lock_owner;
+	fri-flags = (fri-lock_owner != 0) ? FUSE_RELEASE_FLUSH : 0;
+
+#ifdef PERFUSE_DEBUG
+	if (perfuse_diagflags  PDF_FH)
+		DPRINTF(%s: opc = %p, ino = %PRId64, fh = 0x%PRIx64\n,
+			 __func__, (void *)opc, pnd-pnd_ino, fri-fh);
+#endif
+
+	if ((error = XCHG_MSG(ps, pu, pm, NO_PAYLOAD_REPLY_LEN)) != 0)
+		goto out;
+
+	ps-ps_destroy_msg(pm);
+
+	error = 0;
+
+out:
+	if (error != 0)
+		DERRX(EX_SOFTWARE, %s: freed fh = 0x%PRIx64 but filesystem 
+		  returned error = %d, __func__, fh, error);
+
+	return error;
+}
 
 static int
 no_access(opc, pcr, mode)
@@ -802,6 +872,19 @@
 	int error;
 	
 	/*
+	 * Special case for ..
+	 */
+	if (PCNISDOTDOT(pcn)) {
+		pn = PERFUSE_NODE_DATA(opc)-pnd_parent;
+		PERFUSE_NODE_DATA(pn)-pnd_flags = ~PND_RECLAIMED;
+		
+		puffs_newinfo_setcookie(pni, pn);
+		puffs_newinfo_setvtype(pni, VDIR);
+
+		return 0;
+	}
+
+	/*
 	 * XXX This is borrowed from librefuse, 
 	 * and __UNCONST is said to be fixed.
 	 */
@@ -866,6 +949,12 @@
 		if (error != 0)
 			return error;
 
+		error = node_lookup_common(pu, opc, (char*)PCNPATH(pcn), pn);
+		if (error != 0)	
+			return error;
+
+		opc = (puffs_cookie_t)pn;
+
 		error = perfuse_node_open(pu, opc, FREAD|FWRITE, pcn-pcn_cred);
 		if (error != 0)	
 			return error;
@@ -898,12 +987,26 @@
 	 * so that we can reuse it later
 	 */
 	pn = 

CVS commit: src/lib/libperfuse

2010-09-03 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Sep  3 14:32:50 UTC 2010

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

Log Message:
Fix reference count bug introduced by previous commit


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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.7 src/lib/libperfuse/ops.c:1.8
--- src/lib/libperfuse/ops.c:1.7	Fri Sep  3 07:15:18 2010
+++ src/lib/libperfuse/ops.c	Fri Sep  3 14:32:50 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.7 2010/09/03 07:15:18 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.8 2010/09/03 14:32:50 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -1006,7 +1006,9 @@
 	 * aware that the file was created. If we do not do it, we 
 	 * get SETATTR (null) (fuse_loc_fill() failed)
 	 */
-	(void)node_lookup_common(pu, opc, (char*)PCNPATH(pcn), NULL);
+	(void)puffs_pn_nodewalk(pu, puffs_path_walkcmp,
+		__UNCONST(pcn-pcn_po_full));
+
 out: 
 	ps-ps_destroy_msg(pm);
 
@@ -2489,7 +2491,6 @@
 	if (puffs_pn_getvap((struct puffs_node *)opc)-va_type == VDIR) 
 		return EBADF;
 
-DPRINTF(%s ENTER\n, __func__);
 	pnd-pnd_flags |= PND_INWRITE;
 
 	requested = *resid;



CVS commit: src/lib/libc/arch/mips

2010-09-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Sep  3 17:22:52 UTC 2010

Modified Files:
src/lib/libc/arch/mips/gen: Makefile.inc _setjmp.S flt_rounds.c
longjmp.c setjmp.S
src/lib/libc/arch/mips/sys: cerror.S

Log Message:
Pullup fixes from matt-nb5-mips64.
This makes setjmp/longjmp work again.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/lib/libc/arch/mips/gen/Makefile.inc
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/arch/mips/gen/_setjmp.S
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/mips/gen/flt_rounds.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/mips/gen/longjmp.c
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/arch/mips/gen/setjmp.S
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/arch/mips/sys/cerror.S

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/arch/mips/gen/Makefile.inc
diff -u src/lib/libc/arch/mips/gen/Makefile.inc:1.30 src/lib/libc/arch/mips/gen/Makefile.inc:1.31
--- src/lib/libc/arch/mips/gen/Makefile.inc:1.30	Mon Dec 14 01:07:42 2009
+++ src/lib/libc/arch/mips/gen/Makefile.inc	Fri Sep  3 17:22:51 2010
@@ -1,6 +1,10 @@
-#	$NetBSD: Makefile.inc,v 1.30 2009/12/14 01:07:42 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.31 2010/09/03 17:22:51 matt Exp $
 
+.if ${MKSOFTFLOAT} == no
 SRCS+=	fabs.S ldexp.S modf.S
+.else
+SRCS+=	fabs_ieee754.c ldexp_ieee754.c modf_ieee754.c
+.endif
 
 # Common ieee754 constants and functions
 SRCS+=	infinityf_ieee754.c infinity_ieee754.c infinityl_dbl_ieee754.c
@@ -11,9 +15,12 @@
 SRCS+=	signbitf_ieee754.c signbitd_ieee754.c
 
 SRCS+=	nanf.c
+SRCS+=	flt_rounds.c
 
-SRCS+=	flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
+.if ${MKSOFTFLOAT} == no
+SRCS+=	fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
 	fpsetround.c fpsetsticky.c
+.endif
 
 SRCS+=	setjmp.S longjmp.c
 SRCS+=	_setjmp.S

Index: src/lib/libc/arch/mips/gen/_setjmp.S
diff -u src/lib/libc/arch/mips/gen/_setjmp.S:1.21 src/lib/libc/arch/mips/gen/_setjmp.S:1.22
--- src/lib/libc/arch/mips/gen/_setjmp.S:1.21	Mon Dec 14 01:07:42 2009
+++ src/lib/libc/arch/mips/gen/_setjmp.S	Fri Sep  3 17:22:51 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: _setjmp.S,v 1.21 2009/12/14 01:07:42 matt Exp $	*/
+/*	$NetBSD: _setjmp.S,v 1.22 2010/09/03 17:22:51 matt Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -46,7 +46,7 @@
 #if 0
 	RCSID(from: @(#)_setjmp.s	8.1 (Berkeley) 6/4/93)
 #else
-	RCSID($NetBSD: _setjmp.S,v 1.21 2009/12/14 01:07:42 matt Exp $)
+	RCSID($NetBSD: _setjmp.S,v 1.22 2010/09/03 17:22:51 matt Exp $)
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -68,7 +68,6 @@
 	REG_LI	v0, 0xACEDBADE			# sigcontext magic number
 	REG_S	ra, _OFFSETOF_SC_PC(a0)		# sc_pc = return address
 	REG_S	v0, _OFFSETOF_SC_REGS(a0)	#   saved in sc_regs[0]
-	REG_S	a1, _OFFSETOF_SC_REGS_V0(a0)	# save return value
 	REG_S	s0, _OFFSETOF_SC_REGS_S0(a0)
 	REG_S	s1, _OFFSETOF_SC_REGS_S1(a0)
 	REG_S	s2, _OFFSETOF_SC_REGS_S2(a0)
@@ -82,13 +81,14 @@
 #if defined(__mips_n32) || defined(__mips_n64)
 	REG_S	gp, _OFFSETOF_SC_REGS_GP(a0)	# newabi gp is callee-saved
 #endif
-	cfc1	v0, $31# too bad cant check if FP used
 	/*
 	 * In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved.
 	 * In N64, FP registers F23 .. F31 are callee-saved.
 	 * In O32, FP registers F20 .. F23 are callee-saved.
 	 */
 #ifndef SOFTFLOAT_FOR_GCC
+	cfc1	v0, $31# too bad cant check if FP used
+	INT_S	v0, _OFFSETOF_SC_FPREGS_FCSR(a0)
 #if defined(__mips_n64) || defined(__mips_n32)
 	FP_S	$f30, _OFFSETOF_SC_FPREGS_F30(a0)
 	FP_S	$f28, _OFFSETOF_SC_FPREGS_F28(a0)
@@ -110,7 +110,6 @@
 	FP_S	$f31, _OFFSETOF_SC_FPREGS_F31(a0)
 #endif
 #endif	/* SOFTFLOAT_FOR_GCC */
-	INT_S	v0, _OFFSETOF_SC_FPREGS_FCSR(a0)
 	REG_EPILOGUE
 
 	j	ra
@@ -128,6 +127,7 @@
 	REG_LI		t0, 0xACEDBADE
 	bne		v0, t0, botch		# jump if error
 	PTR_ADDU	sp, sp, CALLFRAME_SIZ	# does not matter, sanity
+	REG_S		a1, _OFFSETOF_SC_REGS_V0(a0)	# save return value
 	REG_L		s0, _OFFSETOF_SC_REGS_S0(a0)
 	REG_L		s1, _OFFSETOF_SC_REGS_S1(a0)
 	REG_L		s2, _OFFSETOF_SC_REGS_S2(a0)
@@ -140,16 +140,16 @@
 	REG_L		gp, _OFFSETOF_SC_REGS_GP(a0)
 #endif
 	# get fpu status
-	INT_L		v0, _OFFSETOF_SC_FPREGS_FCSR(a0)
 	REG_L		sp, _OFFSETOF_SC_REGS_SP(a0)
 	REG_L		s8, _OFFSETOF_SC_REGS_S8(a0)
+#ifndef SOFTFLOAT_FOR_GCC
+	INT_L		v0, _OFFSETOF_SC_FPREGS_FCSR(a0)
 	ctc1		v0, $31
 	/*
 	 * In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved.
 	 * In N64, FP registers F23 .. F31 are callee-saved.
 	 * In O32, FP registers F20 .. F23 are callee-saved.
 	 */
-#ifndef SOFTFLOAT_FOR_GCC
 #if defined(__mips_n64) || defined(__mips_n32)
 	FP_L	$f30, _OFFSETOF_SC_FPREGS_F30(a0)
 	FP_L	$f28, _OFFSETOF_SC_FPREGS_F28(a0)
@@ -173,7 +173,7 @@
 #endif	/* SOFTFLOAT_FOR_GCC */
 
 	REG_EPILOGUE
-	REG_L	v0, _OFFSETOF_SC_REGS_V0(a0)
+	move	v0, a1			# get return value in 1st arg
 	j	ra
 	nop
 

Index: src/lib/libc/arch/mips/gen/flt_rounds.c
diff -u 

CVS commit: src/sys/dev/pad

2010-09-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Sep  3 19:19:49 UTC 2010

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

Log Message:
- return EIO if audio data is received and /dev/pad isn't open
- give a better description for AUDIO_GETDEV


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pad/pad.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/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.15 src/sys/dev/pad/pad.c:1.16
--- src/sys/dev/pad/pad.c:1.15	Mon Jun 28 17:45:08 2010
+++ src/sys/dev/pad/pad.c	Fri Sep  3 19:19:48 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.15 2010/06/28 17:45:08 pooka Exp $ */
+/* $NetBSD: pad.c,v 1.16 2010/09/03 19:19:48 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pad.c,v 1.15 2010/06/28 17:45:08 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: pad.c,v 1.16 2010/09/03 19:19:48 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -54,12 +54,6 @@
 
 extern struct cfdriver pad_cd;
 
-static struct audio_device pad_device = {
-	Pseudo Audio,
-	1.0,
-	pad,
-};
-
 typedef struct pad_block {
 	uint8_t		*pb_ptr;
 	int		pb_len;
@@ -181,6 +175,9 @@
 {
 	int l;
 
+	if (sc-sc_open == 0)
+		return EIO;
+
 	if (sc-sc_buflen + blksize  PAD_BUFSIZE)
 		return ENOBUFS;
 
@@ -476,8 +473,9 @@
 static int
 pad_getdev(void *opaque, struct audio_device *ret)
 {
-
-	*ret = pad_device;
+	strlcpy(ret-name, Virtual Audio, sizeof(ret-name));
+	strlcpy(ret-version, osrelease, sizeof(ret-version));
+	strlcpy(ret-config, pad, sizeof(ret-config));
 
 	return 0;
 }



CVS commit: src/usr.bin/audiocfg

2010-09-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Sep  3 19:20:37 UTC 2010

Modified Files:
src/usr.bin/audiocfg: audiodev.c main.c

Log Message:
return an error if testing fails, and dump the device info before running tests


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/audiocfg/audiodev.c
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/audiocfg/main.c

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

Modified files:

Index: src/usr.bin/audiocfg/audiodev.c
diff -u src/usr.bin/audiocfg/audiodev.c:1.3 src/usr.bin/audiocfg/audiodev.c:1.4
--- src/usr.bin/audiocfg/audiodev.c:1.3	Thu Sep  2 02:17:35 2010
+++ src/usr.bin/audiocfg/audiodev.c	Fri Sep  3 19:20:37 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: audiodev.c,v 1.3 2010/09/02 02:17:35 jmcneill Exp $ */
+/* $NetBSD: audiodev.c,v 1.4 2010/09/03 19:20:37 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -245,6 +245,7 @@
 	int16_t *buf;
 	size_t buflen;
 	off_t off;
+	int rv = 0;
 
 	AUDIO_INITINFO(info);
 	info.play.sample_rate = AUDIODEV_SAMPLE_RATE;
@@ -271,7 +272,12 @@
 		size_t wlen = info.play.buffer_size;
 		if (wlen  buflen)
 			wlen = buflen;
-		write(adev-fd, (char *)buf + off, wlen);
+		wlen = write(adev-fd, (char *)buf + off, wlen);
+		if (wlen == -1) {
+			perror(write);
+			rv = -1;
+			goto done;
+		}
 		off += wlen;
 		buflen -= wlen;
 	}
@@ -279,7 +285,8 @@
 	if (ioctl(adev-fd, AUDIO_DRAIN) == -1)
 		perror(ioctl AUDIO_DRAIN);
 
+done:
 	free(buf);
 
-	return 0;
+	return rv;
 }

Index: src/usr.bin/audiocfg/main.c
diff -u src/usr.bin/audiocfg/main.c:1.5 src/usr.bin/audiocfg/main.c:1.6
--- src/usr.bin/audiocfg/main.c:1.5	Thu Sep  2 02:17:35 2010
+++ src/usr.bin/audiocfg/main.c	Fri Sep  3 19:20:37 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.5 2010/09/02 02:17:35 jmcneill Exp $ */
+/* $NetBSD: main.c,v 1.6 2010/09/03 19:20:37 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -26,6 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include assert.h
 #include errno.h
 #include fcntl.h
 #include limits.h
@@ -45,6 +46,21 @@
 	exit(EXIT_FAILURE);
 }
 
+static void
+print_audiodev(struct audiodev *adev, int i)
+{
+	assert(adev != NULL);
+
+	printf(%u: [%c] %s @ %s: ,
+	i, adev-defaultdev ? '*' : ' ',
+	adev-xname, adev-pxname);
+	printf(%s, adev-audio_device.name);
+	if (strlen(adev-audio_device.version)  0)
+		printf( %s, adev-audio_device.version);
+	printf(, %u playback channel%s\n,
+	adev-pchan, adev-pchan == 1 ?  : s);
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -60,17 +76,8 @@
 
 	if (strcmp(argv[1], list) == 0) {
 		n = audiodev_count();
-		for (i = 0; i  n; i++) {
-			adev = audiodev_get(i);
-			printf(%u: [%c] %s @ %s: ,
-			i, adev-defaultdev ? '*' : ' ',
-			adev-xname, adev-pxname);
-			printf(%s, adev-audio_device.name);
-			if (strlen(adev-audio_device.version)  0)
-printf( %s, adev-audio_device.version);
-			printf(, %u playback channel%s\n,
-			adev-pchan, adev-pchan == 1 ?  : s);
-		}
+		for (i = 0; i  n; i++)
+			print_audiodev(audiodev_get(i), i);
 	} else if (strcmp(argv[1], default) == 0  argc == 3) {
 		if (*argv[2]  '0' || *argv[2]  '9')
 			usage(argv[0]);
@@ -104,9 +111,13 @@
 			fprintf(stderr, no such device\n);
 			return EXIT_FAILURE;
 		}
+		print_audiodev(adev, i);
 		for (i = 0; i  adev-pchan; i++) {
-			printf(testing channel %d...\n, i);
-			audiodev_test(adev, 1  i);
+			printf(  testing channel %d..., i);
+			fflush(stdout);
+			if (audiodev_test(adev, 1  i) == -1)
+return EXIT_FAILURE;
+			printf( done\n);
 		}
 	} else
 		usage(argv[0]);



CVS commit: src/sys/dev/usb

2010-09-03 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Fri Sep  3 23:15:09 UTC 2010

Modified Files:
src/sys/dev/usb: usbdi.c

Log Message:
fix NULL pointer dereference on detaching:
Attach an USB device that looks like this:
ugen1 at uhub0 port 2
ugen1: detached
ugen1: at uhub0 port 2 (addr 3) disconnected

When unplugging the device:

usb_transfer_complete: xfer=0x8832a800 not busy 0x0055
usb_transfer_complete: bad dequeue 0x8832a800 != 0x0


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/dev/usb/usbdi.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/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.127 src/sys/dev/usb/usbdi.c:1.128
--- src/sys/dev/usb/usbdi.c:1.127	Sat Jan 16 17:03:03 2010
+++ src/sys/dev/usb/usbdi.c	Fri Sep  3 23:15:09 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.127 2010/01/16 17:03:03 bouyer Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.128 2010/09/03 23:15:09 cegger Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: usbdi.c,v 1.127 2010/01/16 17:03:03 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: usbdi.c,v 1.128 2010/09/03 23:15:09 cegger Exp $);
 
 #include opt_compat_netbsd.h
 
@@ -800,7 +800,8 @@
 			   xfer, SIMPLEQ_FIRST(pipe-queue));
 		xfer-busy_free = XFER_BUSY;
 #endif
-		SIMPLEQ_REMOVE_HEAD(pipe-queue, next);
+		if (SIMPLEQ_FIRST(pipe-queue) != NULL)
+			SIMPLEQ_REMOVE_HEAD(pipe-queue, next);
 	}
 	DPRINTFN(5,(usb_transfer_complete: repeat=%d new head=%p\n,
 		repeat, SIMPLEQ_FIRST(pipe-queue)));



CVS commit: src

2010-09-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep  4 01:16:50 UTC 2010

Modified Files:
src/distrib/hpcarm/instkernel: Makefile
src/etc/etc.hpcarm: Makefile.inc
Added Files:
src/sys/arch/hpcarm/conf: INSTALL_JORNADA720

Log Message:
Build install ramdisk kernel for JORNADA720.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/distrib/hpcarm/instkernel/Makefile
cvs rdiff -u -r1.9 -r1.10 src/etc/etc.hpcarm/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/sys/arch/hpcarm/conf/INSTALL_JORNADA720

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

Modified files:

Index: src/distrib/hpcarm/instkernel/Makefile
diff -u src/distrib/hpcarm/instkernel/Makefile:1.2 src/distrib/hpcarm/instkernel/Makefile:1.3
--- src/distrib/hpcarm/instkernel/Makefile:1.2	Sat Apr 17 13:36:22 2010
+++ src/distrib/hpcarm/instkernel/Makefile	Sat Sep  4 01:16:49 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2010/04/17 13:36:22 nonaka Exp $
+#	$NetBSD: Makefile,v 1.3 2010/09/04 01:16:49 tsutsui Exp $
 
 .include bsd.own.mk
 .include ${NETBSDSRCDIR}/distrib/common/Makefile.distrib
@@ -9,6 +9,7 @@
 MINIROOT=	${MINIROOTOBJ}/miniroot.fs
 
 MDSETTARGETS=		INSTALL_IPAQ	${MINIROOT}	netbsd-IPAQ \
+			INSTALL_JORNADA720 ${MINIROOT}	netbsd-JORNADA720 \
 			INSTALL_WZERO3	${MINIROOT}	netbsd-WZERO3
 MDSET_RELEASEDIR=	installation
 

Index: src/etc/etc.hpcarm/Makefile.inc
diff -u src/etc/etc.hpcarm/Makefile.inc:1.9 src/etc/etc.hpcarm/Makefile.inc:1.10
--- src/etc/etc.hpcarm/Makefile.inc:1.9	Sat Apr 17 13:36:21 2010
+++ src/etc/etc.hpcarm/Makefile.inc	Sat Sep  4 01:16:50 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.9 2010/04/17 13:36:21 nonaka Exp $
+#	$NetBSD: Makefile.inc,v 1.10 2010/09/04 01:16:50 tsutsui Exp $
 #
 #	etc.hpcarm/Makefile.inc -- hpcarm-specific etc Makefile targets
 #
@@ -8,7 +8,7 @@
 
 KERNEL_SETS=		IPAQ JORNADA720 WZERO3
 
-BUILD_KERNELS=		INSTALL_IPAQ INSTALL_WZERO3
+BUILD_KERNELS=		INSTALL_IPAQ INSTALL_JORNADA720 INSTALL_WZERO3
 
 INSTALLATION_DIRS+=	installation/miniroot
 

Added files:

Index: src/sys/arch/hpcarm/conf/INSTALL_JORNADA720
diff -u /dev/null src/sys/arch/hpcarm/conf/INSTALL_JORNADA720:1.1
--- /dev/null	Sat Sep  4 01:16:50 2010
+++ src/sys/arch/hpcarm/conf/INSTALL_JORNADA720	Sat Sep  4 01:16:49 2010
@@ -0,0 +1,13 @@
+#
+# kernel config file for system install
+#
+# 	$NetBSD: INSTALL_JORNADA720,v 1.1 2010/09/04 01:16:49 tsutsui Exp $
+#
+
+include		arch/hpcarm/conf/JORNADA720
+
+# Enable the hooks used for initializing the root memory-disk.
+options 	MEMORY_DISK_HOOKS
+options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
+options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
+options 	MEMORY_DISK_ROOT_SIZE=8704	# size of memory disk, in blocks



CVS commit: src/distrib/utils/sysinst/arch/hpcarm

2010-09-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep  4 01:23:25 UTC 2010

Modified Files:
src/distrib/utils/sysinst/arch/hpcarm: md.c md.h

Log Message:
Add dumb code to select an appropriate kernel set to be installed
per running INSTALL kernel name taken from sysctl kern.version.

XXX: on all arm ports, sysctl hw.cpu_model returns a processor name,
XXX: not machine model as mentioned in sys/sysctl.h.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/distrib/utils/sysinst/arch/hpcarm/md.c
cvs rdiff -u -r1.5 -r1.6 src/distrib/utils/sysinst/arch/hpcarm/md.h

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

Modified files:

Index: src/distrib/utils/sysinst/arch/hpcarm/md.c
diff -u src/distrib/utils/sysinst/arch/hpcarm/md.c:1.7 src/distrib/utils/sysinst/arch/hpcarm/md.c:1.8
--- src/distrib/utils/sysinst/arch/hpcarm/md.c:1.7	Sat Sep 19 14:57:28 2009
+++ src/distrib/utils/sysinst/arch/hpcarm/md.c	Sat Sep  4 01:23:25 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.7 2009/09/19 14:57:28 abs Exp $ */
+/*	$NetBSD: md.c,v 1.8 2010/09/04 01:23:25 tsutsui Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -59,7 +59,33 @@
 void
 md_init_set_status(int minimal)
 {
-	(void)minimal;
+	static const struct {
+		const char *name;
+		const int set;
+	} kern_sets[] = {
+		{ IPAQ,	SET_KERNEL_IPAQ },
+		{ JORNADA720,	SET_KERNEL_JORNADA720 },
+		{ WZERO3,	SET_KERNEL_WZERO3 }
+	};
+	static const int mib[2] = {CTL_KERN, KERN_VERSION};
+	size_t len;
+	char *version;
+	u_int i;
+
+	/* check INSTALL kernel name to select an appropriate kernel set */
+	/* XXX: hw.cpu_model has a processor name on arm ports */
+	sysctl(mib, 2, NULL, len, NULL, 0);
+	version = malloc(len);
+	if (version == NULL)
+		return;
+	sysctl(mib, 2, version, len, NULL, 0);
+	for (i = 0; i  __arraycount(kern_sets); i++) {
+		if (strstr(version, kern_sets[i].name) != NULL) {
+			set_kernel_set(kern_sets[i].set);
+			break;
+		}
+	}
+	free(version);
 }
 
 int

Index: src/distrib/utils/sysinst/arch/hpcarm/md.h
diff -u src/distrib/utils/sysinst/arch/hpcarm/md.h:1.5 src/distrib/utils/sysinst/arch/hpcarm/md.h:1.6
--- src/distrib/utils/sysinst/arch/hpcarm/md.h:1.5	Mon May 10 16:33:45 2010
+++ src/distrib/utils/sysinst/arch/hpcarm/md.h	Sat Sep  4 01:23:25 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.h,v 1.5 2010/05/10 16:33:45 tsutsui Exp $	*/
+/*	$NetBSD: md.h,v 1.6 2010/09/04 01:23:25 tsutsui Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -63,6 +63,10 @@
 #define SET_KERNEL_2_NAME	kern-JORNADA720
 #define SET_KERNEL_3_NAME	kern-WZERO3
 
+#define SET_KERNEL_IPAQ		SET_KERNEL_1
+#define SET_KERNEL_JORNADA720	SET_KERNEL_2
+#define SET_KERNEL_WZERO3	SET_KERNEL_3
+
 
 /*
  * Machine-specific command to write a new label to a disk.