CVS commit: src/sys/dev/usb

2009-11-05 Thread Rafal Boni
Module Name:src
Committed By:   rafal
Date:   Fri Nov  6 04:42:27 UTC 2009

Modified Files:
src/sys/dev/usb: uhidev.c ums.c

Log Message:
Fix kern/41737 -- add quirks to make MS Wireless Laser Mouse 6000 work.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/usb/uhidev.c
cvs rdiff -u -r1.74 -r1.75 src/sys/dev/usb/ums.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/uhidev.c
diff -u src/sys/dev/usb/uhidev.c:1.43 src/sys/dev/usb/uhidev.c:1.44
--- src/sys/dev/usb/uhidev.c:1.43	Wed Sep 23 19:07:19 2009
+++ src/sys/dev/usb/uhidev.c	Fri Nov  6 04:42:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhidev.c,v 1.43 2009/09/23 19:07:19 plunky Exp $	*/
+/*	$NetBSD: uhidev.c,v 1.44 2009/11/06 04:42:27 rafal Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.43 2009/09/23 19:07:19 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.44 2009/11/06 04:42:27 rafal Exp $");
 
 #include 
 #include 
@@ -105,7 +105,7 @@
 	struct uhidev_attach_arg uha;
 	device_t dev;
 	struct uhidev *csc;
-	int size, nrepid, repid, repsz;
+	int maxinpktsize, size, nrepid, repid, repsz;
 	int *repsizes;
 	int i;
 	void *desc;
@@ -140,6 +140,7 @@
 		(void)usbd_set_protocol(iface, 1);
 #endif
 
+	maxinpktsize = 0;
 	sc->sc_iep_addr = sc->sc_oep_addr = -1;
 	for (i = 0; i < id->bNumEndpoints; i++) {
 		ed = usbd_interface2endpoint_descriptor(iface, i);
@@ -161,6 +162,7 @@
 
 		if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN &&
 		(ed->bmAttributes & UE_XFERTYPE) == UE_INTERRUPT) {
+			maxinpktsize = UGETW(ed->wMaxPacketSize);
 			sc->sc_iep_addr = ed->bEndpointAddress;
 		} else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT &&
 		(ed->bmAttributes & UE_XFERTYPE) == UE_INTERRUPT) {
@@ -265,8 +267,10 @@
 		aprint_error_dev(self, "no memory\n");
 		USB_ATTACH_ERROR_RETURN;
 	}
+
+	/* Just request max packet size for the interrupt pipe */
+	sc->sc_isize = maxinpktsize;
 	sc->sc_nrepid = nrepid;
-	sc->sc_isize = 0;
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
 			   USBDEV(sc->sc_dev));
@@ -275,12 +279,8 @@
 		repsz = hid_report_size(desc, size, hid_input, repid);
 		DPRINTF(("uhidev_match: repid=%d, repsz=%d\n", repid, repsz));
 		repsizes[repid] = repsz;
-		if (repsz > 0) {
-			if (repsz > sc->sc_isize)
-sc->sc_isize = repsz;
-		}
 	}
-	sc->sc_isize += nrepid != 1;	/* space for report ID */
+
 	DPRINTF(("uhidev_attach: isize=%d\n", sc->sc_isize));
 
 	uha.parent = sc;
@@ -478,7 +478,7 @@
 		rep, scd, scd ? scd->sc_state : 0));
 	if (!(scd->sc_state & UHIDEV_OPEN))
 		return;
-	if (scd->sc_in_rep_size != cc) {
+	if (scd->sc_in_rep_size > cc) {
 		printf("%s: bad input length %d != %d\n",
 		   USBDEVNAME(sc->sc_dev), scd->sc_in_rep_size, cc);
 		return;

Index: src/sys/dev/usb/ums.c
diff -u src/sys/dev/usb/ums.c:1.74 src/sys/dev/usb/ums.c:1.75
--- src/sys/dev/usb/ums.c:1.74	Mon Mar  9 15:59:33 2009
+++ src/sys/dev/usb/ums.c	Fri Nov  6 04:42:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ums.c,v 1.74 2009/03/09 15:59:33 uebayasi Exp $	*/
+/*	$NetBSD: ums.c,v 1.75 2009/11/06 04:42:27 rafal Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.74 2009/03/09 15:59:33 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.75 2009/11/06 04:42:27 rafal Exp $");
 
 #include 
 #include 
@@ -94,6 +94,7 @@
 #define UMS_Z		0x01	/* z direction available */
 #define UMS_SPUR_BUT_UP	0x02	/* spurious button up events */
 #define UMS_REVZ	0x04	/* Z-axis is reversed */
+#define UMS_W		0x08	/* w direction/tilt available */
 
 	int nbuttons;
 
@@ -151,7 +152,8 @@
 	int size;
 	void *desc;
 	u_int32_t flags, quirks;
-	int i, wheel;
+	int i, hl;
+	struct hid_location *zloc;
 	struct hid_location loc_btn;
 
 	aprint_naive("\n");
@@ -197,10 +199,16 @@
 	}
 
 	/* Try the wheel first as the Z activator since it's tradition. */
-	wheel = hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP,
-		  HUG_WHEEL),
-			   uha->reportid, hid_input, &sc->sc_loc_z, &flags);
-	if (wheel) {
+	hl = hid_locate(desc, 
+			size, 
+			HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL), 
+			uha->reportid, 
+			hid_input, 
+			&sc->sc_loc_z, 
+			&flags);
+
+	zloc = &sc->sc_loc_z;
+	if (hl) {
 		if ((flags & MOUSE_FLAGS_MASK) != MOUSE_FLAGS) {
 			aprint_verbose("\n%s: Wheel report 0x%04x not "
 			"supported\n", USBDEVNAME(sc->sc_hdev.sc_dev),
@@ -210,33 +218,59 @@
 			sc->flags |= UMS_Z;
 			/* Wheels need the Z axis reversed. */
 			sc->flags ^= UMS_REVZ;
+			/* Put Z on the W coordinate */
+			zloc = &sc->sc_loc_w;
 		}
-		/*
-		 * We might have both a wheel and Z direction, if so put
-		 * put the Z on the W coordinate.
-		 */
-		if (hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP,
-		  HUG_Z),
-			uha->reportid, hid_inp

CVS commit: src/usr.sbin/ypserv/ypxfr

2009-11-05 Thread Chuck Cranor
Module Name:src
Committed By:   chuck
Date:   Thu Nov  5 21:26:25 UTC 2009

Modified Files:
src/usr.sbin/ypserv/ypxfr: ypxfr.c

Log Message:
rev 1.18 un-covered some bugs:

 1. add_interdomain and add_secure are optional... not all maps use these
keys.  if we are unable to add them due to a YPERR_KEY (meaning they
are not being used), then we should not flag this as a general error.

 2. if we have a failure (status <= 0) we unlink_db() the temp database
as part of error handling.   but we should not overwrite our error
status code with the return value from unlink_db() because if the
unlink_db() works (likely true) than that success will wipe out our
error code and the calling yppush will think we worked.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/ypserv/ypxfr/ypxfr.c

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

Modified files:

Index: src/usr.sbin/ypserv/ypxfr/ypxfr.c
diff -u src/usr.sbin/ypserv/ypxfr/ypxfr.c:1.18 src/usr.sbin/ypserv/ypxfr/ypxfr.c:1.19
--- src/usr.sbin/ypserv/ypxfr/ypxfr.c:1.18	Thu Nov  5 15:23:55 2009
+++ src/usr.sbin/ypserv/ypxfr/ypxfr.c	Thu Nov  5 21:26:25 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ypxfr.c,v 1.18 2009/11/05 15:23:55 chuck Exp $	*/
+/*	$NetBSD: ypxfr.c,v 1.19 2009/11/05 21:26:25 chuck Exp $	*/
 
 /*
  * Copyright (c) 1994 Mats O Jansson 
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: ypxfr.c,v 1.18 2009/11/05 15:23:55 chuck Exp $");
+__RCSID("$NetBSD: ypxfr.c,v 1.19 2009/11/05 21:26:25 chuck Exp $");
 #endif
 
 #include 
@@ -241,7 +241,7 @@
 		if (status > 0)
 			status = install_db(domain, map, temp_map);
 		else
-			status = unlink_db(domain, map, temp_map);
+			(void) unlink_db(domain, map, temp_map);
 	}
 	
  punt:
@@ -521,7 +521,10 @@
 	status = yp_match_host(client, domain, map,
 	k.dptr, k.dsize, &value, &vallen);
 
-	if (status == 0 && value) {
+	if (status == YPERR_KEY) {
+		/* this is an optional key/val, so it may not be present */
+		status = YPPUSH_SUCC;  
+	} else if (status == 0 && value) {
 		v.dptr = value;
 		v.dsize = vallen;
 		
@@ -555,7 +558,10 @@
 	status = yp_match_host(client, domain, map,
 	k.dptr, k.dsize, &value, &vallen);
 	
-	if (status == 0 && value != 0) {
+	if (status == YPERR_KEY) {
+		/* this is an optional key/val, so it may not be present */
+		status = YPPUSH_SUCC;  
+	} else if (status == 0 && value != 0) {
 		v.dptr = value;
 		v.dsize = vallen;
 		



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

2009-11-05 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov  5 21:11:53 UTC 2009

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

Log Message:
ncdcs needs to labeled 'binutils' not 'binutils=216', otherwise
it's present in the DESTDIR but missing from the flist on binutils
2.19 architectures (today, that is all of the architectures).


To generate a diff of this commit:
cvs rdiff -u -r1.840 -r1.841 src/distrib/sets/lists/base/mi

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.840 src/distrib/sets/lists/base/mi:1.841
--- src/distrib/sets/lists/base/mi:1.840	Wed Nov  4 19:02:28 2009
+++ src/distrib/sets/lists/base/mi	Thu Nov  5 21:11:53 2009
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.840 2009/11/04 19:02:28 dyoung Exp $
+# $NetBSD: mi,v 1.841 2009/11/05 21:11:53 dyoung Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -1160,7 +1160,7 @@
 ./usr/sbin/named-compilezone			base-bind-bin
 ./usr/sbin/named.reloadbase-obsolete		obsolete
 ./usr/sbin/named.restart			base-obsolete		obsolete
-./usr/sbin/ncdcsbase-sysutil-root	binutils=216
+./usr/sbin/ncdcsbase-sysutil-root	binutils
 ./usr/sbin/ndbootdbase-bootserver-bin
 ./usr/sbin/ndc	base-obsolete		obsolete
 ./usr/sbin/ndp	base-netutil-bin	inet6



CVS commit: src/external/bsd/mdocml/dist

2009-11-05 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Nov  5 20:38:42 UTC 2009

Modified Files:
src/external/bsd/mdocml/dist: mdoc_action.c

Log Message:
Fix incorrect merge.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/mdocml/dist/mdoc_action.c

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

Modified files:

Index: src/external/bsd/mdocml/dist/mdoc_action.c
diff -u src/external/bsd/mdocml/dist/mdoc_action.c:1.3 src/external/bsd/mdocml/dist/mdoc_action.c:1.4
--- src/external/bsd/mdocml/dist/mdoc_action.c:1.3	Thu Nov  5 18:28:10 2009
+++ src/external/bsd/mdocml/dist/mdoc_action.c	Thu Nov  5 20:38:42 2009
@@ -205,7 +205,6 @@
 	MDOC__R,
 	MDOC__N,
 	MDOC__V,
-	MDOC__U,
 	MDOC__P,
 	MDOC__Q,
 	MDOC__D,



CVS commit: src/share/mk

2009-11-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Nov  5 20:06:29 UTC 2009

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

Log Message:
Switch everyone to binutils 2.19.


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

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.593 src/share/mk/bsd.own.mk:1.594
--- src/share/mk/bsd.own.mk:1.593	Wed Nov  4 17:02:19 2009
+++ src/share/mk/bsd.own.mk	Thu Nov  5 20:06:29 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.593 2009/11/04 17:02:19 skrll Exp $
+#	$NetBSD: bsd.own.mk,v 1.594 2009/11/05 20:06:29 skrll Exp $
 
 .if !defined(_BSD_OWN_MK_)
 _BSD_OWN_MK_=1
@@ -48,24 +48,8 @@
 # default to GDB6
 HAVE_GDB?=	6
 
-# default to binutils 2.16
-.if \
-${MACHINE_ARCH} == "alpha" || \
-${MACHINE_ARCH} == "armeb" || ${MACHINE_ARCH} == "arm" || \
-${MACHINE_ARCH} == "hppa" || \
-${MACHINE_ARCH} == "i386" || \
-${MACHINE_ARCH} == "m68k" || \
-${MACHINE_ARCH} == "mipseb" || ${MACHINE_ARCH} == "mipsel" || \
-${MACHINE_ARCH} == "powerpc" || \
-${MACHINE_ARCH} == "sh3eb" || ${MACHINE_ARCH} == "sh3el" || \
-${MACHINE_ARCH} == "sparc" || \
-${MACHINE_ARCH} == "sparc64" || \
-${MACHINE_ARCH} == "vax" || \
-${MACHINE_ARCH} == "x86_64"
+# default to binutils 2.19
 HAVE_BINUTILS?=	219
-.else
-HAVE_BINUTILS?=	216
-.endif
 
 CPPFLAG_ISYSTEM=	-isystem
 .if defined(HAVE_GCC)



CVS commit: src/sys/fs/puffs

2009-11-05 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Nov  5 19:42:44 UTC 2009

Modified Files:
src/sys/fs/puffs: puffs_msgif.c puffs_node.c puffs_sys.h puffs_vfsops.c
puffs_vnops.c

Log Message:
Kill suspend support.  It was never implemented correctly:
  * it depended on the biglock (in a very cruel way)
  * it was attached to userspace transactions rather than logical
fs operations

(If someone wants to revisit it some day, most of the stuff can be
reused from cvs history)


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/fs/puffs/puffs_msgif.c
cvs rdiff -u -r1.14 -r1.15 src/sys/fs/puffs/puffs_node.c
cvs rdiff -u -r1.71 -r1.72 src/sys/fs/puffs/puffs_sys.h
cvs rdiff -u -r1.82 -r1.83 src/sys/fs/puffs/puffs_vfsops.c
cvs rdiff -u -r1.137 -r1.138 src/sys/fs/puffs/puffs_vnops.c

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

Modified files:

Index: src/sys/fs/puffs/puffs_msgif.c
diff -u src/sys/fs/puffs/puffs_msgif.c:1.73 src/sys/fs/puffs/puffs_msgif.c:1.74
--- src/sys/fs/puffs/puffs_msgif.c:1.73	Wed Mar 18 10:22:42 2009
+++ src/sys/fs/puffs/puffs_msgif.c	Thu Nov  5 19:42:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_msgif.c,v 1.73 2009/03/18 10:22:42 cegger Exp $	*/
+/*	$NetBSD: puffs_msgif.c,v 1.74 2009/11/05 19:42:44 pooka Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,11 +30,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.73 2009/03/18 10:22:42 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.74 2009/11/05 19:42:44 pooka Exp $");
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -366,38 +365,7 @@
 		}
 	}
 
-	/*
-	 * test for suspension lock.
-	 *
-	 * Note that we *DO NOT* keep the lock, since that might block
-	 * lock acquiring PLUS it would give userlandia control over
-	 * the lock.  The operation queue enforces a strict ordering:
-	 * when the fs server gets in the op stream, it knows things
-	 * are in order.  The kernel locks can't guarantee that for
-	 * userspace, in any case.
-	 *
-	 * BUT: this presents a problem for ops which have a consistency
-	 * clause based on more than one operation.  Unfortunately such
-	 * operations (read, write) do not reliably work yet.
-	 *
-	 * Ya, Ya, it's wrong wong wrong, me be fixink this someday.
-	 *
-	 * XXX: and there is one more problem.  We sometimes need to
-	 * take a lazy lock in case the fs is suspending and we are
-	 * executing as the fs server context.  This might happen
-	 * e.g. in the case that the user server triggers a reclaim
-	 * in the kernel while the fs is suspending.  It's not a very
-	 * likely event, but it needs to be fixed some day.
-	 */
-
-	/*
-	 * MOREXXX: once PUFFS_WCACHEINFO is enabled, we can't take
-	 * the mutex here, since getpages() might be called locked.
-	 */
-	fstrans_start(mp, FSTRANS_NORMAL);
 	mutex_enter(&pmp->pmp_lock);
-	fstrans_done(mp);
-
 	if (pmp->pmp_status != PUFFSTAT_RUNNING) {
 		mutex_exit(&pmp->pmp_lock);
 		park->park_flags |= PARKFLAG_HASERROR;
@@ -432,7 +400,6 @@
 puffs_msg_wait(struct puffs_mount *pmp, struct puffs_msgpark *park)
 {
 	struct puffs_req *preq = park->park_preq; /* XXX: hmmm */
-	struct mount *mp = PMPTOMP(pmp);
 	int error = 0;
 	int rv;
 
@@ -504,20 +471,6 @@
 		mutex_exit(&park->park_mtx);
 	}
 
-	/*
-	 * retake the lock and release.  This makes sure (haha,
-	 * I'm humorous) that we don't process the same vnode in
-	 * multiple threads due to the locks hacks we have in
-	 * puffs_lock().  In reality this is well protected by
-	 * the biglock, but once that's gone, well, hopefully
-	 * this will be fixed for real.  (and when you read this
-	 * comment in 2017 and subsequently barf, my condolences ;).
-	 */
-	if (rv == 0 && !fstrans_is_owner(mp)) {
-		fstrans_start(mp, FSTRANS_NORMAL);
-		fstrans_done(mp);
-	}
-
  skipwait:
 	mutex_enter(&pmp->pmp_lock);
 	puffs_mp_release(pmp);
@@ -799,63 +752,6 @@
 	puffs_msgpark_release1(park, 2);
 }
 
-/*
- * helpers
- */
-static void
-dosuspendresume(void *arg)
-{
-	struct puffs_mount *pmp = arg;
-	struct mount *mp;
-	int rv;
-
-	mp = PMPTOMP(pmp);
-	/*
-	 * XXX?  does this really do any good or is it just
-	 * paranoid stupidity?  or stupid paranoia?
-	 */
-	if (mp->mnt_iflag & IMNT_UNMOUNT) {
-		printf("puffs dosuspendresume(): detected suspend on "
-		"unmounting fs\n");
-		goto out;
-	}
-
-	/* Do the dance.  Allow only one concurrent suspend */
-	rv = vfs_suspend(PMPTOMP(pmp), 1);
-	if (rv == 0)
-		vfs_resume(PMPTOMP(pmp));
-
- out:
-	mutex_enter(&pmp->pmp_lock);
-	KASSERT(pmp->pmp_suspend == 1);
-	pmp->pmp_suspend = 0;
-	puffs_mp_release(pmp);
-	mutex_exit(&pmp->pmp_lock);
-
-	kthread_exit(0);
-}
-
-static void
-puffsop_suspend(struct puffs_mount *pmp)
-{
-	int rv = 0;
-
-	mutex_enter(&pmp->pmp_lock);
-	if (pmp->pmp_suspend || pmp->pmp_status != PUFFSTAT_RUNNING) {
-		rv = EBUSY;
-	} else {
-		puffs_mp_reference(pmp);

CVS commit: src/usr.sbin/ypbind

2009-11-05 Thread Chuck Cranor
Module Name:src
Committed By:   chuck
Date:   Thu Nov  5 19:34:06 UTC 2009

Modified Files:
src/usr.sbin/ypbind: ypbind.c

Log Message:
in the case where ypbind is serving more than one domain (i.e.
not just the yp_get_default_domain() domain), we must remove
any old binding files from /var/yp/binding (BINDINGDIR) from
previous runs, or the non-yp_get_default_domain()'s will not
bind properly.   add a purge_bindingdir() function that basically
does "rm BINDINGDIR/*.[0-9]" at ypbind startup time.

example case of where this is an issue: bind a second (non-default)
domain.   ypbind will create and flock a /var/yp/binding/xxx.2
file for it.  stop and restart ypbind.  the old /var/yp/binding/xxx.2
file will remain from the previous run.   since it is not flock()'d
by the new instance of ypbind, libc functions like yp_master() will
fail without even bothering to talk to ypbind itself.   (and ypbind
is totally unaware of the old file...)


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/ypbind/ypbind.c

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

Modified files:

Index: src/usr.sbin/ypbind/ypbind.c
diff -u src/usr.sbin/ypbind/ypbind.c:1.58 src/usr.sbin/ypbind/ypbind.c:1.59
--- src/usr.sbin/ypbind/ypbind.c:1.58	Sun Jan 18 10:39:17 2009
+++ src/usr.sbin/ypbind/ypbind.c	Thu Nov  5 19:34:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ypbind.c,v 1.58 2009/01/18 10:39:17 lukem Exp $	*/
+/*	$NetBSD: ypbind.c,v 1.59 2009/11/05 19:34:06 chuck Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993 Theo de Raadt 
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef LINT
-__RCSID("$NetBSD: ypbind.c,v 1.58 2009/01/18 10:39:17 lukem Exp $");
+__RCSID("$NetBSD: ypbind.c,v 1.59 2009/11/05 19:34:06 chuck Exp $");
 #endif
 
 #include 
@@ -129,6 +129,7 @@
 static struct _dom_binding *makebinding(const char *);
 static int makelock(struct _dom_binding *);
 static void removelock(struct _dom_binding *);
+static int purge_bindingdir(char *);
 static void *ypbindproc_null_2(SVCXPRT *, void *);
 static void *ypbindproc_domain_2(SVCXPRT *, void *);
 static void *ypbindproc_setdom_2(SVCXPRT *, void *);
@@ -221,6 +222,49 @@
 	(void)unlink(path);
 }
 
+/*
+ * purge_bindingdir: remove old binding files (i.e. "rm BINDINGDIR/*.[0-9]")
+ *
+ * local YP functions [e.g. yp_master()] will fail without even talking
+ * to ypbind if there is a stale (non-flock'd) binding file present.
+ * we have to scan the entire BINDINGDIR for binding files, because
+ * ypbind may bind more than just the yp_get_default_domain() domain.
+ */
+static int
+purge_bindingdir(char *dirpath) {
+	DIR *dirp;
+	int unlinkedfiles, l;
+	struct dirent *dp;
+	char pathname[MAXPATHLEN];
+
+	if ((dirp = opendir(dirpath)) == NULL)
+		return(-1);   /* at this point, shouldn't ever happen */
+
+	do {
+		unlinkedfiles = 0;
+		while ((dp = readdir(dirp)) != NULL) {
+			l = dp->d_namlen;
+			/* 'rm *.[0-9]' */
+			if (l > 2 && dp->d_name[l-2] == '.' &&
+			dp->d_name[l-1] >= '0' && dp->d_name[l-1] <= '9') {
+(void)snprintf(pathname, sizeof(pathname), 
+	"%s/%s", dirpath, dp->d_name);
+if (unlink(pathname) < 0 && errno != ENOENT)
+	return(-1);
+unlinkedfiles++;
+			}
+		}
+
+		/* rescan dir if we removed it */
+		if (unlinkedfiles)
+			rewinddir(dirp);
+
+	} while (unlinkedfiles);
+
+	closedir(dirp);
+	return(0);
+}
+
 static void *
 /*ARGSUSED*/
 ypbindproc_null_2(SVCXPRT *transp, void *argp)
@@ -507,8 +551,6 @@
 	/* initialise syslog */
 	openlog("ypbind", LOG_PERROR | LOG_PID, LOG_DAEMON);
 
-	/* blow away everything in BINDINGDIR */
-
 	lockfd = open(_PATH_YPBIND_LOCK, O_CREAT|O_SHLOCK|O_RDWR|O_TRUNC, 0644);
 	if (lockfd == -1)
 		err(1, "Cannot create %s", _PATH_YPBIND_LOCK);
@@ -559,6 +601,10 @@
 	if (_yp_invalid_domain(domainname))
 		errx(1, "bad domainname: %s", domainname);
 
+	/* blow away old bindings in BINDINGDIR */
+	if (purge_bindingdir(BINDINGDIR) < 0)
+		errx(1, "unable to purge old bindings from %s", BINDINGDIR);
+
 	/* build initial domain binding, make it "unsuccessful" */
 	ypbindlist = makebinding(domainname);
 	ypbindlist->dom_vers = YPVERS;



CVS commit: src/sys/fs/puffs

2009-11-05 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Nov  5 19:22:58 UTC 2009

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

Log Message:
Reinstante PNODE_DYING.  vmlocking had a brief hiatus when it was not
a valid optimization, but that's long gone and once VOP_INACTIVE is
called and the file server says that the vnode is going to be recycled,
it really is going to be recycled extra references gained or not.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/fs/puffs/puffs_sys.h
cvs rdiff -u -r1.136 -r1.137 src/sys/fs/puffs/puffs_vnops.c

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

Modified files:

Index: src/sys/fs/puffs/puffs_sys.h
diff -u src/sys/fs/puffs/puffs_sys.h:1.70 src/sys/fs/puffs/puffs_sys.h:1.71
--- src/sys/fs/puffs/puffs_sys.h:1.70	Mon Jan 28 21:06:37 2008
+++ src/sys/fs/puffs/puffs_sys.h	Thu Nov  5 19:22:57 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_sys.h,v 1.70 2008/01/28 21:06:37 pooka Exp $	*/
+/*	$NetBSD: puffs_sys.h,v 1.71 2009/11/05 19:22:57 pooka Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006  Antti Kantee.  All Rights Reserved.
@@ -152,6 +152,7 @@
 
 
 #define PNODE_NOREFS	0x01	/* no backend reference			*/
+#define PNODE_DYING	0x02	/* NOREFS + inactive			*/
 #define PNODE_SUSPEND	0x04	/* issue all operations as FAF		*/
 #define PNODE_DOINACT	0x08	/* if inactive-on-demand, call inactive */
 

Index: src/sys/fs/puffs/puffs_vnops.c
diff -u src/sys/fs/puffs/puffs_vnops.c:1.136 src/sys/fs/puffs/puffs_vnops.c:1.137
--- src/sys/fs/puffs/puffs_vnops.c:1.136	Sat Oct 17 23:16:05 2009
+++ src/sys/fs/puffs/puffs_vnops.c	Thu Nov  5 19:22:57 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_vnops.c,v 1.136 2009/10/17 23:16:05 pooka Exp $	*/
+/*	$NetBSD: puffs_vnops.c,v 1.137 2009/11/05 19:22:57 pooka Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.136 2009/10/17 23:16:05 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.137 2009/11/05 19:22:57 pooka Exp $");
 
 #include 
 #include 
@@ -1028,7 +1028,10 @@
 	 * file server thinks it's gone?  then don't be afraid care,
 	 * node's life was already all it would ever be
 	 */
-	*ap->a_recycle = ((pnode->pn_stat & PNODE_NOREFS) != 0);
+	if (pnode->pn_stat & PNODE_NOREFS) {
+		pnode->pn_stat |= PNODE_DYING;
+		*ap->a_recycle = true;
+	}
 
 	VOP_UNLOCK(vp, 0);
 
@@ -1295,7 +1298,8 @@
 	pn = VPTOPP(vp);
 
 	/* flush out information from our metacache, see vop_setattr */
-	if (pn->pn_stat & PNODE_METACACHE_MASK) {
+	if (pn->pn_stat & PNODE_METACACHE_MASK
+	&& (pn->pn_stat & PNODE_DYING) == 0) {
 		vattr_null(&va);
 		error = VOP_SETATTR(vp, &va, FSCRED); 
 		if (error)
@@ -1320,7 +1324,7 @@
 	 * has references neither in the kernel or the fs server.
 	 * Otherwise we continue to issue fsync() forward.
 	 */
-	if (!EXISTSOP(pmp, FSYNC))
+	if (!EXISTSOP(pmp, FSYNC) || (pn->pn_stat & PNODE_DYING))
 		return 0;
 
 	dofaf = (ap->a_flags & FSYNC_WAIT) == 0 || ap->a_flags == FSYNC_LAZY;
@@ -2168,6 +2172,16 @@
 	|| (BUF_ISWRITE(bp) && !EXISTSOP(pmp, WRITE)))
 		ERROUT(EOPNOTSUPP);
 
+	/*
+	 * Short-circuit optimization: don't flush buffer in between
+	 * VOP_INACTIVE and VOP_RECLAIM in case the node has no references.
+	 */
+	if (pn->pn_stat & PNODE_DYING) {
+		KASSERT(BUF_ISWRITE(bp));
+		bp->b_resid = 0;
+		goto out;
+	}
+
 #ifdef DIAGNOSTIC
 	if (bp->b_bcount > pmp->pmp_msg_maxsize - PUFFS_MSGSTRUCT_MAX)
 		panic("puffs_strategy: wildly inappropriate buf bcount %d",



CVS commit: src/sys/compat

2009-11-05 Thread Rafal Boni
Module Name:src
Committed By:   rafal
Date:   Thu Nov  5 18:39:38 UTC 2009

Modified Files:
src/sys/compat/svr4: svr4_misc.c
src/sys/compat/svr4_32: svr4_32_misc.c

Log Message:
Fix fallout from do_sys_wait changes (hi, rmind!)


To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.148 src/sys/compat/svr4/svr4_misc.c
cvs rdiff -u -r1.66 -r1.67 src/sys/compat/svr4_32/svr4_32_misc.c

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

Modified files:

Index: src/sys/compat/svr4/svr4_misc.c
diff -u src/sys/compat/svr4/svr4_misc.c:1.147 src/sys/compat/svr4/svr4_misc.c:1.148
--- src/sys/compat/svr4/svr4_misc.c:1.147	Wed Nov  4 21:23:03 2009
+++ src/sys/compat/svr4/svr4_misc.c	Thu Nov  5 18:39:38 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_misc.c,v 1.147 2009/11/04 21:23:03 rmind Exp $	 */
+/*	$NetBSD: svr4_misc.c,v 1.148 2009/11/05 18:39:38 rafal Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_misc.c,v 1.147 2009/11/04 21:23:03 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_misc.c,v 1.148 2009/11/05 18:39:38 rafal Exp $");
 
 #include 
 #include 
@@ -999,7 +999,6 @@
 {
 	int options, status;
 	int error;
-	int was_zombie;
 	struct rusage ru;
 	svr4_siginfo_t i;
 	int id = SCARG(uap, id);
@@ -1037,8 +1036,7 @@
 	 SCARG(uap, grp), id,
 		 SCARG(uap, info), SCARG(uap, options)));
 
-	error = do_sys_wait(l, &id, &status, options, &ru,
-	&was_zombie);
+	error = do_sys_wait(&id, &status, options, &ru);
 
 	retval[0] = id;
 	if (error != 0)

Index: src/sys/compat/svr4_32/svr4_32_misc.c
diff -u src/sys/compat/svr4_32/svr4_32_misc.c:1.66 src/sys/compat/svr4_32/svr4_32_misc.c:1.67
--- src/sys/compat/svr4_32/svr4_32_misc.c:1.66	Wed Nov  4 21:23:03 2009
+++ src/sys/compat/svr4_32/svr4_32_misc.c	Thu Nov  5 18:39:38 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_32_misc.c,v 1.66 2009/11/04 21:23:03 rmind Exp $	 */
+/*	$NetBSD: svr4_32_misc.c,v 1.67 2009/11/05 18:39:38 rafal Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_32_misc.c,v 1.66 2009/11/04 21:23:03 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_32_misc.c,v 1.67 2009/11/05 18:39:38 rafal Exp $");
 
 #include 
 #include 
@@ -1006,7 +1006,7 @@
 int
 svr4_32_sys_waitsys(struct lwp *l, const struct svr4_32_sys_waitsys_args *uap, register_t *retval)
 {
-	int options, error, status, was_zombie;;
+	int options, error, status;
 	struct rusage ru;
 	int id = SCARG(uap, id);
 
@@ -1041,8 +1041,7 @@
 	if (SCARG(uap, options) & (SVR4_WSTOPPED|SVR4_WCONTINUED))
 		options |= WUNTRACED;
 
-	error = do_sys_wait(l, &id, &status, options, &ru,
-	&was_zombie);
+	error = do_sys_wait(&id, &status, options, &ru);
 
 	retval[0] = id;
 	if (error != 0)



CVS commit: src/external/bsd/pkg_install/dist

2009-11-05 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Nov  5 18:39:18 UTC 2009

Update of /cvsroot/src/external/bsd/pkg_install/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv25874

Log Message:
pkg_install-20091115:
Completely ignore @src in pkg_create. Silently ignore the -L option.
The combination of -I and -p are used by pkgsrc for the same result.

Do not overwrite a string with itself using snprintf. This breaks
setting the pkgdb directory internally on Linux. Explicitly check
if the string is the same and otherwise just use xstrdup.

Add support to query arbitrary variables with pkg_admin config-var.

Status:

Vendor Tag: PKGSRC
Release Tags:   pkg_install-20091115

U src/external/bsd/pkg_install/dist/add/add.h
U src/external/bsd/pkg_install/dist/add/main.c
U src/external/bsd/pkg_install/dist/add/perform.c
U src/external/bsd/pkg_install/dist/add/pkg_add.1
U src/external/bsd/pkg_install/dist/admin/README
U src/external/bsd/pkg_install/dist/admin/admin.h
U src/external/bsd/pkg_install/dist/admin/audit-packages.sh.in
U src/external/bsd/pkg_install/dist/admin/audit.c
U src/external/bsd/pkg_install/dist/admin/check.c
U src/external/bsd/pkg_install/dist/admin/download-vulnerability-list.sh.in
U src/external/bsd/pkg_install/dist/admin/main.c
U src/external/bsd/pkg_install/dist/admin/pkg_admin.1
U src/external/bsd/pkg_install/dist/bpm/bpm.1
U src/external/bsd/pkg_install/dist/bpm/bpm.sh.in
U src/external/bsd/pkg_install/dist/create/build.c
U src/external/bsd/pkg_install/dist/create/create.h
U src/external/bsd/pkg_install/dist/create/main.c
U src/external/bsd/pkg_install/dist/create/perform.c
U src/external/bsd/pkg_install/dist/create/pkg_create.1
U src/external/bsd/pkg_install/dist/create/pl.c
U src/external/bsd/pkg_install/dist/create/util.c
U src/external/bsd/pkg_install/dist/delete/pkg_delete.1
U src/external/bsd/pkg_install/dist/delete/pkg_delete.c
U src/external/bsd/pkg_install/dist/info/info.h
U src/external/bsd/pkg_install/dist/info/main.c
U src/external/bsd/pkg_install/dist/info/perform.c
U src/external/bsd/pkg_install/dist/info/pkg_info.1
U src/external/bsd/pkg_install/dist/info/show.c
U src/external/bsd/pkg_install/dist/lib/automatic.c
U src/external/bsd/pkg_install/dist/lib/config.h.in
U src/external/bsd/pkg_install/dist/lib/conflicts.c
U src/external/bsd/pkg_install/dist/lib/decompress.c
U src/external/bsd/pkg_install/dist/lib/defs.h
U src/external/bsd/pkg_install/dist/lib/dewey.c
U src/external/bsd/pkg_install/dist/lib/dewey.h
U src/external/bsd/pkg_install/dist/lib/fexec.c
U src/external/bsd/pkg_install/dist/lib/file.c
U src/external/bsd/pkg_install/dist/lib/global.c
U src/external/bsd/pkg_install/dist/lib/gpgsig.c
U src/external/bsd/pkg_install/dist/lib/iterate.c
U src/external/bsd/pkg_install/dist/lib/lib.h
U src/external/bsd/pkg_install/dist/lib/license.c
U src/external/bsd/pkg_install/dist/lib/lpkg.c
U src/external/bsd/pkg_install/dist/lib/opattern.c
U src/external/bsd/pkg_install/dist/lib/parse-config.c
U src/external/bsd/pkg_install/dist/lib/pkcs7.c
U src/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in
U src/external/bsd/pkg_install/dist/lib/pkg_io.c
U src/external/bsd/pkg_install/dist/lib/pkg_signature.c
U src/external/bsd/pkg_install/dist/lib/pkg_summary.5
U src/external/bsd/pkg_install/dist/lib/pkgdb.c
U src/external/bsd/pkg_install/dist/lib/pkgsrc.7
U src/external/bsd/pkg_install/dist/lib/plist.c
U src/external/bsd/pkg_install/dist/lib/remove.c
U src/external/bsd/pkg_install/dist/lib/str.c
U src/external/bsd/pkg_install/dist/lib/var.c
U src/external/bsd/pkg_install/dist/lib/version.c
U src/external/bsd/pkg_install/dist/lib/version.h
U src/external/bsd/pkg_install/dist/lib/vulnerabilities-file.c
U src/external/bsd/pkg_install/dist/lib/xwrapper.c
U src/external/bsd/pkg_install/dist/x509/pkgsrc.cnf
U src/external/bsd/pkg_install/dist/x509/pkgsrc.sh
U src/external/bsd/pkg_install/dist/x509/signing.txt

No conflicts created by this import