From owner-svn-src-head@FreeBSD.ORG  Sun Feb  1 00:50:46 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BA3F510656C9;
	Sun,  1 Feb 2009 00:50:46 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A29B88FC12;
	Sun,  1 Feb 2009 00:50:46 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n110okM5038329;
	Sun, 1 Feb 2009 00:50:46 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n110okI0038328;
	Sun, 1 Feb 2009 00:50:46 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200902010050.n110okI0038328@svn.freebsd.org>
From: "David E. O'Brien" <obrien@FreeBSD.org>
Date: Sun, 1 Feb 2009 00:50:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r187969 - head/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 01 Feb 2009 00:50:48 -0000

Author: obrien
Date: Sun Feb  1 00:50:46 2009
New Revision: 187969
URL: http://svn.freebsd.org/changeset/base/187969

Log:
  Also un-split _PATH_STDPATH for grepability.
  While I'm here, fix other style bugs reported to me.

Modified:
  head/include/paths.h

Modified: head/include/paths.h
==============================================================================
--- head/include/paths.h	Sat Jan 31 23:17:33 2009	(r187968)
+++ head/include/paths.h	Sun Feb  1 00:50:46 2009	(r187969)
@@ -42,10 +42,9 @@
 /* Default search path. */
 #define	_PATH_DEFPATH	"/usr/bin:/bin"
 /* All standard utilities path. */
-#define	_PATH_STDPATH \
-	"/usr/bin:/bin:/usr/sbin:/sbin:"
-/* Locate system binaries */
-#define _PATH_SYSPATH	"/sbin:/usr/sbin"
+#define	_PATH_STDPATH	"/usr/bin:/bin:/usr/sbin:/sbin:"
+/* Locate system binaries. */
+#define	_PATH_SYSPATH	"/sbin:/usr/sbin"
 
 #define	_PATH_AUTHCONF	"/etc/auth.conf"
 #define	_PATH_BSHELL	"/bin/sh"

From owner-svn-src-head@FreeBSD.ORG  Sun Feb  1 00:51:27 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4D52410656EE;
	Sun,  1 Feb 2009 00:51:27 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 38A478FC1E;
	Sun,  1 Feb 2009 00:51:27 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n110pRhU038420;
	Sun, 1 Feb 2009 00:51:27 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n110pPJ5038376;
	Sun, 1 Feb 2009 00:51:25 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200902010051.n110pPJ5038376@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Sun, 1 Feb 2009 00:51:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r187970 - in head/sys/dev/usb2: controller core
	ethernet input misc serial sound storage wlan
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 01 Feb 2009 00:51:28 -0000

Author: thompsa
Date: Sun Feb  1 00:51:25 2009
New Revision: 187970
URL: http://svn.freebsd.org/changeset/base/187970

Log:
  Remove check for null softc in attach, it can never happen.

Modified:
  head/sys/dev/usb2/controller/at91dci_atmelarm.c
  head/sys/dev/usb2/controller/ehci2_pci.c
  head/sys/dev/usb2/controller/musb2_otg_atmelarm.c
  head/sys/dev/usb2/controller/ohci2_atmelarm.c
  head/sys/dev/usb2/controller/ohci2_pci.c
  head/sys/dev/usb2/controller/uhci2_pci.c
  head/sys/dev/usb2/controller/uss820dci_atmelarm.c
  head/sys/dev/usb2/core/usb2_compat_linux.c
  head/sys/dev/usb2/core/usb2_hub.c
  head/sys/dev/usb2/ethernet/if_aue2.c
  head/sys/dev/usb2/ethernet/if_axe2.c
  head/sys/dev/usb2/ethernet/if_cdce2.c
  head/sys/dev/usb2/ethernet/if_cue2.c
  head/sys/dev/usb2/ethernet/if_kue2.c
  head/sys/dev/usb2/ethernet/if_rue2.c
  head/sys/dev/usb2/ethernet/if_udav2.c
  head/sys/dev/usb2/input/uhid2.c
  head/sys/dev/usb2/input/ukbd2.c
  head/sys/dev/usb2/misc/udbp2.c
  head/sys/dev/usb2/misc/ufm2.c
  head/sys/dev/usb2/serial/u3g2.c
  head/sys/dev/usb2/serial/uark2.c
  head/sys/dev/usb2/serial/ubsa2.c
  head/sys/dev/usb2/serial/ubser2.c
  head/sys/dev/usb2/serial/uchcom2.c
  head/sys/dev/usb2/serial/ucycom2.c
  head/sys/dev/usb2/serial/ufoma2.c
  head/sys/dev/usb2/serial/uftdi2.c
  head/sys/dev/usb2/serial/ugensa2.c
  head/sys/dev/usb2/serial/uipaq2.c
  head/sys/dev/usb2/serial/umct2.c
  head/sys/dev/usb2/serial/umodem2.c
  head/sys/dev/usb2/serial/umoscom2.c
  head/sys/dev/usb2/serial/uplcom2.c
  head/sys/dev/usb2/serial/uvisor2.c
  head/sys/dev/usb2/serial/uvscom2.c
  head/sys/dev/usb2/sound/uaudio2.c
  head/sys/dev/usb2/storage/ata-usb2.c
  head/sys/dev/usb2/storage/umass2.c
  head/sys/dev/usb2/storage/urio2.c
  head/sys/dev/usb2/storage/ustorage2_fs.c
  head/sys/dev/usb2/wlan/if_rum2.c
  head/sys/dev/usb2/wlan/if_ural2.c
  head/sys/dev/usb2/wlan/if_zyd2.c

Modified: head/sys/dev/usb2/controller/at91dci_atmelarm.c
==============================================================================
--- head/sys/dev/usb2/controller/at91dci_atmelarm.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/controller/at91dci_atmelarm.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -131,9 +131,6 @@ at91_udp_attach(device_t dev)
 	int err;
 	int rid;
 
-	if (sc == NULL) {
-		return (ENXIO);
-	}
 	/* setup AT9100 USB device controller interface softc */
 
 	sc->sc_dci.sc_clocks_on = &at91_udp_clocks_on;

Modified: head/sys/dev/usb2/controller/ehci2_pci.c
==============================================================================
--- head/sys/dev/usb2/controller/ehci2_pci.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/controller/ehci2_pci.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -227,10 +227,6 @@ ehci_pci_attach(device_t self)
 	int err;
 	int rid;
 
-	if (sc == NULL) {
-		device_printf(self, "Could not allocate sc\n");
-		return (ENXIO);
-	}
 	/* initialise some bus fields */
 	sc->sc_bus.parent = self;
 	sc->sc_bus.devices = sc->sc_devices;

Modified: head/sys/dev/usb2/controller/musb2_otg_atmelarm.c
==============================================================================
--- head/sys/dev/usb2/controller/musb2_otg_atmelarm.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/controller/musb2_otg_atmelarm.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -90,11 +90,7 @@ musbotg_attach(device_t dev)
 	int err;
 	int rid;
 
-	if (sc == NULL) {
-		return (ENXIO);
-	}
 	/* setup MUSB OTG USB controller interface softc */
-
 	sc->sc_otg.sc_clocks_on = &musbotg_clocks_on;
 	sc->sc_otg.sc_clocks_off = &musbotg_clocks_off;
 	sc->sc_otg.sc_clocks_arg = sc;

Modified: head/sys/dev/usb2/controller/ohci2_atmelarm.c
==============================================================================
--- head/sys/dev/usb2/controller/ohci2_atmelarm.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/controller/ohci2_atmelarm.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -69,9 +69,6 @@ ohci_atmelarm_attach(device_t dev)
 	int err;
 	int rid;
 
-	if (sc == NULL) {
-		return (ENXIO);
-	}
 	/* initialise some bus fields */
 	sc->sc_ohci.sc_bus.parent = dev;
 	sc->sc_ohci.sc_bus.devices = sc->sc_ohci.sc_devices;

Modified: head/sys/dev/usb2/controller/ohci2_pci.c
==============================================================================
--- head/sys/dev/usb2/controller/ohci2_pci.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/controller/ohci2_pci.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -195,10 +195,6 @@ ohci_pci_attach(device_t self)
 	int rid;
 	int err;
 
-	if (sc == NULL) {
-		device_printf(self, "Could not allocate sc\n");
-		return (ENXIO);
-	}
 	/* initialise some bus fields */
 	sc->sc_bus.parent = self;
 	sc->sc_bus.devices = sc->sc_devices;

Modified: head/sys/dev/usb2/controller/uhci2_pci.c
==============================================================================
--- head/sys/dev/usb2/controller/uhci2_pci.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/controller/uhci2_pci.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -246,10 +246,6 @@ uhci_pci_attach(device_t self)
 	int rid;
 	int err;
 
-	if (sc == NULL) {
-		device_printf(self, "Could not allocate sc\n");
-		return (ENXIO);
-	}
 	/* initialise some bus fields */
 	sc->sc_bus.parent = self;
 	sc->sc_bus.devices = sc->sc_devices;

Modified: head/sys/dev/usb2/controller/uss820dci_atmelarm.c
==============================================================================
--- head/sys/dev/usb2/controller/uss820dci_atmelarm.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/controller/uss820dci_atmelarm.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -134,10 +134,6 @@ uss820_atmelarm_attach(device_t dev)
 	int err;
 	int rid;
 
-	if (sc == NULL) {
-		return (ENXIO);
-	}
-
 	/* initialise some bus fields */
 	sc->sc_bus.parent = dev;
 	sc->sc_bus.devices = sc->sc_devices;

Modified: head/sys/dev/usb2/core/usb2_compat_linux.c
==============================================================================
--- head/sys/dev/usb2/core/usb2_compat_linux.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/core/usb2_compat_linux.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -246,9 +246,6 @@ usb_linux_attach(device_t dev)
 	struct usb_device *p_dev;
 	const struct usb_device_id *id = NULL;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	mtx_lock(&Giant);
 	LIST_FOREACH(udrv, &usb_linux_driver_list, linux_driver_list) {
 		id = usb_linux_lookup_id(udrv->id_table, uaa);

Modified: head/sys/dev/usb2/core/usb2_hub.c
==============================================================================
--- head/sys/dev/usb2/core/usb2_hub.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/core/usb2_hub.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -649,9 +649,6 @@ uhub_attach(device_t dev)
 	uint8_t iface_index;
 	usb2_error_t err;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	sc->sc_udev = udev;
 	sc->sc_dev = dev;
 

Modified: head/sys/dev/usb2/ethernet/if_aue2.c
==============================================================================
--- head/sys/dev/usb2/ethernet/if_aue2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/ethernet/if_aue2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -752,9 +752,6 @@ aue_attach(device_t dev)
 	int32_t error;
 	uint8_t iface_index;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	sc->sc_udev = uaa->device;
 	sc->sc_dev = dev;
 	sc->sc_unit = device_get_unit(dev);

Modified: head/sys/dev/usb2/ethernet/if_axe2.c
==============================================================================
--- head/sys/dev/usb2/ethernet/if_axe2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/ethernet/if_axe2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -629,9 +629,6 @@ axe_attach(device_t dev)
 	int32_t error;
 	uint8_t iface_index;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	sc->sc_udev = uaa->device;
 	sc->sc_dev = dev;
 	sc->sc_unit = device_get_unit(dev);

Modified: head/sys/dev/usb2/ethernet/if_cdce2.c
==============================================================================
--- head/sys/dev/usb2/ethernet/if_cdce2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/ethernet/if_cdce2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -231,9 +231,6 @@ cdce_attach(device_t dev)
 	uint8_t eaddr[ETHER_ADDR_LEN];
 	char eaddr_str[5 * ETHER_ADDR_LEN];	/* approx */
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	sc->sc_udev = uaa->device;
 	sc->sc_dev = dev;
 	sc->sc_unit = device_get_unit(dev);

Modified: head/sys/dev/usb2/ethernet/if_cue2.c
==============================================================================
--- head/sys/dev/usb2/ethernet/if_cue2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/ethernet/if_cue2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -397,9 +397,6 @@ cue_attach(device_t dev)
 	uint8_t iface_index;
 	int32_t error;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	sc->sc_udev = uaa->device;
 	sc->sc_dev = dev;
 	sc->sc_unit = device_get_unit(dev);

Modified: head/sys/dev/usb2/ethernet/if_kue2.c
==============================================================================
--- head/sys/dev/usb2/ethernet/if_kue2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/ethernet/if_kue2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -459,9 +459,6 @@ kue_attach(device_t dev)
 	int32_t error;
 	uint8_t iface_index;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	sc->sc_udev = uaa->device;
 	sc->sc_dev = dev;
 	sc->sc_unit = device_get_unit(dev);

Modified: head/sys/dev/usb2/ethernet/if_rue2.c
==============================================================================
--- head/sys/dev/usb2/ethernet/if_rue2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/ethernet/if_rue2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -637,9 +637,6 @@ rue_attach(device_t dev)
 	int32_t error;
 	uint8_t iface_index;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	sc->sc_udev = uaa->device;
 	sc->sc_dev = dev;
 	sc->sc_unit = device_get_unit(dev);

Modified: head/sys/dev/usb2/ethernet/if_udav2.c
==============================================================================
--- head/sys/dev/usb2/ethernet/if_udav2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/ethernet/if_udav2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -267,9 +267,6 @@ udav_attach(device_t dev)
 	int32_t error;
 	uint8_t iface_index;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	sc->sc_udev = uaa->device;
 	sc->sc_dev = dev;
 	sc->sc_unit = device_get_unit(dev);

Modified: head/sys/dev/usb2/input/uhid2.c
==============================================================================
--- head/sys/dev/usb2/input/uhid2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/input/uhid2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -660,9 +660,6 @@ uhid_attach(device_t dev)
 
 	DPRINTFN(10, "sc=%p\n", sc);
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	device_set_usb2_desc(dev);
 
 	mtx_init(&sc->sc_mtx, "uhid lock", NULL, MTX_DEF | MTX_RECURSE);

Modified: head/sys/dev/usb2/input/ukbd2.c
==============================================================================
--- head/sys/dev/usb2/input/ukbd2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/input/ukbd2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -625,9 +625,6 @@ ukbd_attach(device_t dev)
 	usb2_error_t err;
 	uint16_t n;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	mtx_assert(&Giant, MA_OWNED);
 
 	kbd_init_struct(kbd, UKBD_DRIVER_NAME, KB_OTHER, unit, 0, 0, 0);

Modified: head/sys/dev/usb2/misc/udbp2.c
==============================================================================
--- head/sys/dev/usb2/misc/udbp2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/misc/udbp2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -320,9 +320,6 @@ udbp_attach(device_t dev)
 	struct udbp_softc *sc = device_get_softc(dev);
 	int error;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	device_set_usb2_desc(dev);
 
 	snprintf(sc->sc_name, sizeof(sc->sc_name),
@@ -476,9 +473,6 @@ udbp_bulk_read_complete(node_p node, hoo
 	struct mbuf *m;
 	int error;
 
-	if (sc == NULL) {
-		return;
-	}
 	mtx_lock(&sc->sc_mtx);
 
 	m = sc->sc_bulk_in_buffer;

Modified: head/sys/dev/usb2/misc/ufm2.c
==============================================================================
--- head/sys/dev/usb2/misc/ufm2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/misc/ufm2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -130,9 +130,6 @@ ufm_attach(device_t dev)
 	struct ufm_softc *sc = device_get_softc(dev);
 	int error;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	sc->sc_udev = uaa->device;
 	sc->sc_unit = device_get_unit(dev);
 

Modified: head/sys/dev/usb2/serial/u3g2.c
==============================================================================
--- head/sys/dev/usb2/serial/u3g2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/serial/u3g2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -391,9 +391,6 @@ u3g_attach(device_t dev)
 
 	DPRINTF("sc=%p\n", sc);
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	/* copy in USB config */
 	for (n = 0; n != U3G_N_TRANSFER; n++) 
 		u3g_config_tmp[n] = u3g_config[n];

Modified: head/sys/dev/usb2/serial/uark2.c
==============================================================================
--- head/sys/dev/usb2/serial/uark2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/serial/uark2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -209,9 +209,6 @@ uark_attach(device_t dev)
 	int32_t error;
 	uint8_t iface_index;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	device_set_usb2_desc(dev);
 
 	sc->sc_udev = uaa->device;

Modified: head/sys/dev/usb2/serial/ubsa2.c
==============================================================================
--- head/sys/dev/usb2/serial/ubsa2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/serial/ubsa2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -329,9 +329,6 @@ ubsa_attach(device_t dev)
 
 	DPRINTF("sc=%p\n", sc);
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	device_set_usb2_desc(dev);
 
 	sc->sc_udev = uaa->device;

Modified: head/sys/dev/usb2/serial/ubser2.c
==============================================================================
--- head/sys/dev/usb2/serial/ubser2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/serial/ubser2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -256,9 +256,6 @@ ubser_attach(device_t dev)
 	uint8_t n;
 	int error;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	device_set_usb2_desc(dev);
 
 	snprintf(sc->sc_name, sizeof(sc->sc_name), "%s",

Modified: head/sys/dev/usb2/serial/uchcom2.c
==============================================================================
--- head/sys/dev/usb2/serial/uchcom2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/serial/uchcom2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -342,9 +342,6 @@ uchcom_attach(device_t dev)
 
 	DPRINTFN(11, "\n");
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	device_set_usb2_desc(dev);
 
 	sc->sc_udev = uaa->device;

Modified: head/sys/dev/usb2/serial/ucycom2.c
==============================================================================
--- head/sys/dev/usb2/serial/ucycom2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/serial/ucycom2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -216,9 +216,6 @@ ucycom_attach(device_t dev)
 	uint16_t urd_len;
 	uint8_t iface_index;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	sc->sc_udev = uaa->device;
 
 	device_set_usb2_desc(dev);

Modified: head/sys/dev/usb2/serial/ufoma2.c
==============================================================================
--- head/sys/dev/usb2/serial/ufoma2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/serial/ufoma2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -407,9 +407,6 @@ ufoma_attach(device_t dev)
 	uint8_t elements;
 	int32_t error;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	sc->sc_udev = uaa->device;
 	sc->sc_dev = dev;
 	sc->sc_unit = device_get_unit(dev);

Modified: head/sys/dev/usb2/serial/uftdi2.c
==============================================================================
--- head/sys/dev/usb2/serial/uftdi2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/serial/uftdi2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -286,9 +286,6 @@ uftdi_attach(device_t dev)
 	struct uftdi_softc *sc = device_get_softc(dev);
 	int error;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	sc->sc_udev = uaa->device;
 	sc->sc_dev = dev;
 	sc->sc_unit = device_get_unit(dev);

Modified: head/sys/dev/usb2/serial/ugensa2.c
==============================================================================
--- head/sys/dev/usb2/serial/ugensa2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/serial/ugensa2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -215,9 +215,6 @@ ugensa_attach(device_t dev)
 	uint8_t iface_index;
 	int x, cnt;
 
-	if (sc == NULL)
-		return (ENOMEM);
-
 	device_set_usb2_desc(dev);
 	mtx_init(&sc->sc_mtx, "ugensa", NULL, MTX_DEF);
 

Modified: head/sys/dev/usb2/serial/uipaq2.c
==============================================================================
--- head/sys/dev/usb2/serial/uipaq2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/serial/uipaq2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -1129,9 +1129,6 @@ uipaq_attach(device_t dev)
 	uint8_t iface_index;
 	uint8_t i;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	sc->sc_udev = uaa->device;
 
 	device_set_usb2_desc(dev);

Modified: head/sys/dev/usb2/serial/umct2.c
==============================================================================
--- head/sys/dev/usb2/serial/umct2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/serial/umct2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -273,9 +273,6 @@ umct_attach(device_t dev)
 	uint16_t maxp;
 	uint8_t iface_index;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	sc->sc_udev = uaa->device;
 	sc->sc_unit = device_get_unit(dev);
 

Modified: head/sys/dev/usb2/serial/umodem2.c
==============================================================================
--- head/sys/dev/usb2/serial/umodem2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/serial/umodem2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -322,9 +322,6 @@ umodem_attach(device_t dev)
 	uint8_t i;
 	int error;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	device_set_usb2_desc(dev);
 
 	sc->sc_ctrl_iface_no = uaa->info.bIfaceNum;

Modified: head/sys/dev/usb2/serial/umoscom2.c
==============================================================================
--- head/sys/dev/usb2/serial/umoscom2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/serial/umoscom2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -335,9 +335,6 @@ umoscom_attach(device_t dev)
 	int error;
 	uint8_t iface_index;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	sc->sc_udev = uaa->device;
 	sc->sc_mcr = 0x08;		/* enable interrupts */
 

Modified: head/sys/dev/usb2/serial/uplcom2.c
==============================================================================
--- head/sys/dev/usb2/serial/uplcom2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/serial/uplcom2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -371,9 +371,6 @@ uplcom_attach(device_t dev)
 
 	DPRINTFN(11, "\n");
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	device_set_usb2_desc(dev);
 
 	DPRINTF("sc = %p\n", sc);

Modified: head/sys/dev/usb2/serial/uvisor2.c
==============================================================================
--- head/sys/dev/usb2/serial/uvisor2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/serial/uvisor2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -321,9 +321,6 @@ uvisor_attach(device_t dev)
 	DPRINTF("sc=%p\n", sc);
 	bcopy(uvisor_config, uvisor_config_copy,
 	    sizeof(uvisor_config_copy));
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	device_set_usb2_desc(dev);
 
 	sc->sc_udev = uaa->device;

Modified: head/sys/dev/usb2/serial/uvscom2.c
==============================================================================
--- head/sys/dev/usb2/serial/uvscom2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/serial/uvscom2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -315,9 +315,6 @@ uvscom_attach(device_t dev)
 	struct uvscom_softc *sc = device_get_softc(dev);
 	int error;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	device_set_usb2_desc(dev);
 
 	sc->sc_udev = uaa->device;

Modified: head/sys/dev/usb2/sound/uaudio2.c
==============================================================================
--- head/sys/dev/usb2/sound/uaudio2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/sound/uaudio2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -562,9 +562,6 @@ uaudio_attach(device_t dev)
 	struct usb2_interface_descriptor *id;
 	device_t child;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	sc->sc_play_chan.priv_sc = sc;
 	sc->sc_rec_chan.priv_sc = sc;
 	sc->sc_udev = uaa->device;

Modified: head/sys/dev/usb2/storage/ata-usb2.c
==============================================================================
--- head/sys/dev/usb2/storage/ata-usb2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/storage/ata-usb2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -328,9 +328,6 @@ atausb2_attach(device_t dev)
 	uint8_t has_intr;
 	int err;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	device_set_usb2_desc(dev);
 
 	sc->dev = dev;

Modified: head/sys/dev/usb2/storage/umass2.c
==============================================================================
--- head/sys/dev/usb2/storage/umass2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/storage/umass2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -1444,9 +1444,6 @@ umass_attach(device_t dev)
 	struct usb2_interface_descriptor *id;
 	int32_t err;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	if (device_get_unit(dev) >= UMASS_MAXUNIT) {
 		device_printf(dev, "Maxunit(%u) limit reached!\n",
 		    UMASS_MAXUNIT);

Modified: head/sys/dev/usb2/storage/urio2.c
==============================================================================
--- head/sys/dev/usb2/storage/urio2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/storage/urio2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -212,9 +212,6 @@ urio_attach(device_t dev)
 	struct urio_softc *sc = device_get_softc(dev);
 	int error;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	device_set_usb2_desc(dev);
 
 	sc->sc_udev = uaa->device;

Modified: head/sys/dev/usb2/storage/ustorage2_fs.c
==============================================================================
--- head/sys/dev/usb2/storage/ustorage2_fs.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/storage/ustorage2_fs.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -318,9 +318,6 @@ ustorage_fs_attach(device_t dev)
 	struct usb2_interface_descriptor *id;
 	int err;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	/*
 	 * NOTE: the softc struct is bzero-ed in device_set_driver.
 	 * We can safely call ustorage_fs_detach without specifically

Modified: head/sys/dev/usb2/wlan/if_rum2.c
==============================================================================
--- head/sys/dev/usb2/wlan/if_rum2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/wlan/if_rum2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -461,9 +461,6 @@ rum_attach(device_t dev)
 	int error;
 	uint8_t iface_index;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	device_set_usb2_desc(dev);
 
 	mtx_init(&sc->sc_mtx, "rum lock", MTX_NETWORK_LOCK,

Modified: head/sys/dev/usb2/wlan/if_ural2.c
==============================================================================
--- head/sys/dev/usb2/wlan/if_ural2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/wlan/if_ural2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -453,9 +453,6 @@ ural_attach(device_t dev)
 	int error;
 	uint8_t iface_index;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	device_set_usb2_desc(dev);
 
 	mtx_init(&sc->sc_mtx, "ural lock", MTX_NETWORK_LOCK,

Modified: head/sys/dev/usb2/wlan/if_zyd2.c
==============================================================================
--- head/sys/dev/usb2/wlan/if_zyd2.c	Sun Feb  1 00:50:46 2009	(r187969)
+++ head/sys/dev/usb2/wlan/if_zyd2.c	Sun Feb  1 00:51:25 2009	(r187970)
@@ -1069,9 +1069,6 @@ zyd_attach(device_t dev)
 	int error;
 	uint8_t iface_index;
 
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 	if (uaa->info.bcdDevice < 0x4330) {
 		device_printf(dev, "device version mismatch: 0x%X "
 		    "(only >= 43.30 supported)\n",

From owner-svn-src-head@FreeBSD.ORG  Sun Feb  1 01:07:16 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BD7EF10656E3;
	Sun,  1 Feb 2009 01:07:16 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ABAD38FC13;
	Sun,  1 Feb 2009 01:07:16 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1117G74038895;
	Sun, 1 Feb 2009 01:07:16 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1117GvW038894;
	Sun, 1 Feb 2009 01:07:16 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200902010107.n1117GvW038894@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Sun, 1 Feb 2009 01:07:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r187972 - head/sys/dev/usb2/misc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 01 Feb 2009 01:07:17 -0000

Author: thompsa
Date: Sun Feb  1 01:07:15 2009
New Revision: 187972
URL: http://svn.freebsd.org/changeset/base/187972

Log:
  Revert part of r187970, the NULL check was removed from
  udbp_bulk_read_complete() as well as udbp_attach.

Modified:
  head/sys/dev/usb2/misc/udbp2.c

Modified: head/sys/dev/usb2/misc/udbp2.c
==============================================================================
--- head/sys/dev/usb2/misc/udbp2.c	Sun Feb  1 01:04:31 2009	(r187971)
+++ head/sys/dev/usb2/misc/udbp2.c	Sun Feb  1 01:07:15 2009	(r187972)
@@ -473,6 +473,9 @@ udbp_bulk_read_complete(node_p node, hoo
 	struct mbuf *m;
 	int error;
 
+	if (sc == NULL) {
+		return;
+	}
 	mtx_lock(&sc->sc_mtx);
 
 	m = sc->sc_bulk_in_buffer;

From owner-svn-src-head@FreeBSD.ORG  Sun Feb  1 01:50:09 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E2B8610657CE;
	Sun,  1 Feb 2009 01:50:09 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D030D8FC1A;
	Sun,  1 Feb 2009 01:50:09 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n111o9T6039637;
	Sun, 1 Feb 2009 01:50:09 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n111o9aS039635;
	Sun, 1 Feb 2009 01:50:09 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200902010150.n111o9aS039635@svn.freebsd.org>
From: Marcel Moolenaar <marcel@FreeBSD.org>
Date: Sun, 1 Feb 2009 01:50:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r187973 - head/sys/geom
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 01 Feb 2009 01:50:10 -0000

Author: marcel
Date: Sun Feb  1 01:50:09 2009
New Revision: 187973
URL: http://svn.freebsd.org/changeset/base/187973

Log:
  Constify val in g_handleattr() and str in g_handleattr_str().
  This allows passing string constants to g_handleattr_str().

Modified:
  head/sys/geom/geom.h
  head/sys/geom/geom_subr.c

Modified: head/sys/geom/geom.h
==============================================================================
--- head/sys/geom/geom.h	Sun Feb  1 01:07:15 2009	(r187972)
+++ head/sys/geom/geom.h	Sun Feb  1 01:50:09 2009	(r187973)
@@ -227,10 +227,11 @@ void g_error_provider(struct g_provider 
 struct g_provider *g_provider_by_name(char const *arg);
 int g_getattr__(const char *attr, struct g_consumer *cp, void *var, int len);
 #define g_getattr(a, c, v) g_getattr__((a), (c), (v), sizeof *(v))
-int g_handleattr(struct bio *bp, const char *attribute, void *val, int len);
+int g_handleattr(struct bio *bp, const char *attribute, const void *val,
+    int len);
 int g_handleattr_int(struct bio *bp, const char *attribute, int val);
 int g_handleattr_off_t(struct bio *bp, const char *attribute, off_t val);
-int g_handleattr_str(struct bio *bp, const char *attribute, char *str);
+int g_handleattr_str(struct bio *bp, const char *attribute, const char *str);
 struct g_consumer * g_new_consumer(struct g_geom *gp);
 struct g_geom * g_new_geomf(struct g_class *mp, const char *fmt, ...);
 struct g_provider * g_new_providerf(struct g_geom *gp, const char *fmt, ...);

Modified: head/sys/geom/geom_subr.c
==============================================================================
--- head/sys/geom/geom_subr.c	Sun Feb  1 01:07:15 2009	(r187972)
+++ head/sys/geom/geom_subr.c	Sun Feb  1 01:50:09 2009	(r187973)
@@ -858,14 +858,14 @@ g_handleattr_off_t(struct bio *bp, const
 }
 
 int
-g_handleattr_str(struct bio *bp, const char *attribute, char *str)
+g_handleattr_str(struct bio *bp, const char *attribute, const char *str)
 {
 
 	return (g_handleattr(bp, attribute, str, 0));
 }
 
 int
-g_handleattr(struct bio *bp, const char *attribute, void *val, int len)
+g_handleattr(struct bio *bp, const char *attribute, const void *val, int len)
 {
 	int error = 0;
 

From owner-svn-src-head@FreeBSD.ORG  Sun Feb  1 02:33:02 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 753B110656BC;
	Sun,  1 Feb 2009 02:33:02 +0000 (UTC)
	(envelope-from kientzle@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 62D258FC18;
	Sun,  1 Feb 2009 02:33:02 +0000 (UTC)
	(envelope-from kientzle@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n112X2gk040570;
	Sun, 1 Feb 2009 02:33:02 GMT (envelope-from kientzle@svn.freebsd.org)
Received: (from kientzle@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n112X2fe040569;
	Sun, 1 Feb 2009 02:33:02 GMT (envelope-from kientzle@svn.freebsd.org)
Message-Id: <200902010233.n112X2fe040569@svn.freebsd.org>
From: Tim Kientzle <kientzle@FreeBSD.org>
Date: Sun, 1 Feb 2009 02:33:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r187975 - head/lib/libarchive
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 01 Feb 2009 02:33:02 -0000

Author: kientzle
Date: Sun Feb  1 02:33:02 2009
New Revision: 187975
URL: http://svn.freebsd.org/changeset/base/187975

Log:
  Permit ` as a pad character in the filename table.
  This seems to fix the devel/zziplib port, which distributes
  its man pages in an ar archive.

Modified:
  head/lib/libarchive/archive_read_support_format_ar.c

Modified: head/lib/libarchive/archive_read_support_format_ar.c
==============================================================================
--- head/lib/libarchive/archive_read_support_format_ar.c	Sun Feb  1 02:04:24 2009	(r187974)
+++ head/lib/libarchive/archive_read_support_format_ar.c	Sun Feb  1 02:33:02 2009	(r187975)
@@ -511,11 +511,10 @@ ar_parse_gnu_filename_table(struct archi
 		}
 	}
 	/*
-	 * Sanity check, last two chars must be `/\n' or '\n\n',
-	 * depending on whether the string table is padded by a '\n'
-	 * (string table produced by GNU ar always has a even size).
+	 * GNU ar always pads the table to an even size.
+	 * The pad character is either '\n' or '`'.
 	 */
-	if (p != ar->strtab + size && *p != '\n')
+	if (p != ar->strtab + size && *p != '\n' && *p != '`')
 		goto bad_string_table;
 
 	/* Enforce zero termination. */

From owner-svn-src-head@FreeBSD.ORG  Sun Feb  1 06:15:47 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 25FDC10656F1;
	Sun,  1 Feb 2009 06:15:47 +0000 (UTC)
	(envelope-from kientzle@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0B6448FC19;
	Sun,  1 Feb 2009 06:15:47 +0000 (UTC)
	(envelope-from kientzle@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n116Fk4q045058;
	Sun, 1 Feb 2009 06:15:46 GMT (envelope-from kientzle@svn.freebsd.org)
Received: (from kientzle@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n116FkLX045057;
	Sun, 1 Feb 2009 06:15:46 GMT (envelope-from kientzle@svn.freebsd.org)
Message-Id: <200902010615.n116FkLX045057@svn.freebsd.org>
From: Tim Kientzle <kientzle@FreeBSD.org>
Date: Sun, 1 Feb 2009 06:15:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r187976 - head/bin/pax
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 01 Feb 2009 06:15:47 -0000

Author: kientzle
Date: Sun Feb  1 06:15:46 2009
New Revision: 187976
URL: http://svn.freebsd.org/changeset/base/187976

Log:
  Before this fix, pax would stop the restore sequence for
  symlinks after setting the owner.  As a result, mode
  and timestamp were not restored.  This patch corrects the
  problem by simply removing the short-circuit for symlinks
  and using lchown()/lchmod()/lutimes() always for restoring
  metadata.
  
  PR:		bin/91316
  Submitted by:	Jaakko Heinonen
  Reviewed by:	Joerg Sonnenberger
  MFC after:	14 days

Modified:
  head/bin/pax/file_subs.c

Modified: head/bin/pax/file_subs.c
==============================================================================
--- head/bin/pax/file_subs.c	Sun Feb  1 02:33:02 2009	(r187975)
+++ head/bin/pax/file_subs.c	Sun Feb  1 06:15:46 2009	(r187976)
@@ -425,19 +425,11 @@ node_creat(ARCHD *arcn)
 	 * we were able to create the node. set uid/gid, modes and times
 	 */
 	if (pids)
-		res = ((arcn->type == PAX_SLK) ?
-		    set_lids(arcn->name, arcn->sb.st_uid, arcn->sb.st_gid) :
-		    set_ids(arcn->name, arcn->sb.st_uid, arcn->sb.st_gid));
+		res = set_ids(arcn->name, arcn->sb.st_uid, arcn->sb.st_gid);
 	else
 		res = 0;
 
 	/*
-	 * symlinks are done now.
-	 */
-	if (arcn->type == PAX_SLK)
-		return(0);
-
-	/*
 	 * IMPORTANT SECURITY NOTE:
 	 * if not preserving mode or we cannot set uid/gid, then PROHIBIT any
 	 * set uid/gid bits
@@ -632,7 +624,7 @@ chk_path( char *name, uid_t st_uid, gid_
  *	used by -t to reset access times).
  *	When ign is zero, only those times the user has asked for are set, the
  *	other ones are left alone. We do not assume the un-documented feature
- *	of many utimes() implementations that consider a 0 time value as a do
+ *	of many lutimes() implementations that consider a 0 time value as a do
  *	not set request.
  */
 
@@ -661,7 +653,7 @@ set_ftime(char *fnm, time_t mtime, time_
 	/*
 	 * set the times
 	 */
-	if (utimes(fnm, tv) < 0)
+	if (lutimes(fnm, tv) < 0)
 		syswarn(1, errno, "Access/modification time set failed on: %s",
 		    fnm);
 	return;
@@ -677,30 +669,6 @@ set_ftime(char *fnm, time_t mtime, time_
 int
 set_ids(char *fnm, uid_t uid, gid_t gid)
 {
-	if (chown(fnm, uid, gid) < 0) {
-		/*
-		 * ignore EPERM unless in verbose mode or being run by root.
-		 * if running as pax, POSIX requires a warning.
-		 */
-		if (strcmp(NM_PAX, argv0) == 0 || errno != EPERM || vflag ||
-		    geteuid() == 0)
-			syswarn(1, errno, "Unable to set file uid/gid of %s",
-			    fnm);
-		return(-1);
-	}
-	return(0);
-}
-
-/*
- * set_lids()
- *	set the uid and gid of a file system node
- * Return:
- *	0 when set, -1 on failure
- */
-
-int
-set_lids(char *fnm, uid_t uid, gid_t gid)
-{
 	if (lchown(fnm, uid, gid) < 0) {
 		/*
 		 * ignore EPERM unless in verbose mode or being run by root.
@@ -724,7 +692,7 @@ void
 set_pmode(char *fnm, mode_t mode)
 {
 	mode &= ABITS;
-	if (chmod(fnm, mode) < 0)
+	if (lchmod(fnm, mode) < 0)
 		syswarn(1, errno, "Could not set permissions on %s", fnm);
 	return;
 }

From owner-svn-src-head@FreeBSD.ORG  Sun Feb  1 16:00:50 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9219D1065672;
	Sun,  1 Feb 2009 16:00:50 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 800178FC13;
	Sun,  1 Feb 2009 16:00:50 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n11G0oir060572;
	Sun, 1 Feb 2009 16:00:50 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n11G0osL060567;
	Sun, 1 Feb 2009 16:00:50 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <200902011600.n11G0osL060567@svn.freebsd.org>
From: Luigi Rizzo <luigi@FreeBSD.org>
Date: Sun, 1 Feb 2009 16:00:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r187983 - head/sbin/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 01 Feb 2009 16:00:51 -0000

Author: luigi
Date: Sun Feb  1 16:00:49 2009
New Revision: 187983
URL: http://svn.freebsd.org/changeset/base/187983

Log:
  put the altq-related functions into a separate file.
  Minor cleanup of the includes used by the various source files,
  including annotations of why certain headers are used.

Added:
  head/sbin/ipfw/altq.c   (contents, props changed)
Modified:
  head/sbin/ipfw/Makefile
  head/sbin/ipfw/dummynet.c
  head/sbin/ipfw/ipfw2.c
  head/sbin/ipfw/ipfw2.h
  head/sbin/ipfw/nat.c

Modified: head/sbin/ipfw/Makefile
==============================================================================
--- head/sbin/ipfw/Makefile	Sun Feb  1 10:13:18 2009	(r187982)
+++ head/sbin/ipfw/Makefile	Sun Feb  1 16:00:49 2009	(r187983)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 PROG=	ipfw
-SRCS=	ipfw2.c dummynet.c ipv6.c main.c nat.c
+SRCS=	ipfw2.c dummynet.c ipv6.c main.c nat.c altq.c
 WARNS?=	2
 MAN=	ipfw.8
 

Added: head/sbin/ipfw/altq.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sbin/ipfw/altq.c	Sun Feb  1 16:00:49 2009	(r187983)
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2002-2003 Luigi Rizzo
+ * Copyright (c) 1996 Alex Nash, Paul Traina, Poul-Henning Kamp
+ * Copyright (c) 1994 Ugen J.S.Antsilevich
+ *
+ * Idea and grammar partially left from:
+ * Copyright (c) 1993 Daniel Boulet
+ *
+ * Redistribution and use in source forms, with and without modification,
+ * are permitted provided that this entire comment appears intact.
+ *
+ * Redistribution in binary form may occur without any restrictions.
+ * Obviously, it would be nice if you gave credit where credit is due
+ * but requiring it would be too onerous.
+ *
+ * This software is provided ``AS IS'' without any warranties of any kind.
+ *
+ * NEW command line interface for IP firewall facility
+ *
+ * $FreeBSD$
+ *
+ * altq interface
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+
+#include "ipfw2.h"
+
+#include <err.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <net/if.h>		/* IFNAMSIZ */
+#include <net/pfvar.h>
+#include <netinet/ip_fw.h>
+
+/*
+ * Map between current altq queue id numbers and names.
+ */
+static TAILQ_HEAD(, pf_altq) altq_entries = 
+	TAILQ_HEAD_INITIALIZER(altq_entries);
+
+void
+altq_set_enabled(int enabled)
+{
+	int pffd;
+
+	pffd = open("/dev/pf", O_RDWR);
+	if (pffd == -1)
+		err(EX_UNAVAILABLE,
+		    "altq support opening pf(4) control device");
+	if (enabled) {
+		if (ioctl(pffd, DIOCSTARTALTQ) != 0 && errno != EEXIST)
+			err(EX_UNAVAILABLE, "enabling altq");
+	} else {
+		if (ioctl(pffd, DIOCSTOPALTQ) != 0 && errno != ENOENT)
+			err(EX_UNAVAILABLE, "disabling altq");
+	}
+	close(pffd);
+}
+
+static void
+altq_fetch(void)
+{
+	struct pfioc_altq pfioc;
+	struct pf_altq *altq;
+	int pffd;
+	unsigned int mnr;
+	static int altq_fetched = 0;
+
+	if (altq_fetched)
+		return;
+	altq_fetched = 1;
+	pffd = open("/dev/pf", O_RDONLY);
+	if (pffd == -1) {
+		warn("altq support opening pf(4) control device");
+		return;
+	}
+	bzero(&pfioc, sizeof(pfioc));
+	if (ioctl(pffd, DIOCGETALTQS, &pfioc) != 0) {
+		warn("altq support getting queue list");
+		close(pffd);
+		return;
+	}
+	mnr = pfioc.nr;
+	for (pfioc.nr = 0; pfioc.nr < mnr; pfioc.nr++) {
+		if (ioctl(pffd, DIOCGETALTQ, &pfioc) != 0) {
+			if (errno == EBUSY)
+				break;
+			warn("altq support getting queue list");
+			close(pffd);
+			return;
+		}
+		if (pfioc.altq.qid == 0)
+			continue;
+		altq = safe_calloc(1, sizeof(*altq));
+		*altq = pfioc.altq;
+		TAILQ_INSERT_TAIL(&altq_entries, altq, entries);
+	}
+	close(pffd);
+}
+
+u_int32_t
+altq_name_to_qid(const char *name)
+{
+	struct pf_altq *altq;
+
+	altq_fetch();
+	TAILQ_FOREACH(altq, &altq_entries, entries)
+		if (strcmp(name, altq->qname) == 0)
+			break;
+	if (altq == NULL)
+		errx(EX_DATAERR, "altq has no queue named `%s'", name);
+	return altq->qid;
+}
+
+const char *
+altq_qid_to_name(u_int32_t qid)
+{
+	struct pf_altq *altq;
+
+	altq_fetch();
+	TAILQ_FOREACH(altq, &altq_entries, entries)
+		if (qid == altq->qid)
+			break;
+	if (altq == NULL)
+		return NULL;
+	return altq->qname;
+}
+
+void
+print_altq_cmd(ipfw_insn_altq *altqptr)
+{
+        if (altqptr) {
+                const char *qname;
+
+                qname = altq_qid_to_name(altqptr->qid);
+                if (qname == NULL)
+                        printf(" altq ?<%u>", altqptr->qid);
+                else
+                        printf(" altq %s", qname);
+        }
+}

Modified: head/sbin/ipfw/dummynet.c
==============================================================================
--- head/sbin/ipfw/dummynet.c	Sun Feb  1 10:13:18 2009	(r187982)
+++ head/sbin/ipfw/dummynet.c	Sun Feb  1 16:00:49 2009	(r187983)
@@ -24,7 +24,8 @@
 
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/sockio.h>
+#include <sys/queue.h>
+/* XXX there are several sysctl leftover here */
 #include <sys/sysctl.h>
 
 #include "ipfw2.h"
@@ -38,12 +39,11 @@
 #include <sysexits.h>
 
 #include <net/if.h>
+#include <net/if.h>
 #include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
 #include <netinet/ip_fw.h>
 #include <netinet/ip_dummynet.h>
-#include <arpa/inet.h>
+#include <arpa/inet.h>	/* inet_ntoa */
 
 static struct _s_x dummynet_params[] = {
 	{ "plr",		TOK_PLR },

Modified: head/sbin/ipfw/ipfw2.c
==============================================================================
--- head/sbin/ipfw/ipfw2.c	Sun Feb  1 10:13:18 2009	(r187982)
+++ head/sbin/ipfw/ipfw2.c	Sun Feb  1 16:00:49 2009	(r187983)
@@ -37,19 +37,15 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sysexits.h>
+#include <time.h>	/* ctime */
 #include <timeconv.h>	/* _long_to_time */
 #include <unistd.h>
 #include <fcntl.h>
 
-#define IPFW_INTERNAL	/* Access to protected structures in ip_fw.h. */
-
 #include <net/ethernet.h>
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/pfvar.h>
-#include <net/route.h> /* def. of struct route */
+#include <net/if.h>		/* only IFNAMSIZ */
 #include <netinet/in.h>
-#include <netinet/in_systm.h>
+#include <netinet/in_systm.h>	/* only n_short, n_long */
 #include <netinet/ip.h>
 #include <netinet/ip_icmp.h>
 #include <netinet/ip_fw.h>
@@ -586,106 +582,6 @@ strtoport(char *s, char **end, int base,
 }
 
 /*
- * Map between current altq queue id numbers and names.
- */
-static int altq_fetched = 0;
-static TAILQ_HEAD(, pf_altq) altq_entries = 
-	TAILQ_HEAD_INITIALIZER(altq_entries);
-
-static void
-altq_set_enabled(int enabled)
-{
-	int pffd;
-
-	pffd = open("/dev/pf", O_RDWR);
-	if (pffd == -1)
-		err(EX_UNAVAILABLE,
-		    "altq support opening pf(4) control device");
-	if (enabled) {
-		if (ioctl(pffd, DIOCSTARTALTQ) != 0 && errno != EEXIST)
-			err(EX_UNAVAILABLE, "enabling altq");
-	} else {
-		if (ioctl(pffd, DIOCSTOPALTQ) != 0 && errno != ENOENT)
-			err(EX_UNAVAILABLE, "disabling altq");
-	}
-	close(pffd);
-}
-
-static void
-altq_fetch(void)
-{
-	struct pfioc_altq pfioc;
-	struct pf_altq *altq;
-	int pffd;
-	unsigned int mnr;
-
-	if (altq_fetched)
-		return;
-	altq_fetched = 1;
-	pffd = open("/dev/pf", O_RDONLY);
-	if (pffd == -1) {
-		warn("altq support opening pf(4) control device");
-		return;
-	}
-	bzero(&pfioc, sizeof(pfioc));
-	if (ioctl(pffd, DIOCGETALTQS, &pfioc) != 0) {
-		warn("altq support getting queue list");
-		close(pffd);
-		return;
-	}
-	mnr = pfioc.nr;
-	for (pfioc.nr = 0; pfioc.nr < mnr; pfioc.nr++) {
-		if (ioctl(pffd, DIOCGETALTQ, &pfioc) != 0) {
-			if (errno == EBUSY)
-				break;
-			warn("altq support getting queue list");
-			close(pffd);
-			return;
-		}
-		if (pfioc.altq.qid == 0)
-			continue;
-		altq = safe_calloc(1, sizeof(*altq));
-		*altq = pfioc.altq;
-		TAILQ_INSERT_TAIL(&altq_entries, altq, entries);
-	}
-	close(pffd);
-}
-
-static u_int32_t
-altq_name_to_qid(const char *name)
-{
-	struct pf_altq *altq;
-
-	altq_fetch();
-	TAILQ_FOREACH(altq, &altq_entries, entries)
-		if (strcmp(name, altq->qname) == 0)
-			break;
-	if (altq == NULL)
-		errx(EX_DATAERR, "altq has no queue named `%s'", name);
-	return altq->qid;
-}
-
-static const char *
-altq_qid_to_name(u_int32_t qid)
-{
-	struct pf_altq *altq;
-
-	altq_fetch();
-	TAILQ_FOREACH(altq, &altq_entries, entries)
-		if (qid == altq->qid)
-			break;
-	if (altq == NULL)
-		return NULL;
-	return altq->qname;
-}
-
-static void
-fill_altq_qid(u_int32_t *qid, const char *av)
-{
-	*qid = altq_name_to_qid(av);
-}
-
-/*
  * Fill the body of the command with the list of port ranges.
  */
 static int
@@ -1206,13 +1102,7 @@ show_ipfw(struct ip_fw *rule, int pcwidt
 			printf(" log");
 	}
 	if (altqptr) {
-		const char *qname;
-
-		qname = altq_qid_to_name(altqptr->qid);
-		if (qname == NULL)
-			printf(" altq ?<%u>", altqptr->qid);
-		else
-			printf(" altq %s", qname);
+		print_altq_cmd(altqptr);
 	}
 	if (tagptr) {
 		if (tagptr->len & F_NOT)
@@ -2945,7 +2835,7 @@ chkarg:	
 			have_altq = (ipfw_insn *)a;
 			cmd->len = F_INSN_SIZE(ipfw_insn_altq);
 			cmd->opcode = O_ALTQ;
-			fill_altq_qid(&a->qid, *av);
+			a->qid = altq_name_to_qid(*av);
 			ac--; av++;
 		    }
 			break;

Modified: head/sbin/ipfw/ipfw2.h
==============================================================================
--- head/sbin/ipfw/ipfw2.h	Sun Feb  1 10:13:18 2009	(r187982)
+++ head/sbin/ipfw/ipfw2.h	Sun Feb  1 16:00:49 2009	(r187983)
@@ -219,6 +219,7 @@ int contigmask(uint8_t *p, int len);
  * functions involved, so we do not lose error checking.
  */
 struct _ipfw_insn;
+struct _ipfw_insn_altq;
 struct _ipfw_insn_u32;
 struct _ipfw_insn_ip6;
 struct _ipfw_insn_icmp6;
@@ -243,6 +244,12 @@ void ipfw_flush(int force);
 void ipfw_zero(int ac, char *av[], int optname);
 void ipfw_list(int ac, char *av[], int show_counters);
 
+/* altq.c */
+void altq_set_enabled(int enabled);
+u_int32_t altq_name_to_qid(const char *name);
+
+void print_altq_cmd(struct _ipfw_insn_altq *altqptr);
+
 /* dummynet.c */
 void ipfw_list_pipes(void *data, uint nbytes, int ac, char *av[]);
 int ipfw_delete_pipe(int pipe_or_queue, int n);

Modified: head/sbin/ipfw/nat.c
==============================================================================
--- head/sbin/ipfw/nat.c	Sun Feb  1 10:13:18 2009	(r187982)
+++ head/sbin/ipfw/nat.c	Sun Feb  1 16:00:49 2009	(r187983)
@@ -24,7 +24,6 @@
 
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/sockio.h>
 #include <sys/sysctl.h>
 
 #include "ipfw2.h"
@@ -43,7 +42,6 @@
 #include <net/if_dl.h>
 #include <net/route.h> /* def. of struct route */
 #include <netinet/in.h>
-#include <netinet/in_systm.h>
 #include <netinet/ip_fw.h>
 #include <arpa/inet.h>
 #include <alias.h>

From owner-svn-src-head@FreeBSD.ORG  Sun Feb  1 21:11:09 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5C321106567C;
	Sun,  1 Feb 2009 21:11:09 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 475FF8FC08;
	Sun,  1 Feb 2009 21:11:09 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n11LB9G5066525;
	Sun, 1 Feb 2009 21:11:09 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n11LB9er066518;
	Sun, 1 Feb 2009 21:11:09 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200902012111.n11LB9er066518@svn.freebsd.org>
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: Sun, 1 Feb 2009 21:11:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r187989 - in head: . sys/netinet6 usr.bin/netstat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 01 Feb 2009 21:11:11 -0000

Author: bz
Date: Sun Feb  1 21:11:08 2009
New Revision: 187989
URL: http://svn.freebsd.org/changeset/base/187989

Log:
  Remove the single global unlocked route cache ip6_forward_rt
  from the inet6 stack along with statistics and make sure we
  properly free the rt in all cases.
  
  While the current situation is not better performance wise it
  prevents panics seen more often these days.
  After more inet6 and ipsec cleanup we should be able to improve
  the situation again passing the rt to ip6_forward directly.
  
  Leave the ip6_forward_rt entry in struct vinet6 but mark it
  for removal.
  
  PR:		kern/128247, kern/131038
  MFC after:	25 days
  Committed from:	Bugathon #6
  Tested by:	Denis Ahrens <denis@h3q.com> (different initial version)

Modified:
  head/UPDATING
  head/sys/netinet6/frag6.c
  head/sys/netinet6/ip6_forward.c
  head/sys/netinet6/ip6_input.c
  head/sys/netinet6/ip6_var.h
  head/sys/netinet6/vinet6.h
  head/usr.bin/netstat/inet6.c

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Sun Feb  1 20:18:27 2009	(r187988)
+++ head/UPDATING	Sun Feb  1 21:11:08 2009	(r187989)
@@ -22,6 +22,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.
 	to maximize performance.  (To disable malloc debugging, run
 	ln -s aj /etc/malloc.conf.)
 
+20090201:
+	INET6 statistics (struct ip6stat) was updated.
+	netstat(1) needs to be recompiled.
+
 20090119:
 	NTFS has been removed from GENERIC kernel on amd64 to match
 	GENERIC on i386. Should not cause any issues since mount_ntfs(8)

Modified: head/sys/netinet6/frag6.c
==============================================================================
--- head/sys/netinet6/frag6.c	Sun Feb  1 20:18:27 2009	(r187988)
+++ head/sys/netinet6/frag6.c	Sun Feb  1 21:11:08 2009	(r187989)
@@ -751,18 +751,6 @@ frag6_slowtimo(void)
 	}
 	VNET_LIST_RUNLOCK();
 	IP6Q_UNLOCK();
-
-#if 0
-	/*
-	 * Routing changes might produce a better route than we last used;
-	 * make sure we notice eventually, even if forwarding only for one
-	 * destination and the cache is never replaced.
-	 */
-	if (V_ip6_forward_rt.ro_rt) {
-		RTFREE(V_ip6_forward_rt.ro_rt);
-		V_ip6_forward_rt.ro_rt = 0;
-	}
-#endif
 }
 
 /*

Modified: head/sys/netinet6/ip6_forward.c
==============================================================================
--- head/sys/netinet6/ip6_forward.c	Sun Feb  1 20:18:27 2009	(r187988)
+++ head/sys/netinet6/ip6_forward.c	Sun Feb  1 21:11:08 2009	(r187989)
@@ -77,10 +77,6 @@ __FBSDID("$FreeBSD$");
 
 #include <netinet6/ip6protosw.h>
 
-#ifdef VIMAGE_GLOBALS
-struct	route_in6 ip6_forward_rt;
-#endif
-
 /*
  * Forward a packet.  If some error occurs return the sender
  * an icmp packet.  Note we can't always generate a meaningful
@@ -100,6 +96,7 @@ ip6_forward(struct mbuf *m, int srcrt)
 	struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
 	struct sockaddr_in6 *dst = NULL;
 	struct rtentry *rt = NULL;
+	struct route_in6 rin6;
 	int error, type = 0, code = 0;
 	struct mbuf *mcopy = NULL;
 	struct ifnet *origifp;	/* maybe unnecessary */
@@ -112,8 +109,6 @@ ip6_forward(struct mbuf *m, int srcrt)
 #endif
 	char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
 
-	/* GIANT_REQUIRED; */ /* XXX bz: ip6_forward_rt */
-
 #ifdef IPSEC
 	/*
 	 * Check AH/ESP integrity.
@@ -355,56 +350,27 @@ ip6_forward(struct mbuf *m, int srcrt)
 skip_ipsec:
 #endif
 
-	dst = (struct sockaddr_in6 *)&V_ip6_forward_rt.ro_dst;
-	if (!srcrt) {
-		/* ip6_forward_rt.ro_dst.sin6_addr is equal to ip6->ip6_dst */
-		if (V_ip6_forward_rt.ro_rt == 0 ||
-		    (V_ip6_forward_rt.ro_rt->rt_flags & RTF_UP) == 0) {
-			if (V_ip6_forward_rt.ro_rt) {
-				RTFREE(V_ip6_forward_rt.ro_rt);
-				V_ip6_forward_rt.ro_rt = 0;
-			}
-
-			/* this probably fails but give it a try again */
-			rtalloc((struct route *)&V_ip6_forward_rt);
-		}
-
-		if (V_ip6_forward_rt.ro_rt == 0) {
-			V_ip6stat.ip6s_noroute++;
-			in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_noroute);
-			if (mcopy) {
-				icmp6_error(mcopy, ICMP6_DST_UNREACH,
-					    ICMP6_DST_UNREACH_NOROUTE, 0);
-			}
-			m_freem(m);
-			return;
-		}
-	} else if ((rt = V_ip6_forward_rt.ro_rt) == 0 ||
-		   !IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &dst->sin6_addr)) {
-		if (V_ip6_forward_rt.ro_rt) {
-			RTFREE(V_ip6_forward_rt.ro_rt);
-			V_ip6_forward_rt.ro_rt = 0;
-		}
-		bzero(dst, sizeof(*dst));
-		dst->sin6_len = sizeof(struct sockaddr_in6);
-		dst->sin6_family = AF_INET6;
-		dst->sin6_addr = ip6->ip6_dst;
-
-		rtalloc((struct route *)&V_ip6_forward_rt);
-		if (V_ip6_forward_rt.ro_rt == 0) {
-			V_ip6stat.ip6s_noroute++;
-			in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_noroute);
-			if (mcopy) {
-				icmp6_error(mcopy, ICMP6_DST_UNREACH,
-					    ICMP6_DST_UNREACH_NOROUTE, 0);
-			}
-			m_freem(m);
-			return;
+	bzero(&rin6, sizeof(struct route_in6));
+	dst = (struct sockaddr_in6 *)&rin6.ro_dst;
+	dst->sin6_len = sizeof(struct sockaddr_in6);
+	dst->sin6_family = AF_INET6;
+	dst->sin6_addr = ip6->ip6_dst;
+
+	rin6.ro_rt = rtalloc1((struct sockaddr *)dst, 0, 0);
+	if (rin6.ro_rt != NULL)
+		RT_UNLOCK(rin6.ro_rt);
+	else {
+		V_ip6stat.ip6s_noroute++;
+		in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_noroute);
+		if (mcopy) {
+			icmp6_error(mcopy, ICMP6_DST_UNREACH,
+			ICMP6_DST_UNREACH_NOROUTE, 0);
 		}
+		goto bad;
 	}
-	rt = V_ip6_forward_rt.ro_rt;
+	rt = rin6.ro_rt;
 #ifdef IPSEC
-    skip_routing:;
+skip_routing:
 #endif
 
 	/*
@@ -421,14 +387,12 @@ skip_ipsec:
 		/* XXX: this should not happen */
 		V_ip6stat.ip6s_cantforward++;
 		V_ip6stat.ip6s_badscope++;
-		m_freem(m);
-		return;
+		goto bad;
 	}
 	if (in6_setscope(&src_in6, m->m_pkthdr.rcvif, &inzone)) {
 		V_ip6stat.ip6s_cantforward++;
 		V_ip6stat.ip6s_badscope++;
-		m_freem(m);
-		return;
+		goto bad;
 	}
 	if (inzone != outzone
 #ifdef IPSEC
@@ -452,8 +416,7 @@ skip_ipsec:
 		if (mcopy)
 			icmp6_error(mcopy, ICMP6_DST_UNREACH,
 				    ICMP6_DST_UNREACH_BEYONDSCOPE, 0);
-		m_freem(m);
-		return;
+		goto bad;
 	}
 
 	/*
@@ -469,8 +432,7 @@ skip_ipsec:
 	    inzone != outzone) {
 		V_ip6stat.ip6s_cantforward++;
 		V_ip6stat.ip6s_badscope++;
-		m_freem(m);
-		return;
+		goto bad;
 	}
 
 	if (m->m_pkthdr.len > IN6_LINKMTU(rt->rt_ifp)) {
@@ -510,8 +472,7 @@ skip_ipsec:
 #endif /* IPSEC */
 			icmp6_error(mcopy, ICMP6_PACKET_TOO_BIG, 0, mtu);
 		}
-		m_freem(m);
-		return;
+		goto bad;
 	}
 
 	if (rt->rt_flags & RTF_GATEWAY)
@@ -544,8 +505,7 @@ skip_ipsec:
 			 */
 			icmp6_error(mcopy, ICMP6_DST_UNREACH,
 				    ICMP6_DST_UNREACH_ADDR, 0);
-			m_freem(m);
-			return;
+			goto bad;
 		}
 		type = ND_REDIRECT;
 	}
@@ -624,12 +584,12 @@ pass:
 
 senderr:
 	if (mcopy == NULL)
-		return;
+		goto out;
 	switch (error) {
 	case 0:
 		if (type == ND_REDIRECT) {
 			icmp6_redirect_output(mcopy, rt);
-			return;
+			goto out;
 		}
 		goto freecopy;
 
@@ -651,9 +611,18 @@ senderr:
 		break;
 	}
 	icmp6_error(mcopy, type, code, 0);
-	return;
+	goto out;
 
  freecopy:
 	m_freem(mcopy);
-	return;
+	goto out;
+bad:
+	m_freem(m);
+out:
+	if (rt != NULL
+#ifdef IPSEC
+	    && !ipsecrt
+#endif
+	    )
+		RTFREE(rt);
 }

Modified: head/sys/netinet6/ip6_input.c
==============================================================================
--- head/sys/netinet6/ip6_input.c	Sun Feb  1 20:18:27 2009	(r187988)
+++ head/sys/netinet6/ip6_input.c	Sun Feb  1 21:11:08 2009	(r187989)
@@ -143,8 +143,6 @@ extern int icmp6errppslim;
 extern int icmp6_nodeinfo;
 extern int udp6_sendspace;
 extern int udp6_recvspace;
-
-extern struct	route_in6 ip6_forward_rt;
 #endif
 
 struct pfil_head inet6_pfil_hook;
@@ -309,10 +307,12 @@ ip6_input(struct mbuf *m)
 	int nxt, ours = 0;
 	struct ifnet *deliverifp = NULL, *ifp = NULL;
 	struct in6_addr odst;
+	struct route_in6 rin6;
 	int srcrt = 0;
 	struct llentry *lle = NULL;
-	struct sockaddr_in6 dst6;
+	struct sockaddr_in6 dst6, *dst;
 
+	bzero(&rin6, sizeof(struct route_in6));
 #ifdef IPSEC
 	/*
 	 * should the inner packet be considered authentic?
@@ -565,29 +565,13 @@ passin:
 	if (lle != NULL)
 		LLE_RUNLOCK(lle);
 
-	if (V_ip6_forward_rt.ro_rt != NULL &&
-	    (V_ip6_forward_rt.ro_rt->rt_flags & RTF_UP) != 0 &&
-	    IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst,
-	    &((struct sockaddr_in6 *)(&V_ip6_forward_rt.ro_dst))->sin6_addr))
-		V_ip6stat.ip6s_forward_cachehit++;
-	else {
-		struct sockaddr_in6 *dst6;
-
-		if (V_ip6_forward_rt.ro_rt) {
-			/* route is down or destination is different */
-			V_ip6stat.ip6s_forward_cachemiss++;
-			RTFREE(V_ip6_forward_rt.ro_rt);
-			V_ip6_forward_rt.ro_rt = 0;
-		}
-
-		bzero(&V_ip6_forward_rt.ro_dst, sizeof(struct sockaddr_in6));
-		dst6 = (struct sockaddr_in6 *)&V_ip6_forward_rt.ro_dst;
-		dst6->sin6_len = sizeof(struct sockaddr_in6);
-		dst6->sin6_family = AF_INET6;
-		dst6->sin6_addr = ip6->ip6_dst;
-
-		rtalloc((struct route *)&V_ip6_forward_rt);
-	}
+	dst = &rin6.ro_dst;
+	dst->sin6_len = sizeof(struct sockaddr_in6);
+	dst->sin6_family = AF_INET6;
+	dst->sin6_addr = ip6->ip6_dst;
+	rin6.ro_rt = rtalloc1((struct sockaddr *)dst, 0, 0);
+	if (rin6.ro_rt)
+		RT_UNLOCK(rin6.ro_rt);
 
 #define rt6_key(r) ((struct sockaddr_in6 *)((r)->rt_nodes->rn_key))
 
@@ -611,14 +595,14 @@ passin:
 	 * while it would be less efficient.  Or, should we rather install a
 	 * reject route for such a case?
 	 */
-	if (V_ip6_forward_rt.ro_rt &&
-	    (V_ip6_forward_rt.ro_rt->rt_flags &
+	if (rin6.ro_rt &&
+	    (rin6.ro_rt->rt_flags &
 	     (RTF_HOST|RTF_GATEWAY)) == RTF_HOST &&
 #ifdef RTF_WASCLONED
-	    !(V_ip6_forward_rt.ro_rt->rt_flags & RTF_WASCLONED) &&
+	    !(rin6.ro_rt->rt_flags & RTF_WASCLONED) &&
 #endif
 #ifdef RTF_CLONED
-	    !(V_ip6_forward_rt.ro_rt->rt_flags & RTF_CLONED) &&
+	    !(rin6.ro_rt->rt_flags & RTF_CLONED) &&
 #endif
 #if 0
 	    /*
@@ -627,11 +611,11 @@ passin:
 	     * already done through looking up the routing table.
 	     */
 	    IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst,
-	    &rt6_key(V_ip6_forward_rt.ro_rt)->sin6_addr)
+	    &rt6_key(rin6.ro_rt)->sin6_addr)
 #endif
-	    V_ip6_forward_rt.ro_rt->rt_ifp->if_type == IFT_LOOP) {
+	    rin6.ro_rt->rt_ifp->if_type == IFT_LOOP) {
 		struct in6_ifaddr *ia6 =
-			(struct in6_ifaddr *)V_ip6_forward_rt.ro_rt->rt_ifa;
+			(struct in6_ifaddr *)rin6.ro_rt->rt_ifa;
 
 		/*
 		 * record address information into m_tag.
@@ -667,11 +651,11 @@ passin:
 	 * FAITH (Firewall Aided Internet Translator)
 	 */
 	if (V_ip6_keepfaith) {
-		if (V_ip6_forward_rt.ro_rt && V_ip6_forward_rt.ro_rt->rt_ifp
-		 && V_ip6_forward_rt.ro_rt->rt_ifp->if_type == IFT_FAITH) {
+		if (rin6.ro_rt && rin6.ro_rt->rt_ifp &&
+		    rin6.ro_rt->rt_ifp->if_type == IFT_FAITH) {
 			/* XXX do we need more sanity checks? */
 			ours = 1;
-			deliverifp = V_ip6_forward_rt.ro_rt->rt_ifp; /* faith */
+			deliverifp = rin6.ro_rt->rt_ifp; /* faith */
 			goto hbhcheck;
 		}
 	}
@@ -721,7 +705,7 @@ passin:
 #if 0	/*touches NULL pointer*/
 			in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard);
 #endif
-			return;	/* m have already been freed */
+			goto out;	/* m have already been freed */
 		}
 
 		/* adjust pointer */
@@ -744,7 +728,7 @@ passin:
 			icmp6_error(m, ICMP6_PARAM_PROB,
 				    ICMP6_PARAMPROB_HEADER,
 				    (caddr_t)&ip6->ip6_plen - (caddr_t)ip6);
-			return;
+			goto out;
 		}
 #ifndef PULLDOWN_TEST
 		/* ip6_hopopts_input() ensures that mbuf is contiguous */
@@ -754,7 +738,7 @@ passin:
 			sizeof(struct ip6_hbh));
 		if (hbh == NULL) {
 			V_ip6stat.ip6s_tooshort++;
-			return;
+			goto out;
 		}
 #endif
 		nxt = hbh->ip6h_nxt;
@@ -816,16 +800,13 @@ passin:
 		if (ip6_mrouter && ip6_mforward &&
 		    ip6_mforward(ip6, m->m_pkthdr.rcvif, m)) {
 			V_ip6stat.ip6s_cantforward++;
-			m_freem(m);
-			return;
-		}
-		if (!ours) {
-			m_freem(m);
-			return;
+			goto bad;
 		}
+		if (!ours)
+			goto bad;
 	} else if (!ours) {
 		ip6_forward(m, srcrt);
-		return;
+		goto out;
 	}
 
 	ip6 = mtod(m, struct ip6_hdr *);
@@ -880,9 +861,12 @@ passin:
 #endif /* IPSEC */
 		nxt = (*inet6sw[ip6_protox[nxt]].pr_input)(&m, &off, nxt);
 	}
-	return;
- bad:
+	goto out;
+bad:
 	m_freem(m);
+out:
+	if (rin6.ro_rt)
+		RTFREE(rin6.ro_rt);
 }
 
 /*

Modified: head/sys/netinet6/ip6_var.h
==============================================================================
--- head/sys/netinet6/ip6_var.h	Sun Feb  1 20:18:27 2009	(r187988)
+++ head/sys/netinet6/ip6_var.h	Sun Feb  1 21:11:08 2009	(r187989)
@@ -229,9 +229,6 @@ struct	ip6stat {
 	/* number of times that a deprecated address is chosen */
 	u_quad_t ip6s_sources_deprecated[16];
 
-	u_quad_t ip6s_forward_cachehit;
-	u_quad_t ip6s_forward_cachemiss;
-
 	/* number of times that each rule of source selection is applied. */
 	u_quad_t ip6s_sources_rule[16];
 };

Modified: head/sys/netinet6/vinet6.h
==============================================================================
--- head/sys/netinet6/vinet6.h	Sun Feb  1 20:18:27 2009	(r187988)
+++ head/sys/netinet6/vinet6.h	Sun Feb  1 21:11:08 2009	(r187989)
@@ -54,7 +54,7 @@ struct vnet_inet6 {
 	u_int				_frag6_nfrags;
 	struct ip6q			_ip6q;
 
-	struct route_in6 		_ip6_forward_rt;
+	struct route_in6 		_ip6_forward_rt;	/* XXX remove */
 
 	struct in6_addrpolicy 		_defaultaddrpolicy;
 	TAILQ_HEAD(, addrsel_policyent) _addrsel_policytab;
@@ -194,7 +194,6 @@ extern struct vnet_inet6 vnet_inet6_0;
 #define	V_ip6_defhlim			VNET_INET6(ip6_defhlim)
 #define	V_ip6_defmcasthlim		VNET_INET6(ip6_defmcasthlim)
 #define	V_ip6_desync_factor		VNET_INET6(ip6_desync_factor)
-#define	V_ip6_forward_rt		VNET_INET6(ip6_forward_rt)
 #define	V_ip6_forwarding		VNET_INET6(ip6_forwarding)
 #define	V_ip6_hdrnestlimit		VNET_INET6(ip6_hdrnestlimit)
 #define	V_ip6_keepfaith			VNET_INET6(ip6_keepfaith)

Modified: head/usr.bin/netstat/inet6.c
==============================================================================
--- head/usr.bin/netstat/inet6.c	Sun Feb  1 20:18:27 2009	(r187988)
+++ head/usr.bin/netstat/inet6.c	Sun Feb  1 21:11:08 2009	(r187989)
@@ -512,8 +512,6 @@ ip6_stats(u_long off, const char *name, 
 		}
 	}
 
-	p1a(ip6s_forward_cachehit, "\t%ju forward cache hit\n");
-	p1a(ip6s_forward_cachemiss, "\t%ju forward cache miss\n");
 	printf("\tSource addresses selection rule applied:\n");
 	for (i = 0; i < 16; i++) {
 		if (ip6stat.ip6s_sources_rule[i])

From owner-svn-src-head@FreeBSD.ORG  Sun Feb  1 22:24:08 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A885F106566C;
	Sun,  1 Feb 2009 22:24:08 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 969708FC1F;
	Sun,  1 Feb 2009 22:24:08 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n11MO8tK067989;
	Sun, 1 Feb 2009 22:24:08 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n11MO85p067988;
	Sun, 1 Feb 2009 22:24:08 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902012224.n11MO85p067988@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Sun, 1 Feb 2009 22:24:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r187991 - head/sys/net80211
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 01 Feb 2009 22:24:09 -0000

Author: sam
Date: Sun Feb  1 22:24:08 2009
New Revision: 187991
URL: http://svn.freebsd.org/changeset/base/187991

Log:
  when promoting an 11b channel to 11g do not accept a ``pure G'' (OFDM only)
  channel, only accept a real 11g channel; this fixes a problem where we were
  wrongly promoting 11b to a Dynamic Turbo G channel which broke scanning on
  channel 6

Modified:
  head/sys/net80211/ieee80211_scan_sta.c

Modified: head/sys/net80211/ieee80211_scan_sta.c
==============================================================================
--- head/sys/net80211/ieee80211_scan_sta.c	Sun Feb  1 21:50:07 2009	(r187990)
+++ head/sys/net80211/ieee80211_scan_sta.c	Sun Feb  1 22:24:08 2009	(r187991)
@@ -395,12 +395,12 @@ find11gchannel(struct ieee80211com *ic, 
 	 */
 	for (j = i+1; j < ic->ic_nchans; j++) {
 		c = &ic->ic_channels[j];
-		if (c->ic_freq == freq && IEEE80211_IS_CHAN_ANYG(c))
+		if (c->ic_freq == freq && IEEE80211_IS_CHAN_G(c))
 			return c;
 	}
 	for (j = 0; j < i; j++) {
 		c = &ic->ic_channels[j];
-		if (c->ic_freq == freq && IEEE80211_IS_CHAN_ANYG(c))
+		if (c->ic_freq == freq && IEEE80211_IS_CHAN_G(c))
 			return c;
 	}
 	return NULL;

From owner-svn-src-head@FreeBSD.ORG  Sun Feb  1 23:28:53 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 421D0106566C;
	Sun,  1 Feb 2009 23:28:53 +0000 (UTC)
	(envelope-from sbruno@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2B4328FC16;
	Sun,  1 Feb 2009 23:28:53 +0000 (UTC)
	(envelope-from sbruno@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n11NSrN4069214;
	Sun, 1 Feb 2009 23:28:53 GMT (envelope-from sbruno@svn.freebsd.org)
Received: (from sbruno@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n11NSqYG069209;
	Sun, 1 Feb 2009 23:28:52 GMT (envelope-from sbruno@svn.freebsd.org)
Message-Id: <200902012328.n11NSqYG069209@svn.freebsd.org>
From: Sean Bruno <sbruno@FreeBSD.org>
Date: Sun, 1 Feb 2009 23:28:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r187993 - head/sys/dev/firewire
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 01 Feb 2009 23:28:53 -0000

Author: sbruno
Date: Sun Feb  1 23:28:52 2009
New Revision: 187993
URL: http://svn.freebsd.org/changeset/base/187993

Log:
  Some updates and bug squashing in the firewire stack.
  
  Move the interupt handler to a driver_intr_t type function as it was trying
  to do way to much for a lightweight filter interrupt function.
  
  Introduce much more locking around fc->mtx.  Tested this for lock reversals
  and other such lockups.  Locking seems to be working better, but there
  is much more to do with regard to locking.  The most significant lock is
  in the BUS RESET handler.  It was possible, before this checkin, to set
  a bus reset via "fwcontrol -r" and have the BUS RESET handler fire before
  the code responsible for asserting BUS RESET was complete.  This locking
  fixes that issue.
  
  Move some of the memory allocations in the fc struct to the attach function
  in firewire.c
  
  Rework the businfo.generation indicator to be merely a on/off bit now.
  It's purpose according to spec is to notify the bus that the config ROM
  has changed.  That's it.
  
  Catch and squash a possible panic in SBP where in the SBP_LOCK was held
  during a possible error case.  The error handling code would definitely
  panic as it would try to acquire the SBP_LOCK on entrance.
  
  Catch and squash a camcontrol/device lockup when firewire drives go away.
  When a firewire device was powered off or disconnected from the firewire
  bus, a "camcontrol rescan all" would hang trying to poll removed devices
  as they were not properly detached.  Don't do that.
  
  Approved by:	scottl
  MFC after:	2 weeks

Modified:
  head/sys/dev/firewire/firewire.c
  head/sys/dev/firewire/fwohci.c
  head/sys/dev/firewire/fwohci_pci.c
  head/sys/dev/firewire/fwohcivar.h
  head/sys/dev/firewire/sbp.c

Modified: head/sys/dev/firewire/firewire.c
==============================================================================
--- head/sys/dev/firewire/firewire.c	Sun Feb  1 23:27:21 2009	(r187992)
+++ head/sys/dev/firewire/firewire.c	Sun Feb  1 23:28:52 2009	(r187993)
@@ -430,6 +430,31 @@ firewire_attach(device_t dev)
 
 	fwdev_makedev(sc);
 
+	fc->crom_src_buf = (struct crom_src_buf *)malloc(
+				sizeof(struct crom_src_buf),
+				M_FW, M_NOWAIT | M_ZERO);
+	if (fc->crom_src_buf == NULL) {
+		device_printf(fc->dev, "%s: Malloc Failure crom src buff\n", __func__);
+		return ENOMEM;
+	}
+	fc->topology_map = (struct fw_topology_map *)malloc(
+				sizeof(struct fw_topology_map),
+				M_FW, M_NOWAIT | M_ZERO);
+	if (fc->topology_map == NULL) {
+		device_printf(fc->dev, "%s: Malloc Failure topology map\n", __func__);
+		free(fc->crom_src_buf, M_FW);
+		return ENOMEM;
+	}
+	fc->speed_map = (struct fw_speed_map *)malloc(
+				sizeof(struct fw_speed_map),
+				M_FW, M_NOWAIT | M_ZERO);
+	if (fc->speed_map == NULL) {
+		device_printf(fc->dev, "%s: Malloc Failure speed map\n", __func__);
+		free(fc->crom_src_buf, M_FW);
+		free(fc->topology_map, M_FW);
+		return ENOMEM;
+	}
+
 	mtx_init(&fc->wait_lock, "fwwait", NULL, MTX_DEF);
 	mtx_init(&fc->tlabel_lock, "fwtlabel", NULL, MTX_DEF);
 	CALLOUT_INIT(&fc->timeout_callout);
@@ -451,7 +476,9 @@ firewire_attach(device_t dev)
 	bus_generic_attach(dev);
 
 	/* bus_reset */
+	FW_GLOCK(fc);
 	fw_busreset(fc, FWBUSNOTREADY);
+	FW_GUNLOCK(fc);
 	fc->ibr(fc);
 
 	return 0;
@@ -642,11 +669,6 @@ fw_init_crom(struct firewire_comm *fc)
 {
 	struct crom_src *src;
 
-	fc->crom_src_buf = (struct crom_src_buf *)
-		malloc(sizeof(struct crom_src_buf), M_FW, M_WAITOK | M_ZERO);
-	if (fc->crom_src_buf == NULL)
-		return;
-
 	src = &fc->crom_src_buf->src;
 	bzero(src, sizeof(struct crom_src));
 
@@ -663,7 +685,7 @@ fw_init_crom(struct firewire_comm *fc)
 	src->businfo.cyc_clk_acc = 100;
 	src->businfo.max_rec = fc->maxrec;
 	src->businfo.max_rom = MAXROM_4;
-	src->businfo.generation = 1;
+	src->businfo.generation = 0;
 	src->businfo.link_spd = fc->speed;
 
 	src->businfo.eui64.hi = fc->eui.hi;
@@ -682,9 +704,6 @@ fw_reset_crom(struct firewire_comm *fc)
 	struct crom_src *src;
 	struct crom_chunk *root;
 
-	if (fc->crom_src_buf == NULL)
-		fw_init_crom(fc);
-
 	buf =  fc->crom_src_buf;
 	src = fc->crom_src;
 	root = fc->crom_root;
@@ -715,18 +734,18 @@ fw_busreset(struct firewire_comm *fc, ui
 	struct firewire_dev_comm *fdc;
 	struct crom_src *src;
 	device_t *devlistp;
-	void *newrom;
 	int i, devcnt;
 
-	switch(fc->status){
-	case FWBUSMGRELECT:
+	FW_GLOCK_ASSERT(fc);
+	if (fc->status == FWBUSMGRELECT)
 		callout_stop(&fc->bmr_callout);
-		break;
-	default:
-		break;
-	}
+
 	fc->status = new_status;
 	fw_reset_csr(fc);
+
+	if (fc->status == FWBUSNOTREADY)
+		fw_init_crom(fc);
+
 	fw_reset_crom(fc);
 
 	if (device_get_children(fc->bdev, &devlistp, &devcnt) == 0) {
@@ -739,19 +758,19 @@ fw_busreset(struct firewire_comm *fc, ui
 		free(devlistp, M_TEMP);
 	}
 
-	newrom = malloc(CROMSIZE, M_FW, M_NOWAIT | M_ZERO);
 	src = &fc->crom_src_buf->src;
-	crom_load(src, (uint32_t *)newrom, CROMSIZE);
-	if (bcmp(newrom, fc->config_rom, CROMSIZE) != 0) {
-		/* bump generation and reload */
-		src->businfo.generation ++;
-		/* generation must be between 0x2 and 0xF */
-		if (src->businfo.generation < 2)
-			src->businfo.generation ++;
-		crom_load(src, (uint32_t *)newrom, CROMSIZE);
-		bcopy(newrom, (void *)fc->config_rom, CROMSIZE);
-	}
-	free(newrom, M_FW);
+	/*
+	 * If the old config rom needs to be overwritten,
+	 * bump the businfo.generation indicator to 
+	 * indicate that we need to be reprobed
+	 */
+	if (bcmp(src, fc->config_rom, CROMSIZE) != 0) {
+		/* generation is a 2 bit field */
+		/* valid values are only from 0 - 3 */
+		src->businfo.generation = 1;
+		bcopy(src, (void *)fc->config_rom, CROMSIZE);
+	} else
+		src->businfo.generation = 0;
 }
 
 /* Call once after reboot */
@@ -807,13 +826,7 @@ void fw_init(struct firewire_comm *fc)
 		fc->ir[i]->maxq = FWMAXQUEUE;
 		fc->it[i]->maxq = FWMAXQUEUE;
 	}
-/* Initialize csr registers */
-	fc->topology_map = (struct fw_topology_map *)malloc(
-				sizeof(struct fw_topology_map),
-				M_FW, M_NOWAIT | M_ZERO);
-	fc->speed_map = (struct fw_speed_map *)malloc(
-				sizeof(struct fw_speed_map),
-				M_FW, M_NOWAIT | M_ZERO);
+
 	CSRARC(fc, TOPO_MAP) = 0x3f1 << 16;
 	CSRARC(fc, TOPO_MAP + 4) = 1;
 	CSRARC(fc, SPED_MAP) = 0x3f1 << 16;
@@ -1559,7 +1572,7 @@ fw_explore_node(struct fw_device *dfwdev
 	/* unchanged ? */
 	if (bcmp(&csr[0], &fwdev->csrrom[0], sizeof(uint32_t) * 5) == 0) {
 		if (firewire_debug)
-			printf("node%d: crom unchanged\n", node);
+			device_printf(fc->dev, "node%d: crom unchanged\n", node);
 		return (0);
 	}
 

Modified: head/sys/dev/firewire/fwohci.c
==============================================================================
--- head/sys/dev/firewire/fwohci.c	Sun Feb  1 23:27:21 2009	(r187992)
+++ head/sys/dev/firewire/fwohci.c	Sun Feb  1 23:28:52 2009	(r187993)
@@ -1003,7 +1003,7 @@ again:
 	if (maxdesc < db_tr->dbcnt) {
 		maxdesc = db_tr->dbcnt;
 		if (firewire_debug)
-			device_printf(sc->fc.dev, "maxdesc: %d\n", maxdesc);
+			device_printf(sc->fc.dev, "%s: maxdesc %d\n", __func__, maxdesc);
 	}
 	/* last db */
 	LAST_DB(db_tr, db);
@@ -1842,6 +1842,7 @@ fwohci_intr_core(struct fwohci_softc *sc
 	struct firewire_comm *fc = (struct firewire_comm *)sc;
 	uint32_t node_id, plen;
 
+	FW_GLOCK_ASSERT(fc);
 	if ((stat & OHCI_INT_PHY_BUS_R) && (fc->status != FWBUSRESET)) {
 		fc->status = FWBUSRESET;
 		/* Disable bus reset interrupt until sid recv. */
@@ -1884,8 +1885,8 @@ fwohci_intr_core(struct fwohci_softc *sc
 		plen = OREAD(sc, OHCI_SID_CNT);
 
 		fc->nodeid = node_id & 0x3f;
-		device_printf(fc->dev, "node_id=0x%08x, gen=%d, ",
-			node_id, (plen >> 16) & 0xff);
+		device_printf(fc->dev, "node_id=0x%08x, SelfID Count=%d, ",
+				fc->nodeid, (plen >> 16) & 0xff);
 		if (!(node_id & OHCI_NODE_VALID)) {
 			printf("Bus reset failure\n");
 			goto sidout;
@@ -1996,9 +1997,11 @@ fwohci_task_busreset(void *arg, int pend
 {
 	struct fwohci_softc *sc = (struct fwohci_softc *)arg;
 
+	FW_GLOCK(&sc->fc);
 	fw_busreset(&sc->fc, FWBUSRESET);
 	OWRITE(sc, OHCI_CROMHDR, ntohl(sc->fc.config_rom[0]));
 	OWRITE(sc, OHCI_BUS_OPT, ntohl(sc->fc.config_rom[2]));
+	FW_GUNLOCK(&sc->fc);
 }
 
 static void
@@ -2010,6 +2013,10 @@ fwohci_task_sid(void *arg, int pending)
 	int i, plen;
 
 
+	/*
+	 * We really should have locking
+	 * here.  Not sure why it's not
+	 */
 	plen = OREAD(sc, OHCI_SID_CNT);
 
 	if (plen & OHCI_SID_ERR) {
@@ -2029,14 +2036,13 @@ fwohci_task_sid(void *arg, int pending)
 	}
 	for (i = 0; i < plen / 4; i ++)
 		buf[i] = FWOHCI_DMA_READ(sc->sid_buf[i+1]);
-#if 1 /* XXX needed?? */
+
 	/* pending all pre-bus_reset packets */
 	fwohci_txd(sc, &sc->atrq);
 	fwohci_txd(sc, &sc->atrs);
 	fwohci_arcv(sc, &sc->arrs, -1);
 	fwohci_arcv(sc, &sc->arrq, -1);
 	fw_drain_txq(fc);
-#endif
 	fw_sidrcv(fc, buf, plen);
 	free(buf, M_FW);
 }
@@ -2061,6 +2067,7 @@ fwohci_check_stat(struct fwohci_softc *s
 {
 	uint32_t stat, irstat, itstat;
 
+	FW_GLOCK_ASSERT(&sc->fc);
 	stat = OREAD(sc, FWOHCI_INTSTAT);
 	if (stat == 0xffffffff) {
 		device_printf(sc->fc.dev, 
@@ -2090,29 +2097,24 @@ fwohci_check_stat(struct fwohci_softc *s
 	return (FILTER_HANDLED);
 }
 
-int
-fwohci_filt(void *arg)
-{
-	struct fwohci_softc *sc = (struct fwohci_softc *)arg;
-
-	if (!(sc->intmask & OHCI_INT_EN)) {
-		/* polling mode */
-		return (FILTER_STRAY);
-	}
-	return (fwohci_check_stat(sc));
-}
-
 void
 fwohci_intr(void *arg)
 {
-	fwohci_filt(arg);
+	struct fwohci_softc *sc = (struct fwohci_softc *)arg;
+
+	FW_GLOCK(&sc->fc);
+	fwohci_check_stat(sc);
+	FW_GUNLOCK(&sc->fc);
 }
 
 void
 fwohci_poll(struct firewire_comm *fc, int quick, int count)
 {
 	struct fwohci_softc *sc = (struct fwohci_softc *)fc;
+
+	FW_GLOCK(fc);
 	fwohci_check_stat(sc);
+	FW_GUNLOCK(fc);
 }
 
 static void
@@ -2466,6 +2468,7 @@ fwohci_ibr(struct firewire_comm *fc)
 	device_printf(fc->dev, "Initiate bus reset\n");
 	sc = (struct fwohci_softc *)fc;
 
+	FW_GLOCK(fc);
 	/*
 	 * Make sure our cached values from the config rom are
 	 * initialised.
@@ -2486,6 +2489,7 @@ fwohci_ibr(struct firewire_comm *fc)
 	fun |= FW_PHY_ISBR | FW_PHY_RHB;
 	fun = fwphy_wrdata(sc, FW_PHY_ISBR_REG, fun);
 #endif
+	FW_GUNLOCK(fc);
 }
 
 void

Modified: head/sys/dev/firewire/fwohci_pci.c
==============================================================================
--- head/sys/dev/firewire/fwohci_pci.c	Sun Feb  1 23:27:21 2009	(r187992)
+++ head/sys/dev/firewire/fwohci_pci.c	Sun Feb  1 23:28:52 2009	(r187993)
@@ -334,14 +334,11 @@ fwohci_pci_attach(device_t self)
 		return ENXIO;
 	}
 
-
 	err = bus_setup_intr(self, sc->irq_res,
-			INTR_TYPE_NET | INTR_MPSAFE,
-#if FWOHCI_INTFILT
-		     fwohci_filt, NULL, sc, &sc->ih);
-#else
-		     NULL, (driver_intr_t *) fwohci_intr, sc, &sc->ih);
-#endif
+				INTR_TYPE_NET | INTR_MPSAFE,
+				NULL, (driver_intr_t *) fwohci_intr,
+				sc, &sc->ih);
+
 #if defined(__DragonFly__) || __FreeBSD_version < 500000
 	/* XXX splcam() should mask this irq for sbp.c*/
 	err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_CAM,

Modified: head/sys/dev/firewire/fwohcivar.h
==============================================================================
--- head/sys/dev/firewire/fwohcivar.h	Sun Feb  1 23:27:21 2009	(r187992)
+++ head/sys/dev/firewire/fwohcivar.h	Sun Feb  1 23:28:52 2009	(r187993)
@@ -37,12 +37,6 @@
 
 #include <sys/taskqueue.h>
 
-#if defined(__DragonFly__) ||  __FreeBSD_version < 700043
-#define FWOHCI_INTFILT	0
-#else
-#define FWOHCI_INTFILT	1
-#endif
-
 typedef struct fwohci_softc {
 	struct firewire_comm fc;
 	bus_space_tag_t bst;
@@ -84,7 +78,7 @@ typedef struct fwohci_softc {
 } fwohci_softc_t;
 
 void fwohci_intr (void *arg);
-int fwohci_filt (void *arg);
+void fwohci_filt (void *arg);
 int fwohci_init (struct fwohci_softc *, device_t);
 void fwohci_poll (struct firewire_comm *, int, int);
 void fwohci_reset (struct fwohci_softc *, device_t);

Modified: head/sys/dev/firewire/sbp.c
==============================================================================
--- head/sys/dev/firewire/sbp.c	Sun Feb  1 23:27:21 2009	(r187992)
+++ head/sys/dev/firewire/sbp.c	Sun Feb  1 23:28:52 2009	(r187993)
@@ -493,6 +493,7 @@ END_DEBUG
 			/* lost device */
 			sbp_cam_detach_sdev(sdev);
 			sbp_free_sdev(sdev);
+			target->luns[lun] = NULL;
 		}
 	}
 
@@ -781,7 +782,9 @@ END_DEBUG
 					SBP_UNLOCK(sbp);
 				}
 				sdev->status = SBP_DEV_RETRY;
-				sbp_abort_all_ocbs(sdev, CAM_SCSI_BUS_RESET);
+				sbp_cam_detach_sdev(sdev);
+				sbp_free_sdev(sdev);
+				target->luns[i] = NULL;
 				break;
 			case SBP_DEV_PROBE:
 			case SBP_DEV_TOATTACH:
@@ -1255,11 +1258,18 @@ END_DEBUG
 		htonl(((sdev->target->sbp->fd.fc->nodeid | FWLOCALBUS )<< 16));
 	xfer->send.payload[1] = htonl((uint32_t)ocb->bus_addr);
 
+	/*
+	 * sbp_xfer_free() will attempt to acquire
+	 * the SBP lock on entrance.  Also, this removes
+	 * a LOR between the firewire layer and sbp
+	 */
+	SBP_UNLOCK(sdev->target->sbp);
 	if(fw_asyreq(xfer->fc, -1, xfer) != 0){
 			sbp_xfer_free(xfer);
 			ocb->ccb->ccb_h.status = CAM_REQ_INVALID;
 			xpt_done(ocb->ccb);
 	}
+	SBP_LOCK(sdev->target->sbp);
 }
 
 static void
@@ -2123,6 +2133,7 @@ sbp_free_sdev(struct sbp_dev *sdev)
 		    sdev->ocb[i].dmamap);
 	fwdma_free(sdev->target->sbp->fd.fc, &sdev->dma);
 	free(sdev, M_SBP);
+	sdev = NULL;
 }
 
 static void

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 00:49:40 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3FBAE1065673;
	Mon,  2 Feb 2009 00:49:40 +0000 (UTC)
	(envelope-from alfred@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2A1968FC14;
	Mon,  2 Feb 2009 00:49:40 +0000 (UTC)
	(envelope-from alfred@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n120neLv070751;
	Mon, 2 Feb 2009 00:49:40 GMT (envelope-from alfred@svn.freebsd.org)
Received: (from alfred@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n120ndkc070738;
	Mon, 2 Feb 2009 00:49:39 GMT (envelope-from alfred@svn.freebsd.org)
Message-Id: <200902020049.n120ndkc070738@svn.freebsd.org>
From: Alfred Perlstein <alfred@FreeBSD.org>
Date: Mon, 2 Feb 2009 00:49:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r187994 - in head: lib/libusbhid sys/dev/usb2/bluetooth
	sys/dev/usb2/core sys/dev/usb2/include sys/dev/usb2/input
	sys/dev/usb2/serial usr.bin/usbhidaction usr.bin/usbhidctl
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 00:49:40 -0000

Author: alfred
Date: Mon Feb  2 00:49:39 2009
New Revision: 187994
URL: http://svn.freebsd.org/changeset/base/187994

Log:
  src/usr.bin/usbhidaction/usbhidaction.c
  src/usr.bin/usbhidctl/usbhid.c
  src/sys/dev/usb2/include/usb2_hid.h
  src/sys/dev/usb2/input/uhid2.c
  src/lib/libusbhid/Makefile
  src/lib/libusbhid/descr.c
  src/lib/libusbhid/descr_compat.c
  src/lib/libusbhid/usbhid.3
  src/lib/libusbhid/usbhid.h
  src/lib/libusbhid/usbvar.h
  
  Patches to make libusbhid and HID userland utilities compatible with
  the new USB stack. All HID ioctls should go through the libusbhid
  library to ensure compatibility. I have found at least one piece of
  software in /usr/ports which needs to get updated before USB HID
  devices will work. This is the X joystick input driver.
  
  Reported and tested by:
  
  Daichi GOTO and Masanori OZAWA.
  
  src/sys/dev/usb2/core/usb2_process.c
  
  Correct USB process names.
  
  Reported by:
  
  Andre Guibert de Bruet
  
  src/sys/dev/usb2/serial/uftdi2.c
  
  Integrate changes from old USB stack.
  
  Submitted by:	hps

Added:
  head/lib/libusbhid/descr_compat.c   (contents, props changed)
Modified:
  head/lib/libusbhid/Makefile
  head/lib/libusbhid/descr.c
  head/lib/libusbhid/usbhid.3
  head/lib/libusbhid/usbhid.h
  head/lib/libusbhid/usbvar.h
  head/sys/dev/usb2/bluetooth/ubtbcmfw2.c
  head/sys/dev/usb2/core/usb2_process.c
  head/sys/dev/usb2/include/usb2_hid.h
  head/sys/dev/usb2/input/uhid2.c
  head/sys/dev/usb2/serial/uftdi2.c
  head/usr.bin/usbhidaction/usbhidaction.c
  head/usr.bin/usbhidctl/usbhid.c

Modified: head/lib/libusbhid/Makefile
==============================================================================
--- head/lib/libusbhid/Makefile	Sun Feb  1 23:28:52 2009	(r187993)
+++ head/lib/libusbhid/Makefile	Mon Feb  2 00:49:39 2009	(r187994)
@@ -15,7 +15,7 @@ MLINKS=	usbhid.3 libusbhid.3 usbhid.3 hi
 	usbhid.3 hid_init.3 \
 	usbhid.3 hid_get_data.3 usbhid.3 hid_set_data.3
 
-SRCS=	descr.c parse.c usage.c data.c
+SRCS=	descr.c descr_compat.c parse.c usage.c data.c
 
 INCS=	usbhid.h
 

Modified: head/lib/libusbhid/descr.c
==============================================================================
--- head/lib/libusbhid/descr.c	Sun Feb  1 23:28:52 2009	(r187993)
+++ head/lib/libusbhid/descr.c	Mon Feb  2 00:49:39 2009	(r187994)
@@ -39,21 +39,83 @@ __FBSDID("$FreeBSD$");
 #include <sys/time.h>
 #include <sys/ioctl.h>
 
-#include <dev/usb/usb.h>
+#include <dev/usb2/include/usb2_ioctl.h>
 
 #include "usbhid.h"
 #include "usbvar.h"
 
+int
+hid_set_immed(int fd, int enable)
+{
+	int ret;
+	ret = ioctl(fd, USB_SET_IMMED, &enable);
+	if (ret < 0)
+		ret = hid_set_immed_compat7(fd, enable);
+	return (ret);
+}
+
+int
+hid_get_report_id(int fd)
+{
+	int temp = -1;
+	int ret;
+
+	ret = ioctl(fd, USB_GET_REPORT_ID, &temp);
+	if (ret < 0)
+		ret = hid_get_report_id_compat7(fd);
+	else
+		ret = temp;
+
+	return (ret);
+}
+
 report_desc_t
 hid_get_report_desc(int fd)
 {
-	struct usb_ctl_report_desc rep;
+	struct usb2_gen_descriptor ugd;
+	report_desc_t rep;
+	void *data;
+
+	memset(&ugd, 0, sizeof(ugd));
+
+	/* get actual length first */
+	ugd.ugd_data = NULL;
+	ugd.ugd_maxlen = 65535;
+	if (ioctl(fd, USB_GET_REPORT_DESC, &ugd) < 0) {
+		/* could not read descriptor */
+		/* try FreeBSD 7 compat code */
+		return (hid_get_report_desc_compat7(fd));
+	}
 
-	rep.ucrd_size = 0;
-	if (ioctl(fd, USB_GET_REPORT_DESC, &rep) < 0)
+	/*
+	 * NOTE: The kernel will return a failure if 
+	 * "ugd_actlen" is zero.
+	 */
+	data = malloc(ugd.ugd_actlen);
+	if (data == NULL)
 		return (NULL);
 
-	return hid_use_report_desc(rep.ucrd_data, (unsigned int)rep.ucrd_size);
+	/* fetch actual descriptor */
+	ugd.ugd_data = data;
+	ugd.ugd_maxlen = ugd.ugd_actlen;
+	if (ioctl(fd, USB_GET_REPORT_DESC, &ugd) < 0) {
+		/* could not read descriptor */
+		free(data);
+		return (NULL);
+	}
+
+	/* check END_COLLECTION */
+	if (((unsigned char *)ugd.ugd_data)[ugd.ugd_actlen -1] != 0xC0) {
+		/* invalid end byte */
+		free(data);
+		return (NULL);
+	}
+
+	rep = hid_use_report_desc(data, ugd.ugd_actlen);
+
+	free(data);
+
+	return (rep);
 }
 
 report_desc_t

Added: head/lib/libusbhid/descr_compat.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libusbhid/descr_compat.c	Mon Feb  2 00:49:39 2009	(r187994)
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * This file contains fallback-compatibility code for the old FreeBSD
+ * USB stack.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+
+#include <dev/usb/usb.h>
+
+#include "usbhid.h"
+#include "usbvar.h"
+
+int
+hid_set_immed_compat7(int fd, int enable)
+{
+	return (ioctl(fd, USB_SET_IMMED, &enable));
+}
+
+int
+hid_get_report_id_compat7(int fd)
+{
+	int temp = -1;
+
+	if (ioctl(fd, USB_GET_REPORT_ID, &temp) < 0)
+		return (-1);
+
+	return (temp);
+}
+
+report_desc_t
+hid_get_report_desc_compat7(int fd)
+{
+	struct usb_ctl_report_desc rep;
+
+	rep.ucrd_size = 0;
+	if (ioctl(fd, USB_GET_REPORT_DESC, &rep) < 0)
+		return (NULL);
+
+	return (hid_use_report_desc(rep.ucrd_data, (unsigned int)rep.ucrd_size));
+}

Modified: head/lib/libusbhid/usbhid.3
==============================================================================
--- head/lib/libusbhid/usbhid.3	Sun Feb  1 23:28:52 2009	(r187993)
+++ head/lib/libusbhid/usbhid.3	Mon Feb  2 00:49:39 2009	(r187994)
@@ -26,12 +26,13 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 29, 2001
+.Dd January 27, 2009
 .Dt USBHID 3
 .Os
 .Sh NAME
 .Nm usbhid ,
 .Nm hid_get_report_desc ,
+.Nm hid_get_report_id ,
 .Nm hid_use_report_desc ,
 .Nm hid_dispose_report_desc ,
 .Nm hid_start_parse ,
@@ -51,6 +52,10 @@
 .In usbhid.h
 .Ft report_desc_t
 .Fn hid_get_report_desc "int file"
+.Ft int
+.Fn hid_get_report_id "int file"
+.Ft int
+.Fn hid_set_immed "int fd" "int enable"
 .Ft report_desc_t
 .Fn hid_use_report_desc "unsigned char *data" "unsigned int size"
 .Ft void
@@ -94,7 +99,15 @@ which contains the data layout informati
 The routines can be divided into four parts: extraction of the descriptor,
 parsing of the descriptor, translating to/from symbolic names, and
 data manipulation.
+.Ss Synchronous HID operation
+Synchronous HID operation can be enabled or disabled by a call to
+.Fn hid_set_immed .
+If the second argument is zero synchronous HID operation is disabled.
+Else synchronous HID operation is enabled.
+The function returns a negative value on failure.
 .Ss Descriptor Functions
+The report descriptor ID can be obtained by calling
+.Fn hid_get_report_id .
 A report descriptor can be obtained by calling
 .Fn hid_get_report_desc
 with a file descriptor obtained by opening a

Modified: head/lib/libusbhid/usbhid.h
==============================================================================
--- head/lib/libusbhid/usbhid.h	Sun Feb  1 23:28:52 2009	(r187993)
+++ head/lib/libusbhid/usbhid.h	Mon Feb  2 00:49:39 2009	(r187994)
@@ -87,6 +87,8 @@ __BEGIN_DECLS
 report_desc_t hid_get_report_desc(int file);
 report_desc_t hid_use_report_desc(unsigned char *data, unsigned int size);
 void hid_dispose_report_desc(report_desc_t);
+int hid_get_report_id(int file);
+int hid_set_immed(int fd, int enable);
 
 /* Parsing of a HID report descriptor, parse.c: */
 hid_data_t hid_start_parse(report_desc_t d, int kindset, int id);

Modified: head/lib/libusbhid/usbvar.h
==============================================================================
--- head/lib/libusbhid/usbvar.h	Sun Feb  1 23:28:52 2009	(r187993)
+++ head/lib/libusbhid/usbvar.h	Mon Feb  2 00:49:39 2009	(r187994)
@@ -34,3 +34,8 @@ struct report_desc {
 	unsigned char data[1];
 };
 
+/* internal backwards compatibility functions */
+
+int	hid_set_immed_compat7(int fd, int enable);
+int	hid_get_report_id_compat7(int fd);
+report_desc_t	hid_get_report_desc_compat7(int fd);

Modified: head/sys/dev/usb2/bluetooth/ubtbcmfw2.c
==============================================================================
--- head/sys/dev/usb2/bluetooth/ubtbcmfw2.c	Sun Feb  1 23:28:52 2009	(r187993)
+++ head/sys/dev/usb2/bluetooth/ubtbcmfw2.c	Mon Feb  2 00:49:39 2009	(r187994)
@@ -385,8 +385,8 @@ ubtbcmfw_open(struct usb2_fifo *fifo, in
 	else if (fflags & FWRITE)
 		xfer = sc->sc_xfer[UBTBCMFW_BULK_DT_WR];
 	else
-		return (EINVAL);	/* XXX can happen? */
-		
+		return (EINVAL);	/* should not happen */
+
 	if (usb2_fifo_alloc_buffer(fifo, xfer->max_data_length,
 			UBTBCMFW_IFQ_MAXLEN) != 0)
 		return (ENOMEM);

Modified: head/sys/dev/usb2/core/usb2_process.c
==============================================================================
--- head/sys/dev/usb2/core/usb2_process.c	Sun Feb  1 23:28:52 2009	(r187993)
+++ head/sys/dev/usb2/core/usb2_process.c	Mon Feb  2 00:49:39 2009	(r187994)
@@ -184,11 +184,11 @@ usb2_proc_setup(struct usb2_process *up,
 
 	TAILQ_INIT(&up->up_qhead);
 
-	usb2_cv_init(&up->up_cv, "WMSG");
-	usb2_cv_init(&up->up_drain, "DMSG");
+	usb2_cv_init(&up->up_cv, "wmsg");
+	usb2_cv_init(&up->up_drain, "dmsg");
 
 	if (USB_THREAD_CREATE(&usb2_process, up,
-	    &up->up_ptr, "USBPROC")) {
+	    &up->up_ptr, "usbproc")) {
 		DPRINTFN(0, "Unable to create USB process.");
 		up->up_ptr = NULL;
 		goto error;

Modified: head/sys/dev/usb2/include/usb2_hid.h
==============================================================================
--- head/sys/dev/usb2/include/usb2_hid.h	Sun Feb  1 23:28:52 2009	(r187993)
+++ head/sys/dev/usb2/include/usb2_hid.h	Mon Feb  2 00:49:39 2009	(r187994)
@@ -29,6 +29,8 @@
 #ifndef _USB2_HID_H_
 #define	_USB2_HID_H_
 
+#include <dev/usb2/include/usb2_endian.h>
+
 #define	UR_GET_HID_DESCRIPTOR	0x06
 #define	UDESC_HID		0x21
 #define	UDESC_REPORT		0x22

Modified: head/sys/dev/usb2/input/uhid2.c
==============================================================================
--- head/sys/dev/usb2/input/uhid2.c	Sun Feb  1 23:28:52 2009	(r187993)
+++ head/sys/dev/usb2/input/uhid2.c	Mon Feb  2 00:49:39 2009	(r187994)
@@ -87,10 +87,9 @@ SYSCTL_INT(_hw_usb2_uhid, OID_AUTO, debu
 
 enum {
 	UHID_INTR_DT_RD,
-	UHID_INTR_CS_RD,
 	UHID_CTRL_DT_WR,
 	UHID_CTRL_DT_RD,
-	UHID_N_TRANSFER = 4,
+	UHID_N_TRANSFER,
 };
 
 struct uhid_softc {
@@ -114,7 +113,6 @@ struct uhid_softc {
 	uint8_t	sc_fid;
 	uint8_t	sc_flags;
 #define	UHID_FLAG_IMMED        0x01	/* set if read should be immediate */
-#define	UHID_FLAG_INTR_STALL   0x02	/* set if interrupt transfer stalled */
 #define	UHID_FLAG_STATIC_DESC  0x04	/* set if report descriptors are
 					 * static */
 };
@@ -130,7 +128,6 @@ static device_attach_t uhid_attach;
 static device_detach_t uhid_detach;
 
 static usb2_callback_t uhid_intr_callback;
-static usb2_callback_t uhid_intr_clear_stall_callback;
 static usb2_callback_t uhid_write_callback;
 static usb2_callback_t uhid_read_callback;
 
@@ -174,41 +171,25 @@ uhid_intr_callback(struct usb2_xfer *xfe
 		}
 
 	case USB_ST_SETUP:
-		if (sc->sc_flags & UHID_FLAG_INTR_STALL) {
-			usb2_transfer_start(sc->sc_xfer[UHID_INTR_CS_RD]);
-		} else {
-			if (usb2_fifo_put_bytes_max(
-			    sc->sc_fifo.fp[USB_FIFO_RX]) != 0) {
-				xfer->frlengths[0] = xfer->max_data_length;
-				usb2_start_hardware(xfer);
-			}
+re_submit:
+		if (usb2_fifo_put_bytes_max(
+		    sc->sc_fifo.fp[USB_FIFO_RX]) != 0) {
+			xfer->frlengths[0] = sc->sc_isize;
+			usb2_start_hardware(xfer);
 		}
 		return;
 
 	default:			/* Error */
 		if (xfer->error != USB_ERR_CANCELLED) {
 			/* try to clear stall first */
-			sc->sc_flags |= UHID_FLAG_INTR_STALL;
-			usb2_transfer_start(sc->sc_xfer[UHID_INTR_CS_RD]);
+			xfer->flags.stall_pipe = 1;
+			goto re_submit;
 		}
 		return;
 	}
 }
 
 static void
-uhid_intr_clear_stall_callback(struct usb2_xfer *xfer)
-{
-	struct uhid_softc *sc = xfer->priv_sc;
-	struct usb2_xfer *xfer_other = sc->sc_xfer[UHID_INTR_DT_RD];
-
-	if (usb2_clear_stall_callback(xfer, xfer_other)) {
-		DPRINTF("stall cleared\n");
-		sc->sc_flags &= ~UHID_FLAG_INTR_STALL;
-		usb2_transfer_start(xfer_other);
-	}
-}
-
-static void
 uhid_fill_set_report(struct usb2_device_request *req, uint8_t iface_no,
     uint8_t type, uint8_t id, uint16_t size)
 {
@@ -337,20 +318,10 @@ static const struct usb2_config uhid_con
 		.endpoint = UE_ADDR_ANY,
 		.direction = UE_DIR_IN,
 		.mh.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
-		.mh.bufsize = 0,	/* use wMaxPacketSize */
+		.mh.bufsize = UHID_BSIZE,
 		.mh.callback = &uhid_intr_callback,
 	},
 
-	[UHID_INTR_CS_RD] = {
-		.type = UE_CONTROL,
-		.endpoint = 0x00,	/* Control pipe */
-		.direction = UE_DIR_ANY,
-		.mh.bufsize = sizeof(struct usb2_device_request),
-		.mh.callback = &uhid_intr_clear_stall_callback,
-		.mh.timeout = 1000,	/* 1 second */
-		.mh.interval = 50,	/* 50ms */
-	},
-
 	[UHID_CTRL_DT_WR] = {
 		.type = UE_CONTROL,
 		.endpoint = 0x00,	/* Control pipe */
@@ -530,6 +501,8 @@ uhid_ioctl(struct usb2_fifo *fifo, u_lon
 			size = sc->sc_repdesc_size;
 		}
 		ugd->ugd_actlen = size;
+		if (ugd->ugd_data == NULL)
+			break;		/* descriptor length only */
 		error = copyout(sc->sc_repdesc_ptr, ugd->ugd_data, size);
 		break;
 

Modified: head/sys/dev/usb2/serial/uftdi2.c
==============================================================================
--- head/sys/dev/usb2/serial/uftdi2.c	Sun Feb  1 23:28:52 2009	(r187993)
+++ head/sys/dev/usb2/serial/uftdi2.c	Mon Feb  2 00:49:39 2009	(r187994)
@@ -233,6 +233,7 @@ MODULE_DEPEND(uftdi, usb2_serial, 1, 1, 
 MODULE_DEPEND(uftdi, usb2_core, 1, 1, 1);
 
 static struct usb2_device_id uftdi_devs[] = {
+	{USB_VPI(USB_VENDOR_DRESDENELEKTRONIK, USB_PRODUCT_DRESDENELEKTRONIK_SENSORTERMINALBOARD, UFTDI_TYPE_8U232AM)},
 	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U100AX, UFTDI_TYPE_SIO)},
 	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_2232C, UFTDI_TYPE_8U232AM)},
 	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U232AM, UFTDI_TYPE_8U232AM)},

Modified: head/usr.bin/usbhidaction/usbhidaction.c
==============================================================================
--- head/usr.bin/usbhidaction/usbhidaction.c	Sun Feb  1 23:28:52 2009	(r187993)
+++ head/usr.bin/usbhidaction/usbhidaction.c	Mon Feb  2 00:49:39 2009	(r187994)
@@ -46,9 +46,7 @@
 #include <limits.h>
 #include <unistd.h>
 #include <sys/types.h>
-#include <sys/ioctl.h>
-#include <dev/usb/usb.h>
-#include <dev/usb/usbhid.h>
+#include <dev/usb2/include/usb2_hid.h>
 #include <usbhid.h>
 #include <syslog.h>
 #include <signal.h>
@@ -155,8 +153,7 @@ main(int argc, char **argv)
 	fd = open(dev, O_RDWR);
 	if (fd < 0)
 		err(1, "%s", dev);
-	if (ioctl(fd, USB_GET_REPORT_ID, &reportid) < 0)
-		reportid = -1;
+	reportid = hid_get_report_id(fd);
 	repd = hid_get_report_desc(fd);
 	if (repd == NULL)
 		err(1, "hid_get_report_desc() failed");

Modified: head/usr.bin/usbhidctl/usbhid.c
==============================================================================
--- head/usr.bin/usbhidctl/usbhid.c	Sun Feb  1 23:28:52 2009	(r187993)
+++ head/usr.bin/usbhidctl/usbhid.c	Mon Feb  2 00:49:39 2009	(r187994)
@@ -42,14 +42,12 @@
 #include <string.h>
 #include <sys/types.h>
 #include <fcntl.h>
-#include <sys/ioctl.h>
 #include <unistd.h>
 #include <err.h>
 #include <ctype.h>
 #include <errno.h>
 #include <usbhid.h>
-#include <dev/usb/usb.h>
-#include <dev/usb/usbhid.h>
+#include <dev/usb2/include/usb2_hid.h>
 
 int verbose = 0;
 int all = 0;
@@ -207,7 +205,6 @@ dumpdata(int f, report_desc_t rd, int lo
 	struct hid_item h, *hids, *n;
 	int r, dlen;
 	u_char *dbuf;
-	static int one = 1;
 	u_int32_t colls[100];
 	int sp = 0;
 	char namebuf[10000], *namep;
@@ -231,7 +228,7 @@ dumpdata(int f, report_desc_t rd, int lo
 	dlen = hid_report_size(rd, hid_input, 0);
 	dbuf = malloc(dlen);
 	if (!loop)
-		if (ioctl(f, USB_SET_IMMED, &one) < 0) {
+		if (hid_set_immed(f, 1) < 0) {
 			if (errno == EOPNOTSUPP)
 				warnx("device does not support immediate mode, only changes reported.");
 			else

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 02:05:59 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3D3CF1065670;
	Mon,  2 Feb 2009 02:05:59 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1164B8FC0C;
	Mon,  2 Feb 2009 02:05:59 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1225wBA077983;
	Mon, 2 Feb 2009 02:05:58 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1225w8V077982;
	Mon, 2 Feb 2009 02:05:58 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902020205.n1225w8V077982@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Mon, 2 Feb 2009 02:05:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r187995 - head/usr.bin/make
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 02:05:59 -0000

Author: imp
Date: Mon Feb  2 02:05:58 2009
New Revision: 187995
URL: http://svn.freebsd.org/changeset/base/187995

Log:
  Sort the options, per style(9).
  
  Reviewed by:	obrien@

Modified:
  head/usr.bin/make/main.c

Modified: head/usr.bin/make/main.c
==============================================================================
--- head/usr.bin/make/main.c	Mon Feb  2 00:49:39 2009	(r187994)
+++ head/usr.bin/make/main.c	Mon Feb  2 02:05:58 2009	(r187995)
@@ -372,6 +372,7 @@ rearg:
 	optind = 1;	/* since we're called more than once */
 	optreset = 1;
 #define OPTFLAGS "ABC:D:E:I:PSV:Xd:ef:ij:km:nQpqrstvx:"
+#define OPTFLAGS "ABC:D:d:E:ef:I:ij:km:nPpQqrSstV:vXx:"
 	for (;;) {
 		if ((optind < argc) && strcmp(argv[optind], "--") == 0) {
 			found_dd = TRUE;
@@ -385,6 +386,11 @@ rearg:
 			arch_fatal = FALSE;
 			MFLAGS_append("-A", NULL);
 			break;
+		case 'B':
+			compatMake = TRUE;
+			MFLAGS_append("-B", NULL);
+			unsetenv("MAKE_JOBS_FIFO");
+			break;
 		case 'C':
 			if (chdir(optarg) == -1)
 				err(1, "chdir %s", optarg);
@@ -393,30 +399,6 @@ rearg:
 			Var_SetGlobal(optarg, "1");
 			MFLAGS_append("-D", optarg);
 			break;
-		case 'I':
-			Parse_AddIncludeDir(optarg);
-			MFLAGS_append("-I", optarg);
-			break;
-		case 'V':
-			Lst_AtEnd(&variables, estrdup(optarg));
-			MFLAGS_append("-V", optarg);
-			break;
-		case 'X':
-			expandVars = FALSE;
-			break;
-		case 'B':
-			compatMake = TRUE;
-			MFLAGS_append("-B", NULL);
-			unsetenv("MAKE_JOBS_FIFO");
-			break;
-		case 'P':
-			usePipes = FALSE;
-			MFLAGS_append("-P", NULL);
-			break;
-		case 'S':
-			keepgoing = FALSE;
-			MFLAGS_append("-S", NULL);
-			break;
 		case 'd': {
 			char *modules = optarg;
 
@@ -484,6 +466,10 @@ rearg:
 		case 'f':
 			Lst_AtEnd(&makefiles, estrdup(optarg));
 			break;
+		case 'I':
+			Parse_AddIncludeDir(optarg);
+			MFLAGS_append("-I", optarg);
+			break;
 		case 'i':
 			ignoreErrors = TRUE;
 			MFLAGS_append("-i", NULL);
@@ -513,6 +499,10 @@ rearg:
 			noExecute = TRUE;
 			MFLAGS_append("-n", NULL);
 			break;
+		case 'P':
+			usePipes = FALSE;
+			MFLAGS_append("-P", NULL);
+			break;
 		case 'p':
 			printGraphOnly = TRUE;
 			debug |= DEBUG_GRAPH1;
@@ -531,6 +521,10 @@ rearg:
 			noBuiltins = TRUE;
 			MFLAGS_append("-r", NULL);
 			break;
+		case 'S':
+			keepgoing = FALSE;
+			MFLAGS_append("-S", NULL);
+			break;
 		case 's':
 			beSilent = TRUE;
 			MFLAGS_append("-s", NULL);
@@ -539,11 +533,18 @@ rearg:
 			touchFlag = TRUE;
 			MFLAGS_append("-t", NULL);
 			break;
+		case 'V':
+			Lst_AtEnd(&variables, estrdup(optarg));
+			MFLAGS_append("-V", optarg);
+			break;
 		case 'v':
 			beVerbose = TRUE;
 			beQuiet = FALSE;
 			MFLAGS_append("-v", NULL);
 			break;
+		case 'X':
+			expandVars = FALSE;
+			break;
 		case 'x':
 			if (Main_ParseWarn(optarg, 1) != -1)
 				MFLAGS_append("-x", optarg);

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 03:34:40 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9FBD11065672;
	Mon,  2 Feb 2009 03:34:40 +0000 (UTC)
	(envelope-from sepotvin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 88D2F8FC12;
	Mon,  2 Feb 2009 03:34:40 +0000 (UTC)
	(envelope-from sepotvin@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n123YeQG079869;
	Mon, 2 Feb 2009 03:34:40 GMT (envelope-from sepotvin@svn.freebsd.org)
Received: (from sepotvin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n123YeMW079868;
	Mon, 2 Feb 2009 03:34:40 GMT (envelope-from sepotvin@svn.freebsd.org)
Message-Id: <200902020334.n123YeMW079868@svn.freebsd.org>
From: "Stephane E. Potvin" <sepotvin@FreeBSD.org>
Date: Mon, 2 Feb 2009 03:34:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r187996 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 03:34:41 -0000

Author: sepotvin
Date: Mon Feb  2 03:34:40 2009
New Revision: 187996
URL: http://svn.freebsd.org/changeset/base/187996

Log:
  Fix select on platforms where sizeof(long) != sizeof(int). This used
  to work by accident before the cleanup done in revision 187693.
  
  Approved by:	kan (mentor)

Modified:
  head/sys/kern/sys_generic.c

Modified: head/sys/kern/sys_generic.c
==============================================================================
--- head/sys/kern/sys_generic.c	Mon Feb  2 02:05:58 2009	(r187995)
+++ head/sys/kern/sys_generic.c	Mon Feb  2 03:34:40 2009	(r187996)
@@ -903,7 +903,7 @@ static int select_flags[3] = {
  * bit position in the fd_mask array.
  */
 static __inline int
-selflags(fd_mask **ibits, int idx, int bit)
+selflags(fd_mask **ibits, int idx, fd_mask bit)
 {
 	int flags;
 	int msk;
@@ -912,7 +912,7 @@ selflags(fd_mask **ibits, int idx, int b
 	for (msk = 0; msk < 3; msk++) {
 		if (ibits[msk] == NULL)
 			continue;
-		if ((ibits[msk][idx] & (fd_mask)bit) == 0)
+		if ((ibits[msk][idx] & bit) == 0)
 			continue;
 		flags |= select_flags[msk];
 	}

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 06:25:58 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5619F106566B;
	Mon,  2 Feb 2009 06:25:58 +0000 (UTC)
	(envelope-from fjoe@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E78DF8FC0A;
	Mon,  2 Feb 2009 06:25:57 +0000 (UTC)
	(envelope-from fjoe@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n126PvFx083158;
	Mon, 2 Feb 2009 06:25:57 GMT (envelope-from fjoe@svn.freebsd.org)
Received: (from fjoe@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n126Pvt6083157;
	Mon, 2 Feb 2009 06:25:57 GMT (envelope-from fjoe@svn.freebsd.org)
Message-Id: <200902020625.n126Pvt6083157@svn.freebsd.org>
From: Max Khon <fjoe@FreeBSD.org>
Date: Mon, 2 Feb 2009 06:25:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188001 - head/usr.bin/make
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 06:25:58 -0000

Author: fjoe
Date: Mon Feb  2 06:25:57 2009
New Revision: 188001
URL: http://svn.freebsd.org/changeset/base/188001

Log:
  Remove duplicate OPTFLAGS definition.

Modified:
  head/usr.bin/make/main.c

Modified: head/usr.bin/make/main.c
==============================================================================
--- head/usr.bin/make/main.c	Mon Feb  2 04:59:00 2009	(r188000)
+++ head/usr.bin/make/main.c	Mon Feb  2 06:25:57 2009	(r188001)
@@ -371,7 +371,6 @@ MainParseArgs(int argc, char **argv)
 rearg:
 	optind = 1;	/* since we're called more than once */
 	optreset = 1;
-#define OPTFLAGS "ABC:D:E:I:PSV:Xd:ef:ij:km:nQpqrstvx:"
 #define OPTFLAGS "ABC:D:d:E:ef:I:ij:km:nPpQqrSstV:vXx:"
 	for (;;) {
 		if ((optind < argc) && strcmp(argv[optind], "--") == 0) {

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 08:38:56 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 95C93106566B;
	Mon,  2 Feb 2009 08:38:56 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 569D58FC08;
	Mon,  2 Feb 2009 08:38:56 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n128aoEi001466;
	Mon, 2 Feb 2009 01:36:50 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Mon, 02 Feb 2009 01:37:13 -0700 (MST)
Message-Id: <20090202.013713.2007156486.imp@bsdimp.com>
To: fjoe@FreeBSD.org
From: "M. Warner Losh" <imp@bsdimp.com>
In-Reply-To: <200902020625.n126Pvt6083157@svn.freebsd.org>
References: <200902020625.n126Pvt6083157@svn.freebsd.org>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r188001 - head/usr.bin/make
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 08:38:57 -0000

In message: <200902020625.n126Pvt6083157@svn.freebsd.org>
            Max Khon <fjoe@FreeBSD.org> writes:
: Author: fjoe
: Date: Mon Feb  2 06:25:57 2009
: New Revision: 188001
: URL: http://svn.freebsd.org/changeset/base/188001
: 
: Log:
:   Remove duplicate OPTFLAGS definition.

Pointy hat to: imp@

Thanks Max.

Warner

: Modified:
:   head/usr.bin/make/main.c
: 
: Modified: head/usr.bin/make/main.c
: ==============================================================================
: --- head/usr.bin/make/main.c	Mon Feb  2 04:59:00 2009	(r188000)
: +++ head/usr.bin/make/main.c	Mon Feb  2 06:25:57 2009	(r188001)
: @@ -371,7 +371,6 @@ MainParseArgs(int argc, char **argv)
:  rearg:
:  	optind = 1;	/* since we're called more than once */
:  	optreset = 1;
: -#define OPTFLAGS "ABC:D:E:I:PSV:Xd:ef:ij:km:nQpqrstvx:"
:  #define OPTFLAGS "ABC:D:d:E:ef:I:ij:km:nPpQqrSstV:vXx:"
:  	for (;;) {
:  		if ((optind < argc) && strcmp(argv[optind], "--") == 0) {
: 

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 10:58:05 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AC32F106566C;
	Mon,  2 Feb 2009 10:58:05 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7F9F18FC17;
	Mon,  2 Feb 2009 10:58:05 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12Aw501095289;
	Mon, 2 Feb 2009 10:58:05 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12Aw5i0095288;
	Mon, 2 Feb 2009 10:58:05 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <200902021058.n12Aw5i0095288@svn.freebsd.org>
From: Luigi Rizzo <luigi@FreeBSD.org>
Date: Mon, 2 Feb 2009 10:58:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188004 - head/sbin/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 10:58:06 -0000

Author: luigi
Date: Mon Feb  2 10:58:05 2009
New Revision: 188004
URL: http://svn.freebsd.org/changeset/base/188004

Log:
  remove duplicate #include

Modified:
  head/sbin/ipfw/dummynet.c

Modified: head/sbin/ipfw/dummynet.c
==============================================================================
--- head/sbin/ipfw/dummynet.c	Mon Feb  2 08:31:16 2009	(r188003)
+++ head/sbin/ipfw/dummynet.c	Mon Feb  2 10:58:05 2009	(r188004)
@@ -39,7 +39,6 @@
 #include <sysexits.h>
 
 #include <net/if.h>
-#include <net/if.h>
 #include <netinet/in.h>
 #include <netinet/ip_fw.h>
 #include <netinet/ip_dummynet.h>

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 11:02:20 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 30A0C106566C;
	Mon,  2 Feb 2009 11:02:20 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1F3E38FC17;
	Mon,  2 Feb 2009 11:02:20 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12B2Kog095426;
	Mon, 2 Feb 2009 11:02:20 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12B2KVd095425;
	Mon, 2 Feb 2009 11:02:20 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <200902021102.n12B2KVd095425@svn.freebsd.org>
From: Luigi Rizzo <luigi@FreeBSD.org>
Date: Mon, 2 Feb 2009 11:02:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188005 - head/sbin/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 11:02:20 -0000

Author: luigi
Date: Mon Feb  2 11:02:19 2009
New Revision: 188005
URL: http://svn.freebsd.org/changeset/base/188005

Log:
  Explain that we assume AF_INET and only use the addr and port field
  from a struct sockaddr_in, so there is no need to initialize sin_len

Modified:
  head/sbin/ipfw/ipfw2.c

Modified: head/sbin/ipfw/ipfw2.c
==============================================================================
--- head/sbin/ipfw/ipfw2.c	Mon Feb  2 10:58:05 2009	(r188004)
+++ head/sbin/ipfw/ipfw2.c	Mon Feb  2 11:02:19 2009	(r188005)
@@ -2733,7 +2733,10 @@ chkarg:	
 		action->opcode = O_FORWARD_IP;
 		action->len = F_INSN_SIZE(ipfw_insn_sa);
 
-		p->sa.sin_len = sizeof(struct sockaddr_in);
+		/*
+		 * In the kernel we assume AF_INET and use only
+		 * sin_port and sin_addr.
+		 */
 		p->sa.sin_family = AF_INET;
 		p->sa.sin_port = 0;
 		/*

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 11:19:57 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 67B9C1065B30;
	Mon,  2 Feb 2009 11:19:57 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4B85A8FC1A;
	Mon,  2 Feb 2009 11:19:57 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12BJvoI095789;
	Mon, 2 Feb 2009 11:19:57 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12BJva6095787;
	Mon, 2 Feb 2009 11:19:57 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200902021119.n12BJva6095787@svn.freebsd.org>
From: Robert Watson <rwatson@FreeBSD.org>
Date: Mon, 2 Feb 2009 11:19:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188006 - in head/usr.bin: basename dirname
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 11:20:15 -0000

Author: rwatson
Date: Mon Feb  2 11:19:56 2009
New Revision: 188006
URL: http://svn.freebsd.org/changeset/base/188006

Log:
  Alow dirname(1) to accept multiple arguments in the same way that
  basename(1) does.
  
  (Two different PRs contained identical patches, both cited below)
  
  PR:		121520, 86148
  Submitted by:	Ighighi <ighighi at gmail dot com>
  Submitted by:	Leif Neland <leif at neland dot dk>
  MFC after:	3 days

Modified:
  head/usr.bin/basename/basename.1
  head/usr.bin/dirname/dirname.c

Modified: head/usr.bin/basename/basename.1
==============================================================================
--- head/usr.bin/basename/basename.1	Mon Feb  2 11:02:19 2009	(r188005)
+++ head/usr.bin/basename/basename.1	Mon Feb  2 11:19:56 2009	(r188006)
@@ -52,6 +52,7 @@
 .Op Ar ...
 .Nm dirname
 .Ar string
+.Op Ar ...
 .Sh DESCRIPTION
 The
 .Nm

Modified: head/usr.bin/dirname/dirname.c
==============================================================================
--- head/usr.bin/dirname/dirname.c	Mon Feb  2 11:02:19 2009	(r188005)
+++ head/usr.bin/dirname/dirname.c	Mon Feb  2 11:19:56 2009	(r188006)
@@ -66,12 +66,15 @@ main(int argc, char **argv)
 	argc -= optind;
 	argv += optind;
 
-	if (argc != 1)
+	if (argc < 1)
 		usage();
 
-	if ((p = dirname(*argv)) == NULL)
-		err(1, "%s", *argv);
-	(void)printf("%s\n", p);
+	while (argc--) {
+		if ((p = dirname(*argv)) == NULL)
+			err(1, "%s", *argv);
+		argv++;
+		(void)printf("%s\n", p);
+	}
 	exit(0);
 }
 
@@ -79,6 +82,6 @@ void
 usage(void)
 {
 
-	(void)fprintf(stderr, "usage: dirname string\n");
+	(void)fprintf(stderr, "usage: dirname string [...]\n");
 	exit(1);
 }

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 11:31:43 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4994E10656C9;
	Mon,  2 Feb 2009 11:31:43 +0000 (UTC) (envelope-from ed@hoeg.nl)
Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211])
	by mx1.freebsd.org (Postfix) with ESMTP id D4AAA8FC08;
	Mon,  2 Feb 2009 11:31:42 +0000 (UTC) (envelope-from ed@hoeg.nl)
Received: by palm.hoeg.nl (Postfix, from userid 1000)
	id 2DE121D1C8; Mon,  2 Feb 2009 12:31:41 +0100 (CET)
Date: Mon, 2 Feb 2009 12:31:41 +0100
From: Ed Schouten <ed@80386.nl>
To: Robert Watson <rwatson@FreeBSD.org>
Message-ID: <20090202113141.GH1230@hoeg.nl>
References: <200902021119.n12BJva6095787@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="VkqCAaSJIySsbD6j"
Content-Disposition: inline
In-Reply-To: <200902021119.n12BJva6095787@svn.freebsd.org>
User-Agent: Mutt/1.5.18 (2008-05-17)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r188006 - in head/usr.bin: basename dirname
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 11:31:44 -0000


--VkqCAaSJIySsbD6j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Robert,

* Robert Watson <rwatson@FreeBSD.org> wrote:
> -	(void)fprintf(stderr, "usage: dirname string\n");
> +	(void)fprintf(stderr, "usage: dirname string [...]\n");

Maybe we shouldn't use brackets here, like rm(1):

	usage: rm [-f | -i] [-dIPRrvW] file ...

--=20
 Ed Schouten <ed@80386.nl>
 WWW: http://80386.nl/

--VkqCAaSJIySsbD6j
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkmG2Z0ACgkQ52SDGA2eCwUdvACeK5+M4B4XEyck/TlK83VEE8Bl
nB8An3Ovl4WDhX2Ezj9xTiH153V2Xo0T
=DONH
-----END PGP SIGNATURE-----

--VkqCAaSJIySsbD6j--

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 11:42:59 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D52441065674
	for <svn-src-head@freebsd.org>; Mon,  2 Feb 2009 11:42:59 +0000 (UTC)
	(envelope-from christoph.mallon@gmx.de)
Received: from mail.gmx.net (mail.gmx.net [213.165.64.20])
	by mx1.freebsd.org (Postfix) with SMTP id 9C63B8FC1A
	for <svn-src-head@freebsd.org>; Mon,  2 Feb 2009 11:42:58 +0000 (UTC)
	(envelope-from christoph.mallon@gmx.de)
Received: (qmail invoked by alias); 02 Feb 2009 11:42:56 -0000
Received: from p54A3EDDF.dip.t-dialin.net (EHLO tron.homeunix.org)
	[84.163.237.223]
	by mail.gmx.net (mp021) with SMTP; 02 Feb 2009 12:42:56 +0100
X-Authenticated: #1673122
X-Provags-ID: V01U2FsdGVkX19cqHRwH+FcOHA1ij5slYhB+Hx9rRFTsFh0fLGQit
	3TsTrazawYHbHe
Message-ID: <4986DC3D.5020708@gmx.de>
Date: Mon, 02 Feb 2009 12:42:53 +0100
From: Christoph Mallon <christoph.mallon@gmx.de>
User-Agent: Thunderbird 2.0.0.19 (X11/20090103)
MIME-Version: 1.0
To: Ed Schouten <ed@80386.nl>
References: <200902021119.n12BJva6095787@svn.freebsd.org>
	<20090202113141.GH1230@hoeg.nl>
In-Reply-To: <20090202113141.GH1230@hoeg.nl>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
X-Y-GMX-Trusted: 0
X-FuHaFi: 0.66
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Robert Watson <rwatson@FreeBSD.org>
Subject: Re: svn commit: r188006 - in head/usr.bin: basename dirname
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 11:43:00 -0000

Ed Schouten schrieb:
> Hi Robert,
> 
> * Robert Watson <rwatson@FreeBSD.org> wrote:
>> -	(void)fprintf(stderr, "usage: dirname string\n");
>> +	(void)fprintf(stderr, "usage: dirname string [...]\n");
> 
> Maybe we shouldn't use brackets here, like rm(1):
> 
> 	usage: rm [-f | -i] [-dIPRrvW] file ...

Also there are no [] around the ... in the manpages of rm, chmod, cp, 
chown, ...

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 11:57:55 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 860041065672;
	Mon,  2 Feb 2009 11:57:55 +0000 (UTC)
	(envelope-from gabor@FreeBSD.org)
Received: from server.mypc.hu (server.mypc.hu [87.229.73.95])
	by mx1.freebsd.org (Postfix) with ESMTP id 397958FC21;
	Mon,  2 Feb 2009 11:57:55 +0000 (UTC)
	(envelope-from gabor@FreeBSD.org)
Received: from localhost (localhost [127.0.0.1])
	by server.mypc.hu (Postfix) with ESMTP id 93D8114D8255;
	Mon,  2 Feb 2009 12:41:02 +0100 (CET)
X-Virus-Scanned: amavisd-new at t-hosting.hu
Received: from server.mypc.hu ([127.0.0.1])
	by localhost (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024)
	with LMTP id dcMhTSxgrtxq; Mon,  2 Feb 2009 12:41:00 +0100 (CET)
Received: from [192.168.1.105] (catv-80-98-156-89.catv.broadband.hu
	[80.98.156.89])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by server.mypc.hu (Postfix) with ESMTPSA id 84C8F14D8162;
	Mon,  2 Feb 2009 12:41:00 +0100 (CET)
Message-ID: <4986DBCA.5000501@FreeBSD.org>
Date: Mon, 02 Feb 2009 12:40:58 +0100
From: =?ISO-8859-1?Q?G=E1bor_K=F6vesd=E1n?= <gabor@FreeBSD.org>
User-Agent: Thunderbird 2.0.0.19 (Windows/20081209)
MIME-Version: 1.0
To: Ed Schouten <ed@80386.nl>
References: <200902021119.n12BJva6095787@svn.freebsd.org>
	<20090202113141.GH1230@hoeg.nl>
In-Reply-To: <20090202113141.GH1230@hoeg.nl>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Robert Watson <rwatson@FreeBSD.org>
Subject: Re: svn commit: r188006 - in head/usr.bin: basename dirname
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 11:57:56 -0000

Ed Schouten escribió:
> Hi Robert,
>
> * Robert Watson <rwatson@FreeBSD.org> wrote:
>   
>> -	(void)fprintf(stderr, "usage: dirname string\n");
>> +	(void)fprintf(stderr, "usage: dirname string [...]\n");
>>     
>
> Maybe we shouldn't use brackets here, like rm(1):
>
> 	usage: rm [-f | -i] [-dIPRrvW] file ...
>   
I'd prefer if we used brackets with rm(1), as well. Even if these syntax 
descriptions aren't BNFs, the brackets are usually used to denote 
optionality.

-- 
Gabor Kovesdan

EMAIL: gabor@FreeBSD.org
WWW:   http://www.kovesdan.org


From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 14:29:17 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C25FA106566C;
	Mon,  2 Feb 2009 14:29:15 +0000 (UTC) (envelope-from phk@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ACD1C8FC34;
	Mon,  2 Feb 2009 14:29:15 +0000 (UTC) (envelope-from phk@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12ETFDo099111;
	Mon, 2 Feb 2009 14:29:15 GMT (envelope-from phk@svn.freebsd.org)
Received: (from phk@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12ETFQk099110;
	Mon, 2 Feb 2009 14:29:15 GMT (envelope-from phk@svn.freebsd.org)
Message-Id: <200902021429.n12ETFQk099110@svn.freebsd.org>
From: Poul-Henning Kamp <phk@FreeBSD.org>
Date: Mon, 2 Feb 2009 14:29:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188007 - head/usr.sbin/fifolog/lib
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 14:29:18 -0000

Author: phk
Date: Mon Feb  2 14:29:15 2009
New Revision: 188007
URL: http://svn.freebsd.org/changeset/base/188007

Log:
  Don't overwrite it, if only one sector is written yet.
  
  Discovered by:	"Dewayne Geraghty" <dewayne.geraghty@heuristicsystems.com.au>

Modified:
  head/usr.sbin/fifolog/lib/fifolog_write_poll.c

Modified: head/usr.sbin/fifolog/lib/fifolog_write_poll.c
==============================================================================
--- head/usr.sbin/fifolog/lib/fifolog_write_poll.c	Mon Feb  2 11:19:56 2009	(r188006)
+++ head/usr.sbin/fifolog/lib/fifolog_write_poll.c	Mon Feb  2 14:29:15 2009	(r188007)
@@ -152,15 +152,16 @@ fifolog_write_open(struct fifolog_writer
 	es = fifolog_int_findend(f->ff, &o);
 	if (es != NULL)
 		return (es);
-	if (o == 0) {
-		f->seq = 0;
-		f->recno = 0;
+	i = fifolog_int_read(f->ff, o);
+	if (i)
+		return ("Read error, looking for seq");
+	f->seq = be32dec(f->ff->recbuf);
+	if (f->seq == 0) {
+		/* Empty fifolog */
+		f->seq = random();
 	} else {
-		i = fifolog_int_read(f->ff, o);
-		if (i)
-			return ("Read error, looking for seq");
-		f->seq = be32dec(f->ff->recbuf) + 1;
 		f->recno = o + 1;
+		f->seq++;
 	}
 
 	f->ibufsize = 32768;

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 14:30:07 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6D33D1065689;
	Mon,  2 Feb 2009 14:30:07 +0000 (UTC) (envelope-from phk@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5AEA18FC2E;
	Mon,  2 Feb 2009 14:30:07 +0000 (UTC) (envelope-from phk@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12EU71D099165;
	Mon, 2 Feb 2009 14:30:07 GMT (envelope-from phk@svn.freebsd.org)
Received: (from phk@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12EU7Dp099164;
	Mon, 2 Feb 2009 14:30:07 GMT (envelope-from phk@svn.freebsd.org)
Message-Id: <200902021430.n12EU7Dp099164@svn.freebsd.org>
From: Poul-Henning Kamp <phk@FreeBSD.org>
Date: Mon, 2 Feb 2009 14:30:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188008 - head/usr.sbin/fifolog/lib
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 14:30:08 -0000

Author: phk
Date: Mon Feb  2 14:30:07 2009
New Revision: 188008
URL: http://svn.freebsd.org/changeset/base/188008

Log:
  The last sector in the first segment might just be a sync, increment before
  checking validity of segment two.

Modified:
  head/usr.sbin/fifolog/lib/fifolog_reader.c

Modified: head/usr.sbin/fifolog/lib/fifolog_reader.c
==============================================================================
--- head/usr.sbin/fifolog/lib/fifolog_reader.c	Mon Feb  2 14:29:15 2009	(r188007)
+++ head/usr.sbin/fifolog/lib/fifolog_reader.c	Mon Feb  2 14:30:07 2009	(r188008)
@@ -155,6 +155,7 @@ fifolog_reader_seek(const struct fifolog
 		retval = fifolog_int_findend(fr->ff, &s);
 		if (retval != NULL)
 			err(1, "%s", retval);
+		s++;
 		e = fifolog_reader_findsync(fr->ff, &s);
 		if (e == 0)
 			return (0);		/* empty fifolog */

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 15:33:22 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 63277106564A;
	Mon,  2 Feb 2009 15:33:22 +0000 (UTC) (envelope-from mtm@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4F7868FC17;
	Mon,  2 Feb 2009 15:33:22 +0000 (UTC) (envelope-from mtm@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12FXMbF000482;
	Mon, 2 Feb 2009 15:33:22 GMT (envelope-from mtm@svn.freebsd.org)
Received: (from mtm@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12FXMHC000481;
	Mon, 2 Feb 2009 15:33:22 GMT (envelope-from mtm@svn.freebsd.org)
Message-Id: <200902021533.n12FXMHC000481@svn.freebsd.org>
From: Mike Makonnen <mtm@FreeBSD.org>
Date: Mon, 2 Feb 2009 15:33:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188009 - head/etc/rc.d
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 15:33:22 -0000

Author: mtm
Date: Mon Feb  2 15:33:22 2009
New Revision: 188009
URL: http://svn.freebsd.org/changeset/base/188009

Log:
  The 30 second wait for network interfaces to show up effectively makes the
  time to boot an unplugged system 30 sec. longer for no good reason. Therefore,
  add a check to make sure that any DHCP interfaces are plugged in before
  waiting.

Modified:
  head/etc/rc.d/defaultroute

Modified: head/etc/rc.d/defaultroute
==============================================================================
--- head/etc/rc.d/defaultroute	Mon Feb  2 14:30:07 2009	(r188008)
+++ head/etc/rc.d/defaultroute	Mon Feb  2 15:33:22 2009	(r188009)
@@ -18,10 +18,21 @@ stop_cmd=":"
 
 defaultroute_start()
 {
-	# Return without waiting if we don't have dhcp interfaces.
-	# Once we can test that the link is actually up, we should
-	# remove this test and always wait.
-	[ -z "`list_net_interfaces dhcp`" ] && return
+	local output carrier nocarrier
+
+	# Return without waiting if we don't have dhcp interfaces or
+	# if none of the dhcp interfaces is plugged in.
+	dhcp_interfaces=`list_net_interfaces dhcp`
+	[ -z "${dhcp_interfaces}" ] && return
+	carrier=false
+	for _if in ${dhcp_interfaces}; do
+		output=`/sbin/ifconfig ${_if}` 
+		nocarrier=`expr "${output}" : '.*[[:blank:]]status: \(no carrier\)'`
+		[ -z "${nocarrier}" ] && carrier=true
+	done
+	if ! ${carrier}; then
+		return
+	fi
 
 	# Wait for a default route
 	delay=${if_up_delay}

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 15:38:25 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 24B82106564A;
	Mon,  2 Feb 2009 15:38:25 +0000 (UTC) (envelope-from mtm@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 115A08FC21;
	Mon,  2 Feb 2009 15:38:25 +0000 (UTC) (envelope-from mtm@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12FcOu9000613;
	Mon, 2 Feb 2009 15:38:24 GMT (envelope-from mtm@svn.freebsd.org)
Received: (from mtm@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12FcOgW000612;
	Mon, 2 Feb 2009 15:38:24 GMT (envelope-from mtm@svn.freebsd.org)
Message-Id: <200902021538.n12FcOgW000612@svn.freebsd.org>
From: Mike Makonnen <mtm@FreeBSD.org>
Date: Mon, 2 Feb 2009 15:38:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188010 - head/etc/defaults
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 15:38:26 -0000

Author: mtm
Date: Mon Feb  2 15:38:24 2009
New Revision: 188010
URL: http://svn.freebsd.org/changeset/base/188010

Log:
  Since, rc.d/defaultroute has the ability to wait for a
  default route to show up we can turn this knob back on
  without screwing subsequent daemons that expect to be
  able to talk to the outside world.

Modified:
  head/etc/defaults/rc.conf

Modified: head/etc/defaults/rc.conf
==============================================================================
--- head/etc/defaults/rc.conf	Mon Feb  2 15:33:22 2009	(r188009)
+++ head/etc/defaults/rc.conf	Mon Feb  2 15:38:24 2009	(r188010)
@@ -101,7 +101,7 @@ nisdomainname="NO"		# Set to NIS domain 
 dhclient_program="/sbin/dhclient"	# Path to dhcp client program.
 dhclient_flags=""		# Extra flags to pass to dhcp client.
 #dhclient_flags_fxp0=""		# Extra dhclient flags for fxp0 only
-background_dhclient="NO"	# Start dhcp client in the background.
+background_dhclient="YES"	# Start dhcp client in the background.
 #background_dhclient_fxp0="YES"	# Start dhcp client on fxp0 in the background.
 synchronous_dhclient="NO"	# Start dhclient directly on configured
 				# interfaces during startup.

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 16:55:57 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 65D2A106566B;
	Mon,  2 Feb 2009 16:55:57 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 53EB08FC26;
	Mon,  2 Feb 2009 16:55:57 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12GtvVw002254;
	Mon, 2 Feb 2009 16:55:57 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12Gtvir002253;
	Mon, 2 Feb 2009 16:55:57 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902021655.n12Gtvir002253@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Mon, 2 Feb 2009 16:55:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188011 - head/sys/dev/ath/ath_hal/ar5212
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 16:55:57 -0000

Author: sam
Date: Mon Feb  2 16:55:57 2009
New Revision: 188011
URL: http://svn.freebsd.org/changeset/base/188011

Log:
  restore variable initialization removed in r187831; this broke
  the horrible SAVE/RESTORE_CCK macros used by swan/nala cards to
  implement 11b using 11g

Modified:
  head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c	Mon Feb  2 15:38:24 2009	(r188010)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c	Mon Feb  2 16:55:57 2009	(r188011)
@@ -954,7 +954,7 @@ ar5212PerCalibrationN(struct ath_hal *ah
 	int32_t qCoff, qCoffDenom;
 	int32_t iqCorrMeas, iCoff, iCoffDenom;
 	uint32_t powerMeasQ, powerMeasI;
-	HAL_BOOL isBmode;
+	HAL_BOOL isBmode = AH_FALSE;
 
 	OS_MARK(ah, AH_MARK_PERCAL, chan->ic_freq);
 	*isCalDone = AH_FALSE;

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 16:56:58 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C626F106566B;
	Mon,  2 Feb 2009 16:56:58 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B47C78FC1B;
	Mon,  2 Feb 2009 16:56:58 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12Guwx4002310;
	Mon, 2 Feb 2009 16:56:58 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12Guw1i002309;
	Mon, 2 Feb 2009 16:56:58 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902021656.n12Guw1i002309@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Mon, 2 Feb 2009 16:56:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188012 - head/sys/dev/ath/ath_hal/ar5212
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 16:56:59 -0000

Author: sam
Date: Mon Feb  2 16:56:58 2009
New Revision: 188012
URL: http://svn.freebsd.org/changeset/base/188012

Log:
  o make SAVE_CCK slightly less error prone by always writing the _flag
    value used later by RESTORE_CCK
  o swap arg order in RESTORE_CCK to slightly reduce cost

Modified:
  head/sys/dev/ath/ath_hal/ar5212/ar5212.h

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212.h	Mon Feb  2 16:55:57 2009	(r188011)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h	Mon Feb  2 16:56:58 2009	(r188012)
@@ -399,10 +399,11 @@ struct ath_hal_5212 {
 		(_chan)->ic_flags &= ~IEEE80211_CHAN_CCK;	\
 		(_chan)->ic_flags |= IEEE80211_CHAN_DYN;	\
 		(_flag) = AH_TRUE;				\
-	}							\
+	} else							\
+		(_flag) = AH_FALSE;				\
 } while (0)
 #define RESTORE_CCK(_ah, _chan, _flag) do {                     \
-	if ((IS_2425(_ah) || IS_2417(_ah)) && (_flag)) {	\
+	if ((_flag) && (IS_2425(_ah) || IS_2417(_ah))) {	\
 		(_chan)->ic_flags &= ~IEEE80211_CHAN_DYN;	\
 		(_chan)->ic_flags |= IEEE80211_CHAN_CCK;	\
 	}							\

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 18:08:23 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0208B1065673;
	Mon,  2 Feb 2009 18:08:23 +0000 (UTC)
	(envelope-from emax@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E38258FC1E;
	Mon,  2 Feb 2009 18:08:22 +0000 (UTC)
	(envelope-from emax@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12I8MOm003637;
	Mon, 2 Feb 2009 18:08:22 GMT (envelope-from emax@svn.freebsd.org)
Received: (from emax@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12I8MiY003634;
	Mon, 2 Feb 2009 18:08:22 GMT (envelope-from emax@svn.freebsd.org)
Message-Id: <200902021808.n12I8MiY003634@svn.freebsd.org>
From: Maksim Yevmenkin <emax@FreeBSD.org>
Date: Mon, 2 Feb 2009 18:08:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188013 - head/usr.sbin/bluetooth/btpand
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 18:08:24 -0000

Author: emax
Date: Mon Feb  2 18:08:22 2009
New Revision: 188013
URL: http://svn.freebsd.org/changeset/base/188013

Log:
  Fix client mode. Pick up service availability changes.
  
  Obtained from:	NetBSD
  MFC after:	1 month

Modified:
  head/usr.sbin/bluetooth/btpand/btpand.c
  head/usr.sbin/bluetooth/btpand/btpand.h
  head/usr.sbin/bluetooth/btpand/server.c

Modified: head/usr.sbin/bluetooth/btpand/btpand.c
==============================================================================
--- head/usr.sbin/bluetooth/btpand/btpand.c	Mon Feb  2 16:56:58 2009	(r188012)
+++ head/usr.sbin/bluetooth/btpand/btpand.c	Mon Feb  2 18:08:22 2009	(r188013)
@@ -54,8 +54,8 @@ uint16_t	service_class;
 
 bdaddr_t	local_bdaddr;		/* -d <addr> */
 bdaddr_t	remote_bdaddr;		/* -a <addr> */
-uint16_t	l2cap_psm = 15;		/* -p <psm> */
-int		l2cap_mode = 0;		/* -m <mode> */
+uint16_t	l2cap_psm;		/* -p <psm> */
+int		l2cap_mode;		/* -m <mode> */
 
 int		server_limit;		/* -n <limit> */
 
@@ -177,6 +177,9 @@ main(int argc, char *argv[])
 	if (interface_name == NULL)
 		interface_name = "/dev/tap";
 
+	if (l2cap_psm == 0)
+		l2cap_psm = L2CAP_PSM_BNEP;
+
 	if (bdaddr_any(&remote_bdaddr) && server_limit == 0) {
 		if (service_class == SDP_SERVICE_CLASS_PANU)
 			server_limit = 1;

Modified: head/usr.sbin/bluetooth/btpand/btpand.h
==============================================================================
--- head/usr.sbin/bluetooth/btpand/btpand.h	Mon Feb  2 16:56:58 2009	(r188012)
+++ head/usr.sbin/bluetooth/btpand/btpand.h	Mon Feb  2 18:08:22 2009	(r188013)
@@ -51,6 +51,10 @@
 #define	L2CAP_PSM_INVALID(psm)	(((psm) & 0x0101) != 0x0001)
 #endif
 
+#ifndef	L2CAP_PSM_BNEP
+#define	L2CAP_PSM_BNEP	15
+#endif
+
 typedef struct channel	channel_t;
 typedef struct pfilter	pfilter_t;
 typedef struct mfilter	mfilter_t;

Modified: head/usr.sbin/bluetooth/btpand/server.c
==============================================================================
--- head/usr.sbin/bluetooth/btpand/server.c	Mon Feb  2 16:56:58 2009	(r188012)
+++ head/usr.sbin/bluetooth/btpand/server.c	Mon Feb  2 18:08:22 2009	(r188013)
@@ -1,4 +1,4 @@
-/*	$NetBSD: server.c,v 1.1 2008/08/17 13:20:57 plunky Exp $	*/
+/*	$NetBSD: server.c,v 1.2 2009/01/24 17:29:28 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2008 Iain Hibbert
@@ -28,11 +28,12 @@
 /* $FreeBSD$ */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: server.c,v 1.1 2008/08/17 13:20:57 plunky Exp $");
+__RCSID("$NetBSD: server.c,v 1.2 2009/01/24 17:29:28 plunky Exp $");
 
 #include <sys/ioctl.h>
 
 #include <bluetooth.h>
+#include <inttypes.h>
 #include <errno.h>
 #include <sdp.h>
 #include <unistd.h>
@@ -42,7 +43,7 @@ __RCSID("$NetBSD: server.c,v 1.1 2008/08
 
 static struct event	server_ev;
 static int		server_fd;
-static int		server_load;
+static int		server_avail;
 
 static void *		server_ss;
 static uint32_t		server_handle;
@@ -73,13 +74,13 @@ server_update(int count)
 
 	log_debug("count %d", count);
 
-	server_load = (count - 1) * 100 / server_limit;
-	log_info("server_load: %d%%", server_load);
+	server_avail = UINT8_MAX - (count - 1) * UINT8_MAX / server_limit;
+	log_info("Service Availability: %d/%d", server_avail, UINT8_MAX);
 
-	if (server_load > 99 && server_fd != -1)
+	if (server_avail == 0 && server_fd != -1)
 		server_close();
 
-	if (server_load < 100 && server_fd == -1)
+	if (server_avail > 0 && server_fd == -1)
 		server_open();
 
 	if (service_name)
@@ -257,19 +258,9 @@ server_register(void)
 	}
 
 	memset(&p, 0, sizeof(p));
-
 	p.psm = l2cap_psm;
-
-	if (server_load < 1)		p.load_factor = 0;
-	else if (server_load <= 17)	p.load_factor = 1;
-	else if (server_load <= 33)	p.load_factor = 2;
-	else if (server_load <= 50)	p.load_factor = 3;
-	else if (server_load <= 67)	p.load_factor = 4;
-	else if (server_load <= 83)	p.load_factor = 5;
-	else if (server_load <= 99)	p.load_factor = 6;
-	else				p.load_factor = 7;
-
-	if (l2cap_mode != 0)		p.security_description = 0x0001;
+	p.load_factor = server_avail;
+	p.security_description = (l2cap_mode == 0 ? 0x0000 : 0x0001);
 
 	if (server_handle)
 		rv = sdp_change_service(server_ss, server_handle,

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 18:10:52 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6D83E106567C;
	Mon,  2 Feb 2009 18:10:52 +0000 (UTC)
	(envelope-from emax@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 403F68FC1B;
	Mon,  2 Feb 2009 18:10:52 +0000 (UTC)
	(envelope-from emax@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12IAqfu003724;
	Mon, 2 Feb 2009 18:10:52 GMT (envelope-from emax@svn.freebsd.org)
Received: (from emax@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12IAqJk003723;
	Mon, 2 Feb 2009 18:10:52 GMT (envelope-from emax@svn.freebsd.org)
Message-Id: <200902021810.n12IAqJk003723@svn.freebsd.org>
From: Maksim Yevmenkin <emax@FreeBSD.org>
Date: Mon, 2 Feb 2009 18:10:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188014 - head/usr.sbin/bluetooth
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 18:10:53 -0000

Author: emax
Date: Mon Feb  2 18:10:51 2009
New Revision: 188014
URL: http://svn.freebsd.org/changeset/base/188014

Log:
  Hook up btpand(8) to the build
  
  MFC after:	1 month

Modified:
  head/usr.sbin/bluetooth/Makefile

Modified: head/usr.sbin/bluetooth/Makefile
==============================================================================
--- head/usr.sbin/bluetooth/Makefile	Mon Feb  2 18:08:22 2009	(r188013)
+++ head/usr.sbin/bluetooth/Makefile	Mon Feb  2 18:10:51 2009	(r188014)
@@ -6,6 +6,7 @@ SUBDIR= \
 	bt3cfw \
 	bthidcontrol \
 	bthidd \
+	btpand \
 	hccontrol \
 	hcsecd \
 	hcseriald \

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 19:22:54 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0F57C10656C2;
	Mon,  2 Feb 2009 19:22:54 +0000 (UTC)
	(envelope-from lulf@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EF36A8FC19;
	Mon,  2 Feb 2009 19:22:53 +0000 (UTC)
	(envelope-from lulf@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12JMrhs005193;
	Mon, 2 Feb 2009 19:22:53 GMT (envelope-from lulf@svn.freebsd.org)
Received: (from lulf@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12JMrM8005192;
	Mon, 2 Feb 2009 19:22:53 GMT (envelope-from lulf@svn.freebsd.org)
Message-Id: <200902021922.n12JMrM8005192@svn.freebsd.org>
From: Ulf Lilleengen <lulf@FreeBSD.org>
Date: Mon, 2 Feb 2009 19:22:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188017 - head/sbin/geom/core
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 19:22:55 -0000

Author: lulf
Date: Mon Feb  2 19:22:53 2009
New Revision: 188017
URL: http://svn.freebsd.org/changeset/base/188017

Log:
  - Use a separate pointer to the allocated memory for freeing, as strsep may
    modify the pointer argument passed to it. This triggered an assert in malloc
    when a geom command being run under the livefs environment.
  
  PR:		bin/130632
  Submitted by:	Dimitry Andric <dimitry -at- andric.com>
  Pointy hat to:	me
  MFC after:	2 days

Modified:
  head/sbin/geom/core/geom.c

Modified: head/sbin/geom/core/geom.c
==============================================================================
--- head/sbin/geom/core/geom.c	Mon Feb  2 18:32:41 2009	(r188016)
+++ head/sbin/geom/core/geom.c	Mon Feb  2 19:22:53 2009	(r188017)
@@ -487,13 +487,13 @@ library_path(void)
 static void
 load_library(void)
 {
-	char *curpath, path[MAXPATHLEN], *totalpath;
+	char *curpath, path[MAXPATHLEN], *tofree, *totalpath;
 	uint32_t *lib_version;
 	void *dlh;
 	int ret;
 
 	ret = 0;
-	totalpath = strdup(library_path());
+	tofree = totalpath = strdup(library_path());
 	if (totalpath == NULL)
 		err(EXIT_FAILURE, "Not enough memory for library path");
 
@@ -519,7 +519,7 @@ load_library(void)
 		}
 		break;
 	}
-	free(totalpath);
+	free(tofree);
 	/* No library was found, but standard commands can still be used */
 	if (ret == -1)
 		return;

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 19:54:17 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2F0B8106567A;
	Mon,  2 Feb 2009 19:54:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1B2ED8FC5A;
	Mon,  2 Feb 2009 19:54:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12JsHNJ005772;
	Mon, 2 Feb 2009 19:54:17 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12JsGT2005768;
	Mon, 2 Feb 2009 19:54:16 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200902021954.n12JsGT2005768@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Mon, 2 Feb 2009 19:54:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188018 - in head: sys/dev/pci usr.sbin/pciconf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 19:54:17 -0000

Author: jhb
Date: Mon Feb  2 19:54:16 2009
New Revision: 188018
URL: http://svn.freebsd.org/changeset/base/188018

Log:
  - Add a new ioctl to /dev/pci to fetch details on an individual BAR of a
    device.  The details include the current value of the BAR (including all
    the flag bits and the current base address), its length, and whether or not
    it is enabled.  Since this operation is not invasive, non-root users are
    allowed to use it (unlike manual config register access which requires
    root).  The intention is that userland apps (such as Xorg) will use this
    interface rather than dangerously frobbing the BARs from userland to
    obtain this information.
  - Add a new sub-mode to the 'list' mode of pciconf.  The -b flag when used
    with -l will now list all the active BARs for each device.
  
  MFC after:	1 month

Modified:
  head/sys/dev/pci/pci_user.c
  head/sys/dev/pci/pcireg.h
  head/usr.sbin/pciconf/pciconf.8
  head/usr.sbin/pciconf/pciconf.c

Modified: head/sys/dev/pci/pci_user.c
==============================================================================
--- head/sys/dev/pci/pci_user.c	Mon Feb  2 19:22:53 2009	(r188017)
+++ head/sys/dev/pci/pci_user.c	Mon Feb  2 19:54:16 2009	(r188018)
@@ -307,7 +307,10 @@ pci_ioctl(struct cdev *dev, u_long cmd, 
 	struct pci_conf_io *cio;
 	struct pci_devinfo *dinfo;
 	struct pci_io *io;
+	struct pci_bar_io *bio;
 	struct pci_match_conf *pattern_buf;
+	struct resource_list_entry *rle;
+	uint32_t value;
 	size_t confsz, iolen, pbufsz;
 	int error, ionum, i, num_patterns;
 #ifdef PRE7_COMPAT
@@ -319,11 +322,11 @@ pci_ioctl(struct cdev *dev, u_long cmd, 
 	io_old = NULL;
 	pattern_buf_old = NULL;
 
-	if (!(flag & FWRITE) &&
-	    (cmd != PCIOCGETCONF && cmd != PCIOCGETCONF_OLD))
+	if (!(flag & FWRITE) && cmd != PCIOCGETBAR &&
+	    cmd != PCIOCGETCONF && cmd != PCIOCGETCONF_OLD)
 		return EPERM;
 #else
-	if (!(flag & FWRITE) && cmd != PCIOCGETCONF)
+	if (!(flag & FWRITE) && cmd != PCIOCGETBAR && cmd != PCIOCGETCONF)
 		return EPERM;
 #endif
 
@@ -669,6 +672,70 @@ getconfexit:
 		}
 		break;
 
+	case PCIOCGETBAR:
+		bio = (struct pci_bar_io *)data;
+
+		/*
+		 * Assume that the user-level bus number is
+		 * in fact the physical PCI bus number.
+		 */
+		pcidev = pci_find_dbsf(bio->pbi_sel.pc_domain,
+		    bio->pbi_sel.pc_bus, bio->pbi_sel.pc_dev,
+		    bio->pbi_sel.pc_func);
+		if (pcidev == NULL) {
+			error = ENODEV;
+			break;
+		}
+		dinfo = device_get_ivars(pcidev);
+		
+		/*
+		 * Look for a resource list entry matching the requested BAR.
+		 *
+		 * XXX: This will not find BARs that are not initialized, but
+		 * maybe that is ok?
+		 */
+		rle = resource_list_find(&dinfo->resources, SYS_RES_MEMORY,
+		    bio->pbi_reg);
+		if (rle == NULL)
+			rle = resource_list_find(&dinfo->resources,
+			    SYS_RES_IOPORT, bio->pbi_reg);
+		if (rle == NULL || rle->res == NULL) {
+			error = EINVAL;
+			break;
+		}
+
+		/*
+		 * Ok, we have a resource for this BAR.  Read the lower
+		 * 32 bits to get any flags.
+		 */
+		value = pci_read_config(pcidev, bio->pbi_reg, 4);
+		if (PCI_BAR_MEM(value)) {
+			if (rle->type != SYS_RES_MEMORY) {
+				error = EINVAL;
+				break;
+			}
+			value &= ~PCIM_BAR_MEM_BASE;
+		} else {
+			if (rle->type != SYS_RES_IOPORT) {
+				error = EINVAL;
+				break;
+			}
+			value &= ~PCIM_BAR_IO_BASE;
+		}
+		bio->pbi_base = rman_get_start(rle->res) | value;
+		bio->pbi_length = rman_get_size(rle->res);
+
+		/*
+		 * Check the command register to determine if this BAR
+		 * is enabled.
+		 */
+		value = pci_read_config(pcidev, PCIR_COMMAND, 2);
+		if (rle->type == SYS_RES_MEMORY)
+			bio->pbi_enabled = (value & PCIM_CMD_MEMEN) != 0;
+		else
+			bio->pbi_enabled = (value & PCIM_CMD_PORTEN) != 0;
+		error = 0;
+		break;
 	default:
 		error = ENOTTY;
 		break;

Modified: head/sys/dev/pci/pcireg.h
==============================================================================
--- head/sys/dev/pci/pcireg.h	Mon Feb  2 19:22:53 2009	(r188017)
+++ head/sys/dev/pci/pcireg.h	Mon Feb  2 19:54:16 2009	(r188018)
@@ -117,7 +117,7 @@
 
 #define	PCIR_BARS	0x10
 #define	PCIR_BAR(x)		(PCIR_BARS + (x) * 4)
-#define	PCI_MAX_BAR_0		5	/* Number of standard bars */
+#define	PCIR_MAX_BAR_0		5
 #define	PCI_RID2BAR(rid)	(((rid) - PCIR_BARS) / 4)
 #define	PCI_BAR_IO(x)		(((x) & PCIM_BAR_SPACE) == PCIM_BAR_IO_SPACE)
 #define	PCI_BAR_MEM(x)		(((x) & PCIM_BAR_SPACE) == PCIM_BAR_MEM_SPACE)
@@ -158,6 +158,7 @@
 
 /* config registers for header type 1 (PCI-to-PCI bridge) devices */
 
+#define	PCIR_MAX_BAR_1	1
 #define	PCIR_SECSTAT_1	0x1e
 
 #define	PCIR_PRIBUS_1	0x18
@@ -188,6 +189,7 @@
 
 /* config registers for header type 2 (CardBus) devices */
 
+#define	PCIR_MAX_BAR_2	0
 #define	PCIR_CAP_PTR_2	0x14
 #define	PCIR_SECSTAT_2	0x16
 

Modified: head/usr.sbin/pciconf/pciconf.8
==============================================================================
--- head/usr.sbin/pciconf/pciconf.8	Mon Feb  2 19:22:53 2009	(r188017)
+++ head/usr.sbin/pciconf/pciconf.8	Mon Feb  2 19:54:16 2009	(r188018)
@@ -33,7 +33,7 @@
 .Nd diagnostic utility for the PCI bus
 .Sh SYNOPSIS
 .Nm
-.Fl l Op Fl cv
+.Fl l Op Fl bcv
 .Nm
 .Fl a Ar selector
 .Nm
@@ -112,6 +112,32 @@ device, which contains several (similar 
 one chip.
 .Pp
 If the
+.Fl b
+option is supplied,
+.Nm
+will list any base address registers
+.Pq BARs
+that are assigned resources for each device.
+Each BAR will be enumerated via a line in the following format:
+.Bd -literal
+    bar   [10] = type Memory, range 32, base 0xda060000, size 131072, enabled
+.Ed
+.Pp
+The first value after the
+.Dq Li bar
+prefix in the square brackets is the offset of the BAR in config space in
+hexadecimal.
+The type of a BAR is one of
+.Dq Memory ,
+.Dq Prefetchable Memory ,
+or
+.Dq I/O Port .
+The range indicates the maximum address the BAR decodes.
+The base and size indicate the start and length of the BAR's address window,
+respectively.
+Finally, the last flag indicates if the BAR is enabled or disabled.
+.Pp
+If the
 .Fl c
 option is supplied,
 .Nm

Modified: head/usr.sbin/pciconf/pciconf.c
==============================================================================
--- head/usr.sbin/pciconf/pciconf.c	Mon Feb  2 19:22:53 2009	(r188017)
+++ head/usr.sbin/pciconf/pciconf.c	Mon Feb  2 19:54:16 2009	(r188018)
@@ -37,6 +37,7 @@ static const char rcsid[] =
 
 #include <ctype.h>
 #include <err.h>
+#include <inttypes.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -66,7 +67,8 @@ struct pci_vendor_info
 
 TAILQ_HEAD(,pci_vendor_info)	pci_vendors;
 
-static void list_devs(int verbose, int caps);
+static void list_bars(int fd, struct pci_conf *p);
+static void list_devs(int verbose, int bars, int caps);
 static void list_verbose(struct pci_conf *p);
 static const char *guess_class(struct pci_conf *p);
 static const char *guess_subclass(struct pci_conf *p);
@@ -81,7 +83,7 @@ static void
 usage(void)
 {
 	fprintf(stderr, "%s\n%s\n%s\n%s\n",
-		"usage: pciconf -l [-cv]",
+		"usage: pciconf -l [-bcv]",
 		"       pciconf -a selector",
 		"       pciconf -r [-b | -h] selector addr[:addr2]",
 		"       pciconf -w [-b | -h] selector addr value");
@@ -92,10 +94,10 @@ int
 main(int argc, char **argv)
 {
 	int c;
-	int listmode, readmode, writemode, attachedmode, caps, verbose;
+	int listmode, readmode, writemode, attachedmode, bars, caps, verbose;
 	int byte, isshort;
 
-	listmode = readmode = writemode = attachedmode = caps = verbose = byte = isshort = 0;
+	listmode = readmode = writemode = attachedmode = bars = caps = verbose = byte = isshort = 0;
 
 	while ((c = getopt(argc, argv, "abchlrwv")) != -1) {
 		switch(c) {
@@ -104,6 +106,7 @@ main(int argc, char **argv)
 			break;
 
 		case 'b':
+			bars = 1;
 			byte = 1;
 			break;
 
@@ -143,7 +146,7 @@ main(int argc, char **argv)
 		usage();
 
 	if (listmode) {
-		list_devs(verbose, caps);
+		list_devs(verbose, bars, caps);
 	} else if (attachedmode) {
 		chkattached(argv[optind],
 		    byte ? 1 : isshort ? 2 : 4);
@@ -161,7 +164,7 @@ main(int argc, char **argv)
 }
 
 static void
-list_devs(int verbose, int caps)
+list_devs(int verbose, int bars, int caps)
 {
 	int fd;
 	struct pci_conf_io pc;
@@ -217,6 +220,8 @@ list_devs(int verbose, int caps)
 			    p->pc_revid, p->pc_hdr);
 			if (verbose)
 				list_verbose(p);
+			if (bars)
+				list_bars(fd, p);
 			if (caps)
 				list_caps(fd, p);
 		}
@@ -226,6 +231,64 @@ list_devs(int verbose, int caps)
 }
 
 static void
+list_bars(int fd, struct pci_conf *p)
+{
+	struct pci_bar_io bar;
+	uint64_t base;
+	const char *type;
+	int i, range, max;
+
+	switch (p->pc_hdr & PCIM_HDRTYPE) {
+	case PCIM_HDRTYPE_NORMAL:
+		max = PCIR_MAX_BAR_0;
+		break;
+	case PCIM_HDRTYPE_BRIDGE:
+		max = PCIR_MAX_BAR_1;
+		break;
+	case PCIM_HDRTYPE_CARDBUS:
+		max = PCIR_MAX_BAR_2;
+		break;
+	default:
+		return;
+	}
+
+	for (i = 0; i <= max; i++) {
+		bar.pbi_sel = p->pc_sel;
+		bar.pbi_reg = PCIR_BAR(i);
+		if (ioctl(fd, PCIOCGETBAR, &bar) < 0)
+			continue;
+		if (PCI_BAR_IO(bar.pbi_base)) {
+			type = "I/O Port";
+			range = 32;
+			base = bar.pbi_base & PCIM_BAR_IO_BASE;
+		} else {
+			if (bar.pbi_base & PCIM_BAR_MEM_PREFETCH)
+				type = "Prefetchable Memory";
+			else
+				type = "Memory";
+			switch (bar.pbi_base & PCIM_BAR_MEM_TYPE) {
+			case PCIM_BAR_MEM_32:
+				range = 32;
+				break;
+			case PCIM_BAR_MEM_1MB:
+				range = 20;
+				break;
+			case PCIM_BAR_MEM_64:
+				range = 64;
+				break;
+			default:
+				range = -1;
+			}
+			base = bar.pbi_base & ~((uint64_t)0xf);
+		}
+		printf("    bar   [%02x] = type %s, range %2d, base %#jx, ",
+		    PCIR_BAR(i), type, range, (uintmax_t)base);
+		printf("size %2d, %s\n", (int)bar.pbi_length,
+		    bar.pbi_enabled ? "enabled" : "disabled");
+	}
+}
+
+static void
 list_verbose(struct pci_conf *p)
 {
 	struct pci_vendor_info	*vi;

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 20:09:14 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9230F106567F;
	Mon,  2 Feb 2009 20:09:14 +0000 (UTC)
	(envelope-from cognet@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7F4B88FC16;
	Mon,  2 Feb 2009 20:09:14 +0000 (UTC)
	(envelope-from cognet@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12K9Exi006077;
	Mon, 2 Feb 2009 20:09:14 GMT (envelope-from cognet@svn.freebsd.org)
Received: (from cognet@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12K9Ei5006072;
	Mon, 2 Feb 2009 20:09:14 GMT (envelope-from cognet@svn.freebsd.org)
Message-Id: <200902022009.n12K9Ei5006072@svn.freebsd.org>
From: Olivier Houchard <cognet@FreeBSD.org>
Date: Mon, 2 Feb 2009 20:09:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188019 - in head/sys/arm: arm sa11x0
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 20:09:15 -0000

Author: cognet
Date: Mon Feb  2 20:09:14 2009
New Revision: 188019
URL: http://svn.freebsd.org/changeset/base/188019

Log:
  Remove unused variables.
  
  Spotted out by:	Christoph Mallon <christoph d0t mallon AT gmx d0t de>

Modified:
  head/sys/arm/arm/dump_machdep.c
  head/sys/arm/arm/elf_trampoline.c
  head/sys/arm/arm/pmap.c
  head/sys/arm/arm/vm_machdep.c
  head/sys/arm/sa11x0/assabet_machdep.c

Modified: head/sys/arm/arm/dump_machdep.c
==============================================================================
--- head/sys/arm/arm/dump_machdep.c	Mon Feb  2 19:54:16 2009	(r188018)
+++ head/sys/arm/arm/dump_machdep.c	Mon Feb  2 20:09:14 2009	(r188019)
@@ -158,14 +158,12 @@ cb_dumpdata(struct md_pa *mdp, int seqnr
 {
 	struct dumperinfo *di = (struct dumperinfo*)arg;
 	vm_paddr_t pa;
-	vm_offset_t va;
 	uint32_t pgs;
 	size_t counter, sz, chunk;
 	int c, error;
 
 	error = 0;	/* catch case in which chunk size is 0 */
 	counter = 0;
-	va = 0;
 	pgs = mdp->md_size / PAGE_SIZE;
 	pa = mdp->md_start;
 

Modified: head/sys/arm/arm/elf_trampoline.c
==============================================================================
--- head/sys/arm/arm/elf_trampoline.c	Mon Feb  2 19:54:16 2009	(r188018)
+++ head/sys/arm/arm/elf_trampoline.c	Mon Feb  2 20:09:14 2009	(r188019)
@@ -404,11 +404,11 @@ load_kernel(unsigned int kstart, unsigne
 	int symtabindex = -1;
 	int symstrindex = -1;
 	vm_offset_t lastaddr = 0;
-	Elf_Addr ssym = 0, esym = 0;
+	Elf_Addr ssym = 0;
 	Elf_Dyn *dp;
 	
 	eh = (Elf32_Ehdr *)kstart;
-	ssym = esym = 0;
+	ssym = 0;
 	entry_point = (void*)eh->e_entry;
 	memcpy(phdr, (void *)(kstart + eh->e_phoff ),
 	    eh->e_phnum * sizeof(phdr[0]));

Modified: head/sys/arm/arm/pmap.c
==============================================================================
--- head/sys/arm/arm/pmap.c	Mon Feb  2 19:54:16 2009	(r188018)
+++ head/sys/arm/arm/pmap.c	Mon Feb  2 20:09:14 2009	(r188019)
@@ -3102,7 +3102,7 @@ void
 pmap_remove_all(vm_page_t m)
 {
 	pv_entry_t pv;
-	pt_entry_t *ptep, pte;
+	pt_entry_t *ptep;
 	struct l2_bucket *l2b;
 	boolean_t flush = FALSE;
 	pmap_t curpm;
@@ -3130,7 +3130,6 @@ pmap_remove_all(vm_page_t m)
 		l2b = pmap_get_l2_bucket(pv->pv_pmap, pv->pv_va);
 		KASSERT(l2b != NULL, ("No l2 bucket"));
 		ptep = &l2b->l2b_kva[l2pte_index(pv->pv_va)];
-		pte = *ptep;
 		*ptep = 0;
 		PTE_SYNC_CURRENT(pv->pv_pmap, ptep);
 		pmap_free_l2_bucket(pv->pv_pmap, l2b, 1);

Modified: head/sys/arm/arm/vm_machdep.c
==============================================================================
--- head/sys/arm/arm/vm_machdep.c	Mon Feb  2 19:54:16 2009	(r188018)
+++ head/sys/arm/arm/vm_machdep.c	Mon Feb  2 20:09:14 2009	(r188019)
@@ -108,14 +108,13 @@ void
 cpu_fork(register struct thread *td1, register struct proc *p2,
     struct thread *td2, int flags)
 {
-	struct pcb *pcb1, *pcb2;
+	struct pcb *pcb2;
 	struct trapframe *tf;
 	struct switchframe *sf;
 	struct mdproc *mdp2;
 
 	if ((flags & RFPROC) == 0)
 		return;
-	pcb1 = td1->td_pcb;
 	pcb2 = (struct pcb *)(td2->td_kstack + td2->td_kstack_pages * PAGE_SIZE) - 1;
 #ifdef __XSCALE__
 #ifndef CPU_XSCALE_CORE3

Modified: head/sys/arm/sa11x0/assabet_machdep.c
==============================================================================
--- head/sys/arm/sa11x0/assabet_machdep.c	Mon Feb  2 19:54:16 2009	(r188018)
+++ head/sys/arm/sa11x0/assabet_machdep.c	Mon Feb  2 20:09:14 2009	(r188019)
@@ -210,12 +210,10 @@ initarm(void *arg, void *arg2)
 	struct pv_addr	md_addr;
 	struct pv_addr	md_bla;
 	int loop;
-	u_int kerneldatasize, symbolsize;
 	u_int l1pagetable;
 	vm_offset_t freemempos;
 	vm_offset_t lastalloced;
 	vm_offset_t lastaddr;
-	vm_size_t pt_size;
 	uint32_t memsize = 32 * 1024 * 1024;
 	sa1110_uart_vaddr = SACOM1_VBASE;
 
@@ -232,8 +230,6 @@ initarm(void *arg, void *arg2)
 	physical_end =  lastaddr;
 	physical_freestart = (((vm_offset_t)physical_end) + PAGE_MASK) & ~PAGE_MASK;
 	md_addr.pv_va = md_addr.pv_pa = MDROOT_ADDR;
-	kerneldatasize = (u_int32_t)&end - (u_int32_t)KERNVIRTADDR;
-	symbolsize = 0;
 	freemempos = (vm_offset_t)round_page(physical_freestart);
 	memset((void *)freemempos, 0, 256*1024);
 		/* Define a macro to simplify memory allocation */
@@ -272,7 +268,6 @@ initarm(void *arg, void *arg2)
 	 * This page will just contain the system vectors and can be
 	 * shared by all processes.
 	 */
-	pt_size = round_page(freemempos) - physical_freestart;
 
 	/* Allocate stacks for all modes */
 	valloc_pages(irqstack, IRQ_STACK_SIZE);

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 20:14:32 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D4B1A1065686
	for <svn-src-head@freebsd.org>; Mon,  2 Feb 2009 20:14:32 +0000 (UTC)
	(envelope-from christoph.mallon@gmx.de)
Received: from mail.gmx.net (mail.gmx.net [213.165.64.20])
	by mx1.freebsd.org (Postfix) with SMTP id 1C5A18FC14
	for <svn-src-head@freebsd.org>; Mon,  2 Feb 2009 20:14:31 +0000 (UTC)
	(envelope-from christoph.mallon@gmx.de)
Received: (qmail invoked by alias); 02 Feb 2009 20:14:28 -0000
Received: from p54A3EDDF.dip.t-dialin.net (EHLO tron.homeunix.org)
	[84.163.237.223]
	by mail.gmx.net (mp008) with SMTP; 02 Feb 2009 21:14:28 +0100
X-Authenticated: #1673122
X-Provags-ID: V01U2FsdGVkX18RD58hUxURGwMfjWec2c9kZT8C3nipPvNc750WQO
	kALN2E/BiKeoB9
Message-ID: <49875422.8070402@gmx.de>
Date: Mon, 02 Feb 2009 21:14:26 +0100
From: Christoph Mallon <christoph.mallon@gmx.de>
User-Agent: Thunderbird 2.0.0.19 (X11/20090103)
MIME-Version: 1.0
To: Olivier Houchard <cognet@FreeBSD.org>
References: <200902022009.n12K9Ei5006072@svn.freebsd.org>
In-Reply-To: <200902022009.n12K9Ei5006072@svn.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Y-GMX-Trusted: 0
X-FuHaFi: 0.58
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r188019 - in head/sys/arm: arm sa11x0
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 20:14:33 -0000

Olivier Houchard schrieb:
> Modified: head/sys/arm/sa11x0/assabet_machdep.c
> ==============================================================================
> --- head/sys/arm/sa11x0/assabet_machdep.c	Mon Feb  2 19:54:16 2009	(r188018)
> +++ head/sys/arm/sa11x0/assabet_machdep.c	Mon Feb  2 20:09:14 2009	(r188019)
> @@ -272,7 +268,6 @@ initarm(void *arg, void *arg2)
>  	 * This page will just contain the system vectors and can be
>  	 * shared by all processes.
>  	 */
> -	pt_size = round_page(freemempos) - physical_freestart;
>  
>  	/* Allocate stacks for all modes */
>  	valloc_pages(irqstack, IRQ_STACK_SIZE);

What about the comment above? It seems to relate to the removed line.

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 20:23:38 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 627AB106573B;
	Mon,  2 Feb 2009 20:23:38 +0000 (UTC)
	(envelope-from doginou@dong.ci0.org)
Received: from dong.ci0.org (dong.ci0.org [IPv6:2001:7a8:2066:1::1])
	by mx1.freebsd.org (Postfix) with ESMTP id 901138FC0A;
	Mon,  2 Feb 2009 20:23:37 +0000 (UTC)
	(envelope-from doginou@dong.ci0.org)
Received: from dong.ci0.org (localhost.ci0.org [127.0.0.1])
	by dong.ci0.org (8.14.1/8.13.8) with ESMTP id n12N0tCN058412;
	Tue, 3 Feb 2009 00:00:55 +0100 (CET)
	(envelope-from doginou@dong.ci0.org)
Received: (from doginou@localhost)
	by dong.ci0.org (8.14.1/8.13.8/Submit) id n12N0tHR058411;
	Tue, 3 Feb 2009 00:00:55 +0100 (CET) (envelope-from doginou)
Date: Tue, 3 Feb 2009 00:00:55 +0100
From: Olivier Houchard <cognet@ci0.org>
To: Christoph Mallon <christoph.mallon@gmx.de>
Message-ID: <20090202230054.GA58364@ci0.org>
References: <200902022009.n12K9Ei5006072@svn.freebsd.org>
	<49875422.8070402@gmx.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <49875422.8070402@gmx.de>
User-Agent: Mutt/1.4.1i
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r188019 - in head/sys/arm: arm sa11x0
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 20:23:40 -0000

On Mon, Feb 02, 2009 at 09:14:26PM +0100, Christoph Mallon wrote:
> Olivier Houchard schrieb:
> >Modified: head/sys/arm/sa11x0/assabet_machdep.c
> >==============================================================================
> >--- head/sys/arm/sa11x0/assabet_machdep.c	Mon Feb  2 19:54:16 2009 
> >(r188018)
> >+++ head/sys/arm/sa11x0/assabet_machdep.c	Mon Feb  2 20:09:14 2009 
> >(r188019)
> >@@ -272,7 +268,6 @@ initarm(void *arg, void *arg2)
> > 	 * This page will just contain the system vectors and can be
> > 	 * shared by all processes.
> > 	 */
> >-	pt_size = round_page(freemempos) - physical_freestart;
> > 
> > 	/* Allocate stacks for all modes */
> > 	valloc_pages(irqstack, IRQ_STACK_SIZE);
> 
> What about the comment above? It seems to relate to the removed line.

Actually, it refers to the line just before :)
I'm going to move it up so it's more clear.

Thanks,

Olivier

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 20:24:30 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 77D481065729;
	Mon,  2 Feb 2009 20:24:29 +0000 (UTC)
	(envelope-from cognet@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8D7728FC1D;
	Mon,  2 Feb 2009 20:24:29 +0000 (UTC)
	(envelope-from cognet@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12KOT4g006432;
	Mon, 2 Feb 2009 20:24:29 GMT (envelope-from cognet@svn.freebsd.org)
Received: (from cognet@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12KOT1M006431;
	Mon, 2 Feb 2009 20:24:29 GMT (envelope-from cognet@svn.freebsd.org)
Message-Id: <200902022024.n12KOT1M006431@svn.freebsd.org>
From: Olivier Houchard <cognet@FreeBSD.org>
Date: Mon, 2 Feb 2009 20:24:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188020 - head/sys/arm/sa11x0
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 20:24:32 -0000

Author: cognet
Date: Mon Feb  2 20:24:29 2009
New Revision: 188020
URL: http://svn.freebsd.org/changeset/base/188020

Log:
  Move a comment to where it belongs.
  
  Spotted out by:	Christoph Mallon <christoph d0t mallon AT gmx d0t de>

Modified:
  head/sys/arm/sa11x0/assabet_machdep.c

Modified: head/sys/arm/sa11x0/assabet_machdep.c
==============================================================================
--- head/sys/arm/sa11x0/assabet_machdep.c	Mon Feb  2 20:09:14 2009	(r188019)
+++ head/sys/arm/sa11x0/assabet_machdep.c	Mon Feb  2 20:24:29 2009	(r188020)
@@ -261,13 +261,12 @@ initarm(void *arg, void *arg2)
 		}
 	}
 
-	valloc_pages(systempage, 1);
-
 	/*
 	 * Allocate a page for the system page mapped to V0x00000000
 	 * This page will just contain the system vectors and can be
 	 * shared by all processes.
 	 */
+	valloc_pages(systempage, 1);
 
 	/* Allocate stacks for all modes */
 	valloc_pages(irqstack, IRQ_STACK_SIZE);

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 20:55:11 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8685D106580E;
	Mon,  2 Feb 2009 20:55:11 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id AF7918FC21;
	Mon,  2 Feb 2009 20:55:08 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net
	[98.109.39.197])
	by cyrus.watson.org (Postfix) with ESMTPSA id 2C54946B2E;
	Mon,  2 Feb 2009 15:55:08 -0500 (EST)
Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0)
	by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n12Kt1V1043547;
	Mon, 2 Feb 2009 15:55:02 -0500 (EST) (envelope-from jhb@freebsd.org)
From: John Baldwin <jhb@freebsd.org>
To: src-committers@freebsd.org
Date: Mon, 2 Feb 2009 15:54:55 -0500
User-Agent: KMail/1.9.7
References: <200902021954.n12JsGT2005768@svn.freebsd.org>
In-Reply-To: <200902021954.n12JsGT2005768@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200902021554.55644.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by
	milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]);
	Mon, 02 Feb 2009 15:55:02 -0500 (EST)
X-Virus-Scanned: ClamAV 0.94.2/8942/Mon Feb 2 13:56:43 2009 on
	server.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 
	autolearn=ham version=3.1.3
X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org
Subject: Re: svn commit: r188018 - in head: sys/dev/pci usr.sbin/pciconf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 20:55:34 -0000

On Monday 02 February 2009 2:54:16 pm John Baldwin wrote:
> Author: jhb
> Date: Mon Feb  2 19:54:16 2009
> New Revision: 188018
> URL: http://svn.freebsd.org/changeset/base/188018
> 
> Log:
>   - Add a new ioctl to /dev/pci to fetch details on an individual BAR of a
>     device.  The details include the current value of the BAR (including all
>     the flag bits and the current base address), its length, and whether or not
>     it is enabled.  Since this operation is not invasive, non-root users are
>     allowed to use it (unlike manual config register access which requires
>     root).  The intention is that userland apps (such as Xorg) will use this
>     interface rather than dangerously frobbing the BARs from userland to
>     obtain this information.
>   - Add a new sub-mode to the 'list' mode of pciconf.  The -b flag when used
>     with -l will now list all the active BARs for each device.
>   
>   MFC after:	1 month

As with the capability messages, I attempted to make the bar messages match
the output of a verbose dmesg.  An example:

igb0@pci0:8:0:0:        class=0x020000 card=0x10a715d9 chip=0x10a78086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    class      = network
    subclass   = ethernet
    bar   [10] = type Memory, range 32, base 0xda020000, size 131072, enabled
    bar   [14] = type Memory, range 32, base 0xda000000, size 131072, enabled
    bar   [18] = type I/O Port, range 32, base 0x3000, size 32, enabled
    bar   [1c] = type Memory, range 32, base 0xda080000, size 16384, enabled
    cap 01[40] = powerspec 2  supports D0 D3  current D0
    cap 05[50] = MSI supports 1 message, 64 bit
    cap 11[60] = MSI-X supports 10 messages in map 0x1c enabled
    cap 10[a0] = PCI-Express 2 endpoint

There are a few caveats:

 1) the ioctl will not report any status for a BAR that doesn't have allocated
    resources.  We could fix this is if we stored details about the BARs we
    enumerate during pci_add_child() in the dinfo.
 2) The ioctl will report status for BARs we add via quirks, but the pciconf
    doesn't know how to get to them.  It may make sense for the IOCTL to work
    differently than it does now.  Perhaps as an iterator where you request
    register 0 the first time, and then pass in the previous register on each
    update.  It would then walk all the resources and signal end by setting
    the register to -1.  The current mode does handle what Xorg expects I
    think, whereas the iterator approach would require more hacking on X.

-- 
John Baldwin

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 21:05:12 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9C62410656CB;
	Mon,  2 Feb 2009 21:05:12 +0000 (UTC)
	(envelope-from sbruno@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6D78D8FC0A;
	Mon,  2 Feb 2009 21:05:12 +0000 (UTC)
	(envelope-from sbruno@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12L5CX6007522;
	Mon, 2 Feb 2009 21:05:12 GMT (envelope-from sbruno@svn.freebsd.org)
Received: (from sbruno@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12L5C3o007520;
	Mon, 2 Feb 2009 21:05:12 GMT (envelope-from sbruno@svn.freebsd.org)
Message-Id: <200902022105.n12L5C3o007520@svn.freebsd.org>
From: Sean Bruno <sbruno@FreeBSD.org>
Date: Mon, 2 Feb 2009 21:05:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188029 - head/usr.sbin/fwcontrol
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 21:05:14 -0000

Author: sbruno
Date: Mon Feb  2 21:05:12 2009
New Revision: 188029
URL: http://svn.freebsd.org/changeset/base/188029

Log:
  Begin basic improvements to fwcontrol in the area of handling
  video streams from cameras.
  
  This patch changes the displayed timer to a time stamp and corrects
  one or two mishandled errors.
  
  Submitted by:	imp

Modified:
  head/usr.sbin/fwcontrol/fwdv.c
  head/usr.sbin/fwcontrol/fwmpegts.c

Modified: head/usr.sbin/fwcontrol/fwdv.c
==============================================================================
--- head/usr.sbin/fwcontrol/fwdv.c	Mon Feb  2 21:02:23 2009	(r188028)
+++ head/usr.sbin/fwcontrol/fwdv.c	Mon Feb  2 21:05:12 2009	(r188029)
@@ -202,15 +202,20 @@ again:
 					(dv->payload[0] & DV_DSF_12) == 0)
 					dv->payload[0] |= DV_DSF_12;
 				nb = nblocks[system];
-				fprintf(stderr, "%d", k%10);
+ 				fprintf(stderr, "%d:%02d:%02d %d\r",
+					k / (3600 * frame_rate[system]),
+					(k / (60 * frame_rate[system])) % 60,
+					(k / frame_rate[system]) % 60,
+					k % frame_rate[system]);
+
 #if FIX_FRAME
 				if (m > 0 && m != nb) {
 					/* padding bad frame */
 					npad = ((nb - m) % nb);
 					if (npad < 0)
 						npad += nb;
-					fprintf(stderr, "(%d blocks padded)",
-								npad);
+					fprintf(stderr, "\n%d blocks padded\n",
+					    npad);
 					npad *= DSIZE;
 					wbuf[vec].iov_base = pad;
 					wbuf[vec++].iov_len = npad;
@@ -221,10 +226,6 @@ again:
 				}
 #endif
 				k++;
-				if (k % frame_rate[system] == 0) {
-					/* every second */
-					fprintf(stderr, "\n");
-				}
 				fflush(stderr);
 				m = 0;
 			}
@@ -245,9 +246,8 @@ next:
 		if (vec > 0)
 			writev(fd, wbuf, vec);
 	}
-	if(fd != STDOUT_FILENO) {
+	if (fd != STDOUT_FILENO)
 		close(fd);
-	}
 	fprintf(stderr, "\n");
 }
 

Modified: head/usr.sbin/fwcontrol/fwmpegts.c
==============================================================================
--- head/usr.sbin/fwcontrol/fwmpegts.c	Mon Feb  2 21:02:23 2009	(r188028)
+++ head/usr.sbin/fwcontrol/fwmpegts.c	Mon Feb  2 21:05:12 2009	(r188029)
@@ -195,10 +195,9 @@ mpegtsrecv(int d, const char *filename, 
 		if (len < 0) {
 			if (errno == EAGAIN) {
 				fprintf(stderr, "(EAGAIN) - push 'Play'?\n");
-				if (len <= 0)
-					continue;
-			} else
-				err(1, "read failed");
+				continue;
+			}
+			err(1, "read failed");
 		}
 		ptr = (uint32_t *) buf;
 

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 21:34:04 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 725F7106566B;
	Mon,  2 Feb 2009 21:34:04 +0000 (UTC)
	(envelope-from emax@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 60A478FC1B;
	Mon,  2 Feb 2009 21:34:04 +0000 (UTC)
	(envelope-from emax@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12LY4Y0008111;
	Mon, 2 Feb 2009 21:34:04 GMT (envelope-from emax@svn.freebsd.org)
Received: (from emax@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12LY4H0008110;
	Mon, 2 Feb 2009 21:34:04 GMT (envelope-from emax@svn.freebsd.org)
Message-Id: <200902022134.n12LY4H0008110@svn.freebsd.org>
From: Maksim Yevmenkin <emax@FreeBSD.org>
Date: Mon, 2 Feb 2009 21:34:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188030 - head/sys/dev/kbdmux
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 21:34:04 -0000

Author: emax
Date: Mon Feb  2 21:34:04 2009
New Revision: 188030
URL: http://svn.freebsd.org/changeset/base/188030

Log:
  Properly retun error core from kbdmux_modevent()
  
  Reported by:	Christoph Mallon < christoph -dot- mallon -at- gmx -dot- de >
  MFC after:	1 week

Modified:
  head/sys/dev/kbdmux/kbdmux.c

Modified: head/sys/dev/kbdmux/kbdmux.c
==============================================================================
--- head/sys/dev/kbdmux/kbdmux.c	Mon Feb  2 21:05:12 2009	(r188029)
+++ head/sys/dev/kbdmux/kbdmux.c	Mon Feb  2 21:34:04 2009	(r188030)
@@ -1363,7 +1363,7 @@ kbdmux_modevent(module_t mod, int type, 
 		break;
 	}
 
-	return (0);
+	return (error);
 }
 
 DEV_MODULE(kbdmux, kbdmux_modevent, NULL);

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 21:41:51 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7357A106564A;
	Mon,  2 Feb 2009 21:41:51 +0000 (UTC)
	(envelope-from rnoland@FreeBSD.org)
Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195])
	by mx1.freebsd.org (Postfix) with ESMTP id 3F1578FC21;
	Mon,  2 Feb 2009 21:41:50 +0000 (UTC)
	(envelope-from rnoland@FreeBSD.org)
Received: from [192.168.1.132] (adsl-157-59-139.bna.bellsouth.net
	[70.157.59.139]) (authenticated bits=0)
	by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id n12L90UT094805
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Mon, 2 Feb 2009 16:09:00 -0500 (EST)
	(envelope-from rnoland@FreeBSD.org)
From: Robert Noland <rnoland@FreeBSD.org>
To: John Baldwin <jhb@freebsd.org>
In-Reply-To: <200902021554.55644.jhb@freebsd.org>
References: <200902021954.n12JsGT2005768@svn.freebsd.org>
	<200902021554.55644.jhb@freebsd.org>
Content-Type: multipart/signed; micalg="pgp-sha1";
	protocol="application/pgp-signature";
	boundary="=-g/9T2Lflg1SfluNqpfAK"
Organization: FreeBSD
Date: Mon, 02 Feb 2009 16:09:35 -0500
Message-Id: <1233608975.1492.45.camel@ferret.2hip.net>
Mime-Version: 1.0
X-Mailer: Evolution 2.24.3 FreeBSD GNOME Team Port 
X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_PBL,
	RDNS_DYNAMIC autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r188018 - in head: sys/dev/pci usr.sbin/pciconf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 21:41:52 -0000


--=-g/9T2Lflg1SfluNqpfAK
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Mon, 2009-02-02 at 15:54 -0500, John Baldwin wrote:
> On Monday 02 February 2009 2:54:16 pm John Baldwin wrote:
> > Author: jhb
> > Date: Mon Feb  2 19:54:16 2009
> > New Revision: 188018
> > URL: http://svn.freebsd.org/changeset/base/188018
> >=20
> > Log:
> >   - Add a new ioctl to /dev/pci to fetch details on an individual BAR o=
f a
> >     device.  The details include the current value of the BAR (includin=
g all
> >     the flag bits and the current base address), its length, and whethe=
r or not
> >     it is enabled.  Since this operation is not invasive, non-root user=
s are
> >     allowed to use it (unlike manual config register access which requi=
res
> >     root).  The intention is that userland apps (such as Xorg) will use=
 this
> >     interface rather than dangerously frobbing the BARs from userland t=
o
> >     obtain this information.
> >   - Add a new sub-mode to the 'list' mode of pciconf.  The -b flag when=
 used
> >     with -l will now list all the active BARs for each device.
> >  =20
> >   MFC after:	1 month
>=20
> As with the capability messages, I attempted to make the bar messages mat=
ch
> the output of a verbose dmesg.  An example:
>=20
> igb0@pci0:8:0:0:        class=3D0x020000 card=3D0x10a715d9 chip=3D0x10a78=
086 rev=3D0x02 hdr=3D0x00
>     vendor     =3D 'Intel Corporation'
>     class      =3D network
>     subclass   =3D ethernet
>     bar   [10] =3D type Memory, range 32, base 0xda020000, size 131072, e=
nabled
>     bar   [14] =3D type Memory, range 32, base 0xda000000, size 131072, e=
nabled
>     bar   [18] =3D type I/O Port, range 32, base 0x3000, size 32, enabled
>     bar   [1c] =3D type Memory, range 32, base 0xda080000, size 16384, en=
abled
>     cap 01[40] =3D powerspec 2  supports D0 D3  current D0
>     cap 05[50] =3D MSI supports 1 message, 64 bit
>     cap 11[60] =3D MSI-X supports 10 messages in map 0x1c enabled
>     cap 10[a0] =3D PCI-Express 2 endpoint

I haven't looked this over thoroughly yet, but will it support BIOS
mappings as well?  Or should I take a crack at adding that?

robert.

> There are a few caveats:
>=20
>  1) the ioctl will not report any status for a BAR that doesn't have allo=
cated
>     resources.  We could fix this is if we stored details about the BARs =
we
>     enumerate during pci_add_child() in the dinfo.
>  2) The ioctl will report status for BARs we add via quirks, but the pcic=
onf
>     doesn't know how to get to them.  It may make sense for the IOCTL to =
work
>     differently than it does now.  Perhaps as an iterator where you reque=
st
>     register 0 the first time, and then pass in the previous register on =
each
>     update.  It would then walk all the resources and signal end by setti=
ng
>     the register to -1.  The current mode does handle what Xorg expects I
>     think, whereas the iterator approach would require more hacking on X.

--=20
Robert Noland <rnoland@FreeBSD.org>
FreeBSD

--=-g/9T2Lflg1SfluNqpfAK
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (FreeBSD)

iEYEABECAAYFAkmHYQ8ACgkQM4TrQ4qfROMQbQCfe10dRnIuqFXgaPzlO7CyG+5P
UXEAnj+0ZE8841fCl7+A5HirZTfyWByV
=bk7a
-----END PGP SIGNATURE-----

--=-g/9T2Lflg1SfluNqpfAK--


From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 21:51:52 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8D4ED106564A;
	Mon,  2 Feb 2009 21:51:52 +0000 (UTC)
	(envelope-from rdivacky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7A9198FC08;
	Mon,  2 Feb 2009 21:51:52 +0000 (UTC)
	(envelope-from rdivacky@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12Lpq72008471;
	Mon, 2 Feb 2009 21:51:52 GMT (envelope-from rdivacky@svn.freebsd.org)
Received: (from rdivacky@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12LpqeC008470;
	Mon, 2 Feb 2009 21:51:52 GMT (envelope-from rdivacky@svn.freebsd.org)
Message-Id: <200902022151.n12LpqeC008470@svn.freebsd.org>
From: Roman Divacky <rdivacky@FreeBSD.org>
Date: Mon, 2 Feb 2009 21:51:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188031 - head/lib/libc/sparc64/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 21:51:53 -0000

Author: rdivacky
Date: Mon Feb  2 21:51:52 2009
New Revision: 188031
URL: http://svn.freebsd.org/changeset/base/188031

Log:
  Provide a type for the argument.
  
  Approved by:	kib (mentor)

Modified:
  head/lib/libc/sparc64/sys/__sparc_utrap.c

Modified: head/lib/libc/sparc64/sys/__sparc_utrap.c
==============================================================================
--- head/lib/libc/sparc64/sys/__sparc_utrap.c	Mon Feb  2 21:34:04 2009	(r188030)
+++ head/lib/libc/sparc64/sys/__sparc_utrap.c	Mon Feb  2 21:51:52 2009	(r188031)
@@ -122,7 +122,7 @@ __utrap_write(const char *str)
 }
 
 void
-__utrap_kill_self(sig)
+__utrap_kill_self(int sig)
 {
 	int berrno;
 

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 22:04:41 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2977E1065674;
	Mon,  2 Feb 2009 22:04:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 122418FC0C;
	Mon,  2 Feb 2009 22:04:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12M4elZ008778;
	Mon, 2 Feb 2009 22:04:40 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12M4e0C008777;
	Mon, 2 Feb 2009 22:04:40 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200902022204.n12M4e0C008777@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Mon, 2 Feb 2009 22:04:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188032 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 22:04:41 -0000

Author: jhb
Date: Mon Feb  2 22:04:40 2009
New Revision: 188032
URL: http://svn.freebsd.org/changeset/base/188032

Log:
  - Add a new ioctl to /dev/pci to fetch details on an individual BAR of a
    device.  The details include the current value of the BAR (including all
    the flag bits and the current base address), its length, and whether or not
    it is enabled.  Since this operation is not invasive, non-root users are
    allowed to use it (unlike manual config register access which requires
    root).  The intention is that userland apps (such as Xorg) will use this
    interface rather than dangerously frobbing the BARs from userland to
    obtain this information.
  - Add a new sub-mode to the 'list' mode of pciconf.  The -b flag when used
    with -l will now list all the active BARs for each device.
  
  (Missed in previous commit)
  
  MFC after:	1 week

Modified:
  head/sys/sys/pciio.h

Modified: head/sys/sys/pciio.h
==============================================================================
--- head/sys/sys/pciio.h	Mon Feb  2 21:51:52 2009	(r188031)
+++ head/sys/sys/pciio.h	Mon Feb  2 22:04:40 2009	(r188032)
@@ -108,9 +108,18 @@ struct pci_io {
 	u_int32_t	pi_data;	/* data to write or result of read */
 };
 
+struct pci_bar_io {
+	struct pcisel	pbi_sel;	/* device to operate on */
+	int		pbi_reg;	/* starting address of BAR */
+	int		pbi_enabled;	/* decoding enabled */
+	uint64_t	pbi_base;	/* current value of BAR */
+	uint64_t	pbi_length;	/* length of BAR */
+};
+
 #define	PCIOCGETCONF	_IOWR('p', 5, struct pci_conf_io)
 #define	PCIOCREAD	_IOWR('p', 2, struct pci_io)
 #define	PCIOCWRITE	_IOWR('p', 3, struct pci_io)
 #define	PCIOCATTACHED	_IOWR('p', 4, struct pci_io)
+#define	PCIOCGETBAR	_IOWR('p', 6, struct pci_bar_io)
 
 #endif /* !_SYS_PCIIO_H_ */

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 22:06:21 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3634A106564A;
	Mon,  2 Feb 2009 22:06:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 24C198FC12;
	Mon,  2 Feb 2009 22:06:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12M6KWm008848;
	Mon, 2 Feb 2009 22:06:20 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12M6KPD008847;
	Mon, 2 Feb 2009 22:06:20 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200902022206.n12M6KPD008847@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Mon, 2 Feb 2009 22:06:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188033 - head/sys/dev/cardbus
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 22:06:21 -0000

Author: jhb
Date: Mon Feb  2 22:06:20 2009
New Revision: 188033
URL: http://svn.freebsd.org/changeset/base/188033

Log:
  Goof, catch up to constant rename (I renamed it to match the overall PCI
  style of having register offsets start with PCIR_* rather than PCI_*).
  
  Submitted by:	rss

Modified:
  head/sys/dev/cardbus/cardbus.c

Modified: head/sys/dev/cardbus/cardbus.c
==============================================================================
--- head/sys/dev/cardbus/cardbus.c	Mon Feb  2 22:04:40 2009	(r188032)
+++ head/sys/dev/cardbus/cardbus.c	Mon Feb  2 22:06:20 2009	(r188033)
@@ -143,7 +143,7 @@ cardbus_device_setup_regs(pcicfgregs *cf
 	 * Some cards power up with garbage in their BARs.  This
 	 * code clears all that junk out.
 	 */
-	for (i = 0; i < PCI_MAX_BAR_0; i++)
+	for (i = 0; i < PCIR_MAX_BAR_0; i++)
 		pci_write_config(dev, PCIR_BAR(i), 0, 4);
 
 	cfg->intline =

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 23:04:20 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5F19C1065672;
	Mon,  2 Feb 2009 23:04:20 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4D5088FC19;
	Mon,  2 Feb 2009 23:04:20 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n12N4K9M010211;
	Mon, 2 Feb 2009 23:04:20 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n12N4KGJ010210;
	Mon, 2 Feb 2009 23:04:20 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200902022304.n12N4KGJ010210@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Mon, 2 Feb 2009 23:04:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188036 - head/sys/dev/xen/netfront
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 23:04:21 -0000

Author: kmacy
Date: Mon Feb  2 23:04:20 2009
New Revision: 188036
URL: http://svn.freebsd.org/changeset/base/188036

Log:
  break out of loop if we run out of mbufs

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==============================================================================
--- head/sys/dev/xen/netfront/netfront.c	Mon Feb  2 22:18:48 2009	(r188035)
+++ head/sys/dev/xen/netfront/netfront.c	Mon Feb  2 23:04:20 2009	(r188036)
@@ -1234,11 +1234,12 @@ xennet_get_responses(struct netfront_inf
 		gnttab_release_grant_reference(&np->gref_rx_head, ref);
 
 next:
-		if (m != NULL) {
-				m->m_len = rx->status;
-				m->m_data += rx->offset;
-				m0->m_pkthdr.len += rx->status;
-		}
+		if (m == NULL)
+			break;
+		
+		m->m_len = rx->status;
+		m->m_data += rx->offset;
+		m0->m_pkthdr.len += rx->status;
 		
 		if (!(rx->flags & NETRXF_more_data))
 			break;

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 23:09:53 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9A92E1065673;
	Mon,  2 Feb 2009 23:09:53 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 68CB98FC0C;
	Mon,  2 Feb 2009 23:09:53 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net
	[98.109.39.197])
	by cyrus.watson.org (Postfix) with ESMTPSA id D803C46B03;
	Mon,  2 Feb 2009 18:09:52 -0500 (EST)
Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0)
	by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n12N9ksp044335;
	Mon, 2 Feb 2009 18:09:47 -0500 (EST) (envelope-from jhb@freebsd.org)
From: John Baldwin <jhb@freebsd.org>
To: Robert Noland <rnoland@freebsd.org>
Date: Mon, 2 Feb 2009 16:59:54 -0500
User-Agent: KMail/1.9.7
References: <200902021954.n12JsGT2005768@svn.freebsd.org>
	<200902021554.55644.jhb@freebsd.org>
	<1233608975.1492.45.camel@ferret.2hip.net>
In-Reply-To: <1233608975.1492.45.camel@ferret.2hip.net>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200902021659.54847.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by
	milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]);
	Mon, 02 Feb 2009 18:09:47 -0500 (EST)
X-Virus-Scanned: ClamAV 0.94.2/8942/Mon Feb 2 13:56:43 2009 on
	server.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 
	autolearn=ham version=3.1.3
X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r188018 - in head: sys/dev/pci usr.sbin/pciconf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 23:09:54 -0000

On Monday 02 February 2009 4:09:35 pm Robert Noland wrote:
> On Mon, 2009-02-02 at 15:54 -0500, John Baldwin wrote:
> > On Monday 02 February 2009 2:54:16 pm John Baldwin wrote:
> > > Author: jhb
> > > Date: Mon Feb  2 19:54:16 2009
> > > New Revision: 188018
> > > URL: http://svn.freebsd.org/changeset/base/188018
> > > 
> > > Log:
> > >   - Add a new ioctl to /dev/pci to fetch details on an individual BAR of 
a
> > >     device.  The details include the current value of the BAR (including 
all
> > >     the flag bits and the current base address), its length, and whether 
or not
> > >     it is enabled.  Since this operation is not invasive, non-root users 
are
> > >     allowed to use it (unlike manual config register access which 
requires
> > >     root).  The intention is that userland apps (such as Xorg) will use 
this
> > >     interface rather than dangerously frobbing the BARs from userland to
> > >     obtain this information.
> > >   - Add a new sub-mode to the 'list' mode of pciconf.  The -b flag when 
used
> > >     with -l will now list all the active BARs for each device.
> > >   
> > >   MFC after:	1 month
> > 
> > As with the capability messages, I attempted to make the bar messages 
match
> > the output of a verbose dmesg.  An example:
> > 
> > igb0@pci0:8:0:0:        class=0x020000 card=0x10a715d9 chip=0x10a78086 
rev=0x02 hdr=0x00
> >     vendor     = 'Intel Corporation'
> >     class      = network
> >     subclass   = ethernet
> >     bar   [10] = type Memory, range 32, base 0xda020000, size 131072, 
enabled
> >     bar   [14] = type Memory, range 32, base 0xda000000, size 131072, 
enabled
> >     bar   [18] = type I/O Port, range 32, base 0x3000, size 32, enabled
> >     bar   [1c] = type Memory, range 32, base 0xda080000, size 16384, 
enabled
> >     cap 01[40] = powerspec 2  supports D0 D3  current D0
> >     cap 05[50] = MSI supports 1 message, 64 bit
> >     cap 11[60] = MSI-X supports 10 messages in map 0x1c enabled
> >     cap 10[a0] = PCI-Express 2 endpoint
> 
> I haven't looked this over thoroughly yet, but will it support BIOS
> mappings as well?  Or should I take a crack at adding that?

It does not handle the BIOS BAR.  If we need to we can either extend this or 
add a new ioctl for that.  However, if X is just reading the current setting 
then what it is doing now may be fine.  I will try to look at the current 
code for that in a bit.

-- 
John Baldwin

From owner-svn-src-head@FreeBSD.ORG  Mon Feb  2 23:21:30 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0DB9F106566C;
	Mon,  2 Feb 2009 23:21:30 +0000 (UTC)
	(envelope-from rnoland@FreeBSD.org)
Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195])
	by mx1.freebsd.org (Postfix) with ESMTP id CEEAB8FC18;
	Mon,  2 Feb 2009 23:21:29 +0000 (UTC)
	(envelope-from rnoland@FreeBSD.org)
Received: from [192.168.1.132] (adsl-157-59-139.bna.bellsouth.net
	[70.157.59.139]) (authenticated bits=0)
	by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id n12NKkiG095563
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Mon, 2 Feb 2009 18:20:46 -0500 (EST)
	(envelope-from rnoland@FreeBSD.org)
From: Robert Noland <rnoland@FreeBSD.org>
To: John Baldwin <jhb@freebsd.org>
In-Reply-To: <200902021659.54847.jhb@freebsd.org>
References: <200902021954.n12JsGT2005768@svn.freebsd.org>
	<200902021554.55644.jhb@freebsd.org>
	<1233608975.1492.45.camel@ferret.2hip.net>
	<200902021659.54847.jhb@freebsd.org>
Content-Type: multipart/signed; micalg="pgp-sha1";
	protocol="application/pgp-signature";
	boundary="=-fbw5UWXx9fxxJncqNowf"
Organization: FreeBSD
Date: Mon, 02 Feb 2009 18:21:21 -0500
Message-Id: <1233616882.1492.68.camel@ferret.2hip.net>
Mime-Version: 1.0
X-Mailer: Evolution 2.24.3 FreeBSD GNOME Team Port 
X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_PBL,
	RDNS_DYNAMIC autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r188018 - in head: sys/dev/pci usr.sbin/pciconf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Feb 2009 23:21:30 -0000


--=-fbw5UWXx9fxxJncqNowf
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Mon, 2009-02-02 at 16:59 -0500, John Baldwin wrote:
> On Monday 02 February 2009 4:09:35 pm Robert Noland wrote:
> > On Mon, 2009-02-02 at 15:54 -0500, John Baldwin wrote:
> > > On Monday 02 February 2009 2:54:16 pm John Baldwin wrote:
> > > > Author: jhb
> > > > Date: Mon Feb  2 19:54:16 2009
> > > > New Revision: 188018
> > > > URL: http://svn.freebsd.org/changeset/base/188018
> > > >=20
> > > > Log:
> > > >   - Add a new ioctl to /dev/pci to fetch details on an individual B=
AR of=20
> a
> > > >     device.  The details include the current value of the BAR (incl=
uding=20
> all
> > > >     the flag bits and the current base address), its length, and wh=
ether=20
> or not
> > > >     it is enabled.  Since this operation is not invasive, non-root =
users=20
> are
> > > >     allowed to use it (unlike manual config register access which=20
> requires
> > > >     root).  The intention is that userland apps (such as Xorg) will=
 use=20
> this
> > > >     interface rather than dangerously frobbing the BARs from userla=
nd to
> > > >     obtain this information.
> > > >   - Add a new sub-mode to the 'list' mode of pciconf.  The -b flag =
when=20
> used
> > > >     with -l will now list all the active BARs for each device.
> > > >  =20
> > > >   MFC after:	1 month
> > >=20
> > > As with the capability messages, I attempted to make the bar messages=
=20
> match
> > > the output of a verbose dmesg.  An example:
> > >=20
> > > igb0@pci0:8:0:0:        class=3D0x020000 card=3D0x10a715d9 chip=3D0x1=
0a78086=20
> rev=3D0x02 hdr=3D0x00
> > >     vendor     =3D 'Intel Corporation'
> > >     class      =3D network
> > >     subclass   =3D ethernet
> > >     bar   [10] =3D type Memory, range 32, base 0xda020000, size 13107=
2,=20
> enabled
> > >     bar   [14] =3D type Memory, range 32, base 0xda000000, size 13107=
2,=20
> enabled
> > >     bar   [18] =3D type I/O Port, range 32, base 0x3000, size 32, ena=
bled
> > >     bar   [1c] =3D type Memory, range 32, base 0xda080000, size 16384=
,=20
> enabled
> > >     cap 01[40] =3D powerspec 2  supports D0 D3  current D0
> > >     cap 05[50] =3D MSI supports 1 message, 64 bit
> > >     cap 11[60] =3D MSI-X supports 10 messages in map 0x1c enabled
> > >     cap 10[a0] =3D PCI-Express 2 endpoint
> >=20
> > I haven't looked this over thoroughly yet, but will it support BIOS
> > mappings as well?  Or should I take a crack at adding that?
>=20
> It does not handle the BIOS BAR.  If we need to we can either extend this=
 or=20
> add a new ioctl for that.  However, if X is just reading the current sett=
ing=20
> then what it is doing now may be fine.  I will try to look at the current=
=20
> code for that in a bit.

Right now, X wants to know if a pci bios BAR exists, what size it is and
what the base address is.  In libpciaccess it then mmaps that region and
copies the bios into a buffer which is handed to X.  If a pci bios does
not exist, it mmaps 0xc0000 x 0x10000 (the standard VGA bios setting).
We may not be able to do this as efficiently as I would like unless we
implement a way to actually extract the bios contents, as userland would
still possibly need a way to set/restore the rom rom enabled bit for
copying.

robert.

--=20
Robert Noland <rnoland@FreeBSD.org>
FreeBSD

--=-fbw5UWXx9fxxJncqNowf
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (FreeBSD)

iEYEABECAAYFAkmHf/EACgkQM4TrQ4qfRONjNgCbB1nFueQDF5swNvmJZFfWWg78
dN8An0nP2tHlE+k39foZmw2S2TPpF8JY
=tXZD
-----END PGP SIGNATURE-----

--=-fbw5UWXx9fxxJncqNowf--


From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 00:10:22 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 023E31065679;
	Tue,  3 Feb 2009 00:10:22 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E47DF8FC14;
	Tue,  3 Feb 2009 00:10:21 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n130ALnv011552;
	Tue, 3 Feb 2009 00:10:21 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n130ALGm011551;
	Tue, 3 Feb 2009 00:10:21 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902030010.n130ALGm011551@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Tue, 3 Feb 2009 00:10:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188037 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 00:10:22 -0000

Author: imp
Date: Tue Feb  3 00:10:21 2009
New Revision: 188037
URL: http://svn.freebsd.org/changeset/base/188037

Log:
  Declare bus_data_devices to be static: it isn't used elsewhere.
  Use NULL in a couple of places rather than 0 in the context of
  pointers to be consistent with the rest of the file.

Modified:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==============================================================================
--- head/sys/kern/subr_bus.c	Mon Feb  2 23:04:20 2009	(r188036)
+++ head/sys/kern/subr_bus.c	Tue Feb  3 00:10:21 2009	(r188037)
@@ -741,10 +741,10 @@ sysctl_devctl_disable(SYSCTL_HANDLER_ARG
 
 /* End of /dev/devctl code */
 
-TAILQ_HEAD(,device)	bus_data_devices;
+static TAILQ_HEAD(,device)	bus_data_devices;
 static int bus_data_generation = 1;
 
-kobj_method_t null_methods[] = {
+static kobj_method_t null_methods[] = {
 	{ 0, 0 }
 };
 
@@ -1735,7 +1735,7 @@ device_probe_child(device_t dev, device_
 	driverlink_t best = NULL;
 	driverlink_t dl;
 	int result, pri = 0;
-	int hasclass = (child->devclass != 0);
+	int hasclass = (child->devclass != NULL);
 
 	GIANT_REQUIRED;
 
@@ -2014,7 +2014,7 @@ device_print_prettyname(device_t dev)
 {
 	const char *name = device_get_name(dev);
 
-	if (name == 0)
+	if (name == NULL)
 		return (printf("unknown: "));
 	return (printf("%s%d: ", name, device_get_unit(dev)));
 }
@@ -3842,7 +3842,7 @@ root_bus_module_handler(module_t mod, in
 static moduledata_t root_bus_mod = {
 	"rootbus",
 	root_bus_module_handler,
-	0
+	NULL
 };
 DECLARE_MODULE(rootbus, root_bus_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
 

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 00:15:19 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 948341065670;
	Tue,  3 Feb 2009 00:15:19 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 826BE8FC08;
	Tue,  3 Feb 2009 00:15:19 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n130FJ1R011688;
	Tue, 3 Feb 2009 00:15:19 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n130FJHh011687;
	Tue, 3 Feb 2009 00:15:19 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200902030015.n130FJHh011687@svn.freebsd.org>
From: Xin LI <delphij@FreeBSD.org>
Date: Tue, 3 Feb 2009 00:15:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188038 - head/sbin/ifconfig
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 00:15:20 -0000

Author: delphij
Date: Tue Feb  3 00:15:19 2009
New Revision: 188038
URL: http://svn.freebsd.org/changeset/base/188038

Log:
  Use %u instead of %zu when we intend to print integer constant.

Modified:
  head/sbin/ifconfig/ifieee80211.c

Modified: head/sbin/ifconfig/ifieee80211.c
==============================================================================
--- head/sbin/ifconfig/ifieee80211.c	Tue Feb  3 00:10:21 2009	(r188037)
+++ head/sbin/ifconfig/ifieee80211.c	Tue Feb  3 00:15:19 2009	(r188038)
@@ -1023,16 +1023,16 @@ set80211chanlist(const char *val, int d,
 		switch (sscanf(cp, "%u-%u", &first, &last)) {
 		case 1:
 			if (first > IEEE80211_CHAN_MAX)
-				errx(-1, "channel %u out of range, max %zu",
+				errx(-1, "channel %u out of range, max %u",
 					first, IEEE80211_CHAN_MAX);
 			setbit(chanlist.ic_channels, first);
 			break;
 		case 2:
 			if (first > IEEE80211_CHAN_MAX)
-				errx(-1, "channel %u out of range, max %zu",
+				errx(-1, "channel %u out of range, max %u",
 					first, IEEE80211_CHAN_MAX);
 			if (last > IEEE80211_CHAN_MAX)
-				errx(-1, "channel %u out of range, max %zu",
+				errx(-1, "channel %u out of range, max %u",
 					last, IEEE80211_CHAN_MAX);
 			if (first > last)
 				errx(-1, "void channel range, %u > %u",

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 01:00:41 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 002C5106567D;
	Tue,  3 Feb 2009 01:00:40 +0000 (UTC) (envelope-from xcllnt@mac.com)
Received: from asmtpout018.mac.com (asmtpout018.mac.com [17.148.16.93])
	by mx1.freebsd.org (Postfix) with ESMTP id DDCF98FC2B;
	Tue,  3 Feb 2009 01:00:40 +0000 (UTC) (envelope-from xcllnt@mac.com)
MIME-version: 1.0
Content-transfer-encoding: 7BIT
Content-type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
Received: from srangarajan-t411.jnpr.net (natint3.juniper.net [66.129.224.36])
	by asmtp018.mac.com
	(Sun Java(tm) System Messaging Server 6.3-7.03 (built Aug  7 2008;
	32bit)) with ESMTPSA id <0KEG004ZFTH3JL20@asmtp018.mac.com>; Mon,
	02 Feb 2009 17:00:40 -0800 (PST)
Message-id: <685DBD3A-CE6E-4D0B-80C5-31DA98521200@mac.com>
From: Marcel Moolenaar <xcllnt@mac.com>
To: Ulf Lilleengen <lulf@freebsd.org>
In-reply-to: <200902021922.n12JMrM8005192@svn.freebsd.org>
Date: Mon, 02 Feb 2009 17:00:38 -0800
References: <200902021922.n12JMrM8005192@svn.freebsd.org>
X-Mailer: Apple Mail (2.930.3)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r188017 - head/sbin/geom/core
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 01:00:41 -0000


On Feb 2, 2009, at 11:22 AM, Ulf Lilleengen wrote:

>  - Use a separate pointer to the allocated memory for freeing, as  
> strsep may
>    modify the pointer argument passed to it. This triggered an  
> assert in malloc
>    when a geom command being run under the livefs environment.

Thanks Ulf!

-- 
Marcel Moolenaar
xcllnt@mac.com




From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 01:17:17 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 81D24106564A;
	Tue,  3 Feb 2009 01:17:17 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7025A8FC22;
	Tue,  3 Feb 2009 01:17:17 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n131HHAZ012860;
	Tue, 3 Feb 2009 01:17:17 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n131HHas012859;
	Tue, 3 Feb 2009 01:17:17 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902030117.n131HHas012859@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Tue, 3 Feb 2009 01:17:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188039 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 01:17:17 -0000

Author: imp
Date: Tue Feb  3 01:17:17 2009
New Revision: 188039
URL: http://svn.freebsd.org/changeset/base/188039

Log:
  Use NULL in preference to '0' for pointers.

Modified:
  head/sys/sys/sysctl.h

Modified: head/sys/sys/sysctl.h
==============================================================================
--- head/sys/sys/sysctl.h	Tue Feb  3 00:15:19 2009	(r188038)
+++ head/sys/sys/sysctl.h	Tue Feb  3 01:17:17 2009	(r188039)
@@ -222,7 +222,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 /* This constructs a "raw" MIB oid. */
 #define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
 	static struct sysctl_oid sysctl__##parent##_##name = {		 \
-		&sysctl_##parent##_children, { 0 }, nbr, kind,		 \
+		&sysctl_##parent##_children, { NULL }, nbr, kind,	 \
 		a1, a2, #name, handler, fmt, 0, __DESCR(descr) };        \
 	DATA_SET(sysctl_set, sysctl__##parent##_##name)
 
@@ -258,7 +258,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 
 #define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr)	    \
 	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access),	    \
-	0, 0, handler, "N", __DESCR(descr))
+	NULL, 0, handler, "N", __DESCR(descr))
 
 /* Oid for a string.  len can be 0 to indicate '\0' termination. */
 #define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 01:17:35 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8AFBD106566B;
	Tue,  3 Feb 2009 01:17:35 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 78CFE8FC2B;
	Tue,  3 Feb 2009 01:17:35 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n131HZRC012900;
	Tue, 3 Feb 2009 01:17:35 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n131HZDr012899;
	Tue, 3 Feb 2009 01:17:35 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902030117.n131HZDr012899@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Tue, 3 Feb 2009 01:17:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188040 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 01:17:36 -0000

Author: imp
Date: Tue Feb  3 01:17:34 2009
New Revision: 188040
URL: http://svn.freebsd.org/changeset/base/188040

Log:
  Use NULL in preference to 0 for pointers.

Modified:
  head/sys/sys/kobj.h

Modified: head/sys/sys/kobj.h
==============================================================================
--- head/sys/sys/kobj.h	Tue Feb  3 01:17:17 2009	(r188039)
+++ head/sys/sys/kobj.h	Tue Feb  3 01:17:34 2009	(r188040)
@@ -114,7 +114,7 @@ DEFINE_CLASS_0(name, name ## _class, met
 #define DEFINE_CLASS_0(name, classvar, methods, size)	\
 							\
 struct kobj_class classvar = {				\
-	#name, methods, size, 0				\
+	#name, methods, size, NULL			\
 }
 
 /*
@@ -127,7 +127,7 @@ struct kobj_class classvar = {				\
 		       base1)				\
 							\
 static kobj_class_t name ## _baseclasses[] =		\
-	{ &base1, 0 };					\
+	{ &base1, NULL };					\
 struct kobj_class classvar = {				\
 	#name, methods, size, name ## _baseclasses	\
 }
@@ -143,7 +143,7 @@ struct kobj_class classvar = {				\
 							\
 static kobj_class_t name ## _baseclasses[] =		\
 	{ &base1,					\
-	  &base2, 0 };					\
+	  &base2, NULL };				\
 struct kobj_class name ## _class = {			\
 	#name, methods, size, name ## _baseclasses	\
 }
@@ -160,7 +160,7 @@ struct kobj_class name ## _class = {			\
 static kobj_class_t name ## _baseclasses[] =		\
 	{ &base1,					\
 	  &base2,					\
-	  &base3, 0 };					\
+	  &base3, NULL };				\
 struct kobj_class name ## _class = {			\
 	#name, methods, size, name ## _baseclasses	\
 }

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 03:43:00 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 82F71106564A;
	Tue,  3 Feb 2009 03:43:00 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5751A8FC14;
	Tue,  3 Feb 2009 03:43:00 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n133h08H016111;
	Tue, 3 Feb 2009 03:43:00 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n133h0LH016110;
	Tue, 3 Feb 2009 03:43:00 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200902030343.n133h0LH016110@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Tue, 3 Feb 2009 03:43:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188042 - head/sys/i386/xen
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 03:43:01 -0000

Author: kmacy
Date: Tue Feb  3 03:43:00 2009
New Revision: 188042
URL: http://svn.freebsd.org/changeset/base/188042

Log:
  make sure that interrupts are disabled when handling page faults et al

Modified:
  head/sys/i386/xen/xen_machdep.c

Modified: head/sys/i386/xen/xen_machdep.c
==============================================================================
--- head/sys/i386/xen/xen_machdep.c	Tue Feb  3 02:51:57 2009	(r188041)
+++ head/sys/i386/xen/xen_machdep.c	Tue Feb  3 03:43:00 2009	(r188042)
@@ -1130,13 +1130,13 @@ initvalues(start_info_t *startinfo)
 
 trap_info_t trap_table[] = {
 	{ 0,   0, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(div)},
-	{ 1,   0, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(dbg)},
-	{ 3,   3, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(bpt)},
+	{ 1,   0|4, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(dbg)},
+	{ 3,   3|4, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(bpt)},
 	{ 4,   3, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(ofl)},
 	/* This is UPL on Linux and KPL on BSD */
 	{ 5,   3, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(bnd)},
 	{ 6,   0, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(ill)},
-	{ 7,   0, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(dna)},
+	{ 7,   0|4, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(dna)},
 	/*
 	 * { 8,   0, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(XXX)},
 	 *   no handler for double fault
@@ -1146,7 +1146,7 @@ trap_info_t trap_table[] = {
 	{11,   0, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(missing)},
 	{12,   0, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(stk)},
 	{13,   0, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(prot)},
-	{14,   0, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(page)},
+	{14,   0|4, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(page)},
 	{15,   0, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(rsvd)},
 	{16,   0, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(fpu)},
 	{17,   0, GSEL(GCODE_SEL, SEL_KPL), (unsigned long) &IDTVEC(align)},

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 04:28:46 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8A7341065674;
	Tue,  3 Feb 2009 04:28:46 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 78EB38FC18;
	Tue,  3 Feb 2009 04:28:46 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n134SkjB017032;
	Tue, 3 Feb 2009 04:28:46 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n134Skg8017030;
	Tue, 3 Feb 2009 04:28:46 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902030428.n134Skg8017030@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Tue, 3 Feb 2009 04:28:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188044 - head/sys/dev/mmc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 04:28:47 -0000

Author: imp
Date: Tue Feb  3 04:28:45 2009
New Revision: 188044
URL: http://svn.freebsd.org/changeset/base/188044

Log:
  o Define some symbols for a few items that are bare constants in the
    code.
  o Use NULL in preference to 0 for a few pointers.
  o default to bus timing normal, like we default to bus_width_1.

Modified:
  head/sys/dev/mmc/mmc.c
  head/sys/dev/mmc/mmcreg.h

Modified: head/sys/dev/mmc/mmc.c
==============================================================================
--- head/sys/dev/mmc/mmc.c	Tue Feb  3 03:46:26 2009	(r188043)
+++ head/sys/dev/mmc/mmc.c	Tue Feb  3 04:28:45 2009	(r188044)
@@ -105,9 +105,9 @@ struct mmc_ivars {
 
 #define CMD_RETRIES	3
 
-SYSCTL_NODE(_hw, OID_AUTO, mmc, CTLFLAG_RD, 0, "mmc driver");
+SYSCTL_NODE(_hw, OID_AUTO, mmc, CTLFLAG_RD, NULL, "mmc driver");
 
-int	mmc_debug;
+static int mmc_debug;
 SYSCTL_INT(_hw_mmc, OID_AUTO, debug, CTLFLAG_RW, &mmc_debug, 0, "Debug level");
 
 /* bus entry points */
@@ -570,7 +570,8 @@ mmc_switch(struct mmc_softc *sc, uint8_t
 }
 
 static int
-mmc_sd_switch(struct mmc_softc *sc, uint8_t mode, uint8_t grp, uint8_t value, uint8_t *res)
+mmc_sd_switch(struct mmc_softc *sc, uint8_t mode, uint8_t grp, uint8_t value,
+    uint8_t *res)
 {
 	int err;
 	struct mmc_command cmd;
@@ -578,11 +579,11 @@ mmc_sd_switch(struct mmc_softc *sc, uint
 
 	memset(&cmd, 0, sizeof(struct mmc_command));
 	memset(&data, 0, sizeof(struct mmc_data));
-
 	memset(res, 0, 64);
+
 	cmd.opcode = SD_SWITCH_FUNC;
 	cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
-	cmd.arg = mode << 31;
+	cmd.arg = mode << 31;			/* 0 - check, 1 - set */
 	cmd.arg |= 0x00FFFFFF;
 	cmd.arg &= ~(0xF << (grp * 4));
 	cmd.arg |= value << (grp * 4);
@@ -656,7 +657,8 @@ mmc_set_timing(struct mmc_softc *sc, int
 		return (MMC_ERR_INVALID);
 	}
 	if (mmcbr_get_mode(sc->dev) == mode_sd)
-		err = mmc_sd_switch(sc, 1, 0, value, switch_res);
+		err = mmc_sd_switch(sc, SD_SWITCH_MODE_SET, SD_SWITCH_GROUP1,
+		    value, switch_res);
 	else
 		err = mmc_switch(sc, EXT_CSD_CMD_SET_NORMAL,
 		    EXT_CSD_HS_TIMING, value);
@@ -1144,6 +1146,7 @@ mmc_discover_cards(struct mmc_softc *sc)
 		if (mmcbr_get_ro(sc->dev))
 			ivar->read_only = 1;
 		ivar->bus_width = bus_width_1;
+		ivar->timing = bus_timing_normal;
 		ivar->mode = mmcbr_get_mode(sc->dev);
 		if (ivar->mode == mode_sd) {
 			mmc_decode_cid_sd(ivar->raw_cid, &ivar->cid);
@@ -1162,14 +1165,15 @@ mmc_discover_cards(struct mmc_softc *sc)
 			mmc_select_card(sc, ivar->rca);
 			mmc_app_send_scr(sc, ivar->rca, ivar->raw_scr);
 			mmc_app_decode_scr(ivar->raw_scr, &ivar->scr);
-			/* Get card switch capabilities. */
-			ivar->timing = bus_timing_normal;
+			/* Get card switch capabilities (command class 10). */
 			if ((ivar->scr.sda_vsn >= 1) &&
 			    (ivar->csd.ccc & (1<<10))) {
-				mmc_sd_switch(sc, 0, 0, 0xF, switch_res);
+				mmc_sd_switch(sc, SD_SWITCH_MODE_CHECK,
+				    SD_SWITCH_GROUP1, SD_SWITCH_NOCHANGE,
+				    switch_res);
 				if (switch_res[13] & 2) {
 					ivar->timing = bus_timing_hs;
-					ivar->hs_tran_speed = 50000000;
+					ivar->hs_tran_speed = SD_MAX_HS;
 				}
 			}
 			mmc_app_sd_status(sc, ivar->rca, ivar->raw_sd_status);
@@ -1221,10 +1225,10 @@ mmc_discover_cards(struct mmc_softc *sc)
 			ivar->timing = bus_timing_hs;
 			if (ivar->raw_ext_csd[EXT_CSD_CARD_TYPE]
 			    & EXT_CSD_CARD_TYPE_52)
-				ivar->hs_tran_speed = 52000000;
+				ivar->hs_tran_speed = MMC_TYPE_52_MAX_HS;
 			else if (ivar->raw_ext_csd[EXT_CSD_CARD_TYPE]
 			    & EXT_CSD_CARD_TYPE_26)
-				ivar->hs_tran_speed = 26000000;
+				ivar->hs_tran_speed = MMC_TYPE_26_MAX_HS;
 			else
 				ivar->hs_tran_speed = ivar->tran_speed;
 			/* Find max supported bus width. */
@@ -1524,5 +1528,5 @@ static driver_t mmc_driver = {
 static devclass_t mmc_devclass;
 
 
-DRIVER_MODULE(mmc, at91_mci, mmc_driver, mmc_devclass, 0, 0);
-DRIVER_MODULE(mmc, sdhci, mmc_driver, mmc_devclass, 0, 0);
+DRIVER_MODULE(mmc, at91_mci, mmc_driver, mmc_devclass, NULL, NULL);
+DRIVER_MODULE(mmc, sdhci, mmc_driver, mmc_devclass, NULL, NULL);

Modified: head/sys/dev/mmc/mmcreg.h
==============================================================================
--- head/sys/dev/mmc/mmcreg.h	Tue Feb  3 03:46:26 2009	(r188043)
+++ head/sys/dev/mmc/mmcreg.h	Tue Feb  3 04:28:45 2009	(r188044)
@@ -97,6 +97,7 @@ struct mmc_command {
 #define	MMC_ERR_FAILED	4
 #define	MMC_ERR_INVALID	5
 #define	MMC_ERR_NO_MEMORY 6
+#define MMC_ERR_MAX	6
 	struct mmc_data	*data;		/* Data segment with cmd */
 	struct mmc_request *mrq;	/* backpointer to request */
 };
@@ -287,7 +288,6 @@ struct mmc_request {
 /*
  * EXT_CSD fields
  */
-
 #define EXT_CSD_ERASE_GRP_DEF	175	/* R/W */
 #define EXT_CSD_BUS_WIDTH	183	/* R/W */
 #define EXT_CSD_HS_TIMING	185	/* R/W */
@@ -300,7 +300,6 @@ struct mmc_request {
 /*
  * EXT_CSD field definitions
  */
-
 #define EXT_CSD_CMD_SET_NORMAL		1
 #define EXT_CSD_CMD_SET_SECURE		2
 #define EXT_CSD_CMD_SET_CPSECURE	4
@@ -312,12 +311,27 @@ struct mmc_request {
 #define EXT_CSD_BUS_WIDTH_4	1
 #define EXT_CSD_BUS_WIDTH_8	2
 
+#define MMC_TYPE_26_MAX_HS	26000000
+#define MMC_TYPE_52_MAX_HS	52000000
+
 /*
  * SD bus widths
  */
 #define SD_BUS_WIDTH_1		0
 #define SD_BUS_WIDTH_4		2
 
+/*
+ * SD Switch
+ */
+#define SD_SWITCH_MODE_CHECK	0
+#define SD_SWITCH_MODE_SET	1
+#define SD_SWITCH_GROUP1	0
+#define SD_SWITCH_NORMAL_MODE	0
+#define SD_SWITCH_HS_MODE	1
+#define SD_SWITCH_NOCHANGE	0xF
+
+#define	SD_MAX_HS		50000000
+
 /* OCR bits */
 
 /*

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 05:50:37 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2756F1065672;
	Tue,  3 Feb 2009 05:50:37 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 147788FC1F;
	Tue,  3 Feb 2009 05:50:37 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n135oawH018665;
	Tue, 3 Feb 2009 05:50:36 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n135oapF018660;
	Tue, 3 Feb 2009 05:50:36 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200902030550.n135oapF018660@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Tue, 3 Feb 2009 05:50:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188048 - in head/sys/dev/usb2: core include quirk
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 05:50:37 -0000

Author: thompsa
Date: Tue Feb  3 05:50:36 2009
New Revision: 188048
URL: http://svn.freebsd.org/changeset/base/188048

Log:
  Move away from autogenerated enums, these values never change and its helpful
  to be able to look them up.

Modified:
  head/sys/dev/usb2/core/usb2_error.c
  head/sys/dev/usb2/include/usb2_error.h
  head/sys/dev/usb2/include/usb2_mfunc.h
  head/sys/dev/usb2/include/usb2_revision.h
  head/sys/dev/usb2/quirk/usb2_quirk.h

Modified: head/sys/dev/usb2/core/usb2_error.c
==============================================================================
--- head/sys/dev/usb2/core/usb2_error.c	Tue Feb  3 04:37:45 2009	(r188047)
+++ head/sys/dev/usb2/core/usb2_error.c	Tue Feb  3 05:50:36 2009	(r188048)
@@ -29,8 +29,37 @@
 
 #include <dev/usb2/core/usb2_core.h>
 
-USB_MAKE_DEBUG_TABLE(USB_ERR);
-
+static const char* usb_errstr_table[USB_ERR_MAX] = {
+	[USB_ERR_NORMAL_COMPLETION]	= "USB_ERR_NORMAL_COMPLETION",
+	[USB_ERR_BAD_ADDRESS]		= "USB_ERR_BAD_ADDRESS",
+	[USB_ERR_BAD_BUFSIZE]		= "USB_ERR_BAD_BUFSIZE",
+	[USB_ERR_BAD_CONTEXT]		= "USB_ERR_BAD_CONTEXT",
+	[USB_ERR_BAD_FLAG]		= "USB_ERR_BAD_FLAG",
+	[USB_ERR_CANCELLED]		= "USB_ERR_CANCELLED",
+	[USB_ERR_DMA_LOAD_FAILED]	= "USB_ERR_DMA_LOAD_FAILED",
+	[USB_ERR_INTERRUPTED]		= "USB_ERR_INTERRUPTED",
+	[USB_ERR_INVAL]			= "USB_ERR_INVAL",
+	[USB_ERR_IN_USE]		= "USB_ERR_IN_USE",
+	[USB_ERR_IOERROR]		= "USB_ERR_IOERROR",
+	[USB_ERR_NOMEM]			= "USB_ERR_NOMEM",
+	[USB_ERR_NOT_CONFIGURED]	= "USB_ERR_NOT_CONFIGURED",
+	[USB_ERR_NOT_LOCKED]		= "USB_ERR_NOT_LOCKED",
+	[USB_ERR_NOT_STARTED]		= "USB_ERR_NOT_STARTED",
+	[USB_ERR_NO_ADDR]		= "USB_ERR_NO_ADDR",
+	[USB_ERR_NO_CALLBACK]		= "USB_ERR_NO_CALLBACK",
+	[USB_ERR_NO_INTR_THREAD]	= "USB_ERR_NO_INTR_THREAD",
+	[USB_ERR_NO_PIPE]		= "USB_ERR_NO_PIPE",
+	[USB_ERR_NO_POWER]		= "USB_ERR_NO_POWER",
+	[USB_ERR_NO_ROOT_HUB]		= "USB_ERR_NO_ROOT_HUB",
+	[USB_ERR_PENDING_REQUESTS]	= "USB_ERR_PENDING_REQUESTS",
+	[USB_ERR_SET_ADDR_FAILED]	= "USB_ERR_SET_ADDR_FAILED",
+	[USB_ERR_SHORT_XFER]		= "USB_ERR_SHORT_XFER",
+	[USB_ERR_STALLED]		= "USB_ERR_STALLED",
+	[USB_ERR_TIMEOUT]		= "USB_ERR_TIMEOUT",
+	[USB_ERR_TOO_DEEP]		= "USB_ERR_TOO_DEEP",
+	[USB_ERR_ZERO_MAXP]		= "USB_ERR_ZERO_MAXP",
+	[USB_ERR_ZERO_NFRAMES]		= "USB_ERR_ZERO_NFRAMES",
+};
 /*------------------------------------------------------------------------*
  *	usb2_errstr
  *
@@ -39,5 +68,5 @@ USB_MAKE_DEBUG_TABLE(USB_ERR);
 const char *
 usb2_errstr(usb2_error_t err)
 {
-	return ((err < USB_ERR_MAX) ? USB_ERR[err] : "USB_ERR_UNKNOWN");
+	return (err < USB_ERR_MAX ? usb_errstr_table[err] : "USB_ERR_UNKNOWN");
 }

Modified: head/sys/dev/usb2/include/usb2_error.h
==============================================================================
--- head/sys/dev/usb2/include/usb2_error.h	Tue Feb  3 04:37:45 2009	(r188047)
+++ head/sys/dev/usb2/include/usb2_error.h	Tue Feb  3 05:50:36 2009	(r188048)
@@ -27,42 +27,37 @@
 #ifndef _USB2_ERROR_H_
 #define	_USB2_ERROR_H_
 
-/*
- * The "USB_STATUS" macro defines all the USB error codes.
- * NOTE: "USB_ERR_NORMAL_COMPLETION" is not an error code.
- * NOTE: "USB_ERR_STARTING" is not an error code.
- */
-#define	USB_ERR(m,n)\
-m(n, USB_ERR_NORMAL_COMPLETION)\
-m(n, USB_ERR_PENDING_REQUESTS)\
-m(n, USB_ERR_NOT_STARTED)\
-m(n, USB_ERR_INVAL)\
-m(n, USB_ERR_NOMEM)\
-m(n, USB_ERR_CANCELLED)\
-m(n, USB_ERR_BAD_ADDRESS)\
-m(n, USB_ERR_BAD_BUFSIZE)\
-m(n, USB_ERR_BAD_FLAG)\
-m(n, USB_ERR_NO_CALLBACK)\
-m(n, USB_ERR_IN_USE)\
-m(n, USB_ERR_NO_ADDR)\
-m(n, USB_ERR_NO_PIPE)\
-m(n, USB_ERR_ZERO_NFRAMES)\
-m(n, USB_ERR_ZERO_MAXP)\
-m(n, USB_ERR_SET_ADDR_FAILED)\
-m(n, USB_ERR_NO_POWER)\
-m(n, USB_ERR_TOO_DEEP)\
-m(n, USB_ERR_IOERROR)\
-m(n, USB_ERR_NOT_CONFIGURED)\
-m(n, USB_ERR_TIMEOUT)\
-m(n, USB_ERR_SHORT_XFER)\
-m(n, USB_ERR_STALLED)\
-m(n, USB_ERR_INTERRUPTED)\
-m(n, USB_ERR_DMA_LOAD_FAILED)\
-m(n, USB_ERR_BAD_CONTEXT)\
-m(n, USB_ERR_NO_ROOT_HUB)\
-m(n, USB_ERR_NO_INTR_THREAD)\
-m(n, USB_ERR_NOT_LOCKED)\
-
-USB_MAKE_ENUM(USB_ERR);
+enum {	/* keep in sync with usb_errstr_table */
+	USB_ERR_NORMAL_COMPLETION = 0,
+	USB_ERR_PENDING_REQUESTS,	/* 1 */
+	USB_ERR_NOT_STARTED,		/* 2 */
+	USB_ERR_INVAL,			/* 3 */
+	USB_ERR_NOMEM,			/* 4 */
+	USB_ERR_CANCELLED,		/* 5 */
+	USB_ERR_BAD_ADDRESS,		/* 6 */
+	USB_ERR_BAD_BUFSIZE,		/* 7 */
+	USB_ERR_BAD_FLAG,		/* 8 */
+	USB_ERR_NO_CALLBACK,		/* 9 */
+	USB_ERR_IN_USE,			/* 10 */
+	USB_ERR_NO_ADDR,		/* 11 */
+	USB_ERR_NO_PIPE,		/* 12 */
+	USB_ERR_ZERO_NFRAMES,		/* 13 */
+	USB_ERR_ZERO_MAXP,		/* 14 */
+	USB_ERR_SET_ADDR_FAILED,	/* 15 */
+	USB_ERR_NO_POWER,		/* 16 */
+	USB_ERR_TOO_DEEP,		/* 17 */
+	USB_ERR_IOERROR,		/* 18 */
+	USB_ERR_NOT_CONFIGURED,		/* 19 */
+	USB_ERR_TIMEOUT,		/* 20 */
+	USB_ERR_SHORT_XFER,		/* 21 */
+	USB_ERR_STALLED,		/* 22 */
+	USB_ERR_INTERRUPTED,		/* 23 */
+	USB_ERR_DMA_LOAD_FAILED,	/* 24 */
+	USB_ERR_BAD_CONTEXT,		/* 25 */
+	USB_ERR_NO_ROOT_HUB,		/* 26 */
+	USB_ERR_NO_INTR_THREAD,		/* 27 */
+	USB_ERR_NOT_LOCKED,		/* 28 */
+	USB_ERR_MAX
+};
 
 #endif					/* _USB2_ERROR_H_ */

Modified: head/sys/dev/usb2/include/usb2_mfunc.h
==============================================================================
--- head/sys/dev/usb2/include/usb2_mfunc.h	Tue Feb  3 04:37:45 2009	(r188047)
+++ head/sys/dev/usb2/include/usb2_mfunc.h	Tue Feb  3 05:50:36 2009	(r188048)
@@ -29,14 +29,6 @@
 #ifndef _USB2_MFUNC_H_
 #define	_USB2_MFUNC_H_
 
-#define	USB_MAKE_001(n,ENUM) ENUM,
-#define	USB_MAKE_ENUM(m) \
-enum { m(USB_MAKE_001,) m##_MAX }
-
-#define	USB_MAKE_002(n,ENUM) #ENUM,
-#define	USB_MAKE_DEBUG_TABLE(m) \
-static const char * m[m##_MAX] = { m(USB_MAKE_002,) }
-
 #define	USB_LOG2(n) (	    \
 ((x) <= (1<<0x00)) ? 0x00 : \
 ((x) <= (1<<0x01)) ? 0x01 : \

Modified: head/sys/dev/usb2/include/usb2_revision.h
==============================================================================
--- head/sys/dev/usb2/include/usb2_revision.h	Tue Feb  3 04:37:45 2009	(r188047)
+++ head/sys/dev/usb2/include/usb2_revision.h	Tue Feb  3 05:50:36 2009	(r188048)
@@ -27,41 +27,39 @@
 #ifndef _USB2_REVISION_H_
 #define	_USB2_REVISION_H_
 
-#include <dev/usb2/include/usb2_mfunc.h>
-
 /*
  * The "USB_SPEED" macro defines all the supported USB speeds.
  */
-#define	USB_SPEED(m,n)\
-m(n, USB_SPEED_VARIABLE)\
-m(n, USB_SPEED_LOW)\
-m(n, USB_SPEED_FULL)\
-m(n, USB_SPEED_HIGH)\
-m(n, USB_SPEED_SUPER)\
-
-USB_MAKE_ENUM(USB_SPEED);
+enum {
+	USB_SPEED_VARIABLE,
+	USB_SPEED_LOW,
+	USB_SPEED_FULL,
+	USB_SPEED_HIGH,
+	USB_SPEED_SUPER,
+	USB_SPEED_MAX
+};
 
 /*
  * The "USB_REV" macro defines all the supported USB revisions.
  */
-#define	USB_REV(m,n)\
-m(n, USB_REV_UNKNOWN)\
-m(n, USB_REV_PRE_1_0)\
-m(n, USB_REV_1_0)\
-m(n, USB_REV_1_1)\
-m(n, USB_REV_2_0)\
-m(n, USB_REV_2_5)\
-m(n, USB_REV_3_0)\
-
-USB_MAKE_ENUM(USB_REV);
+enum {
+	USB_REV_UNKNOWN,
+	USB_REV_PRE_1_0,
+	USB_REV_1_0,
+	USB_REV_1_1,
+	USB_REV_2_0,
+	USB_REV_2_5,
+	USB_REV_3_0,
+	USB_REV_MAX
+};
 
 /*
  * The "USB_MODE" macro defines all the supported USB modes.
  */
-#define	USB_MODE(m,n)\
-m(n, USB_MODE_HOST)\
-m(n, USB_MODE_DEVICE)\
-
-USB_MAKE_ENUM(USB_MODE);
+enum {
+	USB_MODE_HOST,
+	USB_MODE_DEVICE,
+	USB_MODE_MAX
+};
 
 #endif					/* _USB2_REVISION_H_ */

Modified: head/sys/dev/usb2/quirk/usb2_quirk.h
==============================================================================
--- head/sys/dev/usb2/quirk/usb2_quirk.h	Tue Feb  3 04:37:45 2009	(r188047)
+++ head/sys/dev/usb2/quirk/usb2_quirk.h	Tue Feb  3 05:50:36 2009	(r188048)
@@ -28,56 +28,32 @@
 #define	_USB2_QUIRK_H_
 
 /* NOTE: UQ_NONE is not a valid quirk */
-
-#define	USB_QUIRK(m,n)					\
-  m(n, UQ_NONE)						\
-  /* left and right sound channels are swapped */	\
-  m(n, UQ_AUDIO_SWAP_LR)				\
-  /* input is async despite claim of adaptive */	\
-  m(n, UQ_AU_INP_ASYNC)					\
-  /* don't adjust for fractional samples */		\
-  m(n, UQ_AU_NO_FRAC)					\
-  /* audio device has broken extension unit */		\
-  m(n, UQ_AU_NO_XU)					\
-  /* bad audio spec version number */			\
-  m(n, UQ_BAD_ADC)					\
-  /* device claims audio class, but isn't */		\
-  m(n, UQ_BAD_AUDIO)					\
-  /* printer has broken bidir mode */			\
-  m(n, UQ_BROKEN_BIDIR)					\
-  /* device is bus powered, despite claim */		\
-  m(n, UQ_BUS_POWERED)					\
-  /* device should be ignored by hid class */		\
-  m(n, UQ_HID_IGNORE)					\
-  /* device should be ignored by kbd class */		\
-  m(n, UQ_KBD_IGNORE)					\
-  /* doesn't identify properly */			\
-  m(n, UQ_MS_BAD_CLASS)					\
-  /* mouse sends an unknown leading byte */		\
-  m(n, UQ_MS_LEADING_BYTE)				\
-  /* mouse has Z-axis reversed */			\
-  m(n, UQ_MS_REVZ)					\
-  /* string descriptors are broken */			\
-  m(n, UQ_NO_STRINGS)					\
-  /* device needs clear endpoint stall */		\
-  m(n, UQ_OPEN_CLEARSTALL)				\
-  /* hub lies about power status */			\
-  m(n, UQ_POWER_CLAIM)					\
-  /* spurious mouse button up events */			\
-  m(n, UQ_SPUR_BUT_UP)					\
-  /* has some Unicode strings swapped */		\
-  m(n, UQ_SWAP_UNICODE)					\
-  /* select configuration index 1 by default */		\
-  m(n, UQ_CFG_INDEX_1)					\
-  /* select configuration index 2 by default */		\
-  m(n, UQ_CFG_INDEX_2)					\
-  /* select configuration index 3 by default */		\
-  m(n, UQ_CFG_INDEX_3)					\
-  /* select configuration index 4 by default */		\
-  m(n, UQ_CFG_INDEX_4)					\
-  /* select configuration index 0 by default */		\
-  m(n, UQ_CFG_INDEX_0)
-
-USB_MAKE_ENUM(USB_QUIRK);
+enum {
+	UQ_NONE,
+	UQ_AUDIO_SWAP_LR,	/* left and right sound channels are swapped */
+	UQ_AU_INP_ASYNC,	/* input is async despite claim of adaptive */
+	UQ_AU_NO_FRAC,		/* don't adjust for fractional samples */
+	UQ_AU_NO_XU,		/* audio device has broken extension unit */
+	UQ_BAD_ADC,		/* bad audio spec version number */
+	UQ_BAD_AUDIO,		/* device claims audio class, but isn't */
+	UQ_BROKEN_BIDIR,	/* printer has broken bidir mode */
+	UQ_BUS_POWERED,		/* device is bus powered, despite claim */
+	UQ_HID_IGNORE,		/* device should be ignored by hid class */
+	UQ_KBD_IGNORE,		/* device should be ignored by kbd class */
+	UQ_MS_BAD_CLASS,	/* doesn't identify properly */
+	UQ_MS_LEADING_BYTE,	/* mouse sends an unknown leading byte */
+	UQ_MS_REVZ,		/* mouse has Z-axis reversed */
+	UQ_NO_STRINGS,		/* string descriptors are broken */
+	UQ_OPEN_CLEARSTALL,	/* device needs clear endpoint stall */
+	UQ_POWER_CLAIM,		/* hub lies about power status */
+	UQ_SPUR_BUT_UP,		/* spurious mouse button up events */
+	UQ_SWAP_UNICODE,	/* has some Unicode strings swapped */
+	UQ_CFG_INDEX_1,		/* select configuration index 1 by default */
+	UQ_CFG_INDEX_2,		/* select configuration index 2 by default */
+	UQ_CFG_INDEX_3,		/* select configuration index 3 by default */
+	UQ_CFG_INDEX_4,		/* select configuration index 4 by default */
+	UQ_CFG_INDEX_0,		/* select configuration index 0 by default */
+	USB_QUIRK_MAX
+};
 
 #endif					/* _USB2_QUIRK_H_ */

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 06:12:13 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E7341106564A;
	Tue,  3 Feb 2009 06:12:13 +0000 (UTC)
	(envelope-from jkoshy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D5C898FC1F;
	Tue,  3 Feb 2009 06:12:13 +0000 (UTC)
	(envelope-from jkoshy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n136CDel019151;
	Tue, 3 Feb 2009 06:12:13 GMT (envelope-from jkoshy@svn.freebsd.org)
Received: (from jkoshy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n136CDef019150;
	Tue, 3 Feb 2009 06:12:13 GMT (envelope-from jkoshy@svn.freebsd.org)
Message-Id: <200902030612.n136CDef019150@svn.freebsd.org>
From: Joseph Koshy <jkoshy@FreeBSD.org>
Date: Tue, 3 Feb 2009 06:12:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188050 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 06:12:14 -0000

Author: jkoshy
Date: Tue Feb  3 06:12:13 2009
New Revision: 188050
URL: http://svn.freebsd.org/changeset/base/188050

Log:
  Introduce a C type representing the header for GNU-style hash table
  sections.  These ELF sections are generated by newer versions of
  GNU binutils.
  
  Reviewed by:		kaiw, Ali Bahrami <ali dot bahrami at sun dot com>

Modified:
  head/sys/sys/elf_common.h

Modified: head/sys/sys/elf_common.h
==============================================================================
--- head/sys/sys/elf_common.h	Tue Feb  3 06:08:58 2009	(r188049)
+++ head/sys/sys/elf_common.h	Tue Feb  3 06:12:13 2009	(r188050)
@@ -48,6 +48,17 @@ typedef struct {
 	u_int32_t	n_type;		/* Type of this note. */
 } Elf_Note;
 
+/*
+ * The header for GNU-style hash sections.
+ */
+
+typedef struct {
+	u_int32_t	gh_nbuckets;	/* Number of hash buckets. */
+	u_int32_t	gh_symndx;	/* First visible symbol in .dynsym. */
+	u_int32_t	gh_maskwords;	/* #maskwords used in bloom filter. */
+	u_int32_t	gh_shift2;	/* Bloom filter shift count. */
+} Elf_GNU_Hash_Header;
+
 /* Indexes into the e_ident array.  Keep synced with
    http://www.sco.com/developers/gabi/latest/ch4.eheader.html */
 #define	EI_MAG0		0	/* Magic number, byte 0. */

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 07:07:14 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2F1111065673;
	Tue,  3 Feb 2009 07:07:14 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1CA378FC1F;
	Tue,  3 Feb 2009 07:07:14 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1377EaR020378;
	Tue, 3 Feb 2009 07:07:14 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1377E6Z020377;
	Tue, 3 Feb 2009 07:07:14 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200902030707.n1377E6Z020377@svn.freebsd.org>
From: Marcel Moolenaar <marcel@FreeBSD.org>
Date: Tue, 3 Feb 2009 07:07:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188054 - head/sys/geom
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 07:07:14 -0000

Author: marcel
Date: Tue Feb  3 07:07:13 2009
New Revision: 188054
URL: http://svn.freebsd.org/changeset/base/188054

Log:
  In g_handleattr(), set bp->bio_completed also for the case
  where len is 0. Otherwise g_getattr() will never succeed
  when it is handled by g_handleattr_str().

Modified:
  head/sys/geom/geom_subr.c

Modified: head/sys/geom/geom_subr.c
==============================================================================
--- head/sys/geom/geom_subr.c	Tue Feb  3 07:04:10 2009	(r188053)
+++ head/sys/geom/geom_subr.c	Tue Feb  3 07:07:13 2009	(r188054)
@@ -882,12 +882,13 @@ g_handleattr(struct bio *bp, const char 
 		}
 	} else if (bp->bio_length == len) {
 		bcopy(val, bp->bio_data, len);
-		bp->bio_completed = len;
 	} else {
 		printf("%s: %s bio_length %jd len %d -> EFAULT\n", __func__,
 		    bp->bio_to->name, (intmax_t)bp->bio_length, len);
 		error = EFAULT;
 	}
+	if (error == 0)
+		bp->bio_completed = bp->bio_length;
 	g_io_deliver(bp, error);
 	return (1);
 }

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 07:42:14 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8BA39106564A;
	Tue,  3 Feb 2009 07:42:14 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 4A90A8FC1D;
	Tue,  3 Feb 2009 07:42:14 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n137dEsC025448;
	Tue, 3 Feb 2009 00:39:14 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Tue, 03 Feb 2009 00:39:39 -0700 (MST)
Message-Id: <20090203.003939.-579111975.imp@bsdimp.com>
To: jhb@FreeBSD.org
From: "M. Warner Losh" <imp@bsdimp.com>
In-Reply-To: <200902021659.54847.jhb@freebsd.org>
References: <200902021554.55644.jhb@freebsd.org>
	<1233608975.1492.45.camel@ferret.2hip.net>
	<200902021659.54847.jhb@freebsd.org>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, rnoland@FreeBSD.org
Subject: Re: svn commit: r188018 - in head: sys/dev/pci usr.sbin/pciconf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 07:42:15 -0000

In message: <200902021659.54847.jhb@freebsd.org>
            John Baldwin <jhb@freebsd.org> writes:
On Mon, 2009-02-02 at 15:54 -0500, John Baldwin wrote:
jhb> I haven't looked this over thoroughly yet, but will it support BIOS
jhb> mappings as well?  Or should I take a crack at adding that?

On Monday 02 February 2009 4:09:35 pm Robert Noland wrote:

rnoland> It does not handle the BIOS BAR.  If we need to we can either
rnoland> extend this or add a new ioctl for that.  However, if X is
rnoland> just reading the current setting then what it is doing now
rnoland> may be fine.  I will try to look at the current code for that
rnoland> in a bit.

The BIOS BAR is special.  Very special in a number of ways...  Be
careful probing it.  I run into trouble whenever I touch the cardbus
CIS parsing code.

Warner

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 07:50:05 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C34271065672;
	Tue,  3 Feb 2009 07:50:04 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B14008FC17;
	Tue,  3 Feb 2009 07:50:04 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n137o1Sh021166;
	Tue, 3 Feb 2009 07:50:01 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n137o104021165;
	Tue, 3 Feb 2009 07:50:01 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902030750.n137o104021165@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Tue, 3 Feb 2009 07:50:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188055 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 07:50:07 -0000

Author: imp
Date: Tue Feb  3 07:50:01 2009
New Revision: 188055
URL: http://svn.freebsd.org/changeset/base/188055

Log:
  int foo(void) is the proper ANSI function definition when there's no
  parameters.  Use it for resettodr().

Modified:
  head/sys/kern/subr_rtc.c

Modified: head/sys/kern/subr_rtc.c
==============================================================================
--- head/sys/kern/subr_rtc.c	Tue Feb  3 07:07:13 2009	(r188054)
+++ head/sys/kern/subr_rtc.c	Tue Feb  3 07:50:01 2009	(r188055)
@@ -154,7 +154,7 @@ inittodr(time_t base)
  * Write system time back to RTC
  */
 void
-resettodr()
+resettodr(void)
 {
 	struct timespec ts;
 	int error;

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 07:50:41 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 90168106567D;
	Tue,  3 Feb 2009 07:50:41 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7E1CE8FC0A;
	Tue,  3 Feb 2009 07:50:41 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n137ofvC021215;
	Tue, 3 Feb 2009 07:50:41 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n137ofUH021214;
	Tue, 3 Feb 2009 07:50:41 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902030750.n137ofUH021214@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Tue, 3 Feb 2009 07:50:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188056 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 07:50:42 -0000

Author: imp
Date: Tue Feb  3 07:50:41 2009
New Revision: 188056
URL: http://svn.freebsd.org/changeset/base/188056

Log:
  o Use unsigned for bit fields.
  o Use NULL for pointers in preference to 0.

Modified:
  head/sys/kern/subr_witness.c

Modified: head/sys/kern/subr_witness.c
==============================================================================
--- head/sys/kern/subr_witness.c	Tue Feb  3 07:50:01 2009	(r188055)
+++ head/sys/kern/subr_witness.c	Tue Feb  3 07:50:41 2009	(r188056)
@@ -235,8 +235,8 @@ struct witness {
 	uint16_t 		w_num_descendants; /* direct/indirect
 						    * descendant count */
 	int16_t 		w_ddb_level;
-	int 			w_displayed:1;
-	int 			w_reversed:1;
+	unsigned		w_displayed:1;
+	unsigned		w_reversed:1;
 };
 
 STAILQ_HEAD(witness_list, witness);
@@ -376,7 +376,7 @@ static void	witness_setflag(struct lock_
 #define	witness_debugger(c)
 #endif
 
-SYSCTL_NODE(_debug, OID_AUTO, witness, CTLFLAG_RW, 0, "Witness Locking");
+SYSCTL_NODE(_debug, OID_AUTO, witness, CTLFLAG_RW, NULL, "Witness Locking");
 
 /*
  * If set to 0, lock order checking is disabled.  If set to -1,

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 07:51:11 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 85A351065675;
	Tue,  3 Feb 2009 07:51:11 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 73A4C8FC2B;
	Tue,  3 Feb 2009 07:51:11 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n137pBRU021263;
	Tue, 3 Feb 2009 07:51:11 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n137pBEu021261;
	Tue, 3 Feb 2009 07:51:11 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902030751.n137pBEu021261@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Tue, 3 Feb 2009 07:51:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188057 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 07:51:12 -0000

Author: imp
Date: Tue Feb  3 07:51:11 2009
New Revision: 188057
URL: http://svn.freebsd.org/changeset/base/188057

Log:
  Use NULL in preference to 0 for pointers.

Modified:
  head/sys/kern/subr_firmware.c
  head/sys/kern/subr_prf.c

Modified: head/sys/kern/subr_firmware.c
==============================================================================
--- head/sys/kern/subr_firmware.c	Tue Feb  3 07:50:41 2009	(r188056)
+++ head/sys/kern/subr_firmware.c	Tue Feb  3 07:51:11 2009	(r188057)
@@ -525,7 +525,7 @@ firmware_modevent(module_t mod, int type
 static moduledata_t firmware_mod = {
 	"firmware",
 	firmware_modevent,
-	0
+	NULL
 };
 DECLARE_MODULE(firmware, firmware_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
 MODULE_VERSION(firmware, 1);

Modified: head/sys/kern/subr_prf.c
==============================================================================
--- head/sys/kern/subr_prf.c	Tue Feb  3 07:50:41 2009	(r188056)
+++ head/sys/kern/subr_prf.c	Tue Feb  3 07:51:11 2009	(r188057)
@@ -959,7 +959,7 @@ sysctl_kern_msgbuf(SYSCTL_HANDLER_ARGS)
 }
 
 SYSCTL_PROC(_kern, OID_AUTO, msgbuf, CTLTYPE_STRING | CTLFLAG_RD,
-    0, 0, sysctl_kern_msgbuf, "A", "Contents of kernel message buffer");
+    NULL, 0, sysctl_kern_msgbuf, "A", "Contents of kernel message buffer");
 
 static int msgbuf_clearflag;
 

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 07:51:42 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 77AF5106568B;
	Tue,  3 Feb 2009 07:51:42 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4B7768FC17;
	Tue,  3 Feb 2009 07:51:42 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n137pg1n021310;
	Tue, 3 Feb 2009 07:51:42 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n137pgMY021308;
	Tue, 3 Feb 2009 07:51:42 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902030751.n137pgMY021308@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Tue, 3 Feb 2009 07:51:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188058 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 07:51:43 -0000

Author: imp
Date: Tue Feb  3 07:51:41 2009
New Revision: 188058
URL: http://svn.freebsd.org/changeset/base/188058

Log:
  Use NULL in preference to 0 for pointers.

Modified:
  head/sys/kern/subr_clist.c
  head/sys/kern/subr_taskqueue.c

Modified: head/sys/kern/subr_clist.c
==============================================================================
--- head/sys/kern/subr_clist.c	Tue Feb  3 07:51:11 2009	(r188057)
+++ head/sys/kern/subr_clist.c	Tue Feb  3 07:51:41 2009	(r188058)
@@ -43,7 +43,7 @@ SYSINIT(clist, SI_SUB_CLIST, SI_ORDER_FI
 
 static MALLOC_DEFINE(M_CLIST, "clist", "clist queue blocks");
 
-static struct cblock *cfreelist = 0;
+static struct cblock *cfreelist = NULL;
 int cfreecount = 0;
 static int cslushcount;
 static int ctotcount;
@@ -478,7 +478,7 @@ b_to_q(char *src, int amount, struct cli
 int
 unputc(struct clist *clistp)
 {
-	struct cblock *cblockp = 0, *cbp = 0;
+	struct cblock *cblockp = NULL, *cbp = NULL;
 	int s;
 	int chr = -1;
 

Modified: head/sys/kern/subr_taskqueue.c
==============================================================================
--- head/sys/kern/subr_taskqueue.c	Tue Feb  3 07:51:11 2009	(r188057)
+++ head/sys/kern/subr_taskqueue.c	Tue Feb  3 07:51:41 2009	(r188058)
@@ -114,7 +114,7 @@ _taskqueue_create(const char *name, int 
 
 	queue = malloc(sizeof(struct taskqueue), M_TASKQUEUE, mflags | M_ZERO);
 	if (!queue)
-		return 0;
+		return NULL;
 
 	STAILQ_INIT(&queue->tq_queue);
 	queue->tq_name = name;
@@ -213,7 +213,7 @@ taskqueue_enqueue(struct taskqueue *queu
 	if (!prev || prev->ta_priority >= task->ta_priority) {
 		STAILQ_INSERT_TAIL(&queue->tq_queue, task, ta_link);
 	} else {
-		prev = 0;
+		prev = NULL;
 		for (ins = STAILQ_FIRST(&queue->tq_queue); ins;
 		     prev = ins, ins = STAILQ_NEXT(ins, ta_link))
 			if (ins->ta_priority < task->ta_priority)
@@ -423,11 +423,11 @@ taskqueue_thread_enqueue(void *context)
 	wakeup_one(tq);
 }
 
-TASKQUEUE_DEFINE(swi, taskqueue_swi_enqueue, 0,
+TASKQUEUE_DEFINE(swi, taskqueue_swi_enqueue, NULL,
 		 swi_add(NULL, "task queue", taskqueue_swi_run, NULL, SWI_TQ,
 		     INTR_MPSAFE, &taskqueue_ih)); 
 
-TASKQUEUE_DEFINE(swi_giant, taskqueue_swi_giant_enqueue, 0,
+TASKQUEUE_DEFINE(swi_giant, taskqueue_swi_giant_enqueue, NULL,
 		 swi_add(NULL, "Giant taskq", taskqueue_swi_giant_run,
 		     NULL, SWI_TQ_GIANT, 0, &taskqueue_giant_ih)); 
 
@@ -462,6 +462,6 @@ taskqueue_fast_run(void *dummy)
 	taskqueue_run(taskqueue_fast);
 }
 
-TASKQUEUE_FAST_DEFINE(fast, taskqueue_fast_enqueue, 0,
+TASKQUEUE_FAST_DEFINE(fast, taskqueue_fast_enqueue, NULL,
 	swi_add(NULL, "Fast task queue", taskqueue_fast_run, NULL,
 	SWI_TQ_FAST, INTR_MPSAFE, &taskqueue_fast_ih));

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 07:52:07 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 55F461065670;
	Tue,  3 Feb 2009 07:52:07 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 42DC18FC41;
	Tue,  3 Feb 2009 07:52:07 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n137q7H4021355;
	Tue, 3 Feb 2009 07:52:07 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n137q7SN021354;
	Tue, 3 Feb 2009 07:52:07 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902030752.n137q7SN021354@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Tue, 3 Feb 2009 07:52:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188059 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 07:52:08 -0000

Author: imp
Date: Tue Feb  3 07:52:07 2009
New Revision: 188059
URL: http://svn.freebsd.org/changeset/base/188059

Log:
  Prefer ANSI function definitions to K&R ones.

Modified:
  head/sys/kern/subr_autoconf.c

Modified: head/sys/kern/subr_autoconf.c
==============================================================================
--- head/sys/kern/subr_autoconf.c	Tue Feb  3 07:51:41 2009	(r188058)
+++ head/sys/kern/subr_autoconf.c	Tue Feb  3 07:52:07 2009	(r188059)
@@ -91,8 +91,7 @@ run_interrupt_driven_config_hooks_warnin
 }
 
 static void
-run_interrupt_driven_config_hooks(dummy)
-	void *dummy;
+run_interrupt_driven_config_hooks(void *dummy)
 {
 	struct intr_config_hook *hook_entry, *next_entry;
 	int warned;
@@ -127,8 +126,7 @@ SYSINIT(intr_config_hooks, SI_SUB_INT_CO
  * be used to complete initialization.
  */
 int
-config_intrhook_establish(hook)
-	struct intr_config_hook *hook;
+config_intrhook_establish(struct intr_config_hook *hook)
 {
 	struct intr_config_hook *hook_entry;
 
@@ -151,8 +149,7 @@ config_intrhook_establish(hook)
 }
 
 void
-config_intrhook_disestablish(hook)
-	struct intr_config_hook *hook;
+config_intrhook_disestablish(struct intr_config_hook *hook)
 {
 	struct intr_config_hook *hook_entry;
 

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 07:52:37 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 55B881065676;
	Tue,  3 Feb 2009 07:52:37 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4405C8FC23;
	Tue,  3 Feb 2009 07:52:37 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n137qaYX021401;
	Tue, 3 Feb 2009 07:52:36 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n137qalg021400;
	Tue, 3 Feb 2009 07:52:36 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902030752.n137qalg021400@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Tue, 3 Feb 2009 07:52:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188060 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 07:52:38 -0000

Author: imp
Date: Tue Feb  3 07:52:36 2009
New Revision: 188060
URL: http://svn.freebsd.org/changeset/base/188060

Log:
  Use ANSI function definition for profil.

Modified:
  head/sys/kern/subr_prof.c

Modified: head/sys/kern/subr_prof.c
==============================================================================
--- head/sys/kern/subr_prof.c	Tue Feb  3 07:52:07 2009	(r188059)
+++ head/sys/kern/subr_prof.c	Tue Feb  3 07:52:36 2009	(r188060)
@@ -404,9 +404,7 @@ struct profil_args {
 #endif
 /* ARGSUSED */
 int
-profil(td, uap)
-	struct thread *td;
-	register struct profil_args *uap;
+profil(struct thread *td, struct profil_args *uap)
 {
 	struct uprof *upp;
 	struct proc *p;

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 07:53:08 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B7D0A10656CC;
	Tue,  3 Feb 2009 07:53:08 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A63DF8FC1C;
	Tue,  3 Feb 2009 07:53:08 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n137r8nP021449;
	Tue, 3 Feb 2009 07:53:08 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n137r8jI021448;
	Tue, 3 Feb 2009 07:53:08 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902030753.n137r8jI021448@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Tue, 3 Feb 2009 07:53:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188061 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 07:53:09 -0000

Author: imp
Date: Tue Feb  3 07:53:08 2009
New Revision: 188061
URL: http://svn.freebsd.org/changeset/base/188061

Log:
  rman_debug should be static, so make it static.

Modified:
  head/sys/kern/subr_rman.c

Modified: head/sys/kern/subr_rman.c
==============================================================================
--- head/sys/kern/subr_rman.c	Tue Feb  3 07:52:36 2009	(r188060)
+++ head/sys/kern/subr_rman.c	Tue Feb  3 07:53:08 2009	(r188061)
@@ -99,7 +99,7 @@ struct resource_i {
 	int	r_rid;		/* optional rid for this resource. */
 };
 
-int     rman_debug = 0;
+static int     rman_debug = 0;
 TUNABLE_INT("debug.rman_debug", &rman_debug);
 SYSCTL_INT(_debug, OID_AUTO, rman_debug, CTLFLAG_RW,
     &rman_debug, 0, "rman debug");

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 07:53:51 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E47491065701;
	Tue,  3 Feb 2009 07:53:51 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D2F7F8FC38;
	Tue,  3 Feb 2009 07:53:51 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n137rpZi021505;
	Tue, 3 Feb 2009 07:53:51 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n137rp0A021504;
	Tue, 3 Feb 2009 07:53:51 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902030753.n137rp0A021504@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Tue, 3 Feb 2009 07:53:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188062 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 07:53:52 -0000

Author: imp
Date: Tue Feb  3 07:53:51 2009
New Revision: 188062
URL: http://svn.freebsd.org/changeset/base/188062

Log:
  Make bioq_disksort have a ANSI-C definition rather than a K&R definition.

Modified:
  head/sys/kern/subr_disk.c

Modified: head/sys/kern/subr_disk.c
==============================================================================
--- head/sys/kern/subr_disk.c	Tue Feb  3 07:53:08 2009	(r188061)
+++ head/sys/kern/subr_disk.c	Tue Feb  3 07:53:51 2009	(r188062)
@@ -144,9 +144,7 @@ bioq_takefirst(struct bio_queue_head *he
  * This implements the one-way scan which optimizes disk seek times.
  */
 void
-bioq_disksort(bioq, bp)
-	struct bio_queue_head *bioq;
-	struct bio *bp;
+bioq_disksort(struct bio_queue_head *bioq, struct bio *bp)
 {
 	struct bio *bq;
 	struct bio *bn;

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 07:54:42 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A14A2106564A;
	Tue,  3 Feb 2009 07:54:42 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 757C78FC1F;
	Tue,  3 Feb 2009 07:54:42 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n137sgmJ021563;
	Tue, 3 Feb 2009 07:54:42 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n137sg9g021561;
	Tue, 3 Feb 2009 07:54:42 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902030754.n137sg9g021561@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Tue, 3 Feb 2009 07:54:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188063 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 07:54:43 -0000

Author: imp
Date: Tue Feb  3 07:54:42 2009
New Revision: 188063
URL: http://svn.freebsd.org/changeset/base/188063

Log:
  Use NULL in preference to 0 in pointer contexts.

Modified:
  head/sys/kern/subr_devstat.c
  head/sys/kern/subr_kobj.c

Modified: head/sys/kern/subr_devstat.c
==============================================================================
--- head/sys/kern/subr_devstat.c	Tue Feb  3 07:53:51 2009	(r188062)
+++ head/sys/kern/subr_devstat.c	Tue Feb  3 07:54:42 2009	(r188063)
@@ -407,10 +407,10 @@ sysctl_devstat(SYSCTL_HANDLER_ARGS)
  * Sysctl entries for devstat.  The first one is a node that all the rest
  * hang off of. 
  */
-SYSCTL_NODE(_kern, OID_AUTO, devstat, CTLFLAG_RD, 0, "Device Statistics");
+SYSCTL_NODE(_kern, OID_AUTO, devstat, CTLFLAG_RD, NULL, "Device Statistics");
 
 SYSCTL_PROC(_kern_devstat, OID_AUTO, all, CTLFLAG_RD|CTLTYPE_OPAQUE,
-    0, 0, sysctl_devstat, "S,devstat", "All devices in the devstat list");
+    NULL, 0, sysctl_devstat, "S,devstat", "All devices in the devstat list");
 /*
  * Export the number of devices in the system so that userland utilities
  * can determine how much memory to allocate to hold all the devices.
@@ -534,4 +534,4 @@ devstat_free(struct devstat *dsp)
 }
 
 SYSCTL_INT(_debug_sizeof, OID_AUTO, devstat, CTLFLAG_RD,
-    0, sizeof(struct devstat), "sizeof(struct devstat)");
+    NULL, sizeof(struct devstat), "sizeof(struct devstat)");

Modified: head/sys/kern/subr_kobj.c
==============================================================================
--- head/sys/kern/subr_kobj.c	Tue Feb  3 07:53:51 2009	(r188062)
+++ head/sys/kern/subr_kobj.c	Tue Feb  3 07:54:42 2009	(r188063)
@@ -207,7 +207,7 @@ kobj_lookup_method_class(kobj_class_t cl
 		}
 	}
 
-	return 0;
+	return NULL;
 }
 
 static kobj_method_t*
@@ -230,7 +230,7 @@ kobj_lookup_method_mi(kobj_class_t cls,
 		}
 	}
 
-	return 0;
+	return NULL;
 }
 
 kobj_method_t*
@@ -261,7 +261,7 @@ kobj_class_free(kobj_class_t cls)
 {
 	int i;
 	kobj_method_t *m;
-	void* ops = 0;
+	void* ops = NULL;
 
 	KOBJ_ASSERT(MA_NOTOWNED);
 	KOBJ_LOCK();
@@ -281,7 +281,7 @@ kobj_class_free(kobj_class_t cls)
 		 * Free memory and clean up.
 		 */
 		ops = cls->ops;
-		cls->ops = 0;
+		cls->ops = NULL;
 	}
 	
 	KOBJ_UNLOCK();
@@ -302,7 +302,7 @@ kobj_create(kobj_class_t cls,
 	 */
 	obj = malloc(cls->size, mtype, mflags | M_ZERO);
 	if (!obj)
-		return 0;
+		return NULL;
 	kobj_init(obj, cls);
 
 	return obj;
@@ -355,7 +355,7 @@ kobj_delete(kobj_t obj, struct malloc_ty
 	if (!refs)
 		kobj_class_free(cls);
 
-	obj->ops = 0;
+	obj->ops = NULL;
 	if (mtype)
 		free(obj, mtype);
 }

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 09:01:46 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 10A8B106564A;
	Tue,  3 Feb 2009 09:01:46 +0000 (UTC)
	(envelope-from jkoshy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F12FD8FC1F;
	Tue,  3 Feb 2009 09:01:45 +0000 (UTC)
	(envelope-from jkoshy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1391jj6023011;
	Tue, 3 Feb 2009 09:01:45 GMT (envelope-from jkoshy@svn.freebsd.org)
Received: (from jkoshy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1391jl6023007;
	Tue, 3 Feb 2009 09:01:45 GMT (envelope-from jkoshy@svn.freebsd.org)
Message-Id: <200902030901.n1391jl6023007@svn.freebsd.org>
From: Joseph Koshy <jkoshy@FreeBSD.org>
Date: Tue, 3 Feb 2009 09:01:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188065 - in head/sys/amd64: amd64 include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 09:01:46 -0000

Author: jkoshy
Date: Tue Feb  3 09:01:45 2009
New Revision: 188065
URL: http://svn.freebsd.org/changeset/base/188065

Log:
  Improve robustness of NMI handling, for NMIs recognized in kernel
  mode.
  
  - Make the NMI handler run on its own stack (TSS_IST2).
  - Store the GSBASE value for each CPU just before the start of
    each NMI stack, permitting efficient retrieval using %rsp-relative
    addressing.
  - For NMIs taken from kernel mode, program MSR_GSBASE explicitly
    since one or both of MSR_GSBASE and MSR_KGSBASE can be potentially
    invalid.  The current contents of MSR_GSBASE are saved and restored
    at exit.
  - For NMIs handled from user mode, continue to use 'swapgs' to
    load the per-CPU GSBASE.
  
  Reviewed by:	jeff
  Debugging help:	jeff
  Tested by:	gnn, Artem Belevich <artemb at gmail dot com>

Modified:
  head/sys/amd64/amd64/exception.S
  head/sys/amd64/amd64/machdep.c
  head/sys/amd64/amd64/mp_machdep.c
  head/sys/amd64/include/intr_machdep.h

Modified: head/sys/amd64/amd64/exception.S
==============================================================================
--- head/sys/amd64/amd64/exception.S	Tue Feb  3 08:25:24 2009	(r188064)
+++ head/sys/amd64/amd64/exception.S	Tue Feb  3 09:01:45 2009	(r188065)
@@ -383,22 +383,24 @@ IDTVEC(fast_syscall32)
  * NMI handling is special.
  *
  * First, NMIs do not respect the state of the processor's RFLAGS.IF
- * bit and the NMI handler may be invoked at any time, including when
- * the processor is in a critical section with RFLAGS.IF == 0.  In
- * particular, this means that the processor's GS.base values could be
- * inconsistent on entry to the handler, and so we need to read
- * MSR_GSBASE to determine if a 'swapgs' is needed.  We use '%ebx', a
- * C-preserved register, to remember whether to swap GS back on the
- * exit path.
+ * bit.  The NMI handler may be entered at any time, including when
+ * the processor is in a critical section with RFLAGS.IF == 0.
+ * The processor's GS.base value could be invalid on entry to the
+ * handler.
  *
  * Second, the processor treats NMIs specially, blocking further NMIs
- * until an 'iretq' instruction is executed.  We therefore need to
- * execute the NMI handler with interrupts disabled to prevent a
- * nested interrupt from executing an 'iretq' instruction and
- * inadvertently taking the processor out of NMI mode.
+ * until an 'iretq' instruction is executed.  We thus need to execute
+ * the NMI handler with interrupts disabled, to prevent a nested interrupt
+ * from executing an 'iretq' instruction and inadvertently taking the
+ * processor out of NMI mode.
  *
- * Third, the NMI handler runs on its own stack (tss_ist1), shared
- * with the double fault handler.
+ * Third, the NMI handler runs on its own stack (tss_ist2). The canonical
+ * GS.base value for the processor is stored just above the bottom of its
+ * NMI stack.  For NMIs taken from kernel mode, the current value in
+ * the processor's GS.base is saved at entry to C-preserved register %r12,
+ * the canonical value for GS.base is then loaded into the processor, and
+ * the saved value is restored at exit time.  For NMIs taken from user mode,
+ * the cheaper 'SWAPGS' instructions are used for swapping GS.base.
  */
 
 IDTVEC(nmi)
@@ -423,12 +425,22 @@ IDTVEC(nmi)
 	movq	%r15,TF_R15(%rsp)
 	xorl	%ebx,%ebx
 	testb	$SEL_RPL_MASK,TF_CS(%rsp)
-	jnz	nmi_needswapgs		/* we came from userland */
+	jnz	nmi_fromuserspace
+	/*
+	 * We've interrupted the kernel.  Preserve GS.base in %r12.
+	 */
 	movl	$MSR_GSBASE,%ecx
 	rdmsr
-	cmpl	$VM_MAXUSER_ADDRESS >> 32,%edx
-	jae	nmi_calltrap		/* GS.base holds a kernel VA */
-nmi_needswapgs:
+	movq	%rax,%r12
+	shlq	$32,%rdx
+	orq	%rdx,%r12
+	/* Retrieve and load the canonical value for GS.base. */
+	movq	TF_SIZE(%rsp),%rdx
+	movl	%edx,%eax
+	shrq	$32,%rdx
+	wrmsr
+	jmp	nmi_calltrap
+nmi_fromuserspace:
 	incl	%ebx
 	swapgs
 /* Note: this label is also used by ddb and gdb: */
@@ -439,14 +451,19 @@ nmi_calltrap:
 	MEXITCOUNT
 #ifdef HWPMC_HOOKS
 	/*
-	 * Check if the current trap was from user mode and if so
-	 * whether the current thread needs a user call chain to be
-	 * captured. We are still in NMI mode at this point.
+	 * Capture a userspace callchain if needed.
+	 * 
+	 * - Check if the current trap was from user mode.
+	 * - Check if the current thread is valid.
+	 * - Check if the thread requires a user call chain to be
+	 *   captured.
+	 *
+	 * We are still in NMI mode at this point.
 	 */
-	testb	$SEL_RPL_MASK,TF_CS(%rsp)
-	jz	nocallchain
-	movq	PCPU(CURTHREAD),%rax	/* curthread present? */
-	orq	%rax,%rax
+	testl	%ebx,%ebx
+	jz	nocallchain	/* not from userspace */
+	movq	PCPU(CURTHREAD),%rax
+	orq	%rax,%rax	/* curthread present? */
 	jz	nocallchain
 	testl	$TDP_CALLCHAIN,TD_PFLAGS(%rax) /* flagged for capture? */
 	jz	nocallchain
@@ -498,8 +515,18 @@ outofnmi:
 nocallchain:
 #endif
 	testl	%ebx,%ebx
-	jz	nmi_restoreregs
+	jz	nmi_kernelexit
 	swapgs
+	jmp	nmi_restoreregs
+nmi_kernelexit:	
+	/*
+	 * Put back the preserved MSR_GSBASE value.
+	 */
+	movl	$MSR_GSBASE,%ecx
+	movq	%r12,%rdx
+	movl	%edx,%eax
+	shrq	$32,%rdx
+	wrmsr
 nmi_restoreregs:
 	movq	TF_RDI(%rsp),%rdi
 	movq	TF_RSI(%rsp),%rsi

Modified: head/sys/amd64/amd64/machdep.c
==============================================================================
--- head/sys/amd64/amd64/machdep.c	Tue Feb  3 08:25:24 2009	(r188064)
+++ head/sys/amd64/amd64/machdep.c	Tue Feb  3 09:01:45 2009	(r188065)
@@ -809,6 +809,9 @@ struct gate_descriptor *idt = &idt0[0];	
 
 static char dblfault_stack[PAGE_SIZE] __aligned(16);
 
+static char nmi0_stack[PAGE_SIZE] __aligned(16);
+CTASSERT(sizeof(struct nmi_pcpu) == 16);
+
 struct amd64tss common_tss[MAXCPU];
 
 /* software prototypes -- in more palatable form */
@@ -1291,6 +1294,7 @@ hammer_time(u_int64_t modulep, u_int64_t
 	caddr_t kmdp;
 	int gsel_tss, x;
 	struct pcpu *pc;
+	struct nmi_pcpu *np;
 	u_int64_t msr;
 	char *env;
 
@@ -1365,7 +1369,7 @@ hammer_time(u_int64_t modulep, u_int64_t
 		setidt(x, &IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0);
 	setidt(IDT_DE, &IDTVEC(div),  SDT_SYSIGT, SEL_KPL, 0);
 	setidt(IDT_DB, &IDTVEC(dbg),  SDT_SYSIGT, SEL_KPL, 0);
-	setidt(IDT_NMI, &IDTVEC(nmi),  SDT_SYSIGT, SEL_KPL, 1);
+	setidt(IDT_NMI, &IDTVEC(nmi),  SDT_SYSIGT, SEL_KPL, 2);
  	setidt(IDT_BP, &IDTVEC(bpt),  SDT_SYSIGT, SEL_UPL, 0);
 	setidt(IDT_OF, &IDTVEC(ofl),  SDT_SYSIGT, SEL_KPL, 0);
 	setidt(IDT_BR, &IDTVEC(bnd),  SDT_SYSIGT, SEL_KPL, 0);
@@ -1438,6 +1442,14 @@ hammer_time(u_int64_t modulep, u_int64_t
 	/* doublefault stack space, runs on ist1 */
 	common_tss[0].tss_ist1 = (long)&dblfault_stack[sizeof(dblfault_stack)];
 
+	/*
+	 * NMI stack, runs on ist2.  The pcpu pointer is stored just
+	 * above the start of the ist2 stack.
+	 */
+	np = ((struct nmi_pcpu *) &nmi0_stack[sizeof(nmi0_stack)]) - 1;
+	np->np_pcpu = (register_t) pc;
+	common_tss[0].tss_ist2 = (long) np;
+
 	/* Set the IO permission bitmap (empty due to tss seg limit) */
 	common_tss[0].tss_iobase = sizeof(struct amd64tss);
 

Modified: head/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- head/sys/amd64/amd64/mp_machdep.c	Tue Feb  3 08:25:24 2009	(r188064)
+++ head/sys/amd64/amd64/mp_machdep.c	Tue Feb  3 09:01:45 2009	(r188065)
@@ -92,6 +92,7 @@ void *bootstacks[MAXCPU];
 
 /* Temporary holder for double fault stack */
 char *doublefault_stack;
+char *nmi_stack;
 
 /* Hotwire a 0->4MB V==P mapping */
 extern pt_entry_t *KPTphys;
@@ -437,6 +438,7 @@ void
 init_secondary(void)
 {
 	struct pcpu *pc;
+	struct nmi_pcpu *np;
 	u_int64_t msr, cr0;
 	int cpu, gsel_tss, x;
 	struct region_descriptor ap_gdt;
@@ -450,6 +452,10 @@ init_secondary(void)
 	common_tss[cpu].tss_iobase = sizeof(struct amd64tss);
 	common_tss[cpu].tss_ist1 = (long)&doublefault_stack[PAGE_SIZE];
 
+	/* The NMI stack runs on IST2. */
+	np = ((struct nmi_pcpu *) &nmi_stack[PAGE_SIZE]) - 1;
+	common_tss[cpu].tss_ist2 = (long) np;
+
 	/* Prepare private GDT */
 	gdt_segs[GPROC0_SEL].ssd_base = (long) &common_tss[cpu];
 	ssdtosyssd(&gdt_segs[GPROC0_SEL],
@@ -474,6 +480,9 @@ init_secondary(void)
 	pc->pc_rsp0 = 0;
 	pc->pc_gs32p = &gdt[NGDT * cpu + GUGS32_SEL];
 
+	/* Save the per-cpu pointer for use by the NMI handler. */
+	np->np_pcpu = (register_t) pc;
+
 	wrmsr(MSR_FSBASE, 0);		/* User value */
 	wrmsr(MSR_GSBASE, (u_int64_t)pc);
 	wrmsr(MSR_KGSBASE, (u_int64_t)pc);	/* XXX User value while we're in the kernel */
@@ -725,6 +734,7 @@ start_all_aps(void)
 		/* allocate and set up an idle stack data page */
 		bootstacks[cpu] = (void *)kmem_alloc(kernel_map, KSTACK_PAGES * PAGE_SIZE);
 		doublefault_stack = (char *)kmem_alloc(kernel_map, PAGE_SIZE);
+		nmi_stack = (char *)kmem_alloc(kernel_map, PAGE_SIZE);
 
 		bootSTK = (char *)bootstacks[cpu] + KSTACK_PAGES * PAGE_SIZE - 8;
 		bootAP = cpu;

Modified: head/sys/amd64/include/intr_machdep.h
==============================================================================
--- head/sys/amd64/include/intr_machdep.h	Tue Feb  3 08:25:24 2009	(r188064)
+++ head/sys/amd64/include/intr_machdep.h	Tue Feb  3 09:01:45 2009	(r188065)
@@ -120,6 +120,15 @@ struct intsrc {
 
 struct trapframe;
 
+/*
+ * The following data structure holds per-cpu data, and is placed just
+ * above the top of the space used for the NMI stack.
+ */
+struct nmi_pcpu {
+	register_t	np_pcpu;
+	register_t	__padding;	/* pad to 16 bytes */
+};
+
 extern struct mtx icu_lock;
 extern int elcr_found;
 

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 11:00:43 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B90A7106564A;
	Tue,  3 Feb 2009 11:00:43 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9D2908FC12;
	Tue,  3 Feb 2009 11:00:43 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13B0hAD028522;
	Tue, 3 Feb 2009 11:00:43 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13B0hvp028517;
	Tue, 3 Feb 2009 11:00:43 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <200902031100.n13B0hvp028517@svn.freebsd.org>
From: Randall Stewart <rrs@FreeBSD.org>
Date: Tue, 3 Feb 2009 11:00:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188066 - in head/sys: dev/xen/netback net netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 11:00:44 -0000

Author: rrs
Date: Tue Feb  3 11:00:43 2009
New Revision: 188066
URL: http://svn.freebsd.org/changeset/base/188066

Log:
  Adds support for SCTP checksum offload. This means
  we, like TCP and UDP, move the checksum calculation
  into the IP routines when there is no hardware support
  we call into the normal SCTP checksum routine.
  
  The next round of SCTP updates will use
  this functionality. Of course the IGB driver needs
  a few updates to support the new intel controller set
  that actually does SCTP csum offload too.
  
  Reviewed by:	gnn, rwatson, kmacy

Modified:
  head/sys/dev/xen/netback/netback.c
  head/sys/net/if_ethersubr.c
  head/sys/netinet/ip_divert.c
  head/sys/netinet/ip_ipsec.c
  head/sys/netinet/ip_output.c

Modified: head/sys/dev/xen/netback/netback.c
==============================================================================
--- head/sys/dev/xen/netback/netback.c	Tue Feb  3 09:01:45 2009	(r188065)
+++ head/sys/dev/xen/netback/netback.c	Tue Feb  3 11:00:43 2009	(r188066)
@@ -30,6 +30,7 @@
 
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
+#include "opt_sctp.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -57,6 +58,10 @@ __FBSDID("$FreeBSD$");
 #include <netinet/ip.h>
 #include <netinet/tcp.h>
 #include <netinet/udp.h>
+#ifdef SCTP
+#include <netinet/sctp.h>
+#include <netinet/sctp_crc32.h>
+#endif
 
 #include <vm/vm_extern.h>
 #include <vm/vm_kern.h>
@@ -295,6 +300,11 @@ fixup_checksum(struct mbuf *m)
 			htons(IPPROTO_TCP + (iplen - iphlen)));
 		th->th_sum = in_cksum_skip(m, iplen + sizeof(*eh), sizeof(*eh) + iphlen);
 		m->m_pkthdr.csum_flags &= ~CSUM_TCP;
+#ifdef SCTP
+	} else if (sw_csum & CSUM_SCTP) {
+		sctp_delayed_cksum(m);
+		sw_csum &= ~CSUM_SCTP;
+#endif
 	} else {
 		u_short csum;
 		struct udphdr *uh = (struct udphdr *)((caddr_t)ip + iphlen);
@@ -908,7 +918,8 @@ netif_rx(netif_t *netif)
 #ifdef XEN_NETBACK_FIXUP_CSUM
 		/* Check if we need to compute a checksum.  This happens */
 		/* when bridging from one domain to another. */
-		if ((m->m_pkthdr.csum_flags & CSUM_DELAY_DATA))
+		if ((m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) ||
+			(m->m_pkthdr.csum_flags & CSUM_SCTP))
 			fixup_checksum(m);
 #endif
 

Modified: head/sys/net/if_ethersubr.c
==============================================================================
--- head/sys/net/if_ethersubr.c	Tue Feb  3 09:01:45 2009	(r188065)
+++ head/sys/net/if_ethersubr.c	Tue Feb  3 11:00:43 2009	(r188066)
@@ -299,6 +299,8 @@ ether_output(struct ifnet *ifp, struct m
 			csum_flags |= (CSUM_IP_CHECKED|CSUM_IP_VALID);
 		if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA)
 			csum_flags |= (CSUM_DATA_VALID|CSUM_PSEUDO_HDR);
+		if (m->m_pkthdr.csum_flags & CSUM_SCTP)
+			csum_flags |= CSUM_SCTP_VALID;
 		m->m_pkthdr.csum_flags |= csum_flags;
 		m->m_pkthdr.csum_data = 0xffff;
 		return (if_simloop(ifp, m, dst->sa_family, 0));
@@ -339,6 +341,8 @@ ether_output(struct ifnet *ifp, struct m
 			csum_flags |= (CSUM_IP_CHECKED|CSUM_IP_VALID);
 		if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA)
 			csum_flags |= (CSUM_DATA_VALID|CSUM_PSEUDO_HDR);
+		if (m->m_pkthdr.csum_flags & CSUM_SCTP)
+			csum_flags |= CSUM_SCTP_VALID;
 
 		if (m->m_flags & M_BCAST) {
 			struct mbuf *n;

Modified: head/sys/netinet/ip_divert.c
==============================================================================
--- head/sys/netinet/ip_divert.c	Tue Feb  3 09:01:45 2009	(r188065)
+++ head/sys/netinet/ip_divert.c	Tue Feb  3 11:00:43 2009	(r188066)
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 #include "opt_inet.h"
 #include "opt_ipfw.h"
 #include "opt_mac.h"
+#include "opt_sctp.h"
 #ifndef INET
 #error "IPDIVERT requires INET."
 #endif
@@ -76,6 +77,9 @@ __FBSDID("$FreeBSD$");
 #include <netinet/ip_var.h>
 #include <netinet/ip_fw.h>
 #include <netinet/vinet.h>
+#ifdef SCTP
+#include <netinet/sctp_crc32.h>
+#endif
 
 #include <security/mac/mac_framework.h>
 
@@ -222,7 +226,14 @@ divert_packet(struct mbuf *m, int incomi
 		m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
 		ip->ip_len = htons(ip->ip_len);
 	}
-
+#ifdef SCTP
+	if (m->m_pkthdr.csum_flags & CSUM_SCTP) {
+		ip->ip_len = ntohs(ip->ip_len);
+		sctp_delayed_cksum(m);
+		m->m_pkthdr.csum_flags &= ~CSUM_SCTP;
+		ip->ip_len = htons(ip->ip_len);
+	}
+#endif
 	/*
 	 * Record receive interface address, if any.
 	 * But only for incoming packets.

Modified: head/sys/netinet/ip_ipsec.c
==============================================================================
--- head/sys/netinet/ip_ipsec.c	Tue Feb  3 09:01:45 2009	(r188065)
+++ head/sys/netinet/ip_ipsec.c	Tue Feb  3 11:00:43 2009	(r188066)
@@ -31,6 +31,7 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_ipsec.h"
+#include "opt_sctp.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -56,6 +57,9 @@ __FBSDID("$FreeBSD$");
 #include <netinet/ip_options.h>
 #include <netinet/ip_ipsec.h>
 #include <netinet/vinet.h>
+#ifdef SCTP
+#include <netinet/sctp_crc32.h>
+#endif
 
 #include <machine/in_cksum.h>
 
@@ -328,7 +332,12 @@ ip_ipsec_output(struct mbuf **m, struct 
 			in_delayed_cksum(*m);
 			(*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
 		}
-
+#ifdef SCTP
+		if ((*m)->m_pkthdr.csum_flags & CSUM_SCTP) {
+			sctp_delayed_cksum(*m);
+			(*m)->m_pkthdr.csum_flags &= ~CSUM_SCTP;
+		}
+#endif
 		ip->ip_len = htons(ip->ip_len);
 		ip->ip_off = htons(ip->ip_off);
 

Modified: head/sys/netinet/ip_output.c
==============================================================================
--- head/sys/netinet/ip_output.c	Tue Feb  3 09:01:45 2009	(r188065)
+++ head/sys/netinet/ip_output.c	Tue Feb  3 11:00:43 2009	(r188066)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include "opt_mac.h"
 #include "opt_mbuf_stress_test.h"
 #include "opt_mpath.h"
+#include "opt_sctp.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -70,6 +71,10 @@ __FBSDID("$FreeBSD$");
 #include <netinet/ip_var.h>
 #include <netinet/ip_options.h>
 #include <netinet/vinet.h>
+#ifdef SCTP
+#include <netinet/sctp.h>
+#include <netinet/sctp_crc32.h>
+#endif
 
 #ifdef IPSEC
 #include <netinet/ip_ipsec.h>
@@ -485,7 +490,10 @@ sendit:
 			}
 			m->m_pkthdr.csum_flags |=
 			    CSUM_IP_CHECKED | CSUM_IP_VALID;
-
+#ifdef SCTP
+			if (m->m_pkthdr.csum_flags & CSUM_SCTP)
+				m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID;
+#endif
 			error = netisr_queue(NETISR_IP, m);
 			goto done;
 		} else
@@ -502,6 +510,10 @@ sendit:
 			    CSUM_DATA_VALID | CSUM_PSEUDO_HDR;
 			m->m_pkthdr.csum_data = 0xffff;
 		}
+#ifdef SCTP
+		if (m->m_pkthdr.csum_flags & CSUM_SCTP)
+			m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID;
+#endif
 		m->m_pkthdr.csum_flags |=
 			    CSUM_IP_CHECKED | CSUM_IP_VALID;
 
@@ -536,6 +548,12 @@ passout:
 		in_delayed_cksum(m);
 		sw_csum &= ~CSUM_DELAY_DATA;
 	}
+#ifdef SCTP
+	if (sw_csum & CSUM_SCTP) {
+		sctp_delayed_cksum(m);
+		sw_csum &= ~CSUM_SCTP;
+	}
+#endif
 	m->m_pkthdr.csum_flags &= ifp->if_hwassist;
 
 	/*
@@ -670,7 +688,13 @@ ip_fragment(struct ip *ip, struct mbuf *
 		in_delayed_cksum(m0);
 		m0->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
 	}
-
+#ifdef SCTP
+	if (m0->m_pkthdr.csum_flags & CSUM_SCTP &&
+	    (if_hwassist_flags & CSUM_IP_FRAGS) == 0) {
+		sctp_delayed_cksum(m0);
+		m0->m_pkthdr.csum_flags &= ~CSUM_SCTP;
+	}
+#endif
 	if (len > PAGE_SIZE) {
 		/* 
 		 * Fragment large datagrams such that each segment 

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 11:04:04 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 15A10106564A;
	Tue,  3 Feb 2009 11:04:04 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 028548FC13;
	Tue,  3 Feb 2009 11:04:04 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13B44fX028630;
	Tue, 3 Feb 2009 11:04:04 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13B43DG028622;
	Tue, 3 Feb 2009 11:04:03 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <200902031104.n13B43DG028622@svn.freebsd.org>
From: Randall Stewart <rrs@FreeBSD.org>
Date: Tue, 3 Feb 2009 11:04:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188067 - in head/sys: netinet netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 11:04:04 -0000

Author: rrs
Date: Tue Feb  3 11:04:03 2009
New Revision: 188067
URL: http://svn.freebsd.org/changeset/base/188067

Log:
  - Cleanup checksum code.
  - Prepare for CRC offloading, add MIB counters (RS/MT).
  - Bugfix: Disable CRC computation for IPv6 addresses with local scope (MT).
  - Bugfix: Handle close() with SO_LINGER correctly when notifications
            are generated during the close() call(MT).
  - Bugfix: Generate DRY event when sender is dry during subscription.
            Only for 1-to-1 style sockets (RS/MT)
  - Bugfix: Put vtags for the correct amount of time into time-wait (MT).
  - Bugfix: Clear vtag entries correctly on expiration (MT).
  - Bugfix: shutdown() indicates ENOTCONN when called for unconnected
            1-to-1 style sockets (MT).
  - Bugfix: In sctp Auth code (PL).
  - Add support for devices that support SCTP csum offload (igb).
  - Add missing sctp_associd to mib sysctl xsctp_tcb structure (RS)
  Obtained from:	With help from Peter Lei and Michael Tuexen

Modified:
  head/sys/netinet/sctp_auth.c
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_crc32.c
  head/sys/netinet/sctp_crc32.h
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_os_bsd.h
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_pcb.h
  head/sys/netinet/sctp_sysctl.c
  head/sys/netinet/sctp_uio.h
  head/sys/netinet/sctp_usrreq.c
  head/sys/netinet/sctputil.c
  head/sys/netinet/sctputil.h
  head/sys/netinet6/sctp6_usrreq.c

Modified: head/sys/netinet/sctp_auth.c
==============================================================================
--- head/sys/netinet/sctp_auth.c	Tue Feb  3 11:00:43 2009	(r188066)
+++ head/sys/netinet/sctp_auth.c	Tue Feb  3 11:04:03 2009	(r188067)
@@ -1645,8 +1645,10 @@ sctp_auth_get_cookie_params(struct sctp_
 			bcopy(p_random->random_data, new_key->key, random_len);
 	}
 #else
-	keylen = sizeof(*p_random) + random_len + sizeof(*chunks) + num_chunks +
-	    sizeof(*hmacs) + hmacs_len;
+	keylen = sizeof(*p_random) + random_len + sizeof(*hmacs) + hmacs_len;
+	if (chunks != NULL) {
+		keylen += sizeof(*chunks) + num_chunks;
+	}
 	new_key = sctp_alloc_key(keylen);
 	if (new_key != NULL) {
 		/* copy in the RANDOM */

Modified: head/sys/netinet/sctp_constants.h
==============================================================================
--- head/sys/netinet/sctp_constants.h	Tue Feb  3 11:00:43 2009	(r188066)
+++ head/sys/netinet/sctp_constants.h	Tue Feb  3 11:04:03 2009	(r188067)
@@ -37,8 +37,15 @@ __FBSDID("$FreeBSD$");
 #define __sctp_constants_h__
 
 /* IANA assigned port number for SCTP over UDP encapsulation */
-#define SCTP_OVER_UDP_TUNNELING_PORT 9899
-
+/* For freebsd we cannot bind the port at
+ * startup. Otherwise what will happen is
+ * we really won't be bound. The user must
+ * put it into the sysctl... or we need
+ * to build a special timer for this to allow
+ * us to wait 1 second or so after the system
+ * comes up.
+ */
+#define SCTP_OVER_UDP_TUNNELING_PORT 0
 /* Number of packets to get before sack sent by default */
 #define SCTP_DEFAULT_SACK_FREQ 2
 
@@ -310,10 +317,6 @@ __FBSDID("$FreeBSD$");
 
 #define SCTP_PARTIAL_DELIVERY_SHIFT 1
 
-/* Minimum number of bytes read by user before we
- * condsider doing a rwnd update
- */
-
 /*
  * default HMAC for cookies, etc... use one of the AUTH HMAC id's
  * SCTP_HMAC is the HMAC_ID to use
@@ -323,21 +326,6 @@ __FBSDID("$FreeBSD$");
 #define SCTP_SIGNATURE_SIZE	SCTP_AUTH_DIGEST_LEN_SHA1
 #define SCTP_SIGNATURE_ALOC_SIZE SCTP_SIGNATURE_SIZE
 
-/* DEFINE HERE WHAT CRC YOU WANT TO USE */
-#define SCTP_USECRC_RFC2960  1
-/* #define SCTP_USECRC_FLETCHER 1 */
-/* #define SCTP_USECRC_SSHCRC32 1 */
-/* #define SCTP_USECRC_FASTCRC32 1 */
-/* #define SCTP_USECRC_CRC32 1 */
-/* #define SCTP_USECRC_TCP32 1 */
-/* #define SCTP_USECRC_CRC16SMAL 1 */
-/* #define SCTP_USECRC_CRC16 1 */
-/* #define SCTP_USECRC_MODADLER 1 */
-
-#ifndef SCTP_ADLER32_BASE
-#define SCTP_ADLER32_BASE 65521
-#endif
-
 /*
  * the SCTP protocol signature this includes the version number encoded in
  * the last 4 bits of the signature.
@@ -619,43 +607,16 @@ __FBSDID("$FreeBSD$");
 
 
 
-/*
- * Number of ticks before the soxwakeup() event that is delayed is sent AFTER
- * the accept() call
- */
-
-/*
- * Of course we really don't collect stale cookies, being folks of decerning
- * taste. However we do count them, if we get too many before the association
- * comes up.. we give up. Below is the constant that dictates when we give it
- * up...this is a implemenation dependent treatment. In ours we do not ask
- * for a extension of time, but just retry this many times...
- */
-
 /* max number of TSN's dup'd that I will hold */
 #define SCTP_MAX_DUP_TSNS	20
 
 /*
  * Here we define the types used when setting the retry amounts.
  */
-/* constants for type of set */
-
-/* Maximum TSN's we will summarize in a drop report */
-
 /* How many drop re-attempts we make on  INIT/COOKIE-ECHO */
 #define SCTP_RETRY_DROPPED_THRESH 4
 
 /*
- * And the max we will keep a history of in the tcb which MUST be lower than
- * 256.
- */
-
-/*
- * Here we define the default timers and the default number of attemts we
- * make for each respective side (send/init).
- */
-
-/*
  * Maxmium number of chunks a single association can have on it. Note that
  * this is a squishy number since the count can run over this if the user
  * sends a large message down .. the fragmented chunks don't count until
@@ -763,7 +724,7 @@ __FBSDID("$FreeBSD$");
 #define SCTP_DEBUG_INDATA1	0x01000000
 #define SCTP_DEBUG_INDATA2	0x02000000	/* unused */
 #define SCTP_DEBUG_INDATA3	0x04000000	/* unused */
-#define SCTP_DEBUG_INDATA4	0x08000000	/* unused */
+#define SCTP_DEBUG_CRCOFFLOAD	0x08000000	/* unused */
 #define SCTP_DEBUG_USRREQ1	0x10000000	/* unused */
 #define SCTP_DEBUG_USRREQ2	0x20000000	/* unused */
 #define SCTP_DEBUG_PEEL1	0x40000000
@@ -783,7 +744,7 @@ __FBSDID("$FreeBSD$");
 
 #define SCTP_INITIAL_CWND 4380
 
-#define SCTP_DEFAULT_MTU 1500	/* emegency default MTU */
+#define SCTP_DEFAULT_MTU 1500	/* emergency default MTU */
 /* amount peer is obligated to have in rwnd or I will abort */
 #define SCTP_MIN_RWND	1500
 
@@ -996,13 +957,6 @@ __FBSDID("$FreeBSD$");
  */
 #define SCTP_STACK_VTAG_HASH_SIZE   32
 
-
-/*
- * If we use the per-endpoint model than we do not have a hash table of
- * entries but instead have a single head pointer and we must crawl through
- * the entire list.
- */
-
 /*
  * Number of seconds of time wait for a vtag.
  */

Modified: head/sys/netinet/sctp_crc32.c
==============================================================================
--- head/sys/netinet/sctp_crc32.c	Tue Feb  3 11:00:43 2009	(r188066)
+++ head/sys/netinet/sctp_crc32.c	Tue Feb  3 11:04:03 2009	(r188067)
@@ -34,12 +34,16 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/uio.h>
+#include <netinet/sctp.h>
 #include <netinet/sctp_os.h>
 #include <netinet/sctp_crc32.h>
+#include <netinet/sctp_pcb.h>
 
-#ifndef SCTP_USE_ADLER32
-
-
+#if !defined(SCTP_WITH_NO_CSUM)
 /**
  *
  * Routine Description:
@@ -80,12 +84,14 @@ __FBSDID("$FreeBSD$");
  * The following CRC lookup table was generated automagically using the
  * following model parameters:
  *
- * Generator Polynomial = ................. 0x1EDC6F41 Generator Polynomial
- * Length = .......... 32 bits Reflected Bits = ....................... TRUE
- * Table Generation Offset = .............. 32 bits Number of Slices =
- * ..................... 8 slices Slice Lengths = ........................ 8
- * 8 8 8 8 8 8 8 Directory Name = ....................... .\ File Name =
- * ............................ 8x256_tables.c
+ * Generator Polynomial = ................. 0x1EDC6F41
+ * Generator Polynomial Length = .......... 32 bits
+ * Reflected Bits = ....................... TRUE
+ * Table Generation Offset = .............. 32 bits
+ * Number of Slices = ..................... 8 slices
+ * Slice Lengths = ........................ 8 8 8 8 8 8 8 8
+ * Directory Name = ....................... .\
+ * File Name = ............................ 8x256_tables.c
  */
 
 uint32_t sctp_crc_tableil8_o32[256] =
@@ -134,12 +140,14 @@ uint32_t sctp_crc_tableil8_o32[256] =
  * The following CRC lookup table was generated automagically using the
  * following model parameters:
  *
- * Generator Polynomial = ................. 0x1EDC6F41 Generator Polynomial
- * Length = .......... 32 bits Reflected Bits = ....................... TRUE
- * Table Generation Offset = .............. 32 bits Number of Slices =
- * ..................... 8 slices Slice Lengths = ........................ 8
- * 8 8 8 8 8 8 8 Directory Name = ....................... .\ File Name =
- * ............................ 8x256_tables.c
+ * Generator Polynomial = ................. 0x1EDC6F41
+ * Generator Polynomial Length = .......... 32 bits
+ * Reflected Bits = ....................... TRUE
+ * Table Generation Offset = .............. 32 bits
+ * Number of Slices = ..................... 8 slices
+ * Slice Lengths = ........................ 8 8 8 8 8 8 8 8
+ * Directory Name = ....................... .\
+ * File Name = ............................ 8x256_tables.c
  */
 
 uint32_t sctp_crc_tableil8_o40[256] =
@@ -188,12 +196,14 @@ uint32_t sctp_crc_tableil8_o40[256] =
  * The following CRC lookup table was generated automagically using the
  * following model parameters:
  *
- * Generator Polynomial = ................. 0x1EDC6F41 Generator Polynomial
- * Length = .......... 32 bits Reflected Bits = ....................... TRUE
- * Table Generation Offset = .............. 32 bits Number of Slices =
- * ..................... 8 slices Slice Lengths = ........................ 8
- * 8 8 8 8 8 8 8 Directory Name = ....................... .\ File Name =
- * ............................ 8x256_tables.c
+ * Generator Polynomial = ................. 0x1EDC6F41
+ * Generator Polynomial Length = .......... 32 bits
+ * Reflected Bits = ....................... TRUE
+ * Table Generation Offset = .............. 32 bits
+ * Number of Slices = ..................... 8 slices
+ * Slice Lengths = ........................ 8 8 8 8 8 8 8 8
+ * Directory Name = ....................... .\
+ * File Name = ............................ 8x256_tables.c
  */
 
 uint32_t sctp_crc_tableil8_o48[256] =
@@ -242,12 +252,14 @@ uint32_t sctp_crc_tableil8_o48[256] =
  * The following CRC lookup table was generated automagically using the
  * following model parameters:
  *
- * Generator Polynomial = ................. 0x1EDC6F41 Generator Polynomial
- * Length = .......... 32 bits Reflected Bits = ....................... TRUE
- * Table Generation Offset = .............. 32 bits Number of Slices =
- * ..................... 8 slices Slice Lengths = ........................ 8
- * 8 8 8 8 8 8 8 Directory Name = ....................... .\ File Name =
- * ............................ 8x256_tables.c
+ * Generator Polynomial = ................. 0x1EDC6F41
+ * Generator Polynomial Length = .......... 32 bits
+ * Reflected Bits = ....................... TRUE
+ * Table Generation Offset = .............. 32 bits
+ * Number of Slices = ..................... 8 slices
+ * Slice Lengths = ........................ 8 8 8 8 8 8 8 8
+ * Directory Name = ....................... .\
+ * File Name = ............................ 8x256_tables.c
  */
 
 uint32_t sctp_crc_tableil8_o56[256] =
@@ -296,12 +308,14 @@ uint32_t sctp_crc_tableil8_o56[256] =
  * The following CRC lookup table was generated automagically using the
  * following model parameters:
  *
- * Generator Polynomial = ................. 0x1EDC6F41 Generator Polynomial
- * Length = .......... 32 bits Reflected Bits = ....................... TRUE
- * Table Generation Offset = .............. 32 bits Number of Slices =
- * ..................... 8 slices Slice Lengths = ........................ 8
- * 8 8 8 8 8 8 8 Directory Name = ....................... .\ File Name =
- * ............................ 8x256_tables.c
+ * Generator Polynomial = ................. 0x1EDC6F41
+ * Generator Polynomial Length = .......... 32 bits
+ * Reflected Bits = ....................... TRUE
+ * Table Generation Offset = .............. 32 bits
+ * Number of Slices = ..................... 8 slices
+ * Slice Lengths = ........................ 8 8 8 8 8 8 8 8
+ * Directory Name = ....................... .\
+ * File Name = ............................ 8x256_tables.c
  */
 
 uint32_t sctp_crc_tableil8_o64[256] =
@@ -350,12 +364,14 @@ uint32_t sctp_crc_tableil8_o64[256] =
  * The following CRC lookup table was generated automagically using the
  * following model parameters:
  *
- * Generator Polynomial = ................. 0x1EDC6F41 Generator Polynomial
- * Length = .......... 32 bits Reflected Bits = ....................... TRUE
- * Table Generation Offset = .............. 32 bits Number of Slices =
- * ..................... 8 slices Slice Lengths = ........................ 8
- * 8 8 8 8 8 8 8 Directory Name = ....................... .\ File Name =
- * ............................ 8x256_tables.c
+ * Generator Polynomial = ................. 0x1EDC6F41
+ * Generator Polynomial Length = .......... 32 bits
+ * Reflected Bits = ....................... TRUE
+ * Table Generation Offset = .............. 32 bits
+ * Number of Slices = ..................... 8 slices
+ * Slice Lengths = ........................ 8 8 8 8 8 8 8 8
+ * Directory Name = ....................... .\
+ * File Name = ............................ 8x256_tables.c
  */
 
 uint32_t sctp_crc_tableil8_o72[256] =
@@ -404,12 +420,14 @@ uint32_t sctp_crc_tableil8_o72[256] =
  * The following CRC lookup table was generated automagically using the
  * following model parameters:
  *
- * Generator Polynomial = ................. 0x1EDC6F41 Generator Polynomial
- * Length = .......... 32 bits Reflected Bits = ....................... TRUE
- * Table Generation Offset = .............. 32 bits Number of Slices =
- * ..................... 8 slices Slice Lengths = ........................ 8
- * 8 8 8 8 8 8 8 Directory Name = ....................... .\ File Name =
- * ............................ 8x256_tables.c
+ * Generator Polynomial = ................. 0x1EDC6F41
+ * Generator Polynomial Length = .......... 32 bits
+ * Reflected Bits = ....................... TRUE
+ * Table Generation Offset = .............. 32 bits
+ * Number of Slices = ..................... 8 slices
+ * Slice Lengths = ........................ 8 8 8 8 8 8 8 8
+ * Directory Name = ....................... .\
+ * File Name = ............................ 8x256_tables.c
  */
 
 uint32_t sctp_crc_tableil8_o80[256] =
@@ -458,12 +476,14 @@ uint32_t sctp_crc_tableil8_o80[256] =
  * The following CRC lookup table was generated automagically using the
  * following model parameters:
  *
- * Generator Polynomial = ................. 0x1EDC6F41 Generator Polynomial
- * Length = .......... 32 bits Reflected Bits = ....................... TRUE
- * Table Generation Offset = .............. 32 bits Number of Slices =
- * ..................... 8 slices Slice Lengths = ........................ 8
- * 8 8 8 8 8 8 8 Directory Name = ....................... .\ File Name =
- * ............................ 8x256_tables.c
+ * Generator Polynomial = ................. 0x1EDC6F41
+ * Generator Polynomial Length = .......... 32 bits
+ * Reflected Bits = ....................... TRUE
+ * Table Generation Offset = .............. 32 bits
+ * Number of Slices = ..................... 8 slices
+ * Slice Lengths = ........................ 8 8 8 8 8 8 8 8
+ * Directory Name = ....................... .\
+ * File Name = ............................ 8x256_tables.c
  */
 
 uint32_t sctp_crc_tableil8_o88[256] =
@@ -506,6 +526,7 @@ uint32_t sctp_crc_tableil8_o88[256] =
  * end of the CRC lookup table crc_tableil8_o88
  */
 
+
 static uint32_t
 sctp_crc32c_sb8_64_bit(uint32_t crc,
     unsigned char *p_buf,
@@ -578,7 +599,7 @@ sctp_crc32c_sb8_64_bit(uint32_t crc,
  *
  *		none
  */
-uint32_t
+static uint32_t
 update_crc32(uint32_t crc32c,
     unsigned char *buffer,
     unsigned int length)
@@ -662,7 +683,7 @@ uint32_t sctp_crc_c[256] = {
 
 #define SCTP_CRC32C(c,d) (c=(c>>8)^sctp_crc_c[(c^(d))&0xFF])
 
-uint32_t
+static uint32_t
 old_update_crc32(uint32_t crc32c,
     unsigned char *buffer,
     unsigned int length)
@@ -676,8 +697,8 @@ old_update_crc32(uint32_t crc32c,
 }
 
 
-uint32_t
-sctp_csum_finalize(uint32_t crc32c)
+static uint32_t
+sctp_finalize_crc32(uint32_t crc32c)
 {
 	uint32_t result;
 
@@ -709,4 +730,88 @@ sctp_csum_finalize(uint32_t crc32c)
 	return (crc32c);
 }
 
+#endif				/* !defined(SCTP_WITH_NO_CSUM) */
+
+#if defined(SCTP_WITH_NO_CSUM)
+uint32_t
+sctp_calculate_cksum(struct mbuf *m, uint32_t offset)
+{
+	return (0);
+}
+
+#else
+uint32_t
+sctp_calculate_cksum(struct mbuf *m, uint32_t offset)
+{
+	/*
+	 * given a mbuf chain with a packetheader offset by 'offset'
+	 * pointing at a sctphdr (with csum set to 0) go through the chain
+	 * of SCTP_BUF_NEXT()'s and calculate the SCTP checksum. This also
+	 * has a side bonus as it will calculate the total length of the
+	 * mbuf chain. Note: if offset is greater than the total mbuf
+	 * length, checksum=1, pktlen=0 is returned (ie. no real error code)
+	 */
+	uint32_t base = 0xffffffff;
+	struct mbuf *at;
+
+	at = m;
+	/* find the correct mbuf and offset into mbuf */
+	while ((at != NULL) && (offset > (uint32_t) SCTP_BUF_LEN(at))) {
+		offset -= SCTP_BUF_LEN(at);	/* update remaining offset
+						 * left */
+		at = SCTP_BUF_NEXT(at);
+	}
+	while (at != NULL) {
+		if ((SCTP_BUF_LEN(at) - offset) > 0) {
+			if ((SCTP_BUF_LEN(at) - offset) < 4) {
+				/* Use old method if less than 4 bytes */
+				base = old_update_crc32(base,
+				    (unsigned char *)(SCTP_BUF_AT(at, offset)),
+				    (unsigned int)(SCTP_BUF_LEN(at) - offset));
+			} else {
+				base = update_crc32(base,
+				    (unsigned char *)(SCTP_BUF_AT(at, offset)),
+				    (unsigned int)(SCTP_BUF_LEN(at) - offset));
+			}
+			/* we only offset once into the first mbuf */
+		}
+		if (offset) {
+			if (offset < (uint32_t) SCTP_BUF_LEN(at))
+				offset = 0;
+			else
+				offset -= SCTP_BUF_LEN(at);
+		}
+		at = SCTP_BUF_NEXT(at);
+	}
+	base = sctp_finalize_crc32(base);
+	return (base);
+}
+
 #endif
+
+void
+sctp_delayed_cksum(struct mbuf *m)
+{
+	struct ip *ip;
+	uint32_t checksum;
+	uint32_t offset;
+
+	ip = mtod(m, struct ip *);
+	offset = ip->ip_hl << 2;
+	checksum = sctp_calculate_cksum(m, offset);
+	SCTP_STAT_DECR(sctps_sendhwcrc);
+	SCTP_STAT_INCR(sctps_sendswcrc);
+	offset += offsetof(struct sctphdr, checksum);
+
+	if (offset + sizeof(uint32_t) > (uint32_t) (m->m_len)) {
+		printf("delayed m_pullup, m->len: %d  off: %d  p: %d\n",
+		    (uint32_t) m->m_len, offset, ip->ip_p);
+		/*
+		 * XXX this shouldn't happen, but if it does, the correct
+		 * behavior may be to insert the checksum in the appropriate
+		 * next mbuf in the chain.
+		 */
+		return;
+	}
+	*(uint32_t *) (m->m_data + offset) = checksum;
+}

Modified: head/sys/netinet/sctp_crc32.h
==============================================================================
--- head/sys/netinet/sctp_crc32.h	Tue Feb  3 11:00:43 2009	(r188066)
+++ head/sys/netinet/sctp_crc32.h	Tue Feb  3 11:04:03 2009	(r188067)
@@ -36,16 +36,10 @@ __FBSDID("$FreeBSD$");
 #ifndef __crc32c_h__
 #define __crc32c_h__
 
-#ifndef SCTP_USE_ADLER32
-
 #if defined(_KERNEL) || defined(__Userspace__)
-uint32_t update_crc32(uint32_t, unsigned char *, unsigned int);
-
-uint32_t old_update_crc32(uint32_t, unsigned char *, unsigned int);
-
-uint32_t sctp_csum_finalize(uint32_t);
-
+uint32_t sctp_calculate_cksum(struct mbuf *, uint32_t);
+void sctp_delayed_cksum(struct mbuf *);
 
 #endif				/* _KERNEL */
-#endif				/* !SCTP_USE_ADLER32 */
+
 #endif				/* __crc32c_h__ */

Modified: head/sys/netinet/sctp_input.c
==============================================================================
--- head/sys/netinet/sctp_input.c	Tue Feb  3 11:00:43 2009	(r188066)
+++ head/sys/netinet/sctp_input.c	Tue Feb  3 11:04:03 2009	(r188067)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include <netinet/sctp_asconf.h>
 #include <netinet/sctp_bsd_addr.h>
 #include <netinet/sctp_timer.h>
+#include <netinet/sctp_crc32.h>
 #include <netinet/udp.h>
 
 
@@ -1384,14 +1385,6 @@ sctp_process_cookie_existing(struct mbuf
 			/* FOOBAR */
 			return (NULL);
 		}
-		/* pre-reserve some space */
-#ifdef INET6
-		SCTP_BUF_RESV_UF(op_err, sizeof(struct ip6_hdr));
-#else
-		SCTP_BUF_RESV_UF(op_err, sizeof(struct ip));
-#endif
-		SCTP_BUF_RESV_UF(op_err, sizeof(struct sctphdr));
-		SCTP_BUF_RESV_UF(op_err, sizeof(struct sctp_chunkhdr));
 		/* Set the len */
 		SCTP_BUF_LEN(op_err) = sizeof(struct sctp_paramhdr);
 		ph = mtod(op_err, struct sctp_paramhdr *);
@@ -2504,15 +2497,6 @@ sctp_handle_cookie_echo(struct mbuf *m, 
 			/* FOOBAR */
 			return (NULL);
 		}
-		/* pre-reserve some space */
-#ifdef INET6
-		SCTP_BUF_RESV_UF(op_err, sizeof(struct ip6_hdr));
-#else
-		SCTP_BUF_RESV_UF(op_err, sizeof(struct ip));
-#endif
-		SCTP_BUF_RESV_UF(op_err, sizeof(struct sctphdr));
-		SCTP_BUF_RESV_UF(op_err, sizeof(struct sctp_chunkhdr));
-
 		/* Set the len */
 		SCTP_BUF_LEN(op_err) = sizeof(struct sctp_stale_cookie_msg);
 		scm = mtod(op_err, struct sctp_stale_cookie_msg *);
@@ -2598,9 +2582,9 @@ sctp_handle_cookie_echo(struct mbuf *m, 
 			}
 		}
 	}
-	if (to == NULL)
+	if (to == NULL) {
 		return (NULL);
-
+	}
 	cookie_len -= SCTP_SIGNATURE_SIZE;
 	if (*stcb == NULL) {
 		/* this is the "normal" case... get a new TCB */
@@ -5594,7 +5578,6 @@ sctp_input_with_port(i_pak, off, port)
 	int refcount_up = 0;
 	int length, mlen, offset;
 
-
 	if (SCTP_GET_PKT_VRFID(i_pak, vrf_id)) {
 		SCTP_RELEASE_PKT(i_pak);
 		return;
@@ -5642,6 +5625,11 @@ sctp_input_with_port(i_pak, off, port)
 		}
 		ip = mtod(m, struct ip *);
 	}
+	/* validate mbuf chain length with IP payload length */
+	if (mlen < (SCTP_GET_IPV4_LENGTH(ip) - iphlen)) {
+		SCTP_STAT_INCR(sctps_hdrops);
+		goto bad;
+	}
 	sh = (struct sctphdr *)((caddr_t)ip + iphlen);
 	ch = (struct sctp_chunkhdr *)((caddr_t)sh + sizeof(*sh));
 	SCTPDBG(SCTP_DEBUG_INPUT1,
@@ -5659,15 +5647,26 @@ sctp_input_with_port(i_pak, off, port)
 		goto bad;
 	}
 	/* validate SCTP checksum */
+	SCTPDBG(SCTP_DEBUG_CRCOFFLOAD,
+	    "sctp_input(): Packet of length %d received on %s with csum_flags 0x%x.\n",
+	    m->m_pkthdr.len,
+	    if_name(m->m_pkthdr.rcvif),
+	    m->m_pkthdr.csum_flags);
+	if (m->m_pkthdr.csum_flags & CSUM_SCTP_VALID) {
+		SCTP_STAT_INCR(sctps_recvhwcrc);
+		goto sctp_skip_csum_4;
+	}
 	check = sh->checksum;	/* save incoming checksum */
 	if ((check == 0) && (SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback)) &&
 	    ((ip->ip_src.s_addr == ip->ip_dst.s_addr) ||
 	    (SCTP_IS_IT_LOOPBACK(m)))
 	    ) {
+		SCTP_STAT_INCR(sctps_recvnocrc);
 		goto sctp_skip_csum_4;
 	}
 	sh->checksum = 0;	/* prepare for calc */
-	calc_check = sctp_calculate_sum(m, &mlen, iphlen);
+	calc_check = sctp_calculate_cksum(m, iphlen);
+	SCTP_STAT_INCR(sctps_recvswcrc);
 	if (calc_check != check) {
 		SCTPDBG(SCTP_DEBUG_INPUT1, "Bad CSUM on SCTP packet calc_check:%x check:%x  m:%p mlen:%d iphlen:%d\n",
 		    calc_check, check, m, mlen, iphlen);
@@ -5699,11 +5698,6 @@ sctp_skip_csum_4:
 		SCTP_STAT_INCR(sctps_hdrops);
 		goto bad;
 	}
-	/* validate mbuf chain length with IP payload length */
-	if (mlen < (SCTP_GET_IPV4_LENGTH(ip) - iphlen)) {
-		SCTP_STAT_INCR(sctps_hdrops);
-		goto bad;
-	}
 	/*
 	 * Locate pcb and tcb for datagram sctp_findassociation_addr() wants
 	 * IP/SCTP/first chunk header...

Modified: head/sys/netinet/sctp_os_bsd.h
==============================================================================
--- head/sys/netinet/sctp_os_bsd.h	Tue Feb  3 11:00:43 2009	(r188066)
+++ head/sys/netinet/sctp_os_bsd.h	Tue Feb  3 11:04:03 2009	(r188067)
@@ -154,11 +154,8 @@ MALLOC_DECLARE(SCTP_M_SOCKOPT);
 #define MOD_IPSEC ipsec
 
 /* then define the macro(s) that hook into the vimage macros */
-#if defined(__FreeBSD__) && __FreeBSD_version >= 800056
 #define MODULE_GLOBAL(__MODULE, __SYMBOL) V_ ## __SYMBOL
-#else
-#define MODULE_GLOBAL(__MODULE, __SYMBOL) (__SYMBOL)
-#endif
+
 /*
  *
  */

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Tue Feb  3 11:00:43 2009	(r188066)
+++ head/sys/netinet/sctp_output.c	Tue Feb  3 11:04:03 2009	(r188067)
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
 #include <netinet/sctp_indata.h>
 #include <netinet/sctp_bsd_addr.h>
 #include <netinet/sctp_input.h>
+#include <netinet/sctp_crc32.h>
 #include <netinet/udp.h>
 #include <machine/in_cksum.h>
 
@@ -5213,6 +5214,9 @@ sctp_lowlevel_chunk_output(struct sctp_i
     int ecn_ok,
     struct sctp_tmit_chunk *chk,
     int out_of_asoc_ok,
+    uint16_t src_port,
+    uint16_t dest_port,
+    uint32_t v_tag,
     uint16_t port,
     int so_locked,
 #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
@@ -5237,7 +5241,6 @@ sctp_lowlevel_chunk_output(struct sctp_i
 	struct mbuf *newm;
 	struct sctphdr *sctphdr;
 	int packet_length;
-	uint32_t csum;
 	int ret;
 	uint32_t vrf_id;
 	sctp_route_t *ro = NULL;
@@ -5263,51 +5266,27 @@ sctp_lowlevel_chunk_output(struct sctp_i
 	if ((auth != NULL) && (stcb != NULL)) {
 		sctp_fill_hmac_digest_m(m, auth_offset, auth, stcb, auth_keyid);
 	}
-	/* Calculate the csum and fill in the length of the packet */
-	sctphdr = mtod(m, struct sctphdr *);
-	if (SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) &&
-	    (stcb) &&
-	    (to->sa_family == AF_INET) &&
-	    (stcb->asoc.loopback_scope)) {
-		sctphdr->checksum = 0;
-		/*
-		 * This can probably now be taken out since my audit shows
-		 * no more bad pktlen's coming in. But we will wait a while
-		 * yet.
-		 */
-		packet_length = sctp_calculate_len(m);
-	} else {
-		sctphdr->checksum = 0;
-		csum = sctp_calculate_sum(m, &packet_length, 0);
-		sctphdr->checksum = csum;
-	}
-
 	if (to->sa_family == AF_INET) {
 		struct ip *ip = NULL;
 		sctp_route_t iproute;
 		uint8_t tos_value;
+		int len;
 
+		len = sizeof(struct ip) + sizeof(struct sctphdr);
 		if (port) {
-			newm = sctp_get_mbuf_for_msg(sizeof(struct ip) + sizeof(struct udphdr), 1, M_DONTWAIT, 1, MT_DATA);
-		} else {
-			newm = sctp_get_mbuf_for_msg(sizeof(struct ip), 1, M_DONTWAIT, 1, MT_DATA);
+			len += sizeof(struct udphdr);
 		}
+		newm = sctp_get_mbuf_for_msg(len, 1, M_DONTWAIT, 1, MT_DATA);
 		if (newm == NULL) {
 			sctp_m_freem(m);
 			SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
 			return (ENOMEM);
 		}
-		if (port) {
-			SCTP_ALIGN_TO_END(newm, sizeof(struct ip) + sizeof(struct udphdr));
-			SCTP_BUF_LEN(newm) = sizeof(struct ip) + sizeof(struct udphdr);
-			packet_length += sizeof(struct ip) + sizeof(struct udphdr);
-		} else {
-			SCTP_ALIGN_TO_END(newm, sizeof(struct ip));
-			SCTP_BUF_LEN(newm) = sizeof(struct ip);
-			packet_length += sizeof(struct ip);
-		}
+		SCTP_ALIGN_TO_END(newm, len);
+		SCTP_BUF_LEN(newm) = len;
 		SCTP_BUF_NEXT(newm) = m;
 		m = newm;
+		packet_length = sctp_calculate_len(m);
 		ip = mtod(m, struct ip *);
 		ip->ip_v = IPVERSION;
 		ip->ip_hl = (sizeof(struct ip) >> 2);
@@ -5401,12 +5380,21 @@ sctp_lowlevel_chunk_output(struct sctp_i
 			}
 		}
 		if (port) {
-			udp = (struct udphdr *)(ip + 1);
+			udp = (struct udphdr *)((caddr_t)ip + sizeof(struct ip));
 			udp->uh_sport = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port));
 			udp->uh_dport = port;
 			udp->uh_ulen = htons(packet_length - sizeof(struct ip));
 			udp->uh_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP));
+			sctphdr = (struct sctphdr *)((caddr_t)udp + sizeof(struct udphdr));
+		} else {
+			sctphdr = (struct sctphdr *)((caddr_t)ip + sizeof(struct ip));
 		}
+
+		sctphdr->src_port = src_port;
+		sctphdr->dest_port = dest_port;
+		sctphdr->v_tag = v_tag;
+		sctphdr->checksum = 0;
+
 		/*
 		 * If source address selection fails and we find no route
 		 * then the ip_output should fail as well with a
@@ -5517,7 +5505,25 @@ sctp_lowlevel_chunk_output(struct sctp_i
 #endif
 		SCTP_ATTACH_CHAIN(o_pak, m, packet_length);
 		if (port) {
+			if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) &&
+			    (stcb) &&
+			    (stcb->asoc.loopback_scope))) {
+				sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip) + sizeof(struct udphdr));
+				SCTP_STAT_INCR(sctps_sendswcrc);
+			} else {
+				SCTP_STAT_INCR(sctps_sendnocrc);
+			}
 			SCTP_ENABLE_UDP_CSUM(o_pak);
+		} else {
+			if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) &&
+			    (stcb) &&
+			    (stcb->asoc.loopback_scope))) {
+				m->m_pkthdr.csum_flags = CSUM_SCTP;
+				m->m_pkthdr.csum_data = 0;	/* FIXME MT */
+				SCTP_STAT_INCR(sctps_sendhwcrc);
+			} else {
+				SCTP_STAT_INCR(sctps_sendnocrc);
+			}
 		}
 		/* send it out.  table id is taken from stcb */
 #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
@@ -5591,6 +5597,7 @@ sctp_lowlevel_chunk_output(struct sctp_i
 		struct sockaddr_in6 lsa6_storage;
 		int error;
 		u_short prev_port = 0;
+		int len;
 
 		if (net != NULL) {
 			flowlabel = net->tos_flowlabel;
@@ -5598,27 +5605,21 @@ sctp_lowlevel_chunk_output(struct sctp_i
 			flowlabel = ((struct in6pcb *)inp)->in6p_flowinfo;
 		}
 
+		len = sizeof(struct ip6_hdr) + sizeof(struct sctphdr);
 		if (port) {
-			newm = sctp_get_mbuf_for_msg(sizeof(struct ip6_hdr) + sizeof(struct udphdr), 1, M_DONTWAIT, 1, MT_DATA);
-		} else {
-			newm = sctp_get_mbuf_for_msg(sizeof(struct ip6_hdr), 1, M_DONTWAIT, 1, MT_DATA);
+			len += sizeof(struct udphdr);
 		}
+		newm = sctp_get_mbuf_for_msg(len, 1, M_DONTWAIT, 1, MT_DATA);
 		if (newm == NULL) {
 			sctp_m_freem(m);
 			SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
 			return (ENOMEM);
 		}
-		if (port) {
-			SCTP_ALIGN_TO_END(newm, sizeof(struct ip6_hdr) + sizeof(struct udphdr));
-			SCTP_BUF_LEN(newm) = sizeof(struct ip6_hdr) + sizeof(struct udphdr);
-			packet_length += sizeof(struct ip6_hdr) + sizeof(struct udphdr);
-		} else {
-			SCTP_ALIGN_TO_END(newm, sizeof(struct ip6_hdr));
-			SCTP_BUF_LEN(newm) = sizeof(struct ip6_hdr);
-			packet_length += sizeof(struct ip6_hdr);
-		}
+		SCTP_ALIGN_TO_END(newm, len);
+		SCTP_BUF_LEN(newm) = len;
 		SCTP_BUF_NEXT(newm) = m;
 		m = newm;
+		packet_length = sctp_calculate_len(m);
 
 		ip6h = mtod(m, struct ip6_hdr *);
 		/*
@@ -5763,12 +5764,21 @@ sctp_lowlevel_chunk_output(struct sctp_i
 		ip6h->ip6_src = lsa6->sin6_addr;
 
 		if (port) {
-			udp = (struct udphdr *)(ip6h + 1);
+			udp = (struct udphdr *)((caddr_t)ip6h + sizeof(struct ip6_hdr));
 			udp->uh_sport = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port));
 			udp->uh_dport = port;
 			udp->uh_ulen = htons(packet_length - sizeof(struct ip6_hdr));
 			udp->uh_sum = 0;
+			sctphdr = (struct sctphdr *)((caddr_t)udp + sizeof(struct udphdr));
+		} else {
+			sctphdr = (struct sctphdr *)((caddr_t)ip6h + sizeof(struct ip6_hdr));
 		}
+
+		sctphdr->src_port = src_port;
+		sctphdr->dest_port = dest_port;
+		sctphdr->v_tag = v_tag;
+		sctphdr->checksum = 0;
+
 		/*
 		 * We set the hop limit now since there is a good chance
 		 * that our ro pointer is now filled
@@ -5805,9 +5815,27 @@ sctp_lowlevel_chunk_output(struct sctp_i
 #endif
 		SCTP_ATTACH_CHAIN(o_pak, m, packet_length);
 		if (port) {
+			if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) &&
+			    (stcb) &&
+			    (stcb->asoc.loopback_scope))) {
+				sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip6_hdr) + sizeof(struct udphdr));
+				SCTP_STAT_INCR(sctps_sendswcrc);
+			} else {
+				SCTP_STAT_INCR(sctps_sendnocrc);
+			}
 			if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), packet_length - sizeof(struct ip6_hdr))) == 0) {
 				udp->uh_sum = 0xffff;
 			}
+		} else {
+			if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) &&
+			    (stcb) &&
+			    (stcb->asoc.loopback_scope))) {
+				m->m_pkthdr.csum_flags = CSUM_SCTP;
+				m->m_pkthdr.csum_data = 0;	/* FIXME MT */
+				SCTP_STAT_INCR(sctps_sendhwcrc);
+			} else {
+				SCTP_STAT_INCR(sctps_sendnocrc);
+			}
 		}
 		/* send it out. table id is taken from stcb */
 #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
@@ -5905,7 +5933,7 @@ sctp_send_initiate(struct sctp_inpcb *in
 {
 	struct mbuf *m, *m_at, *mp_last;
 	struct sctp_nets *net;
-	struct sctp_init_msg *initm;
+	struct sctp_init_chunk *init;
 	struct sctp_supported_addr_param *sup_addr;
 	struct sctp_adaptation_layer_indication *ali;
 	struct sctp_ecn_supported_param *ecn;
@@ -5961,7 +5989,7 @@ sctp_send_initiate(struct sctp_inpcb *in
 		SCTPDBG(SCTP_DEBUG_OUTPUT4, "Sending INIT - mbuf?\n");
 		return;
 	}
-	SCTP_BUF_LEN(m) = sizeof(struct sctp_init_msg);
+	SCTP_BUF_LEN(m) = sizeof(struct sctp_init_chunk);
 	/*
 	 * assume peer supports asconf in order to be able to queue local
 	 * address changes while an INIT is in flight and before the assoc
@@ -5969,28 +5997,24 @@ sctp_send_initiate(struct sctp_inpcb *in
 	 */
 	stcb->asoc.peer_supports_asconf = 1;
 	/* Now lets put the SCTP header in place */
-	initm = mtod(m, struct sctp_init_msg *);
-	initm->sh.src_port = inp->sctp_lport;
-	initm->sh.dest_port = stcb->rport;
-	initm->sh.v_tag = 0;
-	initm->sh.checksum = 0;	/* calculate later */
+	init = mtod(m, struct sctp_init_chunk *);
 	/* now the chunk header */
-	initm->msg.ch.chunk_type = SCTP_INITIATION;
-	initm->msg.ch.chunk_flags = 0;
+	init->ch.chunk_type = SCTP_INITIATION;
+	init->ch.chunk_flags = 0;
 	/* fill in later from mbuf we build */
-	initm->msg.ch.chunk_length = 0;
+	init->ch.chunk_length = 0;
 	/* place in my tag */
-	initm->msg.init.initiate_tag = htonl(stcb->asoc.my_vtag);
+	init->init.initiate_tag = htonl(stcb->asoc.my_vtag);
 	/* set up some of the credits. */
-	initm->msg.init.a_rwnd = htonl(max(SCTP_SB_LIMIT_RCV(inp->sctp_socket),
+	init->init.a_rwnd = htonl(max(SCTP_SB_LIMIT_RCV(inp->sctp_socket),
 	    SCTP_MINIMAL_RWND));
 
-	initm->msg.init.num_outbound_streams = htons(stcb->asoc.pre_open_streams);
-	initm->msg.init.num_inbound_streams = htons(stcb->asoc.max_inbound_streams);
-	initm->msg.init.initial_tsn = htonl(stcb->asoc.init_seq_number);
+	init->init.num_outbound_streams = htons(stcb->asoc.pre_open_streams);
+	init->init.num_inbound_streams = htons(stcb->asoc.max_inbound_streams);
+	init->init.initial_tsn = htonl(stcb->asoc.init_seq_number);
 	/* now the address restriction */
-	sup_addr = (struct sctp_supported_addr_param *)((caddr_t)initm +
-	    sizeof(*initm));
+	sup_addr = (struct sctp_supported_addr_param *)((caddr_t)init +
+	    sizeof(*init));
 	sup_addr->ph.param_type = htons(SCTP_SUPPORTED_ADDRTYPE);
 #ifdef INET6
 	/* we support 2 types: IPv6/IPv4 */
@@ -6004,7 +6028,6 @@ sctp_send_initiate(struct sctp_inpcb *in
 	sup_addr->addr_type[1] = htons(0);	/* this is the padding */
 #endif
 	SCTP_BUF_LEN(m) += sizeof(*sup_addr) + sizeof(uint16_t);
-
 	/* adaptation layer indication parameter */
 	ali = (struct sctp_adaptation_layer_indication *)((caddr_t)sup_addr + sizeof(*sup_addr) + sizeof(uint16_t));
 	ali->ph.param_type = htons(SCTP_ULP_ADAPTATION);
@@ -6013,6 +6036,16 @@ sctp_send_initiate(struct sctp_inpcb *in
 	SCTP_BUF_LEN(m) += sizeof(*ali);
 	ecn = (struct sctp_ecn_supported_param *)((caddr_t)ali + sizeof(*ali));
 
+	if (SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly)) {
+		/* Add NAT friendly parameter */
+		struct sctp_paramhdr *ph;
+
+		ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+SCTP_BUF_LEN(m));
+		ph->param_type = htons(SCTP_HAS_NAT_SUPPORT);
+		ph->param_length = htons(sizeof(struct sctp_paramhdr));
+		SCTP_BUF_LEN(m) += sizeof(struct sctp_paramhdr);
+		ecn = (struct sctp_ecn_supported_param *)((caddr_t)ph + sizeof(*ph));
+	}
 	/* now any cookie time extensions */
 	if (stcb->asoc.cookie_preserve_req) {
 		struct sctp_cookie_perserve_param *cookie_preserve;
@@ -6052,19 +6085,22 @@ sctp_send_initiate(struct sctp_inpcb *in
 	pr_supported->chunk_types[num_ext++] = SCTP_FORWARD_CUM_TSN;
 	pr_supported->chunk_types[num_ext++] = SCTP_PACKET_DROPPED;
 	pr_supported->chunk_types[num_ext++] = SCTP_STREAM_RESET;
-	if (!SCTP_BASE_SYSCTL(sctp_auth_disable))
+	if (!SCTP_BASE_SYSCTL(sctp_auth_disable)) {
 		pr_supported->chunk_types[num_ext++] = SCTP_AUTHENTICATION;
+	}
 	/*
 	 * EY  if the initiator supports nr_sacks, need to report that to
 	 * responder in INIT chunk
 	 */
-	if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off))
+	if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off)) {
 		pr_supported->chunk_types[num_ext++] = SCTP_NR_SELECTIVE_ACK;
+	}
 	p_len = sizeof(*pr_supported) + num_ext;
 	pr_supported->ph.param_length = htons(p_len);
 	bzero((caddr_t)pr_supported + p_len, SCTP_SIZE32(p_len) - p_len);
 	SCTP_BUF_LEN(m) += SCTP_SIZE32(p_len);
 
+
 	/* ECN nonce: And now tell the peer we support ECN nonce */
 	if (SCTP_BASE_SYSCTL(sctp_ecn_nonce)) {
 		ecn_nonce = (struct sctp_ecn_nonce_supported_param *)
@@ -6073,15 +6109,6 @@ sctp_send_initiate(struct sctp_inpcb *in
 		ecn_nonce->ph.param_length = htons(sizeof(*ecn_nonce));
 		SCTP_BUF_LEN(m) += sizeof(*ecn_nonce);
 	}
-	if (SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly)) {
-		/* Add NAT friendly parameter */
-		struct sctp_paramhdr *ph;
-
-		ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+SCTP_BUF_LEN(m));
-		ph->param_type = htons(SCTP_HAS_NAT_SUPPORT);
-		ph->param_length = htons(sizeof(struct sctp_paramhdr));
-		SCTP_BUF_LEN(m) += sizeof(sizeof(struct sctp_paramhdr));
-	}
 	/* add authentication parameters */
 	if (!SCTP_BASE_SYSCTL(sctp_auth_disable)) {
 		struct sctp_auth_random *randp;
@@ -6160,7 +6187,7 @@ sctp_send_initiate(struct sctp_inpcb *in
 			mp_last = m_at;
 		p_len += SCTP_BUF_LEN(m_at);
 	}
-	initm->msg.ch.chunk_length = htons((p_len - sizeof(struct sctphdr)));
+	init->ch.chunk_length = htons(p_len);
 	/*
 	 * We sifa 0 here to NOT set IP_DF if its IPv4, we ignore the return
 	 * here since the timer will drive a retranmission.
@@ -6185,7 +6212,9 @@ sctp_send_initiate(struct sctp_inpcb *in
 	SCTPDBG(SCTP_DEBUG_OUTPUT4, "Sending INIT - calls lowlevel_output\n");
 	ret = sctp_lowlevel_chunk_output(inp, stcb, net,
 	    (struct sockaddr *)&net->ro._l_addr,
-	    m, 0, NULL, 0, 0, 0, NULL, 0, net->port, so_locked, NULL);
+	    m, 0, NULL, 0, 0, 0, NULL, 0,
+	    inp->sctp_lport, stcb->rport, htonl(0),
+	    net->port, so_locked, NULL);
 	SCTPDBG(SCTP_DEBUG_OUTPUT4, "lowlevel_output - %d\n", ret);
 	SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
 	sctp_timer_start(SCTP_TIMER_TYPE_INIT, inp, stcb, net);
@@ -6711,7 +6740,7 @@ sctp_send_initiate_ack(struct sctp_inpcb
 {
 	struct sctp_association *asoc;
 	struct mbuf *m, *m_at, *m_tmp, *m_cookie, *op_err, *mp_last;
-	struct sctp_init_msg *initackm_out;
+	struct sctp_init_ack_chunk *initack;
 	struct sctp_adaptation_layer_indication *ali;
 	struct sctp_ecn_supported_param *ecn;
 	struct sctp_prsctp_supported_param *prsctp;
@@ -6776,7 +6805,7 @@ do_a_abort:
 			sctp_m_freem(op_err);
 		return;
 	}
-	SCTP_BUF_LEN(m) = sizeof(struct sctp_init_msg);
+	SCTP_BUF_LEN(m) = sizeof(struct sctp_init_chunk);
 
 	/* the time I built cookie */

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 15:24:01 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 26014106566C;
	Tue,  3 Feb 2009 15:24:01 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 09E108FC1B;
	Tue,  3 Feb 2009 15:24:01 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13FO02n033826;
	Tue, 3 Feb 2009 15:24:00 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13FO0dn033824;
	Tue, 3 Feb 2009 15:24:00 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200902031524.n13FO0dn033824@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Tue, 3 Feb 2009 15:24:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188074 - head/sys/dev/usb2/quirk
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 15:24:01 -0000

Author: thompsa
Date: Tue Feb  3 15:24:00 2009
New Revision: 188074
URL: http://svn.freebsd.org/changeset/base/188074

Log:
  Add missing string table for the usb quirk enum.
  
  Pointy hat:	me
  Submitted by:	rrs

Modified:
  head/sys/dev/usb2/quirk/usb2_quirk.c
  head/sys/dev/usb2/quirk/usb2_quirk.h

Modified: head/sys/dev/usb2/quirk/usb2_quirk.c
==============================================================================
--- head/sys/dev/usb2/quirk/usb2_quirk.c	Tue Feb  3 14:32:06 2009	(r188073)
+++ head/sys/dev/usb2/quirk/usb2_quirk.c	Tue Feb  3 15:24:00 2009	(r188074)
@@ -112,7 +112,32 @@ static struct usb2_quirk_entry usb2_quir
 	{USB_QUIRK_ENTRY(USB_VENDOR_METAGEEK, USB_PRODUCT_METAGEEK_WISPY24X, 0x0000, 0xFFFF, UQ_KBD_IGNORE, UQ_HID_IGNORE, UQ_NONE)},
 };
 
-USB_MAKE_DEBUG_TABLE(USB_QUIRK);
+static const char *usb_quirk_str[USB_QUIRK_MAX] = {
+	"UQ_NONE",
+	"UQ_AUDIO_SWAP_LR",	/* left and right sound channels are swapped */
+	"UQ_AU_INP_ASYNC",	/* input is async despite claim of adaptive */
+	"UQ_AU_NO_FRAC",	/* don't adjust for fractional samples */
+	"UQ_AU_NO_XU",		/* audio device has broken extension unit */
+	"UQ_BAD_ADC",		/* bad audio spec version number */
+	"UQ_BAD_AUDIO",		/* device claims audio class, but isn't */
+	"UQ_BROKEN_BIDIR",	/* printer has broken bidir mode */
+	"UQ_BUS_POWERED",	/* device is bus powered, despite claim */
+	"UQ_HID_IGNORE",	/* device should be ignored by hid class */
+	"UQ_KBD_IGNORE",	/* device should be ignored by kbd class */
+	"UQ_MS_BAD_CLASS",	/* doesn't identify properly */
+	"UQ_MS_LEADING_BYTE",	/* mouse sends an unknown leading byte */
+	"UQ_MS_REVZ",		/* mouse has Z-axis reversed */
+	"UQ_NO_STRINGS",	/* string descriptors are broken */
+	"UQ_OPEN_CLEARSTALL",	/* device needs clear endpoint stall */
+	"UQ_POWER_CLAIM",	/* hub lies about power status */
+	"UQ_SPUR_BUT_UP",	/* spurious mouse button up events */
+	"UQ_SWAP_UNICODE",	/* has some Unicode strings swapped */
+	"UQ_CFG_INDEX_1",	/* select configuration index 1 by default */
+	"UQ_CFG_INDEX_2",	/* select configuration index 2 by default */
+	"UQ_CFG_INDEX_3",	/* select configuration index 3 by default */
+	"UQ_CFG_INDEX_4",	/* select configuration index 4 by default */
+	"UQ_CFG_INDEX_0",	/* select configuration index 0 by default */
+};
 
 /*------------------------------------------------------------------------*
  *	usb2_quirkstr
@@ -123,7 +148,7 @@ static const char *
 usb2_quirkstr(uint16_t quirk)
 {
 	return ((quirk < USB_QUIRK_MAX) ?
-	    USB_QUIRK[quirk] : "USB_QUIRK_UNKNOWN");
+	    usb_quirk_str[quirk] : "USB_QUIRK_UNKNOWN");
 }
 
 /*------------------------------------------------------------------------*

Modified: head/sys/dev/usb2/quirk/usb2_quirk.h
==============================================================================
--- head/sys/dev/usb2/quirk/usb2_quirk.h	Tue Feb  3 14:32:06 2009	(r188073)
+++ head/sys/dev/usb2/quirk/usb2_quirk.h	Tue Feb  3 15:24:00 2009	(r188074)
@@ -28,7 +28,7 @@
 #define	_USB2_QUIRK_H_
 
 /* NOTE: UQ_NONE is not a valid quirk */
-enum {
+enum {	/* keep in sync with usb_quirk_str table */
 	UQ_NONE,
 	UQ_AUDIO_SWAP_LR,	/* left and right sound channels are swapped */
 	UQ_AU_INP_ASYNC,	/* input is async despite claim of adaptive */

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 15:27:29 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CD1631065698;
	Tue,  3 Feb 2009 15:27:29 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BB0618FC25;
	Tue,  3 Feb 2009 15:27:29 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13FRT0V033942;
	Tue, 3 Feb 2009 15:27:29 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13FRTlf033941;
	Tue, 3 Feb 2009 15:27:29 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200902031527.n13FRTlf033941@svn.freebsd.org>
From: "David E. O'Brien" <obrien@FreeBSD.org>
Date: Tue, 3 Feb 2009 15:27:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188075 - head/usr.bin/make
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 15:27:32 -0000

Author: obrien
Date: Tue Feb  3 15:27:29 2009
New Revision: 188075
URL: http://svn.freebsd.org/changeset/base/188075

Log:
  Partially revert r186559.

Modified:
  head/usr.bin/make/job.c

Modified: head/usr.bin/make/job.c
==============================================================================
--- head/usr.bin/make/job.c	Tue Feb  3 15:24:00 2009	(r188074)
+++ head/usr.bin/make/job.c	Tue Feb  3 15:27:29 2009	(r188075)
@@ -2362,7 +2362,7 @@ Job_Init(int maxproc)
 	makeErrors = 0;
 
 	lastNode = NULL;
-	if ((maxJobs == 1 && fifoFd < 0) || is_posix || beQuiet) {
+	if ((maxJobs == 1 && fifoFd < 0) || !beVerbose || is_posix || beQuiet) {
 		/*
 		 * If only one job can run at a time, there's no need for a
 		 * banner, no is there?

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 16:00:20 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 63346106566B;
	Tue,  3 Feb 2009 16:00:20 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 517338FC17;
	Tue,  3 Feb 2009 16:00:20 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13G0KkJ034625;
	Tue, 3 Feb 2009 16:00:20 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13G0KAN034623;
	Tue, 3 Feb 2009 16:00:20 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200902031600.n13G0KAN034623@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Tue, 3 Feb 2009 16:00:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188076 - in head/sys/dev/usb2: core quirk
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 16:00:21 -0000

Author: thompsa
Date: Tue Feb  3 16:00:20 2009
New Revision: 188076
URL: http://svn.freebsd.org/changeset/base/188076

Log:
  - Keep the same sorting on usb_errstr_table as the enum.
  - Use c99 array initializers for usb_quirk_str so the indexing isnt critical.

Modified:
  head/sys/dev/usb2/core/usb2_error.c
  head/sys/dev/usb2/quirk/usb2_quirk.c

Modified: head/sys/dev/usb2/core/usb2_error.c
==============================================================================
--- head/sys/dev/usb2/core/usb2_error.c	Tue Feb  3 15:27:29 2009	(r188075)
+++ head/sys/dev/usb2/core/usb2_error.c	Tue Feb  3 16:00:20 2009	(r188076)
@@ -31,35 +31,36 @@
 
 static const char* usb_errstr_table[USB_ERR_MAX] = {
 	[USB_ERR_NORMAL_COMPLETION]	= "USB_ERR_NORMAL_COMPLETION",
+	[USB_ERR_PENDING_REQUESTS]	= "USB_ERR_PENDING_REQUESTS",
+	[USB_ERR_NOT_STARTED]		= "USB_ERR_NOT_STARTED",
+	[USB_ERR_INVAL]			= "USB_ERR_INVAL",
+	[USB_ERR_NOMEM]			= "USB_ERR_NOMEM",
+	[USB_ERR_CANCELLED]		= "USB_ERR_CANCELLED",
 	[USB_ERR_BAD_ADDRESS]		= "USB_ERR_BAD_ADDRESS",
 	[USB_ERR_BAD_BUFSIZE]		= "USB_ERR_BAD_BUFSIZE",
-	[USB_ERR_BAD_CONTEXT]		= "USB_ERR_BAD_CONTEXT",
 	[USB_ERR_BAD_FLAG]		= "USB_ERR_BAD_FLAG",
-	[USB_ERR_CANCELLED]		= "USB_ERR_CANCELLED",
-	[USB_ERR_DMA_LOAD_FAILED]	= "USB_ERR_DMA_LOAD_FAILED",
-	[USB_ERR_INTERRUPTED]		= "USB_ERR_INTERRUPTED",
-	[USB_ERR_INVAL]			= "USB_ERR_INVAL",
+	[USB_ERR_NO_CALLBACK]		= "USB_ERR_NO_CALLBACK",
 	[USB_ERR_IN_USE]		= "USB_ERR_IN_USE",
-	[USB_ERR_IOERROR]		= "USB_ERR_IOERROR",
-	[USB_ERR_NOMEM]			= "USB_ERR_NOMEM",
-	[USB_ERR_NOT_CONFIGURED]	= "USB_ERR_NOT_CONFIGURED",
-	[USB_ERR_NOT_LOCKED]		= "USB_ERR_NOT_LOCKED",
-	[USB_ERR_NOT_STARTED]		= "USB_ERR_NOT_STARTED",
 	[USB_ERR_NO_ADDR]		= "USB_ERR_NO_ADDR",
-	[USB_ERR_NO_CALLBACK]		= "USB_ERR_NO_CALLBACK",
-	[USB_ERR_NO_INTR_THREAD]	= "USB_ERR_NO_INTR_THREAD",
 	[USB_ERR_NO_PIPE]		= "USB_ERR_NO_PIPE",
-	[USB_ERR_NO_POWER]		= "USB_ERR_NO_POWER",
-	[USB_ERR_NO_ROOT_HUB]		= "USB_ERR_NO_ROOT_HUB",
-	[USB_ERR_PENDING_REQUESTS]	= "USB_ERR_PENDING_REQUESTS",
+	[USB_ERR_ZERO_NFRAMES]		= "USB_ERR_ZERO_NFRAMES",
+	[USB_ERR_ZERO_MAXP]		= "USB_ERR_ZERO_MAXP",
 	[USB_ERR_SET_ADDR_FAILED]	= "USB_ERR_SET_ADDR_FAILED",
+	[USB_ERR_NO_POWER]		= "USB_ERR_NO_POWER",
+	[USB_ERR_TOO_DEEP]		= "USB_ERR_TOO_DEEP",
+	[USB_ERR_IOERROR]		= "USB_ERR_IOERROR",
+	[USB_ERR_NOT_CONFIGURED]	= "USB_ERR_NOT_CONFIGURED",
+	[USB_ERR_TIMEOUT]		= "USB_ERR_TIMEOUT",
 	[USB_ERR_SHORT_XFER]		= "USB_ERR_SHORT_XFER",
 	[USB_ERR_STALLED]		= "USB_ERR_STALLED",
-	[USB_ERR_TIMEOUT]		= "USB_ERR_TIMEOUT",
-	[USB_ERR_TOO_DEEP]		= "USB_ERR_TOO_DEEP",
-	[USB_ERR_ZERO_MAXP]		= "USB_ERR_ZERO_MAXP",
-	[USB_ERR_ZERO_NFRAMES]		= "USB_ERR_ZERO_NFRAMES",
+	[USB_ERR_INTERRUPTED]		= "USB_ERR_INTERRUPTED",
+	[USB_ERR_DMA_LOAD_FAILED]	= "USB_ERR_DMA_LOAD_FAILED",
+	[USB_ERR_BAD_CONTEXT]		= "USB_ERR_BAD_CONTEXT",
+	[USB_ERR_NO_ROOT_HUB]		= "USB_ERR_NO_ROOT_HUB",
+	[USB_ERR_NO_INTR_THREAD]	= "USB_ERR_NO_INTR_THREAD",
+	[USB_ERR_NOT_LOCKED]		= "USB_ERR_NOT_LOCKED",
 };
+
 /*------------------------------------------------------------------------*
  *	usb2_errstr
  *

Modified: head/sys/dev/usb2/quirk/usb2_quirk.c
==============================================================================
--- head/sys/dev/usb2/quirk/usb2_quirk.c	Tue Feb  3 15:27:29 2009	(r188075)
+++ head/sys/dev/usb2/quirk/usb2_quirk.c	Tue Feb  3 16:00:20 2009	(r188076)
@@ -113,30 +113,30 @@ static struct usb2_quirk_entry usb2_quir
 };
 
 static const char *usb_quirk_str[USB_QUIRK_MAX] = {
-	"UQ_NONE",
-	"UQ_AUDIO_SWAP_LR",	/* left and right sound channels are swapped */
-	"UQ_AU_INP_ASYNC",	/* input is async despite claim of adaptive */
-	"UQ_AU_NO_FRAC",	/* don't adjust for fractional samples */
-	"UQ_AU_NO_XU",		/* audio device has broken extension unit */
-	"UQ_BAD_ADC",		/* bad audio spec version number */
-	"UQ_BAD_AUDIO",		/* device claims audio class, but isn't */
-	"UQ_BROKEN_BIDIR",	/* printer has broken bidir mode */
-	"UQ_BUS_POWERED",	/* device is bus powered, despite claim */
-	"UQ_HID_IGNORE",	/* device should be ignored by hid class */
-	"UQ_KBD_IGNORE",	/* device should be ignored by kbd class */
-	"UQ_MS_BAD_CLASS",	/* doesn't identify properly */
-	"UQ_MS_LEADING_BYTE",	/* mouse sends an unknown leading byte */
-	"UQ_MS_REVZ",		/* mouse has Z-axis reversed */
-	"UQ_NO_STRINGS",	/* string descriptors are broken */
-	"UQ_OPEN_CLEARSTALL",	/* device needs clear endpoint stall */
-	"UQ_POWER_CLAIM",	/* hub lies about power status */
-	"UQ_SPUR_BUT_UP",	/* spurious mouse button up events */
-	"UQ_SWAP_UNICODE",	/* has some Unicode strings swapped */
-	"UQ_CFG_INDEX_1",	/* select configuration index 1 by default */
-	"UQ_CFG_INDEX_2",	/* select configuration index 2 by default */
-	"UQ_CFG_INDEX_3",	/* select configuration index 3 by default */
-	"UQ_CFG_INDEX_4",	/* select configuration index 4 by default */
-	"UQ_CFG_INDEX_0",	/* select configuration index 0 by default */
+	[UQ_NONE]		= "UQ_NONE",
+	[UQ_AUDIO_SWAP_LR]	= "UQ_AUDIO_SWAP_LR",
+	[UQ_AU_INP_ASYNC]	= "UQ_AU_INP_ASYNC",
+	[UQ_AU_NO_FRAC]		= "UQ_AU_NO_FRAC",
+	[UQ_AU_NO_XU]		= "UQ_AU_NO_XU",
+	[UQ_BAD_ADC]		= "UQ_BAD_ADC",
+	[UQ_BAD_AUDIO]		= "UQ_BAD_AUDIO",
+	[UQ_BROKEN_BIDIR]	= "UQ_BROKEN_BIDIR",
+	[UQ_BUS_POWERED]	= "UQ_BUS_POWERED",
+	[UQ_HID_IGNORE]		= "UQ_HID_IGNORE",
+	[UQ_KBD_IGNORE]		= "UQ_KBD_IGNORE",
+	[UQ_MS_BAD_CLASS]	= "UQ_MS_BAD_CLASS",
+	[UQ_MS_LEADING_BYTE]	= "UQ_MS_LEADING_BYTE",
+	[UQ_MS_REVZ]		= "UQ_MS_REVZ",
+	[UQ_NO_STRINGS]		= "UQ_NO_STRINGS",
+	[UQ_OPEN_CLEARSTALL]	= "UQ_OPEN_CLEARSTALL",
+	[UQ_POWER_CLAIM]	= "UQ_POWER_CLAIM",
+	[UQ_SPUR_BUT_UP]	= "UQ_SPUR_BUT_UP",
+	[UQ_SWAP_UNICODE]	= "UQ_SWAP_UNICODE",
+	[UQ_CFG_INDEX_1]	= "UQ_CFG_INDEX_1",
+	[UQ_CFG_INDEX_2]	= "UQ_CFG_INDEX_2",
+	[UQ_CFG_INDEX_3]	= "UQ_CFG_INDEX_3",
+	[UQ_CFG_INDEX_4]	= "UQ_CFG_INDEX_4",
+	[UQ_CFG_INDEX_0]	= "UQ_CFG_INDEX_0",
 };
 
 /*------------------------------------------------------------------------*

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 16:14:37 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BF75210656D6;
	Tue,  3 Feb 2009 16:14:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8F5948FC21;
	Tue,  3 Feb 2009 16:14:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13GEbvC034981;
	Tue, 3 Feb 2009 16:14:37 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13GEbAt034978;
	Tue, 3 Feb 2009 16:14:37 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200902031614.n13GEbAt034978@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Tue, 3 Feb 2009 16:14:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188077 - in head/sys/dev: ichsmb ipmi smbus
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 16:14:41 -0000

Author: jhb
Date: Tue Feb  3 16:14:37 2009
New Revision: 188077
URL: http://svn.freebsd.org/changeset/base/188077

Log:
  - Change ichsmb(4) to follow the format of all the other smbus controllers
    for slave addressing by using left-adjusted slave addresses (i.e.
    xxxxxxx0b).
  - Require the low bit of the slave address to always be zero in smb(4) to
    help catch broken applications.
  - Adjust some code in the IPMI driver to not convert the slave address for
    SSIF to a right-adjusted address.  I (or possibly ambrisko@) added this in
    the past to (unknowingly) work around the bug in ichsmb(4).
  
  Submitted by:	 Andriy Gapon <avg of icyb.net.ua> (1,2)
  MFC after:	1 month

Modified:
  head/sys/dev/ichsmb/ichsmb.c
  head/sys/dev/ipmi/ipmi_smbios.c
  head/sys/dev/smbus/smb.c

Modified: head/sys/dev/ichsmb/ichsmb.c
==============================================================================
--- head/sys/dev/ichsmb/ichsmb.c	Tue Feb  3 16:00:20 2009	(r188076)
+++ head/sys/dev/ichsmb/ichsmb.c	Tue Feb  3 16:14:37 2009	(r188077)
@@ -182,7 +182,7 @@ ichsmb_quick(device_t dev, u_char slave,
 		mtx_lock(&sc->mutex);
 		sc->ich_cmd = ICH_HST_CNT_SMB_CMD_QUICK;
 		bus_write_1(sc->io_res, ICH_XMIT_SLVA,
-		    (slave << 1) | (how == SMB_QREAD ?
+		    slave | (how == SMB_QREAD ?
 	    		ICH_XMIT_SLVA_READ : ICH_XMIT_SLVA_WRITE));
 		bus_write_1(sc->io_res, ICH_HST_CNT,
 		    ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
@@ -208,7 +208,7 @@ ichsmb_sendb(device_t dev, u_char slave,
 	mtx_lock(&sc->mutex);
 	sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE;
 	bus_write_1(sc->io_res, ICH_XMIT_SLVA,
-	    (slave << 1) | ICH_XMIT_SLVA_WRITE);
+	    slave | ICH_XMIT_SLVA_WRITE);
 	bus_write_1(sc->io_res, ICH_HST_CMD, byte);
 	bus_write_1(sc->io_res, ICH_HST_CNT,
 	    ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
@@ -230,7 +230,7 @@ ichsmb_recvb(device_t dev, u_char slave,
 	mtx_lock(&sc->mutex);
 	sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE;
 	bus_write_1(sc->io_res, ICH_XMIT_SLVA,
-	    (slave << 1) | ICH_XMIT_SLVA_READ);
+	    slave | ICH_XMIT_SLVA_READ);
 	bus_write_1(sc->io_res, ICH_HST_CNT,
 	    ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
 	if ((smb_error = ichsmb_wait(sc)) == SMB_ENOERR)
@@ -253,7 +253,7 @@ ichsmb_writeb(device_t dev, u_char slave
 	mtx_lock(&sc->mutex);
 	sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE_DATA;
 	bus_write_1(sc->io_res, ICH_XMIT_SLVA,
-	    (slave << 1) | ICH_XMIT_SLVA_WRITE);
+	    slave | ICH_XMIT_SLVA_WRITE);
 	bus_write_1(sc->io_res, ICH_HST_CMD, cmd);
 	bus_write_1(sc->io_res, ICH_D0, byte);
 	bus_write_1(sc->io_res, ICH_HST_CNT,
@@ -277,7 +277,7 @@ ichsmb_writew(device_t dev, u_char slave
 	mtx_lock(&sc->mutex);
 	sc->ich_cmd = ICH_HST_CNT_SMB_CMD_WORD_DATA;
 	bus_write_1(sc->io_res, ICH_XMIT_SLVA,
-	    (slave << 1) | ICH_XMIT_SLVA_WRITE);
+	    slave | ICH_XMIT_SLVA_WRITE);
 	bus_write_1(sc->io_res, ICH_HST_CMD, cmd);
 	bus_write_1(sc->io_res, ICH_D0, word & 0xff);
 	bus_write_1(sc->io_res, ICH_D1, word >> 8);
@@ -301,7 +301,7 @@ ichsmb_readb(device_t dev, u_char slave,
 	mtx_lock(&sc->mutex);
 	sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE_DATA;
 	bus_write_1(sc->io_res, ICH_XMIT_SLVA,
-	    (slave << 1) | ICH_XMIT_SLVA_READ);
+	    slave | ICH_XMIT_SLVA_READ);
 	bus_write_1(sc->io_res, ICH_HST_CMD, cmd);
 	bus_write_1(sc->io_res, ICH_HST_CNT,
 	    ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
@@ -324,7 +324,7 @@ ichsmb_readw(device_t dev, u_char slave,
 	mtx_lock(&sc->mutex);
 	sc->ich_cmd = ICH_HST_CNT_SMB_CMD_WORD_DATA;
 	bus_write_1(sc->io_res, ICH_XMIT_SLVA,
-	    (slave << 1) | ICH_XMIT_SLVA_READ);
+	    slave | ICH_XMIT_SLVA_READ);
 	bus_write_1(sc->io_res, ICH_HST_CMD, cmd);
 	bus_write_1(sc->io_res, ICH_HST_CNT,
 	    ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
@@ -352,7 +352,7 @@ ichsmb_pcall(device_t dev, u_char slave,
 	mtx_lock(&sc->mutex);
 	sc->ich_cmd = ICH_HST_CNT_SMB_CMD_PROC_CALL;
 	bus_write_1(sc->io_res, ICH_XMIT_SLVA,
-	    (slave << 1) | ICH_XMIT_SLVA_WRITE);
+	    slave | ICH_XMIT_SLVA_WRITE);
 	bus_write_1(sc->io_res, ICH_HST_CMD, cmd);
 	bus_write_1(sc->io_res, ICH_D0, sdata & 0xff);
 	bus_write_1(sc->io_res, ICH_D1, sdata >> 8);
@@ -403,7 +403,7 @@ ichsmb_bwrite(device_t dev, u_char slave
 	mtx_lock(&sc->mutex);
 	sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BLOCK;
 	bus_write_1(sc->io_res, ICH_XMIT_SLVA,
-	    (slave << 1) | ICH_XMIT_SLVA_WRITE);
+	    slave | ICH_XMIT_SLVA_WRITE);
 	bus_write_1(sc->io_res, ICH_HST_CMD, cmd);
 	bus_write_1(sc->io_res, ICH_D0, count);
 	bus_write_1(sc->io_res, ICH_BLOCK_DB, buf[0]);
@@ -434,7 +434,7 @@ ichsmb_bread(device_t dev, u_char slave,
 	mtx_lock(&sc->mutex);
 	sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BLOCK;
 	bus_write_1(sc->io_res, ICH_XMIT_SLVA,
-	    (slave << 1) | ICH_XMIT_SLVA_READ);
+	    slave | ICH_XMIT_SLVA_READ);
 	bus_write_1(sc->io_res, ICH_HST_CMD, cmd);
 	bus_write_1(sc->io_res, ICH_D0, *count); /* XXX? */
 	bus_write_1(sc->io_res, ICH_HST_CNT,

Modified: head/sys/dev/ipmi/ipmi_smbios.c
==============================================================================
--- head/sys/dev/ipmi/ipmi_smbios.c	Tue Feb  3 16:00:20 2009	(r188076)
+++ head/sys/dev/ipmi/ipmi_smbios.c	Tue Feb  3 16:14:37 2009	(r188077)
@@ -154,10 +154,10 @@ smbios_t38_proc_info(uint8_t *p, char **
 	case SSIF_MODE:
 		if ((s->base_address & 0xffffffffffffff00) != 0) {
 			printf("SMBIOS: Invalid SSIF SMBus address, using BMC I2C slave address instead\n");
-			info->address = s->i2c_slave_address >> 1;
+			info->address = s->i2c_slave_address;
 			break;
 		}
-		info->address = IPMI_BAR_ADDR(s->base_address) >> 1;
+		info->address = IPMI_BAR_ADDR(s->base_address);
 		break;
 	default:
 		return;

Modified: head/sys/dev/smbus/smb.c
==============================================================================
--- head/sys/dev/smbus/smb.c	Tue Feb  3 16:00:20 2009	(r188076)
+++ head/sys/dev/smbus/smb.c	Tue Feb  3 16:14:37 2009	(r188077)
@@ -180,6 +180,10 @@ smbioctl(struct cdev *dev, u_long cmd, c
 
 	parent = device_get_parent(smbdev);
 
+	/* Make sure that LSB bit is cleared. */
+	if (s->slave & 0x1)
+		return (EINVAL);
+
 	/* Allocate the bus. */
 	if ((error = smbus_request_bus(parent, smbdev,
 			(flags & O_NONBLOCK) ? SMB_DONTWAIT : (SMB_WAIT | SMB_INTR))))

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 16:39:51 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E96401065673;
	Tue,  3 Feb 2009 16:39:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D891C8FC14;
	Tue,  3 Feb 2009 16:39:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13Gdpie035503;
	Tue, 3 Feb 2009 16:39:51 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13GdpCK035502;
	Tue, 3 Feb 2009 16:39:51 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200902031639.n13GdpCK035502@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Tue, 3 Feb 2009 16:39:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188078 - head/sys/dev/ipmi
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 16:39:52 -0000

Author: jhb
Date: Tue Feb  3 16:39:51 2009
New Revision: 188078
URL: http://svn.freebsd.org/changeset/base/188078

Log:
  Don't right-adjust the SMBus slave address for SSIF IPMI BMCs enumerated
  via ACPI either.  This is somewhat academic since we don't currently
  support such devices though.

Modified:
  head/sys/dev/ipmi/ipmi_acpi.c

Modified: head/sys/dev/ipmi/ipmi_acpi.c
==============================================================================
--- head/sys/dev/ipmi/ipmi_acpi.c	Tue Feb  3 16:14:37 2009	(r188077)
+++ head/sys/dev/ipmi/ipmi_acpi.c	Tue Feb  3 16:39:51 2009	(r188078)
@@ -104,7 +104,7 @@ ipmi_acpi_attach(device_t dev)
 	case SSIF_MODE:
 		if (ACPI_FAILURE(acpi_GetInteger(devh, "_ADR", &flags)))
 			return (ENXIO);
-		info.address = flags >> 1;
+		info.address = flags;
 		device_printf(dev, "SSIF interface not supported on ACPI\n");
 		return (0);
 	default:

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 16:45:23 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 472281065672;
	Tue,  3 Feb 2009 16:45:23 +0000 (UTC)
	(envelope-from gavin@FreeBSD.org)
Received: from mail-gw0.york.ac.uk (mail-gw0.york.ac.uk [144.32.128.245])
	by mx1.freebsd.org (Postfix) with ESMTP id B074A8FC0A;
	Tue,  3 Feb 2009 16:45:22 +0000 (UTC)
	(envelope-from gavin@FreeBSD.org)
Received: from mail-gw7.york.ac.uk (mail-gw7.york.ac.uk [144.32.129.30])
	by mail-gw0.york.ac.uk (8.13.6/8.13.6) with ESMTP id n13GjGof029126;
	Tue, 3 Feb 2009 16:45:16 GMT
Received: from buffy-128.york.ac.uk ([144.32.128.160] helo=buffy.york.ac.uk)
	by mail-gw7.york.ac.uk with esmtps (TLSv1:AES256-SHA:256) (Exim 4.68)
	(envelope-from <gavin@FreeBSD.org>)
	id 1LUOOh-0003GR-VB; Tue, 03 Feb 2009 16:45:15 +0000
Received: from buffy.york.ac.uk (localhost [127.0.0.1])
	by buffy.york.ac.uk (8.14.2/8.14.2) with ESMTP id n13GjFl6079343;
	Tue, 3 Feb 2009 16:45:15 GMT (envelope-from gavin@FreeBSD.org)
Received: (from ga9@localhost)
	by buffy.york.ac.uk (8.14.2/8.14.2/Submit) id n13GjFbZ079342;
	Tue, 3 Feb 2009 16:45:15 GMT (envelope-from gavin@FreeBSD.org)
X-Authentication-Warning: buffy.york.ac.uk: ga9 set sender to
	gavin@FreeBSD.org using -f
From: Gavin Atkinson <gavin@FreeBSD.org>
To: John Baldwin <jhb@FreeBSD.org>
In-Reply-To: <200902031614.n13GEbAt034978@svn.freebsd.org>
References: <200902031614.n13GEbAt034978@svn.freebsd.org>
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Date: Tue, 03 Feb 2009 16:45:15 +0000
Message-Id: <1233679515.51684.60.camel@buffy.york.ac.uk>
Mime-Version: 1.0
X-Mailer: Evolution 2.22.2 FreeBSD GNOME Team Port 
X-York-MailScanner: Found to be clean
X-York-MailScanner-From: gavin@freebsd.org
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r188077 - in head/sys/dev: ichsmb ipmi smbus
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 16:45:23 -0000

On Tue, 2009-02-03 at 16:14 +0000, John Baldwin wrote:
> Author: jhb
> Date: Tue Feb  3 16:14:37 2009
> New Revision: 188077
> URL: http://svn.freebsd.org/changeset/base/188077
> 
> Log:
>   - Change ichsmb(4) to follow the format of all the other smbus controllers
>     for slave addressing by using left-adjusted slave addresses (i.e.
>     xxxxxxx0b).

Thank you!  This is kern/100513 (although the PR believed that ichsmb
was the correct one, not the one at fault).

>From my experience, the way FreeBSD now do it seems to be the "more
standard" way, in that I2C datasheets usually give the xxxxxxx0b address
as the device address, however NetBSD (at least) seems to use the
address in the MSB=0 form.  I suspect this is probably worth documenting
explicitly somewhere.

Gavin

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 17:13:38 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4DE381065673;
	Tue,  3 Feb 2009 17:13:38 +0000 (UTC)
	(envelope-from sbruno@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3CA6B8FC1F;
	Tue,  3 Feb 2009 17:13:38 +0000 (UTC)
	(envelope-from sbruno@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13HDcH1036260;
	Tue, 3 Feb 2009 17:13:38 GMT (envelope-from sbruno@svn.freebsd.org)
Received: (from sbruno@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13HDcB9036259;
	Tue, 3 Feb 2009 17:13:38 GMT (envelope-from sbruno@svn.freebsd.org)
Message-Id: <200902031713.n13HDcB9036259@svn.freebsd.org>
From: Sean Bruno <sbruno@FreeBSD.org>
Date: Tue, 3 Feb 2009 17:13:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188079 - head/sys/dev/firewire
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 17:13:38 -0000

Author: sbruno
Date: Tue Feb  3 17:13:37 2009
New Revision: 188079
URL: http://svn.freebsd.org/changeset/base/188079

Log:
  Delete fwohci_filt() as it is now unused
  
  Obtained from:	Marius Strobl <marius@alchemy.franken.de>
  MFC after:	2 weeks

Modified:
  head/sys/dev/firewire/fwohcivar.h

Modified: head/sys/dev/firewire/fwohcivar.h
==============================================================================
--- head/sys/dev/firewire/fwohcivar.h	Tue Feb  3 16:39:51 2009	(r188078)
+++ head/sys/dev/firewire/fwohcivar.h	Tue Feb  3 17:13:37 2009	(r188079)
@@ -78,7 +78,6 @@ typedef struct fwohci_softc {
 } fwohci_softc_t;
 
 void fwohci_intr (void *arg);
-void fwohci_filt (void *arg);
 int fwohci_init (struct fwohci_softc *, device_t);
 void fwohci_poll (struct firewire_comm *, int, int);
 void fwohci_reset (struct fwohci_softc *, device_t);

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 17:58:21 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AA852106564A;
	Tue,  3 Feb 2009 17:58:21 +0000 (UTC)
	(envelope-from danger@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 978CD8FC20;
	Tue,  3 Feb 2009 17:58:21 +0000 (UTC)
	(envelope-from danger@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13HwLNp037178;
	Tue, 3 Feb 2009 17:58:21 GMT (envelope-from danger@svn.freebsd.org)
Received: (from danger@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13HwKHT037144;
	Tue, 3 Feb 2009 17:58:20 GMT (envelope-from danger@svn.freebsd.org)
Message-Id: <200902031758.n13HwKHT037144@svn.freebsd.org>
From: Daniel Gerzo <danger@FreeBSD.org>
Date: Tue, 3 Feb 2009 17:58:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188080 - head/lib/libc/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 17:58:22 -0000

Author: danger (doc committer)
Date: Tue Feb  3 17:58:20 2009
New Revision: 188080
URL: http://svn.freebsd.org/changeset/base/188080

Log:
  - ANSIfy function definitions
  - use nul when we are looking for a terminating character where appropriate
  
  Approved by:	imp

Modified:
  head/lib/libc/string/memccpy.c
  head/lib/libc/string/memchr.c
  head/lib/libc/string/memcmp.c
  head/lib/libc/string/memmem.c
  head/lib/libc/string/strcasecmp.c
  head/lib/libc/string/strcasestr.c
  head/lib/libc/string/strcmp.c
  head/lib/libc/string/strcoll.c
  head/lib/libc/string/strdup.c
  head/lib/libc/string/strmode.c
  head/lib/libc/string/strncmp.c
  head/lib/libc/string/strncpy.c
  head/lib/libc/string/strnstr.c
  head/lib/libc/string/strpbrk.c
  head/lib/libc/string/strsep.c
  head/lib/libc/string/strstr.c
  head/lib/libc/string/wcscat.c
  head/lib/libc/string/wcscmp.c
  head/lib/libc/string/wcscpy.c
  head/lib/libc/string/wcscspn.c
  head/lib/libc/string/wcslcat.c
  head/lib/libc/string/wcslcpy.c
  head/lib/libc/string/wcslen.c
  head/lib/libc/string/wcsncat.c
  head/lib/libc/string/wcsncmp.c
  head/lib/libc/string/wcspbrk.c
  head/lib/libc/string/wcsspn.c
  head/lib/libc/string/wcsstr.c
  head/lib/libc/string/wmemchr.c
  head/lib/libc/string/wmemcmp.c
  head/lib/libc/string/wmemcpy.c
  head/lib/libc/string/wmemmove.c
  head/lib/libc/string/wmemset.c

Modified: head/lib/libc/string/memccpy.c
==============================================================================
--- head/lib/libc/string/memccpy.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/memccpy.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -36,11 +36,7 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 
 void *
-memccpy(t, f, c, n)
-	void *t;
-	const void *f;
-	int c;
-	size_t n;
+memccpy(void *t, const void *f, int c, size_t n)
 {
 
 	if (n) {

Modified: head/lib/libc/string/memchr.c
==============================================================================
--- head/lib/libc/string/memchr.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/memchr.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -39,10 +39,7 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 
 void *
-memchr(s, c, n)
-	const void *s;
-	unsigned char c;
-	size_t n;
+memchr(const void *s, unsigned char c, size_t n)
 {
 	if (n != 0) {
 		const unsigned char *p = s;

Modified: head/lib/libc/string/memcmp.c
==============================================================================
--- head/lib/libc/string/memcmp.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/memcmp.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -42,9 +42,7 @@ __FBSDID("$FreeBSD$");
  * Compare memory regions.
  */
 int
-memcmp(s1, s2, n)
-	const void *s1, *s2;
-	size_t n;
+memcmp(const void *s1, const void *s2, size_t n)
 {
 	if (n != 0) {
 		const unsigned char *p1 = s1, *p2 = s2;

Modified: head/lib/libc/string/memmem.c
==============================================================================
--- head/lib/libc/string/memmem.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/memmem.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -36,9 +36,7 @@ __FBSDID("$FreeBSD$");
  */
 
 void *
-memmem(l, l_len, s, s_len)
-	const void *l; size_t l_len;
-	const void *s; size_t s_len;
+memmem(const void *l, size_t l_len, const void *s, size_t s_len)
 {
 	register char *cur, *last;
 	const char *cl = (const char *)l;

Modified: head/lib/libc/string/strcasecmp.c
==============================================================================
--- head/lib/libc/string/strcasecmp.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/strcasecmp.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -39,8 +39,7 @@ __FBSDID("$FreeBSD$");
 typedef unsigned char u_char;
 
 int
-strcasecmp(s1, s2)
-	const char *s1, *s2;
+strcasecmp(const char *s1, const char *s2)
 {
 	const u_char
 			*us1 = (const u_char *)s1,
@@ -53,9 +52,7 @@ strcasecmp(s1, s2)
 }
 
 int
-strncasecmp(s1, s2, n)
-	const char *s1, *s2;
-	size_t n;
+strncasecmp(const char *s1, const char *s2, size_t n)
 {
 	if (n != 0) {
 		const u_char

Modified: head/lib/libc/string/strcasestr.c
==============================================================================
--- head/lib/libc/string/strcasestr.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/strcasestr.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -40,8 +40,7 @@ __FBSDID("$FreeBSD$");
  * Find the first occurrence of find in s, ignore case.
  */
 char *
-strcasestr(s, find)
-	const char *s, *find;
+strcasestr(const char *s, const char *find)
 {
 	char c, sc;
 	size_t len;

Modified: head/lib/libc/string/strcmp.c
==============================================================================
--- head/lib/libc/string/strcmp.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/strcmp.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -42,11 +42,10 @@ __FBSDID("$FreeBSD$");
  * Compare strings.
  */
 int
-strcmp(s1, s2)
-	const char *s1, *s2;
+strcmp(const char *s1, const char *s2)
 {
 	while (*s1 == *s2++)
-		if (*s1++ == 0)
+		if (*s1++ == '\0')
 			return (0);
 	return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1));
 }

Modified: head/lib/libc/string/strcoll.c
==============================================================================
--- head/lib/libc/string/strcoll.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/strcoll.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -33,8 +33,7 @@ __FBSDID("$FreeBSD$");
 #include "collate.h"
 
 int
-strcoll(s, s2)
-	const char *s, *s2;
+strcoll(const char *s, const char *s2)
 {
 	int len, len2, prim, prim2, sec, sec2, ret, ret2;
 	const char *t, *t2;

Modified: head/lib/libc/string/strdup.c
==============================================================================
--- head/lib/libc/string/strdup.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/strdup.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -38,8 +38,7 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 
 char *
-strdup(str)
-	const char *str;
+strdup(const char *str)
 {
 	size_t len;
 	char *copy;

Modified: head/lib/libc/string/strmode.c
==============================================================================
--- head/lib/libc/string/strmode.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/strmode.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -38,9 +38,7 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 
 void
-strmode(mode, p)
-	mode_t mode;
-	char *p;
+strmode(mode_t mode, char *p)
 {
 	 /* print type */
 	switch (mode & S_IFMT) {

Modified: head/lib/libc/string/strncmp.c
==============================================================================
--- head/lib/libc/string/strncmp.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/strncmp.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -36,9 +36,7 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 
 int
-strncmp(s1, s2, n)
-	const char *s1, *s2;
-	size_t n;
+strncmp(const char *s1, const char *s2, size_t n)
 {
 
 	if (n == 0)
@@ -47,7 +45,7 @@ strncmp(s1, s2, n)
 		if (*s1 != *s2++)
 			return (*(const unsigned char *)s1 -
 				*(const unsigned char *)(s2 - 1));
-		if (*s1++ == 0)
+		if (*s1++ == '\0')
 			break;
 	} while (--n != 0);
 	return (0);

Modified: head/lib/libc/string/strncpy.c
==============================================================================
--- head/lib/libc/string/strncpy.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/strncpy.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -50,10 +50,10 @@ strncpy(char * __restrict dst, const cha
 		const char *s = src;
 
 		do {
-			if ((*d++ = *s++) == 0) {
+			if ((*d++ = *s++) == '\0') {
 				/* NUL pad the remaining n-1 bytes */
 				while (--n != 0)
-					*d++ = 0;
+					*d++ = '\0';
 				break;
 			}
 		} while (--n != 0);

Modified: head/lib/libc/string/strnstr.c
==============================================================================
--- head/lib/libc/string/strnstr.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/strnstr.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -44,10 +44,7 @@ __FBSDID("$FreeBSD$");
  * first slen characters of s.
  */
 char *
-strnstr(s, find, slen)
-	const char *s;
-	const char *find;
-	size_t slen;
+strnstr(const char *s, const char *find, size_t slen)
 {
 	char c, sc;
 	size_t len;

Modified: head/lib/libc/string/strpbrk.c
==============================================================================
--- head/lib/libc/string/strpbrk.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/strpbrk.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -39,14 +39,13 @@ __FBSDID("$FreeBSD$");
  * Find the first occurrence in s1 of a character in s2 (excluding NUL).
  */
 char *
-strpbrk(s1, s2)
-	const char *s1, *s2;
+strpbrk(const char *s1, const char *s2)
 {
 	const char *scanp;
 	int c, sc;
 
 	while ((c = *s1++) != 0) {
-		for (scanp = s2; (sc = *scanp++) != 0;)
+		for (scanp = s2; (sc = *scanp++) != '\0';)
 			if (sc == c)
 				return ((char *)(s1 - 1));
 	}

Modified: head/lib/libc/string/strsep.c
==============================================================================
--- head/lib/libc/string/strsep.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/strsep.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -48,9 +48,7 @@ __FBSDID("$FreeBSD$");
  * If *stringp is NULL, strsep returns NULL.
  */
 char *
-strsep(stringp, delim)
-	char **stringp;
-	const char *delim;
+strsep(char **stringp, const char *delim)
 {
 	char *s;
 	const char *spanp;

Modified: head/lib/libc/string/strstr.c
==============================================================================
--- head/lib/libc/string/strstr.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/strstr.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -42,17 +42,16 @@ __FBSDID("$FreeBSD$");
  * Find the first occurrence of find in s.
  */
 char *
-strstr(s, find)
-	const char *s, *find;
+strstr(const char *s, const char *find)
 {
 	char c, sc;
 	size_t len;
 
-	if ((c = *find++) != 0) {
+	if ((c = *find++) != '\0') {
 		len = strlen(find);
 		do {
 			do {
-				if ((sc = *s++) == 0)
+				if ((sc = *s++) == '\0')
 					return (NULL);
 			} while (sc != c);
 		} while (strncmp(s, find, len) != 0);

Modified: head/lib/libc/string/wcscat.c
==============================================================================
--- head/lib/libc/string/wcscat.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/wcscat.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -37,9 +37,7 @@ __FBSDID("$FreeBSD$");
 #include <wchar.h>
 
 wchar_t *
-wcscat(s1, s2)
-	wchar_t * __restrict s1;
-	const wchar_t * __restrict s2;
+wcscat(wchar_t * __restrict s1, const wchar_t * __restrict s2)
 {
 	wchar_t *cp;
 

Modified: head/lib/libc/string/wcscmp.c
==============================================================================
--- head/lib/libc/string/wcscmp.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/wcscmp.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -45,12 +45,11 @@ __FBSDID("$FreeBSD$");
  * Compare strings.
  */
 int
-wcscmp(s1, s2)
-	const wchar_t *s1, *s2;
+wcscmp(const wchar_t *s1, const wchar_t *s2)
 {
 
 	while (*s1 == *s2++)
-		if (*s1++ == 0)
+		if (*s1++ == '\0')
 			return (0);
 	/* XXX assumes wchar_t = int */
 	return (*(const unsigned int *)s1 - *(const unsigned int *)--s2);

Modified: head/lib/libc/string/wcscpy.c
==============================================================================
--- head/lib/libc/string/wcscpy.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/wcscpy.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -37,9 +37,7 @@ __FBSDID("$FreeBSD$");
 #include <wchar.h>
 
 wchar_t *
-wcscpy(s1, s2)
-	wchar_t * __restrict s1;
-	const wchar_t * __restrict s2;
+wcscpy(wchar_t * __restrict s1, const wchar_t * __restrict s2)
 {
 	wchar_t *cp;
 

Modified: head/lib/libc/string/wcscspn.c
==============================================================================
--- head/lib/libc/string/wcscspn.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/wcscspn.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -37,9 +37,7 @@ __FBSDID("$FreeBSD$");
 #include <wchar.h>
 
 size_t
-wcscspn(s, set)
-	const wchar_t *s;
-	const wchar_t *set;
+wcscspn(const wchar_t *s, const wchar_t *set)
 {
 	const wchar_t *p;
 	const wchar_t *q;

Modified: head/lib/libc/string/wcslcat.c
==============================================================================
--- head/lib/libc/string/wcslcat.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/wcslcat.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -46,10 +46,7 @@ __FBSDID("$FreeBSD$");
  * truncation occurred.
  */
 size_t
-wcslcat(dst, src, siz)
-	wchar_t *dst;
-	const wchar_t *src;
-	size_t siz;
+wcslcat(wchar_t *dst, const wchar_t *src, size_t siz)
 {
 	wchar_t *d = dst;
 	const wchar_t *s = src;

Modified: head/lib/libc/string/wcslcpy.c
==============================================================================
--- head/lib/libc/string/wcslcpy.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/wcslcpy.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -44,10 +44,7 @@ __FBSDID("$FreeBSD$");
  * Returns wcslen(src); if retval >= siz, truncation occurred.
  */
 size_t
-wcslcpy(dst, src, siz)
-	wchar_t *dst;
-	const wchar_t *src;
-	size_t siz;
+wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
 {
 	wchar_t *d = dst;
 	const wchar_t *s = src;

Modified: head/lib/libc/string/wcslen.c
==============================================================================
--- head/lib/libc/string/wcslen.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/wcslen.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -37,8 +37,7 @@ __FBSDID("$FreeBSD$");
 #include <wchar.h>
 
 size_t
-wcslen(s)
-	const wchar_t *s;
+wcslen(const wchar_t *s)
 {
 	const wchar_t *p;
 

Modified: head/lib/libc/string/wcsncat.c
==============================================================================
--- head/lib/libc/string/wcsncat.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/wcsncat.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -37,10 +37,7 @@ __FBSDID("$FreeBSD$");
 #include <wchar.h>
 
 wchar_t *
-wcsncat(s1, s2, n)
-	wchar_t * __restrict s1;
-	const wchar_t * __restrict s2;
-	size_t n;
+wcsncat(wchar_t * __restrict s1, const wchar_t * __restrict s2, size_t n)
 {
 	wchar_t *p;
 	wchar_t *q;

Modified: head/lib/libc/string/wcsncmp.c
==============================================================================
--- head/lib/libc/string/wcsncmp.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/wcsncmp.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -39,9 +39,7 @@ __FBSDID("$FreeBSD$");
 #include <wchar.h>
 
 int
-wcsncmp(s1, s2, n)
-	const wchar_t *s1, *s2;
-	size_t n;
+wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n)
 {
 
 	if (n == 0)

Modified: head/lib/libc/string/wcspbrk.c
==============================================================================
--- head/lib/libc/string/wcspbrk.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/wcspbrk.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -37,9 +37,7 @@ __FBSDID("$FreeBSD$");
 #include <wchar.h>
 
 wchar_t *
-wcspbrk(s, set)
-	const wchar_t *s;
-	const wchar_t *set;
+wcspbrk(const wchar_t *s, const wchar_t *set)
 {
 	const wchar_t *p;
 	const wchar_t *q;

Modified: head/lib/libc/string/wcsspn.c
==============================================================================
--- head/lib/libc/string/wcsspn.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/wcsspn.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -37,9 +37,7 @@ __FBSDID("$FreeBSD$");
 #include <wchar.h>
 
 size_t
-wcsspn(s, set)
-	const wchar_t *s;
-	const wchar_t *set;
+wcsspn(const wchar_t *s, const wchar_t *set)
 {
 	const wchar_t *p;
 	const wchar_t *q;

Modified: head/lib/libc/string/wcsstr.c
==============================================================================
--- head/lib/libc/string/wcsstr.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/wcsstr.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -49,7 +49,7 @@ wcsstr(const wchar_t * __restrict s, con
 	wchar_t c, sc;
 	size_t len;
 
-	if ((c = *find++) != 0) {
+	if ((c = *find++) != L'\0') {
 		len = wcslen(find);
 		do {
 			do {

Modified: head/lib/libc/string/wmemchr.c
==============================================================================
--- head/lib/libc/string/wmemchr.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/wmemchr.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -37,10 +37,7 @@ __FBSDID("$FreeBSD$");
 #include <wchar.h>
 
 wchar_t	*
-wmemchr(s, c, n)
-	const wchar_t *s;
-	wchar_t c;
-	size_t n;
+wmemchr(const wchar_t *s, wchar_t c, size_t n)
 {
 	size_t i;
 

Modified: head/lib/libc/string/wmemcmp.c
==============================================================================
--- head/lib/libc/string/wmemcmp.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/wmemcmp.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -37,10 +37,7 @@ __FBSDID("$FreeBSD$");
 #include <wchar.h>
 
 int
-wmemcmp(s1, s2, n)
-	const wchar_t *s1;
-	const wchar_t *s2;
-	size_t n;
+wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n)
 {
 	size_t i;
 

Modified: head/lib/libc/string/wmemcpy.c
==============================================================================
--- head/lib/libc/string/wmemcpy.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/wmemcpy.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -38,11 +38,7 @@ __FBSDID("$FreeBSD$");
 #include <wchar.h>
 
 wchar_t *
-wmemcpy(d, s, n)
-	wchar_t * __restrict d;
-	const wchar_t * __restrict s;
-	size_t n;
+wmemcpy(wchar_t * __restrict d, const wchar_t * __restrict s, size_t n)
 {
-
 	return (wchar_t *)memcpy(d, s, n * sizeof(wchar_t));
 }

Modified: head/lib/libc/string/wmemmove.c
==============================================================================
--- head/lib/libc/string/wmemmove.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/wmemmove.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -38,11 +38,7 @@ __FBSDID("$FreeBSD$");
 #include <wchar.h>
 
 wchar_t *
-wmemmove(d, s, n)
-	wchar_t *d;
-	const wchar_t *s;
-	size_t n;
+wmemmove(wchar_t *d, const wchar_t *s, size_t n)
 {
-
 	return (wchar_t *)memmove(d, s, n * sizeof(wchar_t));
 }

Modified: head/lib/libc/string/wmemset.c
==============================================================================
--- head/lib/libc/string/wmemset.c	Tue Feb  3 17:13:37 2009	(r188079)
+++ head/lib/libc/string/wmemset.c	Tue Feb  3 17:58:20 2009	(r188080)
@@ -37,10 +37,7 @@ __FBSDID("$FreeBSD$");
 #include <wchar.h>
 
 wchar_t	*
-wmemset(s, c, n)
-	wchar_t *s;
-	wchar_t c;
-	size_t n;
+wmemset(wchar_t *s, wchar_t *c, size_t n)
 {
 	size_t i;
 	wchar_t *p;

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 19:00:57 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A137D1065673;
	Tue,  3 Feb 2009 19:00:57 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4CC178FC13;
	Tue,  3 Feb 2009 19:00:57 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13J0viY038651;
	Tue, 3 Feb 2009 19:00:57 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13J0vl1038649;
	Tue, 3 Feb 2009 19:00:57 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902031900.n13J0vl1038649@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Tue, 3 Feb 2009 19:00:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188084 - in head/sys/dev/ath/ath_hal: . ar5416
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 19:00:58 -0000

Author: sam
Date: Tue Feb  3 19:00:56 2009
New Revision: 188084
URL: http://svn.freebsd.org/changeset/base/188084

Log:
  fix compilation w/ AH_DEBUG

Modified:
  head/sys/dev/ath/ath_hal/ah_regdomain.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c

Modified: head/sys/dev/ath/ath_hal/ah_regdomain.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_regdomain.c	Tue Feb  3 18:52:53 2009	(r188083)
+++ head/sys/dev/ath/ath_hal/ah_regdomain.c	Tue Feb  3 19:00:56 2009	(r188084)
@@ -2219,7 +2219,7 @@ assignPrivateChannels(struct ath_hal *ah
 			/* new entry, assign a private channel entry */
 			if (next >= N(AH_PRIVATE(ah)->ah_channels)) {
 				HALDEBUG(ah, HAL_DEBUG_ANY,
-				    "%s: too many channels, max %u\n",
+				    "%s: too many channels, max %zu\n",
 				    __func__, N(AH_PRIVATE(ah)->ah_channels));
 				return AH_FALSE;
 			}

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Tue Feb  3 18:52:53 2009	(r188083)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Tue Feb  3 19:00:56 2009	(r188084)
@@ -392,7 +392,7 @@ ar5416PerCalibrationN(struct ath_hal *ah
 	HAL_CAL_LIST *currCal = cal->cal_curr;
 	HAL_CHANNEL_INTERNAL *ichan;
 
-	OS_MARK(ah, AH_MARK_PERCAL, chan->channel);
+	OS_MARK(ah, AH_MARK_PERCAL, chan->ic_freq);
 
 	*isCalDone = AH_TRUE;
 

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 19:06:12 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 85BA51065687;
	Tue,  3 Feb 2009 19:06:12 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 740A38FC2C;
	Tue,  3 Feb 2009 19:06:12 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13J6CWI038789;
	Tue, 3 Feb 2009 19:06:12 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13J6CYC038788;
	Tue, 3 Feb 2009 19:06:12 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902031906.n13J6CYC038788@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Tue, 3 Feb 2009 19:06:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188085 - head/sys/arm/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 19:06:13 -0000

Author: sam
Date: Tue Feb  3 19:06:12 2009
New Revision: 188085
URL: http://svn.freebsd.org/changeset/base/188085

Log:
  force atomic_cmpset_ptr types to match atomic_cmpset_32;
  this matches what powerpc does
  
  Submitted by:	stass
  MFC after:	2 weeks

Modified:
  head/sys/arm/include/atomic.h

Modified: head/sys/arm/include/atomic.h
==============================================================================
--- head/sys/arm/include/atomic.h	Tue Feb  3 19:00:56 2009	(r188084)
+++ head/sys/arm/include/atomic.h	Tue Feb  3 19:06:12 2009	(r188085)
@@ -344,7 +344,8 @@ atomic_readandclear_32(volatile u_int32_
 
 #define atomic_clear_ptr		atomic_clear_32
 #define atomic_set_ptr			atomic_set_32
-#define atomic_cmpset_ptr		atomic_cmpset_32
+#define	atomic_cmpset_ptr(dst, old, new)	\
+    atomic_cmpset_32((volatile u_int *)(dst), (u_int)(old), (u_int)(new))
 #define atomic_cmpset_rel_ptr		atomic_cmpset_ptr
 #define atomic_cmpset_acq_ptr		atomic_cmpset_ptr
 #define atomic_store_ptr		atomic_store_32

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 19:07:41 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 81FB21065670;
	Tue,  3 Feb 2009 19:07:41 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 706E48FC08;
	Tue,  3 Feb 2009 19:07:41 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13J7fp0038856;
	Tue, 3 Feb 2009 19:07:41 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13J7f2f038855;
	Tue, 3 Feb 2009 19:07:41 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902031907.n13J7f2f038855@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Tue, 3 Feb 2009 19:07:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188086 - head/sys/dev/cfi
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 19:07:42 -0000

Author: sam
Date: Tue Feb  3 19:07:41 2009
New Revision: 188086
URL: http://svn.freebsd.org/changeset/base/188086

Log:
  reorg ioctl code to simplify adding new requests

Modified:
  head/sys/dev/cfi/cfi_dev.c

Modified: head/sys/dev/cfi/cfi_dev.c
==============================================================================
--- head/sys/dev/cfi/cfi_dev.c	Tue Feb  3 19:06:12 2009	(r188085)
+++ head/sys/dev/cfi/cfi_dev.c	Tue Feb  3 19:07:41 2009	(r188086)
@@ -252,26 +252,31 @@ cfi_devioctl(struct cdev *dev, u_long cm
 	int error;
 	u_char val;
 
-	if (cmd != CFIOCQRY)
-		return (ENOIOCTL);
-
 	sc = dev->si_drv1;
+	error = 0;
 
-	error = (sc->sc_writing) ? cfi_block_finish(sc) : 0;
-	if (error)
-		return (error);
-
-	rq = (struct cfiocqry *)data;
-
-	if (rq->offset >= sc->sc_size / sc->sc_width)
-		return (ESPIPE);
-	if (rq->offset + rq->count > sc->sc_size / sc->sc_width)
-		return (ENOSPC);
-
-	while (!error && rq->count--) {
-		val = cfi_read_qry(sc, rq->offset++);
-		error = copyout(&val, rq->buffer++, 1);
+	switch(cmd) {
+	case CFIOCQRY:
+		if (sc->sc_writing) {
+			error = cfi_block_finish(sc);
+			if (error)
+				break;
+		}
+
+		rq = (struct cfiocqry *)data;
+		if (rq->offset >= sc->sc_size / sc->sc_width)
+			return (ESPIPE);
+		if (rq->offset + rq->count > sc->sc_size / sc->sc_width)
+			return (ENOSPC);
+
+		while (!error && rq->count--) {
+			val = cfi_read_qry(sc, rq->offset++);
+			error = copyout(&val, rq->buffer++, 1);
+		}
+		break;
+	default:
+		error = ENOIOCTL;
+		break;
 	}
-
 	return (error);
 }

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 19:09:16 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 953E4106564A;
	Tue,  3 Feb 2009 19:09:16 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 837D78FC08;
	Tue,  3 Feb 2009 19:09:16 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13J9GC5038924;
	Tue, 3 Feb 2009 19:09:16 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13J9GFf038922;
	Tue, 3 Feb 2009 19:09:16 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902031909.n13J9GFf038922@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Tue, 3 Feb 2009 19:09:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188087 - head/sys/dev/cfi
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 19:09:17 -0000

Author: sam
Date: Tue Feb  3 19:09:16 2009
New Revision: 188087
URL: http://svn.freebsd.org/changeset/base/188087

Log:
  honor any interface width (e.g. setup by the bus shim) and don't probe;
  this is needed for the moment to workaround bus shim issues

Added:
  head/sys/dev/cfi/cfi_bus_ixp4xx.c   (contents, props changed)
Modified:
  head/sys/dev/cfi/cfi_core.c

Added: head/sys/dev/cfi/cfi_bus_ixp4xx.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/cfi/cfi_bus_ixp4xx.c	Tue Feb  3 19:09:16 2009	(r188087)
@@ -0,0 +1,79 @@
+/*-
+ * Copyright (c) 2009 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>   
+#include <sys/module.h>
+#include <sys/rman.h>
+#include <sys/sysctl.h>
+
+#include <machine/bus.h>
+
+#include <dev/cfi/cfi_var.h>
+
+#include <arm/xscale/ixp425/ixp425reg.h>
+#include <arm/xscale/ixp425/ixp425var.h>
+
+static int
+cfi_ixp4xx_probe(device_t dev)
+{
+	struct cfi_softc *sc = device_get_softc(dev);
+	/*
+	 * NB: we assume the boot loader sets up EXP_TIMING_CS0_OFFSET
+	 * according to the flash on the board.  If it does not then it
+	 * can be done here.
+	 */
+	if (bootverbose) {
+		struct ixp425_softc *sa =
+		    device_get_softc(device_get_parent(dev));
+		device_printf(dev, "EXP_TIMING_CS0_OFFSET 0x%x\n",
+		    EXP_BUS_READ_4(sa, EXP_TIMING_CS0_OFFSET));
+	}
+	sc->sc_width = 2;		/* NB: don't probe interface width */
+	return cfi_probe(dev);
+}
+
+static device_method_t cfi_ixp4xx_methods[] = {
+	/* device interface */
+	DEVMETHOD(device_probe,		cfi_ixp4xx_probe),
+	DEVMETHOD(device_attach,	cfi_attach),
+	DEVMETHOD(device_detach,	cfi_detach),
+
+	{0, 0}
+};
+
+static driver_t cfi_ixp4xx_driver = {
+	cfi_driver_name,
+	cfi_ixp4xx_methods,
+	sizeof(struct cfi_softc),
+};
+DRIVER_MODULE (cfi, ixp, cfi_ixp4xx_driver, cfi_devclass, 0, 0);

Modified: head/sys/dev/cfi/cfi_core.c
==============================================================================
--- head/sys/dev/cfi/cfi_core.c	Tue Feb  3 19:07:41 2009	(r188086)
+++ head/sys/dev/cfi/cfi_core.c	Tue Feb  3 19:09:16 2009	(r188087)
@@ -150,11 +150,16 @@ cfi_probe(device_t dev)
 	sc->sc_tag = rman_get_bustag(sc->sc_res);
 	sc->sc_handle = rman_get_bushandle(sc->sc_res);
 
-	sc->sc_width = 1;
-	while (sc->sc_width <= 4) {
-		if (cfi_read_qry(sc, CFI_QRY_IDENT) == 'Q')
-			break;
-		sc->sc_width <<= 1;
+	if (sc->sc_width == 0) {
+		sc->sc_width = 1;
+		while (sc->sc_width <= 4) {
+			if (cfi_read_qry(sc, CFI_QRY_IDENT) == 'Q')
+				break;
+			sc->sc_width <<= 1;
+		}
+	} else if (cfi_read_qry(sc, CFI_QRY_IDENT) != 'Q') {
+		error = ENXIO;
+		goto out;
 	}
 	if (sc->sc_width > 4) {
 		error = ENXIO;

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 19:11:31 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D0346106564A;
	Tue,  3 Feb 2009 19:11:31 +0000 (UTC) (envelope-from sam@freebsd.org)
Received: from ebb.errno.com (ebb.errno.com [69.12.149.25])
	by mx1.freebsd.org (Postfix) with ESMTP id A74758FC12;
	Tue,  3 Feb 2009 19:11:31 +0000 (UTC) (envelope-from sam@freebsd.org)
Received: from trouble.errno.com (trouble.errno.com [10.0.0.248])
	(authenticated bits=0)
	by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n13JBVgF076540
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Tue, 3 Feb 2009 11:11:31 -0800 (PST) (envelope-from sam@freebsd.org)
Message-ID: <498896E3.2080702@freebsd.org>
Date: Tue, 03 Feb 2009 11:11:31 -0800
From: Sam Leffler <sam@freebsd.org>
Organization: FreeBSD Project
User-Agent: Thunderbird 2.0.0.18 (X11/20081209)
MIME-Version: 1.0
To: src-committers@freebsd.org
References: <200902031909.n13J9GFf038922@svn.freebsd.org>
In-Reply-To: <200902031909.n13J9GFf038922@svn.freebsd.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-DCC-sonic.net-Metrics: ebb.errno.com; whitelist
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org
Subject: Re: svn commit: r188087 - head/sys/dev/cfi
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 19:11:32 -0000

Sam Leffler wrote:
> Author: sam
> Date: Tue Feb  3 19:09:16 2009
> New Revision: 188087
> URL: http://svn.freebsd.org/changeset/base/188087
>
> Log:
>   honor any interface width (e.g. setup by the bus shim) and don't probe;
>   this is needed for the moment to workaround bus shim issues
>
> Added:
>   head/sys/dev/cfi/cfi_bus_ixp4xx.c   (contents, props changed)
> Modified:
>   head/sys/dev/cfi/cfi_core.c
>
>   
Sigh, this was supposed to only commit cfi_core.c but also caught the 
xscale bus shim.  Not sure if there's any way to fix this.  Sure wish 
svn worked like perforce and let you edit the commit list.

    Sam


From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 19:16:04 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E1F8D10656F5;
	Tue,  3 Feb 2009 19:16:04 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CF45A8FC1E;
	Tue,  3 Feb 2009 19:16:04 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13JG4K0039121;
	Tue, 3 Feb 2009 19:16:04 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13JG4X9039115;
	Tue, 3 Feb 2009 19:16:04 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902031916.n13JG4X9039115@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Tue, 3 Feb 2009 19:16:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188088 - in head/sys/arm: conf xscale/ixp425
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 19:16:06 -0000

Author: sam
Date: Tue Feb  3 19:16:04 2009
New Revision: 188088
URL: http://svn.freebsd.org/changeset/base/188088

Log:
  Add support for the StrataFlash on 2348 boards:
  o add bus shim for cfi driver
  o add static mapping for CS0 (we map all 16M as the cfi driver doesn't
    support demand mapping)
  
  Note this needs some tweaking to work for 2358 boards which is why the
  CAMBRIA config is not touched.

Modified:
  head/sys/arm/conf/AVILA
  head/sys/arm/conf/AVILA.hints
  head/sys/arm/xscale/ixp425/avila_machdep.c
  head/sys/arm/xscale/ixp425/files.ixp425
  head/sys/arm/xscale/ixp425/ixp425.c
  head/sys/arm/xscale/ixp425/ixp425reg.h

Modified: head/sys/arm/conf/AVILA
==============================================================================
--- head/sys/arm/conf/AVILA	Tue Feb  3 19:09:16 2009	(r188087)
+++ head/sys/arm/conf/AVILA	Tue Feb  3 19:16:04 2009	(r188088)
@@ -66,13 +66,15 @@ options 	BOOTP_COMPAT
 device		pci
 device		uart
 
+device		ixpwdog		# watchdog timer
+device		cfi		# flash support
+
 # I2C Bus
 device		iicbus
 device		iicbb
 device		iic
 
 device		ixpiic		# I2C bus glue
-device		ixpwdog		# watchdog timer
 device		ds1672		# DS1672 on I2C bus
 device		ad7418		# AD7418 on I2C bus
 

Modified: head/sys/arm/conf/AVILA.hints
==============================================================================
--- head/sys/arm/conf/AVILA.hints	Tue Feb  3 19:09:16 2009	(r188087)
+++ head/sys/arm/conf/AVILA.hints	Tue Feb  3 19:16:04 2009	(r188088)
@@ -29,6 +29,10 @@ hint.npe.1.mac="C"
 hint.npe.1.mii="B"
 hint.npe.1.phy=1
 
+# FLASH
+hint.cfi.0.at="ixp0"
+hint.cfi.0.addr=0x50000000
+
 # CF IDE controller
 hint.ata_avila.0.at="ixp0"
 

Modified: head/sys/arm/xscale/ixp425/avila_machdep.c
==============================================================================
--- head/sys/arm/xscale/ixp425/avila_machdep.c	Tue Feb  3 19:09:16 2009	(r188087)
+++ head/sys/arm/xscale/ixp425/avila_machdep.c	Tue Feb  3 19:16:04 2009	(r188088)
@@ -154,6 +154,10 @@ static const struct pmap_devmap ixp425_d
     { IXP425_EXP_VBASE, IXP425_EXP_HWBASE, IXP425_EXP_SIZE,
       VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, },
 
+	/* CFI Flash on the Expansion Bus */
+    { IXP425_EXP_BUS_CS0_VBASE, IXP425_EXP_BUS_CS0_HWBASE,
+      IXP425_EXP_BUS_CS0_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, },
+
 	/* IXP425 PCI Configuration */
     { IXP425_PCI_VBASE, IXP425_PCI_HWBASE, IXP425_PCI_SIZE,
       VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, },

Modified: head/sys/arm/xscale/ixp425/files.ixp425
==============================================================================
--- head/sys/arm/xscale/ixp425/files.ixp425	Tue Feb  3 19:09:16 2009	(r188087)
+++ head/sys/arm/xscale/ixp425/files.ixp425	Tue Feb  3 19:16:04 2009	(r188088)
@@ -15,6 +15,7 @@ arm/xscale/ixp425/uart_cpu_ixp425.c	opti
 arm/xscale/ixp425/uart_bus_ixp425.c	optional	uart
 arm/xscale/ixp425/ixp425_a4x_space.c	optional	uart
 arm/xscale/ixp425/ixp425_a4x_io.S	optional	uart
+dev/cfi/cfi_bus_ixp4xx.c		optional	cfi
 dev/uart/uart_dev_ns8250.c		optional	uart
 #
 # NPE-based Ethernet support (requires qmgr also).

Modified: head/sys/arm/xscale/ixp425/ixp425.c
==============================================================================
--- head/sys/arm/xscale/ixp425/ixp425.c	Tue Feb  3 19:09:16 2009	(r188087)
+++ head/sys/arm/xscale/ixp425/ixp425.c	Tue Feb  3 19:16:04 2009	(r188088)
@@ -329,6 +329,8 @@ static const struct {
 	{ IXP425_IO_HWBASE,	IXP425_IO_SIZE,		IXP425_IO_VBASE },
 	{ IXP425_PCI_HWBASE,	IXP425_PCI_SIZE,	IXP425_PCI_VBASE },
 	{ IXP425_PCI_MEM_HWBASE,IXP425_PCI_MEM_SIZE,	IXP425_PCI_MEM_VBASE },
+	{ IXP425_EXP_BUS_CS0_HWBASE, IXP425_EXP_BUS_CS0_SIZE,
+	  IXP425_EXP_BUS_CS0_VBASE },
 	/* NB: needed only for uart_cpu_getdev */
 	{ IXP425_UART0_HWBASE,	IXP425_REG_SIZE,	IXP425_UART0_VBASE },
 	{ IXP425_UART1_HWBASE,	IXP425_REG_SIZE,	IXP425_UART1_VBASE },

Modified: head/sys/arm/xscale/ixp425/ixp425reg.h
==============================================================================
--- head/sys/arm/xscale/ixp425/ixp425reg.h	Tue Feb  3 19:09:16 2009	(r188087)
+++ head/sys/arm/xscale/ixp425/ixp425reg.h	Tue Feb  3 19:16:04 2009	(r188088)
@@ -76,6 +76,10 @@
  *           Global cache clean area
  * FF00 0000 ---------------------------
  *
+ * FE00 0000 ---------------------------
+ *           16M CFI Flash (on ext bus)
+ * FD00 0000 ---------------------------
+ *
  * FC00 0000 ---------------------------
  *           PCI Data (memory space)
  * F800 0000 --------------------------- IXP425_PCI_MEM_VBASE
@@ -649,6 +653,9 @@
 #define	IXP425_EXP_BUS_CSx_VBASE(i) \
 	(IXP425_MAC_B_VBASE + (i)*IXP425_MAC_B_SIZE)
 
+#define	IXP425_EXP_BUS_CS0_HWBASE	IXP425_EXP_BUS_CSx_HWBASE(0)
+#define IXP425_EXP_BUS_CS0_VBASE	0xFD000000UL
+#define IXP425_EXP_BUS_CS0_SIZE		0x01000000	/* NB: 16M */
 #define	IXP425_EXP_BUS_CS1_HWBASE	IXP425_EXP_BUS_CSx_HWBASE(1)
 #define IXP425_EXP_BUS_CS1_VBASE	IXP425_EXP_BUS_CSx_VBASE(1)
 #define IXP425_EXP_BUS_CS1_SIZE		0x1000
@@ -663,7 +670,6 @@
 #define IXP425_EXP_BUS_CS4_SIZE		0x1000
 
 /* NB: not mapped (yet) */
-#define	IXP425_EXP_BUS_CS0_HWBASE	IXP425_EXP_BUS_CSx_HWBASE(0)
 #define	IXP425_EXP_BUS_CS5_HWBASE	IXP425_EXP_BUS_CSx_HWBASE(5)
 #define	IXP425_EXP_BUS_CS6_HWBASE	IXP425_EXP_BUS_CSx_HWBASE(6)
 #define	IXP425_EXP_BUS_CS7_HWBASE	IXP425_EXP_BUS_CSx_HWBASE(7)

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 19:21:16 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 268651065674;
	Tue,  3 Feb 2009 19:21:16 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EEC948FC20;
	Tue,  3 Feb 2009 19:21:15 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13JLFru039244;
	Tue, 3 Feb 2009 19:21:15 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13JLFkL039243;
	Tue, 3 Feb 2009 19:21:15 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902031921.n13JLFkL039243@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Tue, 3 Feb 2009 19:21:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188089 - head/sys/dev/cfi
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 19:21:16 -0000

Author: sam
Date: Tue Feb  3 19:21:15 2009
New Revision: 188089
URL: http://svn.freebsd.org/changeset/base/188089

Log:
  add Roel's copyright as he did the initial version

Modified:
  head/sys/dev/cfi/cfi_bus_ixp4xx.c

Modified: head/sys/dev/cfi/cfi_bus_ixp4xx.c
==============================================================================
--- head/sys/dev/cfi/cfi_bus_ixp4xx.c	Tue Feb  3 19:16:04 2009	(r188088)
+++ head/sys/dev/cfi/cfi_bus_ixp4xx.c	Tue Feb  3 19:21:15 2009	(r188089)
@@ -1,4 +1,5 @@
 /*-
+ * Copyright (c) 2009 Roelof Jonkman, Carlson Wireless Inc.
  * Copyright (c) 2009 Sam Leffler, Errno Consulting
  * All rights reserved.
  *

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 19:49:22 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 611DA106566B;
	Tue,  3 Feb 2009 19:49:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 34F098FC18;
	Tue,  3 Feb 2009 19:49:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13JnMKn040062;
	Tue, 3 Feb 2009 19:49:22 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13JnMM4040061;
	Tue, 3 Feb 2009 19:49:22 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200902031949.n13JnMM4040061@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Tue, 3 Feb 2009 19:49:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188093 - head/sys/dev/ppbus
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 19:49:22 -0000

Author: jhb
Date: Tue Feb  3 19:49:21 2009
New Revision: 188093
URL: http://svn.freebsd.org/changeset/base/188093

Log:
  Trim what we expose to userland in <dev/ppbus/ppbconf.h> to just the
  constants used for the ppi(4) ioctls for bits in the control and status
  registers.
  
  Reviewed by:	db

Modified:
  head/sys/dev/ppbus/ppbconf.h

Modified: head/sys/dev/ppbus/ppbconf.h
==============================================================================
--- head/sys/dev/ppbus/ppbconf.h	Tue Feb  3 19:47:31 2009	(r188092)
+++ head/sys/dev/ppbus/ppbconf.h	Tue Feb  3 19:49:21 2009	(r188093)
@@ -29,6 +29,35 @@
 #ifndef __PPBCONF_H
 #define __PPBCONF_H
 
+#define n(flags) (~(flags) & (flags))
+
+/*
+ * Parallel Port Chipset control bits.
+ */
+#define STROBE		0x01
+#define AUTOFEED	0x02
+#define nINIT		0x04
+#define SELECTIN	0x08
+#define IRQENABLE	0x10
+#define PCD		0x20
+
+#define nSTROBE		n(STROBE)
+#define nAUTOFEED	n(AUTOFEED)
+#define INIT		n(nINIT)
+#define nSELECTIN	n(SELECTIN)
+#define nPCD		n(PCD)
+
+/*
+ * Parallel Port Chipset status bits.
+ */
+#define TIMEOUT		0x01
+#define nFAULT		0x08
+#define SELECT		0x10
+#define PERROR		0x20
+#define nACK		0x40
+#define nBUSY		0x80
+
+#ifdef _KERNEL
 #include <sys/queue.h>
 
 /*
@@ -59,34 +88,6 @@
 #define PPB_IN_NIBBLE_MODE(bus) (ppb_get_mode (bus) & PPB_NIBBLE)
 #define PPB_IN_PS2_MODE(bus) (ppb_get_mode (bus) & PPB_PS2)
 
-#define n(flags) (~(flags) & (flags))
-
-/*
- * Parallel Port Chipset control bits.
- */
-#define STROBE		0x01
-#define AUTOFEED	0x02
-#define nINIT		0x04
-#define SELECTIN	0x08
-#define IRQENABLE	0x10
-#define PCD		0x20
-
-#define nSTROBE		n(STROBE)
-#define nAUTOFEED	n(AUTOFEED)
-#define INIT		n(nINIT)
-#define nSELECTIN	n(SELECTIN)
-#define nPCD		n(PCD)
-
-/*
- * Parallel Port Chipset status bits.
- */
-#define TIMEOUT		0x01
-#define nFAULT		0x08
-#define SELECT		0x10
-#define PERROR		0x20
-#define nACK		0x40
-#define nBUSY		0x80
-
 /*
  * Structure to store status information.
  */
@@ -251,7 +252,6 @@ struct callout;
 
 typedef int (*ppc_intr_handler)(void *);
 
-#ifdef _KERNEL
 extern int ppb_attach_device(device_t);
 extern int ppb_request_bus(device_t, device_t, int);
 extern int ppb_release_bus(device_t, device_t);

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 19:52:21 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D5CDD1065674;
	Tue,  3 Feb 2009 19:52:21 +0000 (UTC)
	(envelope-from danger@FreeBSD.org)
Received: from services.rulez.sk (services.rulez.sk [92.240.234.125])
	by mx1.freebsd.org (Postfix) with ESMTP id 8DE828FC18;
	Tue,  3 Feb 2009 19:52:21 +0000 (UTC)
	(envelope-from danger@FreeBSD.org)
Received: from localhost (services.rulez.sk [92.240.234.125])
	by services.rulez.sk (Postfix) with ESMTP id C1CF413344A8;
	Tue,  3 Feb 2009 20:36:55 +0100 (CET)
X-Virus-Scanned: amavisd-new at rulez.sk
Received: from services.rulez.sk ([92.240.234.125])
	by localhost (services.rulez.sk [92.240.234.125]) (amavisd-new,
	port 10024)
	with ESMTP id jEUSoVF27HHr; Tue,  3 Feb 2009 20:36:55 +0100 (CET)
Received: from DANGER-PC (danger.mcrn.sk [84.16.37.254])
	(Authenticated sender: danger@rulez.sk)
	by services.rulez.sk (Postfix) with ESMTPA id 0B6F713344A5;
	Tue,  3 Feb 2009 20:36:55 +0100 (CET)
Date: Tue, 3 Feb 2009 20:36:50 +0100
From: Daniel Gerzo <danger@FreeBSD.org>
Organization: The FreeBSD Project
X-Priority: 3 (Normal)
Message-ID: <1264011142.20090203203650@rulez.sk>
To: Sam Leffler <sam@freebsd.org>
In-Reply-To: <498896E3.2080702@freebsd.org>
References: <200902031909.n13J9GFf038922@svn.freebsd.org>
	<498896E3.2080702@freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re[2]: svn commit: r188087 - head/sys/dev/cfi
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 19:52:22 -0000

Hello Sam,

Tuesday, February 3, 2009, 8:11:31 PM, you wrote:

> Sam Leffler wrote:
>> Author: sam
>> Date: Tue Feb  3 19:09:16 2009
>> New Revision: 188087
>> URL: http://svn.freebsd.org/changeset/base/188087
>>
>> Log:
>>   honor any interface width (e.g. setup by the bus shim) and don't probe;
>>   this is needed for the moment to workaround bus shim issues
>>
>> Added:
>>   head/sys/dev/cfi/cfi_bus_ixp4xx.c   (contents, props changed)
>> Modified:
>>   head/sys/dev/cfi/cfi_core.c
>>
>>  =20
> Sigh, this was supposed to only commit cfi_core.c but also caught the=20
> xscale bus shim.  Not sure if there's any way to fix this.  Sure wish=20
> svn worked like perforce and let you edit the commit list.

svn revert file?

--=20
Best regards,
 Daniel                            mailto:danger@FreeBSD.org


From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 19:58:22 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0C4F11065674
	for <svn-src-head@freebsd.org>; Tue,  3 Feb 2009 19:58:22 +0000 (UTC)
	(envelope-from christoph.mallon@gmx.de)
Received: from mail.gmx.net (mail.gmx.net [213.165.64.20])
	by mx1.freebsd.org (Postfix) with SMTP id 43A108FC12
	for <svn-src-head@freebsd.org>; Tue,  3 Feb 2009 19:58:21 +0000 (UTC)
	(envelope-from christoph.mallon@gmx.de)
Received: (qmail invoked by alias); 03 Feb 2009 19:58:18 -0000
Received: from p54A3EB73.dip.t-dialin.net (EHLO tron.homeunix.org)
	[84.163.235.115]
	by mail.gmx.net (mp026) with SMTP; 03 Feb 2009 20:58:18 +0100
X-Authenticated: #1673122
X-Provags-ID: V01U2FsdGVkX1/s3pgRAa/sAq6KLXqUYWd0ztJOQeb8hQPX6oMv9V
	splQ6rVHHSiX0j
Message-ID: <4988A1D8.4040908@gmx.de>
Date: Tue, 03 Feb 2009 20:58:16 +0100
From: Christoph Mallon <christoph.mallon@gmx.de>
User-Agent: Thunderbird 2.0.0.19 (X11/20090103)
MIME-Version: 1.0
To: Daniel Gerzo <danger@FreeBSD.org>
References: <200902031909.n13J9GFf038922@svn.freebsd.org>	<498896E3.2080702@freebsd.org>
	<1264011142.20090203203650@rulez.sk>
In-Reply-To: <1264011142.20090203203650@rulez.sk>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Y-GMX-Trusted: 0
X-FuHaFi: 0.57
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	Sam Leffler <sam@freebsd.org>, src-committers@freebsd.org
Subject: Re: svn commit: r188087 - head/sys/dev/cfi
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 19:58:23 -0000

Daniel Gerzo schrieb:
> Hello Sam,
> 
> Tuesday, February 3, 2009, 8:11:31 PM, you wrote:
> 
>> Sam Leffler wrote:
>>> Author: sam
>>> Date: Tue Feb  3 19:09:16 2009
>>> New Revision: 188087
>>> URL: http://svn.freebsd.org/changeset/base/188087
>>>
>>> Log:
>>>   honor any interface width (e.g. setup by the bus shim) and don't probe;
>>>   this is needed for the moment to workaround bus shim issues
>>>
>>> Added:
>>>   head/sys/dev/cfi/cfi_bus_ixp4xx.c   (contents, props changed)
>>> Modified:
>>>   head/sys/dev/cfi/cfi_core.c
>>>
>>>   
>> Sigh, this was supposed to only commit cfi_core.c but also caught the 
>> xscale bus shim.  Not sure if there's any way to fix this.  Sure wish 
>> svn worked like perforce and let you edit the commit list.

You can abort a commit by not modifying the commit log file at all or 
deleting *all* content of the commit log.
You can also create changelists (svn help changelist).

> svn revert file?

svn revert is for throwing away local changes. But you can do the 
following to reverse-merge the revision:

svn merge -c -$REVISION .

Mind the "-" before the revision number. This is equivalent to -r 
$REVISION:($REVISION - 1).

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 19:58:29 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 134BB1065676;
	Tue,  3 Feb 2009 19:58:29 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EB2348FC13;
	Tue,  3 Feb 2009 19:58:28 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13JwSiw040358;
	Tue, 3 Feb 2009 19:58:28 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13JwSxQ040353;
	Tue, 3 Feb 2009 19:58:28 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200902031958.n13JwSxQ040353@svn.freebsd.org>
From: Ed Schouten <ed@FreeBSD.org>
Date: Tue, 3 Feb 2009 19:58:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188096 - in head/sys: dev/snp kern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 19:58:34 -0000

Author: ed
Date: Tue Feb  3 19:58:28 2009
New Revision: 188096
URL: http://svn.freebsd.org/changeset/base/188096

Log:
  Slightly improve the design of the TTY buffer.
  
  The TTY buffers used the standard <sys/queue.h> lists. Unfortunately
  they have a big shortcoming. If you want to have a double linked list,
  but no tail pointer, it's still not possible to obtain the previous
  element in the list. Inside the buffers we don't need them. This is why
  I switched to custom linked list macros. The macros will also keep track
  of the amount of items in the list. Because it doesn't use a sentinel,
  we can just initialize the queues with zero.
  
  In its simplest form (the output queue), we will only keep two
  references to blocks in the queue, namely the head of the list and the
  last block in use. All free blocks are stored behind the last block in
  use.
  
  I noticed there was a very subtle bug in the previous code: in a very
  uncommon corner case, it would uma_zfree() a block in the queue before
  calling memcpy() to extract the data from the block.

Modified:
  head/sys/dev/snp/snp.c
  head/sys/kern/tty.c
  head/sys/kern/tty_inq.c
  head/sys/kern/tty_outq.c
  head/sys/sys/ttyqueue.h

Modified: head/sys/dev/snp/snp.c
==============================================================================
--- head/sys/dev/snp/snp.c	Tue Feb  3 19:50:11 2009	(r188095)
+++ head/sys/dev/snp/snp.c	Tue Feb  3 19:58:28 2009	(r188096)
@@ -127,7 +127,6 @@ snp_open(struct cdev *dev, int flag, int
 
 	/* Allocate per-snoop data. */
 	ss = malloc(sizeof(struct snp_softc), M_SNP, M_WAITOK|M_ZERO);
-	ttyoutq_init(&ss->snp_outq);
 	cv_init(&ss->snp_outwait, "snp out");
 
 	devfs_set_cdevpriv(ss, snp_dtor);

Modified: head/sys/kern/tty.c
==============================================================================
--- head/sys/kern/tty.c	Tue Feb  3 19:50:11 2009	(r188095)
+++ head/sys/kern/tty.c	Tue Feb  3 19:58:28 2009	(r188096)
@@ -884,9 +884,6 @@ tty_alloc(struct ttydevsw *tsw, void *sc
 	cv_init(&tp->t_bgwait, "ttybg");
 	cv_init(&tp->t_dcdwait, "ttydcd");
 
-	ttyinq_init(&tp->t_inq);
-	ttyoutq_init(&tp->t_outq);
-
 	/* Allow drivers to use a custom mutex to lock the TTY. */
 	if (mutex != NULL) {
 		tp->t_mtx = mutex;

Modified: head/sys/kern/tty_inq.c
==============================================================================
--- head/sys/kern/tty_inq.c	Tue Feb  3 19:50:11 2009	(r188095)
+++ head/sys/kern/tty_inq.c	Tue Feb  3 19:58:28 2009	(r188096)
@@ -79,13 +79,43 @@ SYSCTL_LONG(_kern, OID_AUTO, tty_inq_nsl
 	((tib)->tib_quotes[(boff) / BMSIZE] &= ~(1 << ((boff) % BMSIZE)))
 
 struct ttyinq_block {
-	TAILQ_ENTRY(ttyinq_block) tib_list;
-	uint32_t	tib_quotes[TTYINQ_QUOTESIZE];
-	char		tib_data[TTYINQ_DATASIZE];
+	struct ttyinq_block	*tib_prev;
+	struct ttyinq_block	*tib_next;
+	uint32_t		tib_quotes[TTYINQ_QUOTESIZE];
+	char			tib_data[TTYINQ_DATASIZE];
 };
 
 static uma_zone_t ttyinq_zone;
 
+#define	TTYINQ_INSERT_TAIL(ti, tib) do {				\
+	if (ti->ti_end == 0) {						\
+		tib->tib_prev = NULL;					\
+		tib->tib_next = ti->ti_firstblock;			\
+		ti->ti_firstblock = tib;				\
+	} else {							\
+		tib->tib_prev = ti->ti_lastblock;			\
+		tib->tib_next = ti->ti_lastblock->tib_next;		\
+		ti->ti_lastblock->tib_next = tib;			\
+	}								\
+	if (tib->tib_next != NULL)					\
+		tib->tib_next->tib_prev = tib;				\
+	ti->ti_nblocks++;						\
+} while (0)
+
+#define	TTYINQ_REMOVE_HEAD(ti) do {					\
+	ti->ti_firstblock = ti->ti_firstblock->tib_next;		\
+	if (ti->ti_firstblock != NULL)					\
+		ti->ti_firstblock->tib_prev = NULL;			\
+	ti->ti_nblocks--;						\
+} while (0)
+
+#define	TTYINQ_RECYCLE(ti, tib) do {					\
+	if (ti->ti_quota <= ti->ti_nblocks)				\
+		uma_zfree(ttyinq_zone, tib);				\
+	else								\
+		TTYINQ_INSERT_TAIL(ti, tib);				\
+} while (0)
+
 void
 ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t size)
 {
@@ -108,8 +138,7 @@ ttyinq_setsize(struct ttyinq *ti, struct
 		tib = uma_zalloc(ttyinq_zone, M_WAITOK);
 		tty_lock(tp);
 
-		TAILQ_INSERT_TAIL(&ti->ti_list, tib, tib_list);
-		ti->ti_nblocks++;
+		TTYINQ_INSERT_TAIL(ti, tib);
 	}
 }
 
@@ -121,10 +150,9 @@ ttyinq_free(struct ttyinq *ti)
 	ttyinq_flush(ti);
 	ti->ti_quota = 0;
 
-	while ((tib = TAILQ_FIRST(&ti->ti_list)) != NULL) {
-		TAILQ_REMOVE(&ti->ti_list, tib, tib_list);
+	while ((tib = ti->ti_firstblock) != NULL) {
+		TTYINQ_REMOVE_HEAD(ti);
 		uma_zfree(ttyinq_zone, tib);
-		ti->ti_nblocks--;
 	}
 
 	MPASS(ti->ti_nblocks == 0);
@@ -145,7 +173,7 @@ ttyinq_read_uio(struct ttyinq *ti, struc
 		/* See if there still is data. */
 		if (ti->ti_begin == ti->ti_linestart)
 			return (0);
-		tib = TAILQ_FIRST(&ti->ti_list);
+		tib = ti->ti_firstblock;
 		if (tib == NULL)
 			return (0);
 
@@ -176,8 +204,7 @@ ttyinq_read_uio(struct ttyinq *ti, struc
 			 * Fast path: zero copy. Remove the first block,
 			 * so we can unlock the TTY temporarily.
 			 */
-			TAILQ_REMOVE(&ti->ti_list, tib, tib_list);
-			ti->ti_nblocks--;
+			TTYINQ_REMOVE_HEAD(ti);
 			ti->ti_begin = 0;
 
 			/*
@@ -185,11 +212,10 @@ ttyinq_read_uio(struct ttyinq *ti, struc
 			 * fix up the block offsets.
 			 */
 #define CORRECT_BLOCK(t) do {			\
-	if (t <= TTYINQ_DATASIZE) {		\
+	if (t <= TTYINQ_DATASIZE)		\
 		t = 0;				\
-	} else {				\
+	else					\
 		t -= TTYINQ_DATASIZE;		\
-	}					\
 } while (0)
 			CORRECT_BLOCK(ti->ti_linestart);
 			CORRECT_BLOCK(ti->ti_reprint);
@@ -207,12 +233,7 @@ ttyinq_read_uio(struct ttyinq *ti, struc
 			tty_lock(tp);
 
 			/* Block can now be readded to the list. */
-			if (ti->ti_quota <= ti->ti_nblocks) {
-				uma_zfree(ttyinq_zone, tib);
-			} else {
-				TAILQ_INSERT_TAIL(&ti->ti_list, tib, tib_list);
-				ti->ti_nblocks++;
-			}
+			TTYINQ_RECYCLE(ti, tib);
 		} else {
 			char ob[TTYINQ_DATASIZE - 1];
 			atomic_add_long(&ttyinq_nslow, 1);
@@ -264,25 +285,27 @@ ttyinq_write(struct ttyinq *ti, const vo
 	size_t l;
 	
 	while (nbytes > 0) {
-		tib = ti->ti_lastblock;
 		boff = ti->ti_end % TTYINQ_DATASIZE;
 
 		if (ti->ti_end == 0) {
 			/* First time we're being used or drained. */
 			MPASS(ti->ti_begin == 0);
-			tib = ti->ti_lastblock = TAILQ_FIRST(&ti->ti_list);
+			tib = ti->ti_firstblock;
 			if (tib == NULL) {
 				/* Queue has no blocks. */
 				break;
 			}
+			ti->ti_lastblock = tib;
 		} else if (boff == 0) {
 			/* We reached the end of this block on last write. */
-			tib = TAILQ_NEXT(tib, tib_list);
+			tib = ti->ti_lastblock->tib_next;
 			if (tib == NULL) {
 				/* We've reached the watermark. */
 				break;
 			}
 			ti->ti_lastblock = tib;
+		} else {
+			tib = ti->ti_lastblock;
 		}
 
 		/* Don't copy more than was requested. */
@@ -328,7 +351,7 @@ size_t
 ttyinq_findchar(struct ttyinq *ti, const char *breakc, size_t maxlen,
     char *lastc)
 {
-	struct ttyinq_block *tib = TAILQ_FIRST(&ti->ti_list);
+	struct ttyinq_block *tib = ti->ti_firstblock;
 	unsigned int boff = ti->ti_begin;
 	unsigned int bend = MIN(MIN(TTYINQ_DATASIZE, ti->ti_linestart),
 	    ti->ti_begin + maxlen);
@@ -402,8 +425,7 @@ ttyinq_unputchar(struct ttyinq *ti)
 
 	if (--ti->ti_end % TTYINQ_DATASIZE == 0) {
 		/* Roll back to the previous block. */
-		ti->ti_lastblock = TAILQ_PREV(ti->ti_lastblock,
-		    ttyinq_bhead, tib_list);
+		ti->ti_lastblock = ti->ti_lastblock->tib_prev;
 		/*
 		 * This can only fail if we are unputchar()'ing the
 		 * first character in the queue.
@@ -437,7 +459,7 @@ ttyinq_line_iterate(struct ttyinq *ti,
 
 	/* Use the proper block when we're at the queue head. */
 	if (offset == 0)
-		tib = TAILQ_FIRST(&ti->ti_list);
+		tib = ti->ti_firstblock;
 
 	/* Iterate all characters and call the iterator function. */
 	for (; offset < ti->ti_end; offset++) {
@@ -449,7 +471,7 @@ ttyinq_line_iterate(struct ttyinq *ti,
 
 		/* Last byte iterated - go to the next block. */
 		if (boff == TTYINQ_DATASIZE - 1)
-			tib = TAILQ_NEXT(tib, tib_list);
+			tib = tib->tib_next;
 		MPASS(tib != NULL);
 	}
 }

Modified: head/sys/kern/tty_outq.c
==============================================================================
--- head/sys/kern/tty_outq.c	Tue Feb  3 19:50:11 2009	(r188095)
+++ head/sys/kern/tty_outq.c	Tue Feb  3 19:58:28 2009	(r188096)
@@ -61,12 +61,35 @@ SYSCTL_LONG(_kern, OID_AUTO, tty_outq_ns
 	&ttyoutq_nslow, 0, "Buffered reads to userspace on output");
 
 struct ttyoutq_block {
-	STAILQ_ENTRY(ttyoutq_block) tob_list;
-	char	tob_data[TTYOUTQ_DATASIZE];
+	struct ttyoutq_block	*tob_next;
+	char			tob_data[TTYOUTQ_DATASIZE];
 };
 
 static uma_zone_t ttyoutq_zone;
 
+#define	TTYOUTQ_INSERT_TAIL(to, tob) do {				\
+	if (to->to_end == 0) {						\
+		tob->tob_next = to->to_firstblock;			\
+		to->to_firstblock = tob;				\
+	} else {							\
+		tob->tob_next = to->to_lastblock->tob_next;		\
+		to->to_lastblock->tob_next = tob;			\
+	}								\
+	to->to_nblocks++;						\
+} while (0)
+
+#define	TTYOUTQ_REMOVE_HEAD(to) do {					\
+	to->to_firstblock = to->to_firstblock->tob_next;		\
+	to->to_nblocks--;						\
+} while (0)
+
+#define	TTYOUTQ_RECYCLE(to, tob) do {					\
+	if (to->to_quota <= to->to_nblocks)				\
+		uma_zfree(ttyoutq_zone, tob);				\
+	else								\
+		TTYOUTQ_INSERT_TAIL(to, tob);				\
+} while(0)
+
 void
 ttyoutq_flush(struct ttyoutq *to)
 {
@@ -97,8 +120,7 @@ ttyoutq_setsize(struct ttyoutq *to, stru
 		tob = uma_zalloc(ttyoutq_zone, M_WAITOK);
 		tty_lock(tp);
 
-		STAILQ_INSERT_TAIL(&to->to_list, tob, tob_list);
-		to->to_nblocks++;
+		TTYOUTQ_INSERT_TAIL(to, tob);
 	}
 }
 
@@ -110,10 +132,9 @@ ttyoutq_free(struct ttyoutq *to)
 	ttyoutq_flush(to);
 	to->to_quota = 0;
 
-	while ((tob = STAILQ_FIRST(&to->to_list)) != NULL) {
-		STAILQ_REMOVE_HEAD(&to->to_list, tob_list);
+	while ((tob = to->to_firstblock) != NULL) {
+		TTYOUTQ_REMOVE_HEAD(to);
 		uma_zfree(ttyoutq_zone, tob);
-		to->to_nblocks--;
 	}
 
 	MPASS(to->to_nblocks == 0);
@@ -131,7 +152,7 @@ ttyoutq_read(struct ttyoutq *to, void *b
 		/* See if there still is data. */
 		if (to->to_begin == to->to_end)
 			break;
-		tob = STAILQ_FIRST(&to->to_list);
+		tob = to->to_firstblock;
 		if (tob == NULL)
 			break;
 
@@ -146,30 +167,25 @@ ttyoutq_read(struct ttyoutq *to, void *b
 		    TTYOUTQ_DATASIZE);
 		clen = cend - cbegin;
 
-		if (cend == TTYOUTQ_DATASIZE || cend == to->to_end) {
+		/* Copy the data out of the buffers. */
+		memcpy(cbuf, tob->tob_data + cbegin, clen);
+		cbuf += clen;
+		len -= clen;
+
+		if (cend == to->to_end) {
+			/* Read the complete queue. */
+			to->to_begin = 0;
+			to->to_end = 0;
+		} else if (cend == TTYOUTQ_DATASIZE) {
 			/* Read the block until the end. */
-			STAILQ_REMOVE_HEAD(&to->to_list, tob_list);
-			if (to->to_quota < to->to_nblocks) {
-				uma_zfree(ttyoutq_zone, tob);
-				to->to_nblocks--;
-			} else {
-				STAILQ_INSERT_TAIL(&to->to_list, tob, tob_list);
-			}
+			TTYOUTQ_REMOVE_HEAD(to);
 			to->to_begin = 0;
-			if (to->to_end <= TTYOUTQ_DATASIZE) {
-				to->to_end = 0;
-			} else {
-				to->to_end -= TTYOUTQ_DATASIZE;
-			}
+			to->to_end -= TTYOUTQ_DATASIZE;
+			TTYOUTQ_RECYCLE(to, tob);
 		} else {
 			/* Read the block partially. */
 			to->to_begin += clen;
 		}
-
-		/* Copy the data out of the buffers. */
-		memcpy(cbuf, tob->tob_data + cbegin, clen);
-		cbuf += clen;
-		len -= clen;
 	}
 
 	return (cbuf - (char *)buf);
@@ -197,7 +213,7 @@ ttyoutq_read_uio(struct ttyoutq *to, str
 		/* See if there still is data. */
 		if (to->to_begin == to->to_end)
 			return (0);
-		tob = STAILQ_FIRST(&to->to_list);
+		tob = to->to_firstblock;
 		if (tob == NULL)
 			return (0);
 
@@ -226,14 +242,12 @@ ttyoutq_read_uio(struct ttyoutq *to, str
 			 * Fast path: zero copy. Remove the first block,
 			 * so we can unlock the TTY temporarily.
 			 */
-			STAILQ_REMOVE_HEAD(&to->to_list, tob_list);
-			to->to_nblocks--;
+			TTYOUTQ_REMOVE_HEAD(to);
 			to->to_begin = 0;
-			if (to->to_end <= TTYOUTQ_DATASIZE) {
+			if (to->to_end <= TTYOUTQ_DATASIZE)
 				to->to_end = 0;
-			} else {
+			else
 				to->to_end -= TTYOUTQ_DATASIZE;
-			}
 
 			/* Temporary unlock and copy the data to userspace. */
 			tty_unlock(tp);
@@ -241,12 +255,7 @@ ttyoutq_read_uio(struct ttyoutq *to, str
 			tty_lock(tp);
 
 			/* Block can now be readded to the list. */
-			if (to->to_quota <= to->to_nblocks) {
-				uma_zfree(ttyoutq_zone, tob);
-			} else {
-				STAILQ_INSERT_TAIL(&to->to_list, tob, tob_list);
-				to->to_nblocks++;
-			}
+			TTYOUTQ_RECYCLE(to, tob);
 		} else {
 			char ob[TTYOUTQ_DATASIZE - 1];
 			atomic_add_long(&ttyoutq_nslow, 1);
@@ -280,26 +289,27 @@ ttyoutq_write(struct ttyoutq *to, const 
 	size_t l;
 
 	while (nbytes > 0) {
-		/* Offset in current block. */
-		tob = to->to_lastblock;
 		boff = to->to_end % TTYOUTQ_DATASIZE;
 
 		if (to->to_end == 0) {
 			/* First time we're being used or drained. */
 			MPASS(to->to_begin == 0);
-			tob = to->to_lastblock = STAILQ_FIRST(&to->to_list);
+			tob = to->to_firstblock;
 			if (tob == NULL) {
 				/* Queue has no blocks. */
 				break;
 			}
+			to->to_lastblock = tob;
 		} else if (boff == 0) {
 			/* We reached the end of this block on last write. */
-			tob = STAILQ_NEXT(tob, tob_list);
+			tob = to->to_lastblock->tob_next;
 			if (tob == NULL) {
 				/* We've reached the watermark. */
 				break;
 			}
 			to->to_lastblock = tob;
+		} else {
+			tob = to->to_lastblock;
 		}
 
 		/* Don't copy more than was requested. */

Modified: head/sys/sys/ttyqueue.h
==============================================================================
--- head/sys/sys/ttyqueue.h	Tue Feb  3 19:50:11 2009	(r188095)
+++ head/sys/sys/ttyqueue.h	Tue Feb  3 19:58:28 2009	(r188096)
@@ -43,29 +43,29 @@ struct uio;
 
 /* Data input queue. */
 struct ttyinq {
-	TAILQ_HEAD(ttyinq_bhead, ttyinq_block) ti_list;
-	struct ttyinq_block		*ti_startblock;
-	struct ttyinq_block		*ti_reprintblock;
-	struct ttyinq_block		*ti_lastblock;
-	unsigned int			ti_begin;
-	unsigned int			ti_linestart;
-	unsigned int			ti_reprint;
-	unsigned int			ti_end;
-	unsigned int			ti_nblocks;
-	unsigned int			ti_quota;
+	struct ttyinq_block	*ti_firstblock;
+	struct ttyinq_block	*ti_startblock;
+	struct ttyinq_block	*ti_reprintblock;
+	struct ttyinq_block	*ti_lastblock;
+	unsigned int		ti_begin;
+	unsigned int		ti_linestart;
+	unsigned int		ti_reprint;
+	unsigned int		ti_end;
+	unsigned int		ti_nblocks;
+	unsigned int		ti_quota;
 };
 #define TTYINQ_DATASIZE 128
 
 /* Data output queue. */
 struct ttyoutq {
-	STAILQ_HEAD(, ttyoutq_block)	to_list;
-	struct ttyoutq_block		*to_lastblock;
-	unsigned int			to_begin;
-	unsigned int			to_end;
-	unsigned int			to_nblocks;
-	unsigned int			to_quota;
+	struct ttyoutq_block	*to_firstblock;
+	struct ttyoutq_block	*to_lastblock;
+	unsigned int		to_begin;
+	unsigned int		to_end;
+	unsigned int		to_nblocks;
+	unsigned int		to_quota;
 };
-#define TTYOUTQ_DATASIZE (256 - sizeof(STAILQ_ENTRY(ttyoutq_block)))
+#define TTYOUTQ_DATASIZE (256 - sizeof(struct ttyoutq_block *))
 
 #ifdef _KERNEL
 /* Input queue handling routines. */
@@ -86,13 +86,6 @@ void	ttyinq_unputchar(struct ttyinq *ti)
 void	ttyinq_reprintpos_set(struct ttyinq *ti);
 void	ttyinq_reprintpos_reset(struct ttyinq *ti);
 
-static __inline void
-ttyinq_init(struct ttyinq *ti)
-{
-
-	TAILQ_INIT(&ti->ti_list);
-}
-
 static __inline size_t
 ttyinq_getsize(struct ttyinq *ti)
 {
@@ -143,13 +136,6 @@ int	ttyoutq_read_uio(struct ttyoutq *to,
 size_t	ttyoutq_write(struct ttyoutq *to, const void *buf, size_t len);
 int	ttyoutq_write_nofrag(struct ttyoutq *to, const void *buf, size_t len);
 
-static __inline void
-ttyoutq_init(struct ttyoutq *to)
-{
-
-	STAILQ_INIT(&to->to_list);
-}
-
 static __inline size_t
 ttyoutq_getsize(struct ttyoutq *to)
 {

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 20:25:37 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2F9F31065706;
	Tue,  3 Feb 2009 20:25:37 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1D8838FC1E;
	Tue,  3 Feb 2009 20:25:37 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13KPbgB041015;
	Tue, 3 Feb 2009 20:25:37 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13KPaCV041012;
	Tue, 3 Feb 2009 20:25:36 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902032025.n13KPaCV041012@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Tue, 3 Feb 2009 20:25:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188098 - head/lib/libc/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 20:25:37 -0000

Author: imp
Date: Tue Feb  3 20:25:36 2009
New Revision: 188098
URL: http://svn.freebsd.org/changeset/base/188098

Log:
  Fix the functions to match prototypes.  The K&R definitions differ
  from the ANSI-C prototype due to the 'int promotion' rule.

Modified:
  head/lib/libc/string/memchr.c
  head/lib/libc/string/strmode.c
  head/lib/libc/string/wmemset.c

Modified: head/lib/libc/string/memchr.c
==============================================================================
--- head/lib/libc/string/memchr.c	Tue Feb  3 20:01:51 2009	(r188097)
+++ head/lib/libc/string/memchr.c	Tue Feb  3 20:25:36 2009	(r188098)
@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 
 void *
-memchr(const void *s, unsigned char c, size_t n)
+memchr(const void *s, int c, size_t n)
 {
 	if (n != 0) {
 		const unsigned char *p = s;

Modified: head/lib/libc/string/strmode.c
==============================================================================
--- head/lib/libc/string/strmode.c	Tue Feb  3 20:01:51 2009	(r188097)
+++ head/lib/libc/string/strmode.c	Tue Feb  3 20:25:36 2009	(r188098)
@@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 
 void
-strmode(mode_t mode, char *p)
+strmode(/* mode_t */ int mode, char *p)
 {
 	 /* print type */
 	switch (mode & S_IFMT) {

Modified: head/lib/libc/string/wmemset.c
==============================================================================
--- head/lib/libc/string/wmemset.c	Tue Feb  3 20:01:51 2009	(r188097)
+++ head/lib/libc/string/wmemset.c	Tue Feb  3 20:25:36 2009	(r188098)
@@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$");
 #include <wchar.h>
 
 wchar_t	*
-wmemset(wchar_t *s, wchar_t *c, size_t n)
+wmemset(wchar_t *s, wchar_t c, size_t n)
 {
 	size_t i;
 	wchar_t *p;

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 20:28:51 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B4816106567F
	for <svn-src-head@freebsd.org>; Tue,  3 Feb 2009 20:28:51 +0000 (UTC)
	(envelope-from christoph.mallon@gmx.de)
Received: from mail.gmx.net (mail.gmx.net [213.165.64.20])
	by mx1.freebsd.org (Postfix) with SMTP id 33CE38FC1C
	for <svn-src-head@freebsd.org>; Tue,  3 Feb 2009 20:28:49 +0000 (UTC)
	(envelope-from christoph.mallon@gmx.de)
Received: (qmail invoked by alias); 03 Feb 2009 20:28:45 -0000
Received: from p54A3EB73.dip.t-dialin.net (EHLO tron.homeunix.org)
	[84.163.235.115]
	by mail.gmx.net (mp054) with SMTP; 03 Feb 2009 21:28:45 +0100
X-Authenticated: #1673122
X-Provags-ID: V01U2FsdGVkX19GrLI1wG5GBDZG8bzsF+nDoscw2aOkqJxLYhQ+6x
	8rJGXAIwzc6/M3
Message-ID: <4988A8F8.9050409@gmx.de>
Date: Tue, 03 Feb 2009 21:28:40 +0100
From: Christoph Mallon <christoph.mallon@gmx.de>
User-Agent: Thunderbird 2.0.0.19 (X11/20090103)
MIME-Version: 1.0
To: Daniel Gerzo <danger@FreeBSD.org>
References: <200902031758.n13HwKHT037144@svn.freebsd.org>
In-Reply-To: <200902031758.n13HwKHT037144@svn.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Y-GMX-Trusted: 0
X-FuHaFi: 0.53
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r188080 - head/lib/libc/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 20:28:53 -0000

Daniel Gerzo schrieb:
> Author: danger (doc committer)
> Date: Tue Feb  3 17:58:20 2009
> New Revision: 188080
> URL: http://svn.freebsd.org/changeset/base/188080
> 
> Log:
>   - ANSIfy function definitions
>   - use nul when we are looking for a terminating character where appropriate
>   
>   Approved by:	imp
[...]
> Modified: head/lib/libc/string/memchr.c
> ==============================================================================
> --- head/lib/libc/string/memchr.c	Tue Feb  3 17:13:37 2009	(r188079)
> +++ head/lib/libc/string/memchr.c	Tue Feb  3 17:58:20 2009	(r188080)
> @@ -39,10 +39,7 @@ __FBSDID("$FreeBSD$");
>  #include <string.h>
>  
>  void *
> -memchr(s, c, n)
> -	const void *s;
> -	unsigned char c;
> -	size_t n;
> +memchr(const void *s, unsigned char c, size_t n)
>  {
>  	if (n != 0) {
>  		const unsigned char *p = s;

K&R style function definitions work slightly different than ANSI.

void f(x)
   char x;
{}

fits to the prototype declaration

void f(int x);

int in the prototype because it has to fit to the default promoted type 
of the parameter of the K&R function definition!

So just moving types < int from the K&R declaration list into the 
parameter list will break things (as it does here with memchr(), because 
the prototype declaration correctly uses type int).


Conversely void g(char x); void g(x) char x; {} are NOT compatible, but 
GCC incorrectly accepts this.

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 20:31:26 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6E426106567A;
	Tue,  3 Feb 2009 20:31:26 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5BFCF8FC1D;
	Tue,  3 Feb 2009 20:31:26 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13KVQMB041143;
	Tue, 3 Feb 2009 20:31:26 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13KVQb4041142;
	Tue, 3 Feb 2009 20:31:26 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200902032031.n13KVQb4041142@svn.freebsd.org>
From: Ed Schouten <ed@FreeBSD.org>
Date: Tue, 3 Feb 2009 20:31:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188099 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 20:31:27 -0000

Author: ed
Date: Tue Feb  3 20:31:26 2009
New Revision: 188099
URL: http://svn.freebsd.org/changeset/base/188099

Log:
  Remove NUMCDEVSW, which is unused since RELENG_5.
  
  Discussed with:	kib

Modified:
  head/sys/sys/conf.h

Modified: head/sys/sys/conf.h
==============================================================================
--- head/sys/sys/conf.h	Tue Feb  3 20:25:36 2009	(r188098)
+++ head/sys/sys/conf.h	Tue Feb  3 20:31:26 2009	(r188099)
@@ -219,8 +219,6 @@ struct cdevsw {
 #define	d_gianttrick		__d_giant.gianttrick
 #define	d_postfree_list		__d_giant.postfree_list
 
-#define NUMCDEVSW 256
-
 struct module;
 
 struct devsw_module_data {

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 20:33:29 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0147D106566C;
	Tue,  3 Feb 2009 20:33:29 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E3CC48FC1E;
	Tue,  3 Feb 2009 20:33:28 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13KXS7v041232;
	Tue, 3 Feb 2009 20:33:28 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13KXSrY041231;
	Tue, 3 Feb 2009 20:33:28 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <200902032033.n13KXSrY041231@svn.freebsd.org>
From: Randall Stewart <rrs@FreeBSD.org>
Date: Tue, 3 Feb 2009 20:33:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188100 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 20:33:29 -0000

Author: rrs
Date: Tue Feb  3 20:33:28 2009
New Revision: 188100
URL: http://svn.freebsd.org/changeset/base/188100

Log:
  LOR fix - Lock only when calling the actual code that
            is messing with the UDP tunnel. This means
            that if two users actually tried to change the
            tunnel port at the same time interesting things COULD
            result, but its probably very unlikely to happen :-)

Modified:
  head/sys/netinet/sctp_sysctl.c

Modified: head/sys/netinet/sctp_sysctl.c
==============================================================================
--- head/sys/netinet/sctp_sysctl.c	Tue Feb  3 20:31:26 2009	(r188099)
+++ head/sys/netinet/sctp_sysctl.c	Tue Feb  3 20:33:28 2009	(r188100)
@@ -519,8 +519,9 @@ sysctl_sctp_udp_tunneling_check(SYSCTL_H
 	int error;
 	uint32_t old_sctp_udp_tunneling_port;
 
-	SCTP_INP_INFO_WLOCK();
+	SCTP_INP_INFO_RLOCK();
 	old_sctp_udp_tunneling_port = SCTP_BASE_SYSCTL(sctp_udp_tunneling_port);
+	SCTP_INP_INFO_RUNLOCK();
 	error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
 	if (error == 0) {
 		RANGECHK(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port), SCTPCTL_UDP_TUNNELING_PORT_MIN, SCTPCTL_UDP_TUNNELING_PORT_MAX);
@@ -528,6 +529,7 @@ sysctl_sctp_udp_tunneling_check(SYSCTL_H
 			error = 0;
 			goto out;
 		}
+		SCTP_INP_INFO_WLOCK();
 		if (old_sctp_udp_tunneling_port) {
 			sctp_over_udp_stop();
 		}
@@ -536,9 +538,9 @@ sysctl_sctp_udp_tunneling_check(SYSCTL_H
 				SCTP_BASE_SYSCTL(sctp_udp_tunneling_port) = 0;
 			}
 		}
+		SCTP_INP_INFO_WUNLOCK();
 	}
 out:
-	SCTP_INP_INFO_WUNLOCK();
 	return (error);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 20:35:19 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9685E10656D5
	for <svn-src-head@freebsd.org>; Tue,  3 Feb 2009 20:35:19 +0000 (UTC)
	(envelope-from christoph.mallon@gmx.de)
Received: from mail.gmx.net (mail.gmx.net [213.165.64.20])
	by mx1.freebsd.org (Postfix) with SMTP id D088B8FC25
	for <svn-src-head@freebsd.org>; Tue,  3 Feb 2009 20:35:18 +0000 (UTC)
	(envelope-from christoph.mallon@gmx.de)
Received: (qmail invoked by alias); 03 Feb 2009 20:35:14 -0000
Received: from p54A3EB73.dip.t-dialin.net (EHLO tron.homeunix.org)
	[84.163.235.115]
	by mail.gmx.net (mp058) with SMTP; 03 Feb 2009 21:35:14 +0100
X-Authenticated: #1673122
X-Provags-ID: V01U2FsdGVkX19WAwdbyS1WQwlfl7wGwLpD3Rnt11QSYxb0UABaHc
	gw0/hxfL9iINCF
Message-ID: <4988AA81.6010903@gmx.de>
Date: Tue, 03 Feb 2009 21:35:13 +0100
From: Christoph Mallon <christoph.mallon@gmx.de>
User-Agent: Thunderbird 2.0.0.19 (X11/20090103)
MIME-Version: 1.0
To: Warner Losh <imp@FreeBSD.org>
References: <200902032025.n13KPaCV041012@svn.freebsd.org>
In-Reply-To: <200902032025.n13KPaCV041012@svn.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Y-GMX-Trusted: 0
X-FuHaFi: 0.54
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r188098 - head/lib/libc/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 20:35:20 -0000

Warner Losh schrieb:
> Author: imp
> Date: Tue Feb  3 20:25:36 2009
> New Revision: 188098
> URL: http://svn.freebsd.org/changeset/base/188098
> 
> Log:
>   Fix the functions to match prototypes.  The K&R definitions differ
>   from the ANSI-C prototype due to the 'int promotion' rule.
> 
> Modified:
>   head/lib/libc/string/memchr.c
>   head/lib/libc/string/strmode.c
>   head/lib/libc/string/wmemset.c
> 
> Modified: head/lib/libc/string/memchr.c
> ==============================================================================
> --- head/lib/libc/string/memchr.c	Tue Feb  3 20:01:51 2009	(r188097)
> +++ head/lib/libc/string/memchr.c	Tue Feb  3 20:25:36 2009	(r188098)
> @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
>  #include <string.h>
>  
>  void *
> -memchr(const void *s, unsigned char c, size_t n)
> +memchr(const void *s, int c, size_t n)
>  {
>  	if (n != 0) {
>  		const unsigned char *p = s;
> 

This is not correct either, because now *p (of type unsigned char) gets 
compared with c (now type int). The manpage of memchr() states that

"The memchr() function locates the first occurrence of c (converted to 
an unsigned char) in string b."

The part in parentheses now is missing. This will break when you pass a 
negative number (e.g. -1, which should locate a byte with all bits set) 
to memchr().

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 20:39:34 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 37F1A1065677
	for <svn-src-head@freebsd.org>; Tue,  3 Feb 2009 20:39:34 +0000 (UTC)
	(envelope-from christoph.mallon@gmx.de)
Received: from mail.gmx.net (mail.gmx.net [213.165.64.20])
	by mx1.freebsd.org (Postfix) with SMTP id 722A48FC29
	for <svn-src-head@freebsd.org>; Tue,  3 Feb 2009 20:39:32 +0000 (UTC)
	(envelope-from christoph.mallon@gmx.de)
Received: (qmail invoked by alias); 03 Feb 2009 20:39:31 -0000
Received: from p54A3EB73.dip.t-dialin.net (EHLO tron.homeunix.org)
	[84.163.235.115]
	by mail.gmx.net (mp020) with SMTP; 03 Feb 2009 21:39:31 +0100
X-Authenticated: #1673122
X-Provags-ID: V01U2FsdGVkX1+Q9Vtcfp+QQef9XNrNniRuyzJSg+PJC4SUIYTdd0
	zFWtvTwpm3M/mn
Message-ID: <4988AB83.2050203@gmx.de>
Date: Tue, 03 Feb 2009 21:39:31 +0100
From: Christoph Mallon <christoph.mallon@gmx.de>
User-Agent: Thunderbird 2.0.0.19 (X11/20090103)
MIME-Version: 1.0
To: Warner Losh <imp@FreeBSD.org>
References: <200902032025.n13KPaCV041012@svn.freebsd.org>
In-Reply-To: <200902032025.n13KPaCV041012@svn.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Y-GMX-Trusted: 0
X-FuHaFi: 0.55
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r188098 - head/lib/libc/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 20:39:34 -0000

Warner Losh schrieb:
> Author: imp
> Date: Tue Feb  3 20:25:36 2009
> New Revision: 188098
> URL: http://svn.freebsd.org/changeset/base/188098
> 
> Log:
>   Fix the functions to match prototypes.  The K&R definitions differ
>   from the ANSI-C prototype due to the 'int promotion' rule.
> 
> Modified:
>   head/lib/libc/string/memchr.c
>   head/lib/libc/string/strmode.c
>   head/lib/libc/string/wmemset.c
[...]
> Modified: head/lib/libc/string/strmode.c
> ==============================================================================
> --- head/lib/libc/string/strmode.c	Tue Feb  3 20:01:51 2009	(r188097)
> +++ head/lib/libc/string/strmode.c	Tue Feb  3 20:25:36 2009	(r188098)
> @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
>  #include <string.h>
>  
>  void
> -strmode(mode_t mode, char *p)
> +strmode(/* mode_t */ int mode, char *p)
>  {
>  	 /* print type */
>  	switch (mode & S_IFMT) {

The manpage states that the first parameter of strmode() is a mode_t. 
What's wrong - the implementation (both in header and definition) or the 
documentation?

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 20:43:42 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E16A7106566C;
	Tue,  3 Feb 2009 20:43:42 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 9DB558FC13;
	Tue,  3 Feb 2009 20:43:42 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n13KfGWl048518;
	Tue, 3 Feb 2009 13:41:16 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Tue, 03 Feb 2009 13:41:42 -0700 (MST)
Message-Id: <20090203.134142.-2002504318.imp@bsdimp.com>
To: christoph.mallon@gmx.de
From: "M. Warner Losh" <imp@bsdimp.com>
In-Reply-To: <4988AA81.6010903@gmx.de>
References: <200902032025.n13KPaCV041012@svn.freebsd.org>
	<4988AA81.6010903@gmx.de>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r188098 - head/lib/libc/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 20:43:43 -0000

In message: <4988AA81.6010903@gmx.de>
            Christoph Mallon <christoph.mallon@gmx.de> writes:
: Warner Losh schrieb:
: > Author: imp
: > Date: Tue Feb  3 20:25:36 2009
: > New Revision: 188098
: > URL: http://svn.freebsd.org/changeset/base/188098
: > 
: > Log:
: >   Fix the functions to match prototypes.  The K&R definitions differ
: >   from the ANSI-C prototype due to the 'int promotion' rule.
: > 
: > Modified:
: >   head/lib/libc/string/memchr.c
: >   head/lib/libc/string/strmode.c
: >   head/lib/libc/string/wmemset.c
: > 
: > Modified: head/lib/libc/string/memchr.c
: > ==============================================================================
: > --- head/lib/libc/string/memchr.c	Tue Feb  3 20:01:51 2009	(r188097)
: > +++ head/lib/libc/string/memchr.c	Tue Feb  3 20:25:36 2009	(r188098)
: > @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
: >  #include <string.h>
: >  
: >  void *
: > -memchr(const void *s, unsigned char c, size_t n)
: > +memchr(const void *s, int c, size_t n)
: >  {
: >  	if (n != 0) {
: >  		const unsigned char *p = s;
: > 
: 
: This is not correct either, because now *p (of type unsigned char) gets 
: compared with c (now type int). The manpage of memchr() states that
: 
: "The memchr() function locates the first occurrence of c (converted to 
: an unsigned char) in string b."
: 
: The part in parentheses now is missing. This will break when you pass a 
: negative number (e.g. -1, which should locate a byte with all bits set) 
: to memchr().

I was just trying to fix the build...  I'll look into the issues
here.  There's likely some missing casts.

Warner

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 20:46:05 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 70D48106568F;
	Tue,  3 Feb 2009 20:46:05 +0000 (UTC)
	(envelope-from gabor@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5D3148FC1C;
	Tue,  3 Feb 2009 20:46:05 +0000 (UTC)
	(envelope-from gabor@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13Kk5dn041529;
	Tue, 3 Feb 2009 20:46:05 GMT (envelope-from gabor@svn.freebsd.org)
Received: (from gabor@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13Kk5sl041527;
	Tue, 3 Feb 2009 20:46:05 GMT (envelope-from gabor@svn.freebsd.org)
Message-Id: <200902032046.n13Kk5sl041527@svn.freebsd.org>
From: Gabor Kovesdan <gabor@FreeBSD.org>
Date: Tue, 3 Feb 2009 20:46:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188102 - head
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 20:46:06 -0000

Author: gabor (doc,ports committer)
Date: Tue Feb  3 20:46:05 2009
New Revision: 188102
URL: http://svn.freebsd.org/changeset/base/188102

Log:
  Reflect adding_user.8 -> adding_user.7 rename
  
  Reminded by:	kib

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc	Tue Feb  3 20:37:38 2009	(r188101)
+++ head/ObsoleteFiles.inc	Tue Feb  3 20:46:05 2009	(r188102)
@@ -14,6 +14,8 @@
 # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
 #
 
+# 20090203: adding_user.8 moved to adding_user.7
+OLD_FILES+=usr/share/man/man8/adding_user.8.gz
 # 20090122: tzdata2009a import
 OLD_FILES+=usr/share/zoneinfo/Asia/Katmandu
 # 20090102: file 4.26 import

From owner-svn-src-head@FreeBSD.ORG  Tue Feb  3 22:32:26 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B4F4A106566B;
	Tue,  3 Feb 2009 22:32:26 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 88C4B8FC0A;
	Tue,  3 Feb 2009 22:32:26 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n13MWQuJ044103;
	Tue, 3 Feb 2009 22:32:26 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n13MWQpm044102;
	Tue, 3 Feb 2009 22:32:26 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902032232.n13MWQpm044102@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Tue, 3 Feb 2009 22:32:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188106 - head/sys/net80211
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Feb 2009 22:32:27 -0000

Author: sam
Date: Tue Feb  3 22:32:26 2009
New Revision: 188106
URL: http://svn.freebsd.org/changeset/base/188106

Log:
  When crafting a media setting w/ an auto (non-fixed) rate mask out the
  turbo option in addition to the mode bits; otherwise if the current
  channel is a turbo mode channel we'll form an invalid media setting
  and the ifmedia_set operation in vap_attach will panic.
  
  While here use C99-style initialization for an array indexed by mode;
  this makes it consistent w/ other usage and avoids breakage if we
  should ever change the set of modes.

Modified:
  head/sys/net80211/ieee80211.c

Modified: head/sys/net80211/ieee80211.c
==============================================================================
--- head/sys/net80211/ieee80211.c	Tue Feb  3 22:22:07 2009	(r188105)
+++ head/sys/net80211/ieee80211.c	Tue Feb  3 22:32:26 2009	(r188106)
@@ -472,7 +472,8 @@ ieee80211_vap_attach(struct ieee80211vap
 	    vap->iv_opmode == IEEE80211_M_STA, media_change, media_stat);
 	ieee80211_media_status(ifp, &imr);
 	/* NB: strip explicit mode; we're actually in autoselect */
-	ifmedia_set(&vap->iv_media, imr.ifm_active &~ IFM_MMASK);
+	ifmedia_set(&vap->iv_media,
+	    imr.ifm_active &~ (IFM_MMASK | IFM_IEEE80211_TURBO));
 	if (maxrate)
 		ifp->if_baudrate = IF_Mbps(maxrate);
 
@@ -857,16 +858,16 @@ addmedia(struct ifmedia *media, int caps
 	ifmedia_add(media, \
 		IFM_MAKEWORD(IFM_IEEE80211, (_s), (_o), 0), 0, NULL)
 	static const u_int mopts[IEEE80211_MODE_MAX] = { 
-		IFM_AUTO,
-		IFM_IEEE80211_11A,
-		IFM_IEEE80211_11B,
-		IFM_IEEE80211_11G,
-		IFM_IEEE80211_FH,
-		IFM_IEEE80211_11A | IFM_IEEE80211_TURBO,
-		IFM_IEEE80211_11G | IFM_IEEE80211_TURBO,
-		IFM_IEEE80211_11A | IFM_IEEE80211_TURBO,
-		IFM_IEEE80211_11NA,
-		IFM_IEEE80211_11NG,
+	    [IEEE80211_MODE_AUTO]	= IFM_AUTO,
+	    [IEEE80211_MODE_11A]	= IFM_IEEE80211_11A,
+	    [IEEE80211_MODE_11B]	= IFM_IEEE80211_11B,
+	    [IEEE80211_MODE_11G]	= IFM_IEEE80211_11G,
+	    [IEEE80211_MODE_FH]		= IFM_IEEE80211_FH,
+	    [IEEE80211_MODE_TURBO_A]	= IFM_IEEE80211_11A|IFM_IEEE80211_TURBO,
+	    [IEEE80211_MODE_TURBO_G]	= IFM_IEEE80211_11G|IFM_IEEE80211_TURBO,
+	    [IEEE80211_MODE_STURBO_A]	= IFM_IEEE80211_11A|IFM_IEEE80211_TURBO,
+	    [IEEE80211_MODE_11NA]	= IFM_IEEE80211_11NA,
+	    [IEEE80211_MODE_11NG]	= IFM_IEEE80211_11NG,
 	};
 	u_int mopt;
 
@@ -996,7 +997,8 @@ ieee80211_media_init(struct ieee80211com
 		ieee80211com_media_change, ieee80211com_media_status);
 	/* NB: strip explicit mode; we're actually in autoselect */
 	ifmedia_set(&ic->ic_media,
-		media_status(ic->ic_opmode, ic->ic_curchan) &~ IFM_MMASK);
+	    media_status(ic->ic_opmode, ic->ic_curchan) &~
+		(IFM_MMASK | IFM_IEEE80211_TURBO));
 	if (maxrate)
 		ifp->if_baudrate = IF_Mbps(maxrate);
 

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 01:02:57 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DD1DA1065673;
	Wed,  4 Feb 2009 01:02:56 +0000 (UTC)
	(envelope-from mckusick@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C98988FC21;
	Wed,  4 Feb 2009 01:02:56 +0000 (UTC)
	(envelope-from mckusick@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1412ulW047521;
	Wed, 4 Feb 2009 01:02:56 GMT (envelope-from mckusick@svn.freebsd.org)
Received: (from mckusick@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1412u40047515;
	Wed, 4 Feb 2009 01:02:56 GMT (envelope-from mckusick@svn.freebsd.org)
Message-Id: <200902040102.n1412u40047515@svn.freebsd.org>
From: Kirk McKusick <mckusick@FreeBSD.org>
Date: Wed, 4 Feb 2009 01:02:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188110 - head/sbin/fsck_ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 01:02:57 -0000

Author: mckusick
Date: Wed Feb  4 01:02:56 2009
New Revision: 188110
URL: http://svn.freebsd.org/changeset/base/188110

Log:
  Update the actions previously attempted by the -D option to make them
  robust. With these changes fsck is now able to detect and reliably
  rebuild corrupted cylinder group maps. The -D option is no longer
  necessary as it has been replaced by a prompt asking whether the
  corrupted cylinder group should be rebuilt and doing so when requested.
  These actions are only offered and taken when running fsck in manual
  mode. Corrupted cylinder groups found during preen mode cause the fsck
  to fail.
  
  Add the -r option to free up excess unused inodes. Decreasing the
  number of preallocated inodes reduces the running time of future
  runs of fsck and frees up space that can allocated to files. The -r
  option is ignored when running in preen mode.
  
  Reviewed by: Xin LI <delphij@>
  Sponsored by: Rsync.net

Modified:
  head/sbin/fsck_ffs/fsck.h
  head/sbin/fsck_ffs/fsck_ffs.8
  head/sbin/fsck_ffs/fsutil.c
  head/sbin/fsck_ffs/inode.c
  head/sbin/fsck_ffs/main.c
  head/sbin/fsck_ffs/pass1.c

Modified: head/sbin/fsck_ffs/fsck.h
==============================================================================
--- head/sbin/fsck_ffs/fsck.h	Wed Feb  4 00:45:25 2009	(r188109)
+++ head/sbin/fsck_ffs/fsck.h	Wed Feb  4 01:02:56 2009	(r188110)
@@ -270,7 +270,7 @@ char	yflag;			/* assume a yes response *
 int	bkgrdflag;		/* use a snapshot to run on an active system */
 int	bflag;			/* location of alternate super block */
 int	debug;			/* output debugging info */
-char	damagedflag;		/* run in damaged mode */
+int	inoopt;			/* trim out unused inodes */
 char	ckclean;		/* only do work if not cleanly unmounted */
 int	cvtlevel;		/* convert to newer file system format */
 int	bkgrdcheck;		/* determine if background check is possible */
@@ -337,7 +337,7 @@ void		cacheino(union dinode *dp, ino_t i
 void		catch(int);
 void		catchquit(int);
 int		changeino(ino_t dir, const char *name, ino_t newnum);
-void		check_cgmagic(int cg, struct cg *cgp);
+int		check_cgmagic(int cg, struct cg *cgp);
 int		chkrange(ufs2_daddr_t blk, int cnt);
 void		ckfini(int markclean);
 int		ckinode(union dinode *dp, struct inodesc *);
@@ -362,7 +362,7 @@ int		ftypeok(union dinode *dp);
 void		getblk(struct bufarea *bp, ufs2_daddr_t blk, long size);
 struct bufarea *getdatablk(ufs2_daddr_t blkno, long size);
 struct inoinfo *getinoinfo(ino_t inumber);
-union dinode   *getnextinode(ino_t inumber);
+union dinode   *getnextinode(ino_t inumber, int rebuildcg);
 void		getpathname(char *namebuf, ino_t curdir, ino_t ino);
 union dinode   *ginode(ino_t inumber);
 void		infohandler(int sig);

Modified: head/sbin/fsck_ffs/fsck_ffs.8
==============================================================================
--- head/sbin/fsck_ffs/fsck_ffs.8	Wed Feb  4 00:45:25 2009	(r188109)
+++ head/sbin/fsck_ffs/fsck_ffs.8	Wed Feb  4 01:02:56 2009	(r188110)
@@ -38,7 +38,7 @@
 .Nd file system consistency check and interactive repair
 .Sh SYNOPSIS
 .Nm
-.Op Fl BDFpfny
+.Op Fl BFprfny
 .Op Fl b Ar block
 .Op Fl c Ar level
 .Op Fl m Ar mode
@@ -216,22 +216,6 @@ are being converted at once.
 The format of a file system can be determined from the
 first line of output from
 .Xr dumpfs 8 .
-.It Fl D
-Run
-.Nm
-in 'damaged recovery' mode, which will enable certain aggressive
-operations that can make
-.Nm
-to survive with file systems that has very serious data damage, which
-is an useful last resort when on disk data damage is very serious
-and causes
-.Nm
-to crash otherwise.  Be
-.Em very careful
-using this flag, it is dangerous if there are data transmission hazards
-because a false positive cylinder group magic number mismatch could
-cause
-.Em irrevertible data loss!
 .Pp
 This option implies the
 .Fl f
@@ -259,6 +243,15 @@ which is assumed to be affirmative;
 do not open the file system for writing.
 .It Fl p
 Preen file systems (see above).
+.It Fl r
+Free up excess unused inodes.
+Decreasing the number of preallocated inodes reduces the
+running time of future runs of
+.Nm
+and frees up space that can allocated to files.
+The
+.Fl r
+option is ignored when running in preen mode.
 .It Fl y
 Assume a yes response to all questions asked by
 .Nm ;

Modified: head/sbin/fsck_ffs/fsutil.c
==============================================================================
--- head/sbin/fsck_ffs/fsutil.c	Wed Feb  4 00:45:25 2009	(r188109)
+++ head/sbin/fsck_ffs/fsutil.c	Wed Feb  4 01:02:56 2009	(r188110)
@@ -333,9 +333,13 @@ ckfini(int markclean)
 			if (!markclean)
 				rerun = 1;
 		}
-	} else if (!preen && !markclean) {
-		printf("\n***** FILE SYSTEM STILL DIRTY *****\n");
-		rerun = 1;
+	} else if (!preen) {
+		if (markclean) {
+			printf("\n***** FILE SYSTEM IS CLEAN *****\n");
+		} else {
+			printf("\n***** FILE SYSTEM STILL DIRTY *****\n");
+			rerun = 1;
+		}
 	}
 	if (debug && totalreads > 0)
 		printf("cache missed %ld of %ld (%d%%)\n", diskreads,
@@ -418,32 +422,73 @@ blwrite(int fd, char *buf, ufs2_daddr_t 
 }
 
 /*
- * Check cg's magic number.  If catastrophic mode is enabled and the cg's
- * magic number is bad, offer an option to clear the whole cg.
+ * Verify cylinder group's magic number and other parameters.  If the
+ * test fails, offer an option to rebuild the whole cylinder group.
  */
-void
+int
 check_cgmagic(int cg, struct cg *cgp)
 {
 
-	if (!cg_chkmagic(cgp)) {
-	    pwarn("CG %d: BAD MAGIC NUMBER\n", cg);
-	    if (damagedflag) {
-		if (reply("CLEAR CG")) {
-			memset(cgp, 0, (size_t)sblock.fs_cgsize);
-			cgp->cg_initediblk = sblock.fs_ipg;
-			cgp->cg_old_niblk = sblock.fs_ipg;
-			cgp->cg_old_ncyl = sblock.fs_old_cpg;
-			cgp->cg_cgx = cg;
-			cgp->cg_niblk = sblock.fs_ipg;
-			cgp->cg_ndblk = sblock.fs_size - cgbase(&sblock, cg);
-			cgp->cg_magic = CG_MAGIC;
-			cgdirty();
-			printf("PLEASE RERUN FSCK.\n");
-			rerun = 1;
-		}
-	    } else
-		printf("YOU MAY NEED TO RERUN FSCK WITH -D IF IT CRASHED.\n");
+	/*
+	 * Extended cylinder group checks.
+	 */
+	if (cg_chkmagic(cgp) &&
+	    ((sblock.fs_magic == FS_UFS1_MAGIC &&
+	      cgp->cg_old_niblk == sblock.fs_ipg &&
+	      cgp->cg_ndblk <= sblock.fs_fpg &&
+	      cgp->cg_old_ncyl == sblock.fs_old_cpg) ||
+	     (sblock.fs_magic == FS_UFS2_MAGIC &&
+	      cgp->cg_niblk == sblock.fs_ipg &&
+	      cgp->cg_ndblk <= sblock.fs_fpg &&
+	      cgp->cg_initediblk <= sblock.fs_ipg))) {
+		return (1);
+	}
+	pfatal("CYLINDER GROUP %d: BAD MAGIC NUMBER", cg);
+	if (!reply("REBUILD CYLINDER GROUP")) {
+		printf("YOU WILL NEED TO RERUN FSCK.\n");
+		rerun = 1;
+		return (1);
 	}
+	/*
+	 * Zero out the cylinder group and then initialize critical fields.
+	 * Bit maps and summaries will be recalculated by later passes.
+	 */
+	memset(cgp, 0, (size_t)sblock.fs_cgsize);
+	cgp->cg_magic = CG_MAGIC;
+	cgp->cg_cgx = cg;
+	cgp->cg_niblk = sblock.fs_ipg;
+	cgp->cg_initediblk = sblock.fs_ipg < 2 * INOPB(&sblock) ?
+	    sblock.fs_ipg : 2 * INOPB(&sblock);
+	if (cgbase(&sblock, cg) + sblock.fs_fpg < sblock.fs_size)
+		cgp->cg_ndblk = sblock.fs_fpg;
+	else
+		cgp->cg_ndblk = sblock.fs_size - cgbase(&sblock, cg);
+	cgp->cg_iusedoff = &cgp->cg_space[0] - (u_char *)(&cgp->cg_firstfield);
+	if (sblock.fs_magic == FS_UFS1_MAGIC) {
+		cgp->cg_niblk = 0;
+		cgp->cg_initediblk = 0;
+		cgp->cg_old_ncyl = sblock.fs_old_cpg;
+		cgp->cg_old_niblk = sblock.fs_ipg;
+		cgp->cg_old_btotoff = cgp->cg_iusedoff;
+		cgp->cg_old_boff = cgp->cg_old_btotoff +
+		    sblock.fs_old_cpg * sizeof(int32_t);
+		cgp->cg_iusedoff = cgp->cg_old_boff +
+		    sblock.fs_old_cpg * sizeof(u_int16_t);
+	}
+	cgp->cg_freeoff = cgp->cg_iusedoff + howmany(sblock.fs_ipg, CHAR_BIT);
+	cgp->cg_nextfreeoff = cgp->cg_freeoff + howmany(sblock.fs_fpg,CHAR_BIT);
+	if (sblock.fs_contigsumsize > 0) {
+		cgp->cg_nclusterblks = cgp->cg_ndblk / sblock.fs_frag;
+		cgp->cg_clustersumoff =
+		    roundup(cgp->cg_nextfreeoff, sizeof(u_int32_t));
+		cgp->cg_clustersumoff -= sizeof(u_int32_t);
+		cgp->cg_clusteroff = cgp->cg_clustersumoff +
+		    (sblock.fs_contigsumsize + 1) * sizeof(u_int32_t);
+		cgp->cg_nextfreeoff = cgp->cg_clusteroff +
+		    howmany(fragstoblks(&sblock, sblock.fs_fpg), CHAR_BIT);
+	}
+	cgdirty();
+	return (0);
 }
 
 /*
@@ -470,7 +515,8 @@ allocblk(long frags)
 			}
 			cg = dtog(&sblock, i + j);
 			getblk(&cgblk, cgtod(&sblock, cg), sblock.fs_cgsize);
-			check_cgmagic(cg, cgp);
+			if (!check_cgmagic(cg, cgp))
+				return (0);
 			baseblk = dtogd(&sblock, i + j);
 			for (k = 0; k < frags; k++) {
 				setbmap(i + j + k);

Modified: head/sbin/fsck_ffs/inode.c
==============================================================================
--- head/sbin/fsck_ffs/inode.c	Wed Feb  4 00:45:25 2009	(r188109)
+++ head/sbin/fsck_ffs/inode.c	Wed Feb  4 01:02:56 2009	(r188110)
@@ -309,10 +309,12 @@ static long readcnt, readpercg, fullcnt,
 static caddr_t inodebuf;
 
 union dinode *
-getnextinode(ino_t inumber)
+getnextinode(ino_t inumber, int rebuildcg)
 {
+	int j;
 	long size;
-	ufs2_daddr_t dblk;
+	mode_t mode;
+	ufs2_daddr_t ndb, dblk;
 	union dinode *dp;
 	static caddr_t nextinop;
 
@@ -336,6 +338,54 @@ getnextinode(ino_t inumber)
 		nextinop = inodebuf;
 	}
 	dp = (union dinode *)nextinop;
+	if (rebuildcg && nextinop == inodebuf) {
+		/*
+		 * Try to determine if we have reached the end of the
+		 * allocated inodes.
+		 */
+		mode = DIP(dp, di_mode) & IFMT;
+		if (mode == 0) {
+			if (memcmp(dp->dp2.di_db, ufs2_zino.di_db,
+				NDADDR * sizeof(ufs2_daddr_t)) ||
+			      memcmp(dp->dp2.di_ib, ufs2_zino.di_ib,
+				NIADDR * sizeof(ufs2_daddr_t)) ||
+			      dp->dp2.di_mode || dp->dp2.di_size)
+				return (NULL);
+			goto inodegood;
+		}
+		if (!ftypeok(dp))
+			return (NULL);
+		ndb = howmany(DIP(dp, di_size), sblock.fs_bsize);
+		if (ndb < 0)
+			return (NULL);
+		if (mode == IFBLK || mode == IFCHR)
+			ndb++;
+		if (mode == IFLNK) {
+			/*
+			 * Fake ndb value so direct/indirect block checks below
+			 * will detect any garbage after symlink string.
+			 */
+			if (DIP(dp, di_size) < (off_t)sblock.fs_maxsymlinklen) {
+				ndb = howmany(DIP(dp, di_size),
+				    sizeof(ufs2_daddr_t));
+				if (ndb > NDADDR) {
+					j = ndb - NDADDR;
+					for (ndb = 1; j > 1; j--)
+						ndb *= NINDIR(&sblock);
+					ndb += NDADDR;
+				}
+			}
+		}
+		for (j = ndb; ndb < NDADDR && j < NDADDR; j++)
+			if (DIP(dp, di_db[j]) != 0)
+				return (NULL);
+		for (j = 0, ndb -= NDADDR; ndb > 0; j++)
+			ndb /= NINDIR(&sblock);
+		for (; j < NIADDR; j++)
+			if (DIP(dp, di_ib[j]) != 0)
+				return (NULL);
+	}
+inodegood:
 	if (sblock.fs_magic == FS_UFS1_MAGIC)
 		nextinop += sizeof(struct ufs1_dinode);
 	else
@@ -617,7 +667,8 @@ allocino(ino_t request, int type)
 		return (0);
 	cg = ino_to_cg(&sblock, ino);
 	getblk(&cgblk, cgtod(&sblock, cg), sblock.fs_cgsize);
-	check_cgmagic(cg, cgp);
+	if (!check_cgmagic(cg, cgp))
+		return (0);
 	setbit(cg_inosused(cgp), ino % sblock.fs_ipg);
 	cgp->cg_cs.cs_nifree--;
 	switch (type & IFMT) {

Modified: head/sbin/fsck_ffs/main.c
==============================================================================
--- head/sbin/fsck_ffs/main.c	Wed Feb  4 00:45:25 2009	(r188109)
+++ head/sbin/fsck_ffs/main.c	Wed Feb  4 01:02:56 2009	(r188110)
@@ -81,8 +81,8 @@ main(int argc, char *argv[])
 
 	sync();
 	skipclean = 1;
-	damagedflag = 0;
-	while ((ch = getopt(argc, argv, "b:Bc:CdDfFm:npy")) != -1) {
+	inoopt = 0;
+	while ((ch = getopt(argc, argv, "b:Bc:CdfFm:npry")) != -1) {
 		switch (ch) {
 		case 'b':
 			skipclean = 0;
@@ -106,10 +106,6 @@ main(int argc, char *argv[])
 			debug++;
 			break;
 
-		case 'D':
-			damagedflag = 1;
-			/* FALLTHROUGH */
-
 		case 'f':
 			skipclean = 0;
 			break;
@@ -138,6 +134,10 @@ main(int argc, char *argv[])
 			ckclean++;
 			break;
 
+		case 'r':
+			inoopt++;
+			break;
+
 		case 'y':
 			yflag++;
 			nflag = 0;
@@ -606,7 +606,7 @@ static void
 usage(void)
 {
         (void) fprintf(stderr,
-            "usage: %s [-BCFpfny] [-b block] [-c level] [-m mode] "
+            "usage: %s [-BFprfny] [-b block] [-c level] [-m mode] "
                         "filesystem ...\n",
             getprogname());
         exit(1);

Modified: head/sbin/fsck_ffs/pass1.c
==============================================================================
--- head/sbin/fsck_ffs/pass1.c	Wed Feb  4 00:45:25 2009	(r188109)
+++ head/sbin/fsck_ffs/pass1.c	Wed Feb  4 01:02:56 2009	(r188110)
@@ -54,17 +54,17 @@ static ufs2_daddr_t badblk;
 static ufs2_daddr_t dupblk;
 static ino_t lastino;		/* last inode in use */
 
-static void checkinode(ino_t inumber, struct inodesc *);
+static int checkinode(ino_t inumber, struct inodesc *, int rebuildcg);
 
 void
 pass1(void)
 {
 	struct inostat *info;
 	struct inodesc idesc;
-	ino_t inumber, inosused;
+	ino_t inumber, inosused, mininos;
 	ufs2_daddr_t i, cgd;
 	u_int8_t *cp;
-	int c;
+	int c, rebuildcg;
 
 	/*
 	 * Set file system reserved blocks in used block map.
@@ -93,7 +93,10 @@ pass1(void)
 		inumber = c * sblock.fs_ipg;
 		setinodebuf(inumber);
 		getblk(&cgblk, cgtod(&sblock, c), sblock.fs_cgsize);
-		if (sblock.fs_magic == FS_UFS2_MAGIC) {
+		rebuildcg = 0;
+		if (!check_cgmagic(c, &cgrp))
+			rebuildcg = 1;
+		if (!rebuildcg && sblock.fs_magic == FS_UFS2_MAGIC) {
 			inosused = cgrp.cg_initediblk;
 			if (inosused > sblock.fs_ipg)
 				inosused = sblock.fs_ipg;
@@ -117,9 +120,7 @@ pass1(void)
 		 * to find the inodes that are really in use, and then
 		 * read only those inodes in from disk.
 		 */
-		if (preen && usedsoftdep) {
-			if (!cg_chkmagic(&cgrp))
-				pfatal("CG %d: BAD MAGIC NUMBER\n", c);
+		if ((preen || inoopt) && usedsoftdep && !rebuildcg) {
 			cp = &cg_inosused(&cgrp)[(inosused - 1) / CHAR_BIT];
 			for ( ; inosused > 0; inosused -= CHAR_BIT, cp--) {
 				if (*cp == 0)
@@ -152,24 +153,60 @@ pass1(void)
 		 */
 		for (i = 0; i < inosused; i++, inumber++) {
 			if (inumber < ROOTINO) {
-				(void)getnextinode(inumber);
+				(void)getnextinode(inumber, rebuildcg);
 				continue;
 			}
-			checkinode(inumber, &idesc);
+			/*
+			 * NULL return indicates probable end of allocated
+			 * inodes during cylinder group rebuild attempt.
+			 * We always keep trying until we get to the minimum
+			 * valid number for this cylinder group.
+			 */
+			if (checkinode(inumber, &idesc, rebuildcg) == 0 &&
+			    i > cgrp.cg_initediblk)
+				break;
 		}
-		lastino += 1;
-		if (inosused < sblock.fs_ipg || inumber == lastino)
+		/*
+		 * This optimization speeds up future runs of fsck
+		 * by trimming down the number of inodes in cylinder
+		 * groups that formerly had many inodes but now have
+		 * fewer in use.
+		 */
+		mininos = roundup(inosused + INOPB(&sblock), INOPB(&sblock));
+		if (inoopt && !preen && !rebuildcg &&
+		    sblock.fs_magic == FS_UFS2_MAGIC &&
+		    cgrp.cg_initediblk > 2 * INOPB(&sblock) &&
+		    mininos < cgrp.cg_initediblk) {
+			i = cgrp.cg_initediblk;
+			if (mininos < 2 * INOPB(&sblock))
+				cgrp.cg_initediblk = 2 * INOPB(&sblock);
+			else
+				cgrp.cg_initediblk = mininos;
+			pwarn("CYLINDER GROUP %d: RESET FROM %ju TO %d %s\n",
+			    c, i, cgrp.cg_initediblk, "VALID INODES");
+			cgdirty();
+		}
+		if (inosused < sblock.fs_ipg)
 			continue;
+		lastino += 1;
+		if (lastino < (c * sblock.fs_ipg))
+			inosused = 0;
+		else
+			inosused = lastino - (c * sblock.fs_ipg);
+		if (rebuildcg && inosused > cgrp.cg_initediblk &&
+		    sblock.fs_magic == FS_UFS2_MAGIC) {
+			cgrp.cg_initediblk = roundup(inosused, INOPB(&sblock));
+			pwarn("CYLINDER GROUP %d: FOUND %d VALID INODES\n", c,
+			    cgrp.cg_initediblk);
+		}
 		/*
 		 * If we were not able to determine in advance which inodes
 		 * were in use, then reduce the size of the inoinfo structure
 		 * to the size necessary to describe the inodes that we
 		 * really found.
 		 */
-		if (lastino < (c * sblock.fs_ipg))
-			inosused = 0;
-		else
-			inosused = lastino - (c * sblock.fs_ipg);
+		if (inumber == lastino)
+			continue;
 		inostathead[c].il_numalloced = inosused;
 		if (inosused == 0) {
 			free(inostathead[c].il_stat);
@@ -187,8 +224,8 @@ pass1(void)
 	freeinodebuf();
 }
 
-static void
-checkinode(ino_t inumber, struct inodesc *idesc)
+static int
+checkinode(ino_t inumber, struct inodesc *idesc, int rebuildcg)
 {
 	union dinode *dp;
 	off_t kernmaxfilesize;
@@ -196,7 +233,8 @@ checkinode(ino_t inumber, struct inodesc
 	mode_t mode;
 	int j, ret, offset;
 
-	dp = getnextinode(inumber);
+	if ((dp = getnextinode(inumber, rebuildcg)) == NULL)
+		return (0);
 	mode = DIP(dp, di_mode) & IFMT;
 	if (mode == 0) {
 		if ((sblock.fs_magic == FS_UFS1_MAGIC &&
@@ -220,7 +258,7 @@ checkinode(ino_t inumber, struct inodesc
 			}
 		}
 		inoinfo(inumber)->ino_state = USTATE;
-		return;
+		return (1);
 	}
 	lastino = inumber;
 	/* This should match the file size limit in ffs_mountfs(). */
@@ -352,7 +390,7 @@ checkinode(ino_t inumber, struct inodesc
 		if (preen)
 			printf(" (CORRECTED)\n");
 		else if (reply("CORRECT") == 0)
-			return;
+			return (1);
 		if (bkgrdflag == 0) {
 			dp = ginode(inumber);
 			DIP_SET(dp, di_blocks, idesc->id_entryno);
@@ -368,7 +406,7 @@ checkinode(ino_t inumber, struct inodesc
 				rwerror("ADJUST INODE BLOCK COUNT", cmd.value);
 		}
 	}
-	return;
+	return (1);
 unknown:
 	pfatal("UNKNOWN FILE TYPE I=%lu", (u_long)inumber);
 	inoinfo(inumber)->ino_state = FCLEAR;
@@ -378,6 +416,7 @@ unknown:
 		clearinode(dp);
 		inodirty();
 	}
+	return (1);
 }
 
 int

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 01:14:06 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 955A9106564A;
	Wed,  4 Feb 2009 01:14:06 +0000 (UTC)
	(envelope-from cognet@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 830A58FC19;
	Wed,  4 Feb 2009 01:14:06 +0000 (UTC)
	(envelope-from cognet@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n141E6n7047839;
	Wed, 4 Feb 2009 01:14:06 GMT (envelope-from cognet@svn.freebsd.org)
Received: (from cognet@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n141E6mu047838;
	Wed, 4 Feb 2009 01:14:06 GMT (envelope-from cognet@svn.freebsd.org)
Message-Id: <200902040114.n141E6mu047838@svn.freebsd.org>
From: Olivier Houchard <cognet@FreeBSD.org>
Date: Wed, 4 Feb 2009 01:14:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188112 - head/sys/arm/arm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 01:14:07 -0000

Author: cognet
Date: Wed Feb  4 01:14:06 2009
New Revision: 188112
URL: http://svn.freebsd.org/changeset/base/188112

Log:
  Erm... Report the buffer as being bounced even when it's the entire buffer,
  or we would end up invalidating the cache line for what we just copied...
  
  Reported by:	thompsa
  Pointy at to:	cognet
  
  MFC after:	3 days

Modified:
  head/sys/arm/arm/busdma_machdep.c

Modified: head/sys/arm/arm/busdma_machdep.c
==============================================================================
--- head/sys/arm/arm/busdma_machdep.c	Wed Feb  4 01:11:37 2009	(r188111)
+++ head/sys/arm/arm/busdma_machdep.c	Wed Feb  4 01:14:06 2009	(r188112)
@@ -1168,7 +1168,7 @@ _bus_dma_buf_is_in_bp(bus_dmamap_t map, 
 
 	STAILQ_FOREACH(bpage, &map->bpages, links) {
 		if ((vm_offset_t)buf >= bpage->datavaddr &&
-		    (vm_offset_t)buf + len < bpage->datavaddr + 
+		    (vm_offset_t)buf + len <= bpage->datavaddr + 
 		    bpage->datacount)
 			return (1);
 	}

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 02:35:29 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D3334106564A;
	Wed,  4 Feb 2009 02:35:29 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com
	[66.111.4.28]) by mx1.freebsd.org (Postfix) with ESMTP id A1A9E8FC17;
	Wed,  4 Feb 2009 02:35:29 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from compute1.internal (compute1.internal [10.202.2.41])
	by out1.messagingengine.com (Postfix) with ESMTP id A3CF927DB6A;
	Tue,  3 Feb 2009 21:35:28 -0500 (EST)
Received: from heartbeat1.messagingengine.com ([10.202.2.160])
	by compute1.internal (MEProxy); Tue, 03 Feb 2009 21:35:28 -0500
X-Sasl-enc: 8iyTSoSLMnoC21O3+JDkiLP5rxxYHNm7sB8Otlh9ijSQ 1233714928
Received: from empiric.lon.incunabulum.net
	(82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254])
	by mail.messagingengine.com (Postfix) with ESMTPSA id F02B42E233;
	Tue,  3 Feb 2009 21:35:27 -0500 (EST)
Message-ID: <4988FEEE.1030800@FreeBSD.org>
Date: Wed, 04 Feb 2009 02:35:26 +0000
From: "Bruce M. Simpson" <bms@FreeBSD.org>
User-Agent: Thunderbird 2.0.0.19 (X11/20090126)
MIME-Version: 1.0
To: Sean Bruno <sbruno@FreeBSD.org>
References: <200902012328.n11NSqYG069209@svn.freebsd.org>
In-Reply-To: <200902012328.n11NSqYG069209@svn.freebsd.org>
X-Enigmail-Version: 0.95.6
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r187993 - head/sys/dev/firewire
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 02:35:31 -0000

This probably explains why fwcontrol -r often wouldn't actually reset 
the bus :-)

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 10:35:28 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 87833106564A;
	Wed,  4 Feb 2009 10:35:28 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 74C968FC16;
	Wed,  4 Feb 2009 10:35:28 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14AZS9I066481;
	Wed, 4 Feb 2009 10:35:28 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14AZS0q066480;
	Wed, 4 Feb 2009 10:35:28 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200902041035.n14AZS0q066480@svn.freebsd.org>
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: Wed, 4 Feb 2009 10:35:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188113 - head/sys/netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 10:35:29 -0000

Author: bz
Date: Wed Feb  4 10:35:27 2009
New Revision: 188113
URL: http://svn.freebsd.org/changeset/base/188113

Log:
  When iterating through the list trying to find a router in
  defrouter_select(), NULL the cached llentry after unlocking
  as we are no longer interested in it and with the second
  iteration would try to unlock it again resulting in
  panic: Lock (rw) lle not locked @ ...
  
  Reported by:	Mark Atkinson <m.atkinson@f5.com>
  Tested by:	Mark Atkinson <m.atkinson@f5.com>
  PR:		kern/128247 (in follow-up, unrelated to original report)

Modified:
  head/sys/netinet6/nd6_rtr.c

Modified: head/sys/netinet6/nd6_rtr.c
==============================================================================
--- head/sys/netinet6/nd6_rtr.c	Wed Feb  4 01:14:06 2009	(r188112)
+++ head/sys/netinet6/nd6_rtr.c	Wed Feb  4 10:35:27 2009	(r188113)
@@ -651,8 +651,10 @@ defrouter_select(void)
 			selected_dr = dr;
 		}
 		IF_AFDATA_UNLOCK(dr->ifp);
-		if (ln != NULL)
+		if (ln != NULL) {
 			LLE_RUNLOCK(ln);
+			ln = NULL;
+		}
 
 		if (dr->installed && installed_dr == NULL)
 			installed_dr = dr;

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 11:28:04 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5A896106566B;
	Wed,  4 Feb 2009 11:28:04 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail07.syd.optusnet.com.au (mail07.syd.optusnet.com.au
	[211.29.132.188])
	by mx1.freebsd.org (Postfix) with ESMTP id E6D708FC08;
	Wed,  4 Feb 2009 11:28:03 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from c122-107-120-227.carlnfd1.nsw.optusnet.com.au
	(c122-107-120-227.carlnfd1.nsw.optusnet.com.au [122.107.120.227])
	by mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	n14BRx1f020559
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Wed, 4 Feb 2009 22:28:01 +1100
Date: Wed, 4 Feb 2009 22:27:59 +1100 (EST)
From: Bruce Evans <brde@optusnet.com.au>
X-X-Sender: bde@delplex.bde.org
To: Christoph Mallon <christoph.mallon@gmx.de>
In-Reply-To: <4988AB83.2050203@gmx.de>
Message-ID: <20090204212854.F51932@delplex.bde.org>
References: <200902032025.n13KPaCV041012@svn.freebsd.org>
	<4988AB83.2050203@gmx.de>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Warner Losh <imp@freebsd.org>
Subject: Re: svn commit: r188098 - head/lib/libc/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 11:28:04 -0000

On Tue, 3 Feb 2009, Christoph Mallon wrote:

> Warner Losh schrieb:
>> Modified: head/lib/libc/string/strmode.c
>> ==============================================================================
>> --- head/lib/libc/string/strmode.c	Tue Feb  3 20:01:51 2009 
>> (r188097)
>> +++ head/lib/libc/string/strmode.c	Tue Feb  3 20:25:36 2009 
>> (r188098)
>> @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
>>  #include <string.h>
>>   void
>> -strmode(mode_t mode, char *p)
>> +strmode(/* mode_t */ int mode, char *p)
>>  {
>>  	 /* print type */
>>  	switch (mode & S_IFMT) {
>
> The manpage states that the first parameter of strmode() is a mode_t. What's 
> wrong - the implementation (both in header and definition) or the 
> documentation?

The man page is wrong.  strtomode() should take an int arg (actually
the default (unary) promotion of a mode_t) for the the same reasons
that memchr() does -- because these interfaces should be usable by K&R
compilers and/or by standard C compilers without a protoype in scope.
Even if this is no longer required, binary compatibily requires the
interfaces to be the same as the ones that used to be required.  The
requirement for binary compatibility also prevents "fixing" interfaces
to be "ANSI" in headers (if you "fix" prototypes there then you will
get obscure runtime errors instead of tinderbox errors).

mode_t causes even more problems on systems with 16-bit ints since its
default promotion is unsigned int.  Thus the correct declaration of
strmode() is machine-dependent.  Similarly for memchr() on systems
with sizeof(char) == sizeof(int).  Standard C doesn't support variant
interfaces so memchr() cannot work quite right on such systems.

This problem used to be much larger for POSIX.  POSIX.1-1988 didn't
require prototypes, but it required use of mode_t and lots of other
probably-sub-integer typedefed types too much in its interfaces (unlike
standard C which uses ints and longs too much), and it declares all
its interfaces using prototypes so the ones that involve sub-integer
types cannot be implemented by either K&R compilers or Standard C
compilers (for K&R, sub-integer types are not supported, and for
Standard C the literal prototypes don't match the default promotions).

Now, POSIX requires prototypes (to be supported by the compiler), and,
like standard C, it requires a prototype to be in scope if the type
of any function parameter is incompatible with its default promotion,
so the problems are limited mainly to loss of bits on exotic machines
in the forced conversions between signed and unsigned values.  Since
the prototypes aren't variant, sometimes there are forced conversions
that mess up the values even if the initial and final types are the
same.

I probably missed fixing strmode.3 because of the gcc bug that you pointed
out -- the prototype is incompatible with the declaration in strmode.3, so
the behaviour is undefined, but gcc's implementation of the undefined
behaviour is to do the right thing if a prototype is in scope and to do
the wrong thing if a prototype is not in scope.  Since my man page checker
puts the wrong prototype in scope but doesn't put the correct prototype
from string.h in scope, the error goes undetected.

Bruce

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 14:44:28 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D904A1065670;
	Wed,  4 Feb 2009 14:44:28 +0000 (UTC)
	(envelope-from alexander@leidinger.net)
Received: from redbull.bpaserver.net (redbullneu.bpaserver.net
	[213.198.78.217])
	by mx1.freebsd.org (Postfix) with ESMTP id 61E548FC18;
	Wed,  4 Feb 2009 14:44:28 +0000 (UTC)
	(envelope-from alexander@leidinger.net)
Received: from outgoing.leidinger.net (pD9E2E9D3.dip.t-dialin.net
	[217.226.233.211])
	by redbull.bpaserver.net (Postfix) with ESMTP id C416B2E068;
	Wed,  4 Feb 2009 15:44:19 +0100 (CET)
Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102])
	by outgoing.leidinger.net (Postfix) with ESMTP id 2FB42101086;
	Wed,  4 Feb 2009 15:44:16 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net;
	s=outgoing-alex; t=1233758656; bh=5tMn7r6tXLnDzHvngfHvceEkdnFfKXEfP
	djKftvfAxc=; h=Message-ID:Date:From:To:Cc:Subject:References:
	In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding;
	b=MHK2vPLIdy61WadSBcTzlRdneqVrysRGwHEclNEVUymVDRxdKgmP6nE8DrBhmTkHR
	V/Udtt4tYl+SW++osi0TupgH+Srtscg+r0pDYhMwaL961Pl+ZMuWTbx5rutfay09Cob
	iJF7x+m/SJUl2LZ8pi6z+9fiFH3u6Azv/4kj2p0J74m/SHejSwULSoUaENsuVdzbQaW
	QxRLVah6LX1s54RPy/+BMwkK1+aw2jIal2nIZkdhIxQxHJqfR4RtuJvAhih6nrcynVF
	WkY8s1M+L16Bn/jXjlwPa1lMRV6sRvkoq1TFWSWnWwK1IbuyFZUMGqtwcNibXDogpTY
	6pJb++HjQ==
Received: (from www@localhost)
	by webmail.leidinger.net (8.14.3/8.13.8/Submit) id n14EiFCF018532;
	Wed, 4 Feb 2009 15:44:15 +0100 (CET)
	(envelope-from Alexander@Leidinger.net)
Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by
	webmail.leidinger.net (Horde Framework) with HTTP; Wed, 04 Feb 2009
	15:44:14 +0100
Message-ID: <20090204154414.1949765y56lfhi80@webmail.leidinger.net>
X-Priority: 3 (Normal)
Date: Wed, 04 Feb 2009 15:44:14 +0100
From: Alexander Leidinger <Alexander@Leidinger.net>
To: Bruce Evans <brde@optusnet.com.au>
References: <200902032025.n13KPaCV041012@svn.freebsd.org>
	<4988AB83.2050203@gmx.de> <20090204212854.F51932@delplex.bde.org>
In-Reply-To: <20090204212854.F51932@delplex.bde.org>
MIME-Version: 1.0
Content-Type: text/plain;
	charset=UTF-8;
	DelSp="Yes";
	format="flowed"
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
User-Agent: Internet Messaging Program (IMP) H3 (4.3) / FreeBSD-8.0
X-BPAnet-MailScanner-Information: Please contact the ISP for more information
X-MailScanner-ID: C416B2E068.EA419
X-BPAnet-MailScanner: Found to be clean
X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, 
	score=-13.427, required 6, BAYES_00 -15.00,
	DKIM_SIGNED 0.00, 
	DKIM_VERIFIED -0.00, MIME_QP_LONG_LINE 1.40, RDNS_DYNAMIC 0.10,
	TW_SV 0.08)
X-BPAnet-MailScanner-From: alexander@leidinger.net
X-Spam-Status: No
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	Christoph Mallon <christoph.mallon@gmx.de>,
	Warner Losh <imp@freebsd.org>, src-committers@freebsd.org
Subject: Re: svn commit: r188098 - head/lib/libc/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 14:44:29 -0000

Quoting Bruce Evans <brde@optusnet.com.au> (from Wed, 4 Feb 2009 =20
22:27:59 +1100 (EST)):

> On Tue, 3 Feb 2009, Christoph Mallon wrote:
>
>> Warner Losh schrieb:
>>> Modified: head/lib/libc/string/strmode.c
>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
>>> --- head/lib/libc/string/strmode.c=09Tue Feb  3 20:01:51 2009 (r188097)
>>> +++ head/lib/libc/string/strmode.c=09Tue Feb  3 20:25:36 2009 (r188098)
>>> @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
>>> #include <string.h>
>>>  void
>>> -strmode(mode_t mode, char *p)
>>> +strmode(/* mode_t */ int mode, char *p)
>>> {
>>> =09 /* print type */
>>> =09switch (mode & S_IFMT) {
>>
>> The manpage states that the first parameter of strmode() is a =20
>> mode_t. What's wrong - the implementation (both in header and =20
>> definition) or the documentation?
>
> The man page is wrong.  strtomode() should take an int arg (actually
> the default (unary) promotion of a mode_t) for the the same reasons
> that memchr() does -- because these interfaces should be usable by K&R
> compilers and/or by standard C compilers without a protoype in scope.
> Even if this is no longer required, binary compatibily requires the
> interfaces to be the same as the ones that used to be required.  The
> requirement for binary compatibility also prevents "fixing" interfaces
> to be "ANSI" in headers (if you "fix" prototypes there then you will
> get obscure runtime errors instead of tinderbox errors).

Is this also true for the current use of symbol versioning in our =20
libc? I thought this is supposed to "fix" this problem (assuming we =20
add an UPDATING entry that users have to make sure that they to a full =20
installworld to habe the includes and the lib in sync)?

Bye,
Alexander.

--=20
Sometimes the best medicine is to stop taking something.

http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID =3D B0063FE7
http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID =3D 72077137

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 17:10:02 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4F30C10656F3;
	Wed,  4 Feb 2009 17:10:02 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 31D1F8FC2C;
	Wed,  4 Feb 2009 17:10:02 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14HA2jk082066;
	Wed, 4 Feb 2009 17:10:02 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14HA2Wc082064;
	Wed, 4 Feb 2009 17:10:02 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200902041710.n14HA2Wc082064@svn.freebsd.org>
From: Ed Schouten <ed@FreeBSD.org>
Date: Wed, 4 Feb 2009 17:10:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188115 - in head/sys: kern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 17:10:03 -0000

Author: ed
Date: Wed Feb  4 17:10:01 2009
New Revision: 188115
URL: http://svn.freebsd.org/changeset/base/188115

Log:
  Remove slush space from clists.
  
  Right now we only have a very small amount of drivers that use clists,
  but we still allocate 50 cblocks as slush space, which allows drivers to
  temporarily overcommit their storage. Most of the drivers don't allow
  this anyway.
  
  I've performed the following changes:
  
  - We don't allocate any cblocks on startup.
  
  - I've removed the DDB command, because it has nothing useful to print
    now. You can obtain the amount of allocated blocks by running `vmstat
    -m | grep clist'.
  
  - I've removed cfreecount, which is now unused.
  
  - The old code first tries to allocate using M_NOWAIT, followed by
    M_WAITOK. This doesn't make any sense, so just remove this logic. It
    seems the drivers allow us to sleep anyway.
  
  We can even remove ccmax from clist_alloc_cblocks and c_cbmax from
  struct clist, but this breaks binary compatibility.
  
  This reduces the amount of allocated cblocks on my system from 54 to 4.

Modified:
  head/sys/kern/subr_clist.c
  head/sys/sys/clist.h

Modified: head/sys/kern/subr_clist.c
==============================================================================
--- head/sys/kern/subr_clist.c	Wed Feb  4 15:02:57 2009	(r188114)
+++ head/sys/kern/subr_clist.c	Wed Feb  4 17:10:01 2009	(r188115)
@@ -38,58 +38,15 @@ __FBSDID("$FreeBSD$");
 #include <sys/malloc.h>
 #include <sys/clist.h>
 
-static void clist_init(void *);
-SYSINIT(clist, SI_SUB_CLIST, SI_ORDER_FIRST, clist_init, NULL);
-
 static MALLOC_DEFINE(M_CLIST, "clist", "clist queue blocks");
 
 static struct cblock *cfreelist = NULL;
-int cfreecount = 0;
-static int cslushcount;
-static int ctotcount;
-
-#ifndef INITIAL_CBLOCKS
-#define	INITIAL_CBLOCKS 50
-#endif
 
 static struct cblock *cblock_alloc(void);
 static void cblock_alloc_cblocks(int number);
 static void cblock_free(struct cblock *cblockp);
 static void cblock_free_cblocks(int number);
 
-#include "opt_ddb.h"
-#ifdef DDB
-#include <ddb/ddb.h>
-
-DB_SHOW_COMMAND(cbstat, cbstat)
-{
-	int cbsize = CBSIZE;
-
-	printf(
-	"tot = %d (active = %d, free = %d (reserved = %d, slush = %d))\n",
-	       ctotcount * cbsize, ctotcount * cbsize - cfreecount, cfreecount,
-	       cfreecount - cslushcount * cbsize, cslushcount * cbsize);
-}
-#endif /* DDB */
-
-/*
- * Called from init_main.c
- */
-/* ARGSUSED*/
-static void
-clist_init(void *dummy)
-{
-	/*
-	 * Allocate an initial base set of cblocks as a 'slush'.
-	 * We allocate non-slush cblocks with each initial tty_open() and
-	 * deallocate them with each tty_close().
-	 * We should adjust the slush allocation.  This can't be done in
-	 * the i/o routines because they are sometimes called from
-	 * interrupt handlers when it may be unsafe to call malloc().
-	 */
-	cblock_alloc_cblocks(cslushcount = INITIAL_CBLOCKS);
-}
-
 /*
  * Remove a cblock from the cfreelist queue and return a pointer
  * to it.
@@ -104,7 +61,6 @@ cblock_alloc(void)
 		panic("clist reservation botch");
 	cfreelist = cblockp->c_next;
 	cblockp->c_next = NULL;
-	cfreecount -= CBSIZE;
 	return (cblockp);
 }
 
@@ -116,7 +72,6 @@ cblock_free(struct cblock *cblockp)
 {
 	cblockp->c_next = cfreelist;
 	cfreelist = cblockp;
-	cfreecount += CBSIZE;
 }
 
 /*
@@ -129,19 +84,13 @@ cblock_alloc_cblocks(int number)
 	struct cblock *cbp;
 
 	for (i = 0; i < number; ++i) {
-		cbp = malloc(sizeof *cbp, M_CLIST, M_NOWAIT);
-		if (cbp == NULL) {
-			printf(
-"cblock_alloc_cblocks: M_NOWAIT malloc failed, trying M_WAITOK\n");
-			cbp = malloc(sizeof *cbp, M_CLIST, M_WAITOK);
-		}
+		cbp = malloc(sizeof *cbp, M_CLIST, M_WAITOK);
 		/*
 		 * Freed cblocks have zero quotes and garbage elsewhere.
 		 * Set the may-have-quote bit to force zeroing the quotes.
 		 */
 		cblock_free(cbp);
 	}
-	ctotcount += number;
 }
 
 /*
@@ -184,7 +133,6 @@ cblock_free_cblocks(int number)
 
 	for (i = 0; i < number; ++i)
 		free(cblock_alloc(), M_CLIST);
-	ctotcount -= number;
 }
 
 /*
@@ -237,8 +185,7 @@ getc(struct clist *clistp)
 				clistp->c_cf = clistp->c_cl = NULL;
 			}
 			cblock_free(cblockp);
-			if (--clistp->c_cbcount >= clistp->c_cbreserved)
-				++cslushcount;
+			--clistp->c_cbcount;
 		}
 	}
 
@@ -285,8 +232,7 @@ q_to_b(struct clist *clistp, char *dest,
 				clistp->c_cf = clistp->c_cl = NULL;
 			}
 			cblock_free(cblockp);
-			if (--clistp->c_cbcount >= clistp->c_cbreserved)
-				++cslushcount;
+			--clistp->c_cbcount;
 		}
 	}
 
@@ -328,8 +274,7 @@ ndflush(struct clist *clistp, int amount
 				clistp->c_cf = clistp->c_cl = NULL;
 			}
 			cblock_free(cblockp);
-			if (--clistp->c_cbcount >= clistp->c_cbreserved)
-				++cslushcount;
+			--clistp->c_cbcount;
 		}
 	}
 
@@ -364,12 +309,8 @@ putc(char chr, struct clist *clistp)
 			struct cblock *prev = (cblockp - 1);
 
 			if (clistp->c_cbcount >= clistp->c_cbreserved) {
-				if (clistp->c_cbcount >= clistp->c_cbmax
-				    || cslushcount <= 0) {
-					splx(s);
-					return (-1);
-				}
-				--cslushcount;
+				splx(s);
+				return (-1);
 			}
 			cblockp = cblock_alloc();
 			clistp->c_cbcount++;
@@ -430,12 +371,8 @@ b_to_q(char *src, int amount, struct cli
 			struct cblock *prev = cblockp - 1;
 
 			if (clistp->c_cbcount >= clistp->c_cbreserved) {
-				if (clistp->c_cbcount >= clistp->c_cbmax
-				    || cslushcount <= 0) {
-					splx(s);
-					return (amount);
-				}
-				--cslushcount;
+				splx(s);
+				return (amount);
 			}
 			cblockp = cblock_alloc();
 			clistp->c_cbcount++;
@@ -510,8 +447,7 @@ unputc(struct clist *clistp)
 			 */
 			clistp->c_cl = (char *)(cbp+1);
 			cblock_free(cblockp);
-			if (--clistp->c_cbcount >= clistp->c_cbreserved)
-				++cslushcount;
+			--clistp->c_cbcount;
 			cbp->c_next = NULL;
 		}
 	}
@@ -523,8 +459,7 @@ unputc(struct clist *clistp)
 	if ((clistp->c_cc == 0) && clistp->c_cl) {
 		cblockp = (struct cblock *)((intptr_t)clistp->c_cl & ~CROUND);
 		cblock_free(cblockp);
-		if (--clistp->c_cbcount >= clistp->c_cbreserved)
-			++cslushcount;
+		--clistp->c_cbcount;
 		clistp->c_cf = clistp->c_cl = NULL;
 	}
 

Modified: head/sys/sys/clist.h
==============================================================================
--- head/sys/sys/clist.h	Wed Feb  4 15:02:57 2009	(r188114)
+++ head/sys/sys/clist.h	Wed Feb  4 17:10:01 2009	(r188115)
@@ -54,8 +54,6 @@ struct cblock {
 };
 
 #ifdef _KERNEL
-extern	int cfreecount;
-
 int	 b_to_q(char *cp, int cc, struct clist *q);
 void	 clist_alloc_cblocks(struct clist *q, int ccmax, int ccres);
 void	 clist_free_cblocks(struct clist *q);

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 17:33:28 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 917F7106566C;
	Wed,  4 Feb 2009 17:33:28 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 2D5668FC19;
	Wed,  4 Feb 2009 17:33:28 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n14HVq9q001986;
	Wed, 4 Feb 2009 10:31:52 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Wed, 04 Feb 2009 10:32:20 -0700 (MST)
Message-Id: <20090204.103220.1763804960.imp@bsdimp.com>
To: Alexander@leidinger.net
From: "M. Warner Losh" <imp@bsdimp.com>
In-Reply-To: <20090204154414.1949765y56lfhi80@webmail.leidinger.net>
References: <4988AB83.2050203@gmx.de> <20090204212854.F51932@delplex.bde.org>
	<20090204154414.1949765y56lfhi80@webmail.leidinger.net>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, christoph.mallon@gmx.de,
	src-committers@freebsd.org, brde@optusnet.com.au
Subject: Re: svn commit: r188098 - head/lib/libc/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 17:33:29 -0000

In message: <20090204154414.1949765y56lfhi80@webmail.leidinger.net>
            Alexander Leidinger <Alexander@leidinger.net> writes:
: Quoting Bruce Evans <brde@optusnet.com.au> (from Wed, 4 Feb 2009  
: 22:27:59 +1100 (EST)):
: 
: > On Tue, 3 Feb 2009, Christoph Mallon wrote:
: >
: >> Warner Losh schrieb:
: >>> Modified: head/lib/libc/string/strmode.c
: >>> ==============================================================================
: >>> --- head/lib/libc/string/strmode.c	Tue Feb  3 20:01:51 2009 (r188097)
: >>> +++ head/lib/libc/string/strmode.c	Tue Feb  3 20:25:36 2009 (r188098)
: >>> @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
: >>> #include <string.h>
: >>>  void
: >>> -strmode(mode_t mode, char *p)
: >>> +strmode(/* mode_t */ int mode, char *p)
: >>> {
: >>> 	 /* print type */
: >>> 	switch (mode & S_IFMT) {
: >>
: >> The manpage states that the first parameter of strmode() is a  
: >> mode_t. What's wrong - the implementation (both in header and  
: >> definition) or the documentation?
: >
: > The man page is wrong.  strtomode() should take an int arg (actually
: > the default (unary) promotion of a mode_t) for the the same reasons
: > that memchr() does -- because these interfaces should be usable by K&R
: > compilers and/or by standard C compilers without a protoype in scope.
: > Even if this is no longer required, binary compatibily requires the
: > interfaces to be the same as the ones that used to be required.  The
: > requirement for binary compatibility also prevents "fixing" interfaces
: > to be "ANSI" in headers (if you "fix" prototypes there then you will
: > get obscure runtime errors instead of tinderbox errors).
: 
: Is this also true for the current use of symbol versioning in our  
: libc? I thought this is supposed to "fix" this problem (assuming we  
: add an UPDATING entry that users have to make sure that they to a full  
: installworld to habe the includes and the lib in sync)?

Maybe, but it is a problem worth fixing?  What we have now is correct
for both cases (prototypes and no prototypes) on all the architectures
that FreeBSD supports (or even kinda supports).  Does it make sense to
add a lot of extra hair just to have a slightly more proper prototype?

Warner

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 18:14:30 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7C4F11065673;
	Wed,  4 Feb 2009 18:14:30 +0000 (UTC) (envelope-from phk@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6A3668FC24;
	Wed,  4 Feb 2009 18:14:30 +0000 (UTC) (envelope-from phk@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14IEUjs086672;
	Wed, 4 Feb 2009 18:14:30 GMT (envelope-from phk@svn.freebsd.org)
Received: (from phk@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14IEUuA086671;
	Wed, 4 Feb 2009 18:14:30 GMT (envelope-from phk@svn.freebsd.org)
Message-Id: <200902041814.n14IEUuA086671@svn.freebsd.org>
From: Poul-Henning Kamp <phk@FreeBSD.org>
Date: Wed, 4 Feb 2009 18:14:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188117 - head/tools/tools/sysbuild
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 18:14:31 -0000

Author: phk
Date: Wed Feb  4 18:14:30 2009
New Revision: 188117
URL: http://svn.freebsd.org/changeset/base/188117

Log:
  Get the right system makefiles for make distribution.

Modified:
  head/tools/tools/sysbuild/sysbuild.sh

Modified: head/tools/tools/sysbuild/sysbuild.sh
==============================================================================
--- head/tools/tools/sysbuild/sysbuild.sh	Wed Feb  4 17:35:21 2009	(r188116)
+++ head/tools/tools/sysbuild/sysbuild.sh	Wed Feb  4 18:14:30 2009	(r188117)
@@ -420,7 +420,8 @@ log_it Installworld
 	> /mnt/_.iw 2>&1
 
 log_it distribution
-(cd /usr/src/etc && make distribution DESTDIR=/mnt ${SRCCONF} ) \
+(cd /usr/src/etc && make -m /usr/src/share/mk distribution \
+	DESTDIR=/mnt ${SRCCONF} ) \
 	> /mnt/_.dist 2>&1
 
 log_it Installkernel

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 18:20:27 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9D8A3106566C;
	Wed,  4 Feb 2009 18:20:27 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8BDC08FC1D;
	Wed,  4 Feb 2009 18:20:27 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14IKRIG087305;
	Wed, 4 Feb 2009 18:20:27 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14IKRg9087304;
	Wed, 4 Feb 2009 18:20:27 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200902041820.n14IKRg9087304@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Wed, 4 Feb 2009 18:20:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188118 - head/etc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 18:20:28 -0000

Author: thompsa
Date: Wed Feb  4 18:20:27 2009
New Revision: 188118
URL: http://svn.freebsd.org/changeset/base/188118

Log:
  Check for NOAUTO on child interfaces (eg wlanX) so they can be created via
  rc.conf but not necessarily started.

Modified:
  head/etc/network.subr

Modified: head/etc/network.subr
==============================================================================
--- head/etc/network.subr	Wed Feb  4 18:14:30 2009	(r188117)
+++ head/etc/network.subr	Wed Feb  4 18:20:27 2009	(r188118)
@@ -515,7 +515,9 @@ childif_create()
 			i=`ifconfig wlan create ${create_args}`
 			ifconfig $i name $child && cfg=0
 		fi
-		ifn_start $child
+		if autoif $child; then
+			ifn_start $child
+		fi
 	done
 
 	return ${cfg}

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 18:44:29 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 80822106568E;
	Wed,  4 Feb 2009 18:44:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6B44C8FC23;
	Wed,  4 Feb 2009 18:44:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14IiTuJ088007;
	Wed, 4 Feb 2009 18:44:29 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14IiTu0088005;
	Wed, 4 Feb 2009 18:44:29 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200902041844.n14IiTu0088005@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Wed, 4 Feb 2009 18:44:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188119 - in head/sys/ia64: ia64 include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 18:44:32 -0000

Author: jhb
Date: Wed Feb  4 18:44:29 2009
New Revision: 188119
URL: http://svn.freebsd.org/changeset/base/188119

Log:
  Tweak the ia64 machine check handling code to not register new sysctl nodes
  while holding a spin mutex.  Instead, it now shoves the machine check
  records onto a queue that is later drained to add sysctl nodes for each
  record.  While a routine to drain the queue is present, it is not currently
  called.
  
  Reviewed by:	marcel

Modified:
  head/sys/ia64/ia64/mca.c
  head/sys/ia64/include/mca.h

Modified: head/sys/ia64/ia64/mca.c
==============================================================================
--- head/sys/ia64/ia64/mca.c	Wed Feb  4 18:20:27 2009	(r188118)
+++ head/sys/ia64/ia64/mca.c	Wed Feb  4 18:44:29 2009	(r188119)
@@ -42,6 +42,16 @@
 
 MALLOC_DEFINE(M_MCA, "MCA", "Machine Check Architecture");
 
+struct mca_info {
+	STAILQ_ENTRY(mca_info) mi_link;
+	char	mi_name[32];
+	size_t	mi_recsz;
+	char	mi_record[0];
+};
+
+static STAILQ_HEAD(, mca_info) mca_records =
+    STAILQ_HEAD_INITIALIZER(mca_records);
+
 int64_t		mca_info_size[SAL_INFO_TYPES];
 vm_offset_t	mca_info_block;
 struct mtx	mca_info_block_lock;
@@ -76,14 +86,32 @@ mca_sysctl_handler(SYSCTL_HANDLER_ARGS)
 }
 
 void
+ia64_mca_populate(void)
+{
+	struct mca_info *rec;
+
+	mtx_lock_spin(&mca_info_block_lock);
+	while (!STAILQ_EMPTY(&mca_records)) {
+		rec = STAILQ_FIRST(&mca_records);
+		STAILQ_REMOVE_HEAD(&mca_records, mi_link);
+		mtx_unlock_spin(&mca_info_block_lock);
+		(void)SYSCTL_ADD_PROC(NULL, SYSCTL_STATIC_CHILDREN(_hw_mca),
+		    OID_AUTO, rec->mi_name, CTLTYPE_OPAQUE | CTLFLAG_RD,
+		    rec->mi_record, rec->mi_recsz, mca_sysctl_handler, "S,MCA",
+		    "Error record");
+		mtx_lock_spin(&mca_info_block_lock);
+	}
+	mtx_unlock_spin(&mca_info_block_lock);
+}
+
+void
 ia64_mca_save_state(int type)
 {
 	struct ia64_sal_result result;
 	struct mca_record_header *hdr;
-	struct sysctl_oid *oidp;
-	char *name, *state;
+	struct mca_info *rec;
 	uint64_t seqnr;
-	size_t recsz, totsz;
+	size_t recsz;
 
 	/*
 	 * Don't try to get the state if we couldn't get the size of
@@ -95,9 +123,8 @@ ia64_mca_save_state(int type)
 	if (mca_info_block == 0)
 		return;
 
+	mtx_lock_spin(&mca_info_block_lock);
 	while (1) {
-		mtx_lock_spin(&mca_info_block_lock);
-
 		result = ia64_sal_entry(SAL_GET_STATE_INFO, type, 0,
 		    mca_info_block, 0, 0, 0, 0);
 		if (result.sal_status < 0) {
@@ -111,11 +138,13 @@ ia64_mca_save_state(int type)
 
 		mtx_unlock_spin(&mca_info_block_lock);
 
-		totsz = sizeof(struct sysctl_oid) + recsz + 32;
-		oidp = malloc(totsz, M_MCA, M_NOWAIT|M_ZERO);
-		state = (char*)(oidp + 1);
-		name = state + recsz;
-		sprintf(name, "%lld", (long long)seqnr);
+		rec = malloc(sizeof(struct mca_info) + recsz, M_MCA,
+		    M_NOWAIT | M_ZERO);
+		if (rec == NULL)
+			/* XXX: Not sure what to do. */
+			return;
+
+		sprintf(rec->mi_name, "%lld", (long long)seqnr);
 
 		mtx_lock_spin(&mca_info_block_lock);
 
@@ -133,24 +162,14 @@ ia64_mca_save_state(int type)
 			    mca_info_block, 0, 0, 0, 0);
 			if (seqnr != hdr->rh_seqnr) {
 				mtx_unlock_spin(&mca_info_block_lock);
-				free(oidp, M_MCA);
+				free(rec, M_MCA);
+				mtx_lock_spin(&mca_info_block_lock);
 				continue;
 			}
 		}
 
-		bcopy((char*)mca_info_block, state, recsz);
-
-		oidp->oid_parent = &sysctl__hw_mca_children;
-		oidp->oid_number = OID_AUTO;
-		oidp->oid_kind = CTLTYPE_OPAQUE|CTLFLAG_RD|CTLFLAG_DYN;
-		oidp->oid_arg1 = state;
-		oidp->oid_arg2 = recsz;
-		oidp->oid_name = name;
-		oidp->oid_handler = mca_sysctl_handler;
-		oidp->oid_fmt = "S,MCA";
-		oidp->oid_descr = "Error record";
-
-		sysctl_register_oid(oidp);
+		rec->mi_recsz = recsz;
+		bcopy((char*)mca_info_block, rec->mi_record, recsz);
 
 		if (mca_count > 0) {
 			if (seqnr < mca_first)
@@ -161,6 +180,7 @@ ia64_mca_save_state(int type)
 			mca_first = mca_last = seqnr;
 
 		mca_count++;
+		STAILQ_INSERT_TAIL(&mca_records, rec, mi_link);
 
 		/*
 		 * Clear the state so that we get any other records when
@@ -168,8 +188,6 @@ ia64_mca_save_state(int type)
 		 */
 		result = ia64_sal_entry(SAL_CLEAR_STATE_INFO, type, 0, 0, 0,
 		    0, 0, 0);
-
-		mtx_unlock_spin(&mca_info_block_lock);
 	}
 }
 

Modified: head/sys/ia64/include/mca.h
==============================================================================
--- head/sys/ia64/include/mca.h	Wed Feb  4 18:20:27 2009	(r188118)
+++ head/sys/ia64/include/mca.h	Wed Feb  4 18:44:29 2009	(r188119)
@@ -239,6 +239,7 @@ struct mca_pcidev_reg {
 #ifdef _KERNEL
 
 void ia64_mca_init(void);
+void ia64_mca_populate(void);
 void ia64_mca_save_state(int);
 
 #endif /* _KERNEL */

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 19:56:39 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2723A1065670;
	Wed,  4 Feb 2009 19:56:39 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 143A88FC14;
	Wed,  4 Feb 2009 19:56:39 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14Jub0M089512;
	Wed, 4 Feb 2009 19:56:37 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14JubCQ089511;
	Wed, 4 Feb 2009 19:56:37 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200902041956.n14JubCQ089511@svn.freebsd.org>
From: Robert Watson <rwatson@FreeBSD.org>
Date: Wed, 4 Feb 2009 19:56:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188122 - head/sys/security/audit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 19:56:39 -0000

Author: rwatson
Date: Wed Feb  4 19:56:37 2009
New Revision: 188122
URL: http://svn.freebsd.org/changeset/base/188122

Log:
  Eliminate the local variable 'ape' in audit_pipe_kqread(), as it's only
  used for an assertion that we don't really need anymore.
  
  MFC after:	1 week
  Reported by:	Christoph Mallon <christoph dot mallon at gmx dot de>

Modified:
  head/sys/security/audit/audit_pipe.c

Modified: head/sys/security/audit/audit_pipe.c
==============================================================================
--- head/sys/security/audit/audit_pipe.c	Wed Feb  4 19:43:08 2009	(r188121)
+++ head/sys/security/audit/audit_pipe.c	Wed Feb  4 19:56:37 2009	(r188122)
@@ -1077,18 +1077,13 @@ audit_pipe_kqfilter(struct cdev *dev, st
 static int
 audit_pipe_kqread(struct knote *kn, long hint)
 {
-	struct audit_pipe_entry *ape;
 	struct audit_pipe *ap;
 
 	ap = (struct audit_pipe *)kn->kn_hook;
 	KASSERT(ap != NULL, ("audit_pipe_kqread: ap == NULL"));
-
 	AUDIT_PIPE_LOCK_ASSERT(ap);
 
 	if (ap->ap_qlen != 0) {
-		ape = TAILQ_FIRST(&ap->ap_queue);
-		KASSERT(ape != NULL, ("audit_pipe_kqread: ape == NULL"));
-
 		kn->kn_data = ap->ap_qbyteslen - ap->ap_qoffset;
 		return (1);
 	} else {

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 20:00:17 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EC3D5106564A;
	Wed,  4 Feb 2009 20:00:17 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D9CDA8FC17;
	Wed,  4 Feb 2009 20:00:17 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14K0H24089638;
	Wed, 4 Feb 2009 20:00:17 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14K0HlD089637;
	Wed, 4 Feb 2009 20:00:17 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200902042000.n14K0HlD089637@svn.freebsd.org>
From: Robert Watson <rwatson@FreeBSD.org>
Date: Wed, 4 Feb 2009 20:00:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188123 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 20:00:18 -0000

Author: rwatson
Date: Wed Feb  4 20:00:17 2009
New Revision: 188123
URL: http://svn.freebsd.org/changeset/base/188123

Log:
  Remove written-to but never read local variable 'offset' from
  soreceive_dgram().
  
  Submitted by:	Christoph Mallon <christoph dot mallon at gmx dot de>
  MFC after:	1 week

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c	Wed Feb  4 19:56:37 2009	(r188122)
+++ head/sys/kern/uipc_socket.c	Wed Feb  4 20:00:17 2009	(r188123)
@@ -1858,7 +1858,7 @@ soreceive_dgram(struct socket *so, struc
     struct mbuf **mp0, struct mbuf **controlp, int *flagsp)
 {
 	struct mbuf *m, *m2;
-	int flags, len, error, offset;
+	int flags, len, error;
 	struct protosw *pr = so->so_proto;
 	struct mbuf *nextrecord;
 
@@ -2008,7 +2008,6 @@ soreceive_dgram(struct socket *so, struc
 	}
 	KASSERT(m->m_type == MT_DATA, ("soreceive_dgram: !data"));
 
-	offset = 0;
 	while (m != NULL && uio->uio_resid > 0) {
 		len = uio->uio_resid;
 		if (len > m->m_len)

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 20:04:33 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 519EF106567A;
	Wed,  4 Feb 2009 20:04:33 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3EB8E8FC1F;
	Wed,  4 Feb 2009 20:04:33 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14K4Xtm089743;
	Wed, 4 Feb 2009 20:04:33 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14K4Xix089742;
	Wed, 4 Feb 2009 20:04:33 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200902042004.n14K4Xix089742@svn.freebsd.org>
From: Robert Watson <rwatson@FreeBSD.org>
Date: Wed, 4 Feb 2009 20:04:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188124 - head/sys/netatalk
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 20:04:34 -0000

Author: rwatson
Date: Wed Feb  4 20:04:32 2009
New Revision: 188124
URL: http://svn.freebsd.org/changeset/base/188124

Log:
  Remove local variable 'ddp' from DDP's attach and detach routines; they
  were used only for assertions, and rather than ifdef'ing them
  INVARIANTS and using local variables, just directly access so_pcb.
  
  Submitted by:	Christoph Mallon <christoph dot mallon at gmx dot de>
  MFC after:	1 week

Modified:
  head/sys/netatalk/ddp_usrreq.c

Modified: head/sys/netatalk/ddp_usrreq.c
==============================================================================
--- head/sys/netatalk/ddp_usrreq.c	Wed Feb  4 20:00:17 2009	(r188123)
+++ head/sys/netatalk/ddp_usrreq.c	Wed Feb  4 20:04:32 2009	(r188124)
@@ -75,11 +75,9 @@ static struct ifqueue atintrq1, atintrq2
 static int
 ddp_attach(struct socket *so, int proto, struct thread *td)
 {
-	struct ddpcb *ddp;
 	int error = 0;
 	
-	ddp = sotoddpcb(so);
-	KASSERT(ddp == NULL, ("ddp_attach: ddp != NULL"));
+	KASSERT(sotoddpcb(so) == NULL, ("ddp_attach: ddp != NULL"));
 
 	/*
 	 * Allocate socket buffer space first so that it's present
@@ -175,10 +173,8 @@ ddp_disconnect(struct socket *so)
 static int
 ddp_shutdown(struct socket *so)
 {
-	struct ddpcb	*ddp;
 
-	ddp = sotoddpcb(so);
-	KASSERT(ddp != NULL, ("ddp_shutdown: ddp == NULL"));
+	KASSERT(sotoddpcb(so) != NULL, ("ddp_shutdown: ddp == NULL"));
 
 	socantsendmore(so);
 	return (0);

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 20:23:42 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9DC1A106564A;
	Wed,  4 Feb 2009 20:23:42 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8B23F8FC1A;
	Wed,  4 Feb 2009 20:23:42 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14KNg0U090143;
	Wed, 4 Feb 2009 20:23:42 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14KNgJS090142;
	Wed, 4 Feb 2009 20:23:42 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902042023.n14KNgJS090142@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Wed, 4 Feb 2009 20:23:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188125 - head/sys/dev/ata
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 20:23:43 -0000

Author: imp
Date: Wed Feb  4 20:23:42 2009
New Revision: 188125
URL: http://svn.freebsd.org/changeset/base/188125

Log:
  Correct signature for the identify routine.  The bad parameter wasn't
  used at all, so this is just a tidiness excersize.

Modified:
  head/sys/dev/ata/atapi-cam.c

Modified: head/sys/dev/ata/atapi-cam.c
==============================================================================
--- head/sys/dev/ata/atapi-cam.c	Wed Feb  4 20:04:32 2009	(r188124)
+++ head/sys/dev/ata/atapi-cam.c	Wed Feb  4 20:23:42 2009	(r188125)
@@ -91,7 +91,7 @@ struct atapi_hcb {
 enum reinit_reason { BOOT_ATTACH, ATTACH, RESET };
 
 /* Device methods */
-static void atapi_cam_identify(device_t *dev, device_t parent);
+static void atapi_cam_identify(driver_t *dev, device_t parent);
 static int atapi_cam_probe(device_t dev);
 static int atapi_cam_attach(device_t dev);
 static int atapi_cam_detach(device_t dev);
@@ -144,7 +144,7 @@ MODULE_DEPEND(atapicam, ata, 1, 1, 1);
 MODULE_DEPEND(atapicam, cam, 1, 1, 1);
 
 static void
-atapi_cam_identify(device_t *dev, device_t parent)
+atapi_cam_identify(driver_t *driver, device_t parent)
 {
 	struct atapi_xpt_softc *scp =
 	    malloc (sizeof (struct atapi_xpt_softc), M_ATACAM, M_NOWAIT|M_ZERO);

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 20:26:28 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7118E106566C;
	Wed,  4 Feb 2009 20:26:28 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 45C1E8FC1A;
	Wed,  4 Feb 2009 20:26:28 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14KQSiF090231;
	Wed, 4 Feb 2009 20:26:28 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14KQSAN090227;
	Wed, 4 Feb 2009 20:26:28 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902042026.n14KQSAN090227@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Wed, 4 Feb 2009 20:26:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188126 - head/sys/dev/ata
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 20:26:29 -0000

Author: imp
Date: Wed Feb  4 20:26:27 2009
New Revision: 188126
URL: http://svn.freebsd.org/changeset/base/188126

Log:
  Fix shutdown routine to return 0 and change signature from void return
  to int.

Modified:
  head/sys/dev/ata/ata-disk.c
  head/sys/dev/ata/atapi-cd.c
  head/sys/dev/ata/atapi-fd.c
  head/sys/dev/ata/atapi-tape.c

Modified: head/sys/dev/ata/ata-disk.c
==============================================================================
--- head/sys/dev/ata/ata-disk.c	Wed Feb  4 20:23:42 2009	(r188125)
+++ head/sys/dev/ata/ata-disk.c	Wed Feb  4 20:26:27 2009	(r188126)
@@ -182,13 +182,14 @@ ad_detach(device_t dev)
     return 0;
 }
 
-static void
+static int
 ad_shutdown(device_t dev)
 {
     struct ata_device *atadev = device_get_softc(dev);
 
     if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE)
 	ata_controlcmd(dev, ATA_FLUSHCACHE, 0, 0, 0);
+    return 0;
 }
 
 static int

Modified: head/sys/dev/ata/atapi-cd.c
==============================================================================
--- head/sys/dev/ata/atapi-cd.c	Wed Feb  4 20:23:42 2009	(r188125)
+++ head/sys/dev/ata/atapi-cd.c	Wed Feb  4 20:26:27 2009	(r188126)
@@ -143,13 +143,14 @@ acd_detach(device_t dev)
     return 0;
 }
 
-static void
+static int
 acd_shutdown(device_t dev)
 {
     struct ata_device *atadev = device_get_softc(dev);
 
     if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE)
 	ata_controlcmd(dev, ATA_FLUSHCACHE, 0, 0, 0);
+    return 0;
 }
 
 static int

Modified: head/sys/dev/ata/atapi-fd.c
==============================================================================
--- head/sys/dev/ata/atapi-fd.c	Wed Feb  4 20:23:42 2009	(r188125)
+++ head/sys/dev/ata/atapi-fd.c	Wed Feb  4 20:26:27 2009	(r188126)
@@ -132,13 +132,14 @@ afd_detach(device_t dev)
     return 0;
 }
 
-static void
+static int
 afd_shutdown(device_t dev)
 {
     struct ata_device *atadev = device_get_softc(dev);
 
     if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE)
 	ata_controlcmd(dev, ATA_FLUSHCACHE, 0, 0, 0);
+    return 0;
 }
 
 static int

Modified: head/sys/dev/ata/atapi-tape.c
==============================================================================
--- head/sys/dev/ata/atapi-tape.c	Wed Feb  4 20:23:42 2009	(r188125)
+++ head/sys/dev/ata/atapi-tape.c	Wed Feb  4 20:26:27 2009	(r188126)
@@ -175,13 +175,14 @@ ast_detach(device_t dev)
     return 0;
 }
 
-static void
+static int
 ast_shutdown(device_t dev)
 {
     struct ata_device *atadev = device_get_softc(dev);
 
     if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE)
 	ata_controlcmd(dev, ATA_FLUSHCACHE, 0, 0, 0);
+    return 0;
 }
 
 static int

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 20:35:22 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AC5A0106564A;
	Wed,  4 Feb 2009 20:35:22 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9A1848FC22;
	Wed,  4 Feb 2009 20:35:22 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14KZMHx090436;
	Wed, 4 Feb 2009 20:35:22 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14KZMA9090435;
	Wed, 4 Feb 2009 20:35:22 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902042035.n14KZMA9090435@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Wed, 4 Feb 2009 20:35:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188127 - head/sys/dev/ae
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 20:35:23 -0000

Author: imp
Date: Wed Feb  4 20:35:22 2009
New Revision: 188127
URL: http://svn.freebsd.org/changeset/base/188127

Log:
  detach doesn't return an unsinged int, but returns an int.

Modified:
  head/sys/dev/ae/if_ae.c

Modified: head/sys/dev/ae/if_ae.c
==============================================================================
--- head/sys/dev/ae/if_ae.c	Wed Feb  4 20:26:27 2009	(r188126)
+++ head/sys/dev/ae/if_ae.c	Wed Feb  4 20:35:22 2009	(r188127)
@@ -105,7 +105,7 @@ static void	ae_phy_init(ae_softc_t *sc);
 static int	ae_reset(ae_softc_t *sc);
 static void	ae_init(void *arg);
 static int	ae_init_locked(ae_softc_t *sc);
-static unsigned	int	ae_detach(device_t dev);
+static int	ae_detach(device_t dev);
 static int	ae_miibus_readreg(device_t dev, int phy, int reg);
 static int	ae_miibus_writereg(device_t dev, int phy, int reg, int val);
 static void	ae_miibus_statchg(device_t dev);
@@ -746,7 +746,7 @@ ae_init_locked(ae_softc_t *sc)
 	return (0);
 }
 
-static unsigned int
+static int
 ae_detach(device_t dev)
 {
 	struct ae_softc *sc;

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 20:39:46 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 50E081065676;
	Wed,  4 Feb 2009 20:39:46 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 385C58FC1A;
	Wed,  4 Feb 2009 20:39:46 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14Kdk8S090547;
	Wed, 4 Feb 2009 20:39:46 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14KdkxQ090545;
	Wed, 4 Feb 2009 20:39:46 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902042039.n14KdkxQ090545@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Wed, 4 Feb 2009 20:39:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188128 - head/sys/dev/an
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 20:39:46 -0000

Author: imp
Date: Wed Feb  4 20:39:45 2009
New Revision: 188128
URL: http://svn.freebsd.org/changeset/base/188128

Log:
  Shutdown routine returns int.

Modified:
  head/sys/dev/an/if_an.c
  head/sys/dev/an/if_anreg.h

Modified: head/sys/dev/an/if_an.c
==============================================================================
--- head/sys/dev/an/if_an.c	Wed Feb  4 20:35:22 2009	(r188127)
+++ head/sys/dev/an/if_an.c	Wed Feb  4 20:39:45 2009	(r188128)
@@ -2989,7 +2989,7 @@ an_watchdog(struct ifnet *ifp)
 	return;
 }
 
-void
+int
 an_shutdown(device_t dev)
 {
 	struct an_softc		*sc;
@@ -2998,7 +2998,7 @@ an_shutdown(device_t dev)
 	an_stop(sc);
 	sc->an_gone = 1;
 
-	return;
+	return 0;
 }
 
 void

Modified: head/sys/dev/an/if_anreg.h
==============================================================================
--- head/sys/dev/an/if_anreg.h	Wed Feb  4 20:35:22 2009	(r188127)
+++ head/sys/dev/an/if_anreg.h	Wed Feb  4 20:39:45 2009	(r188128)
@@ -511,7 +511,7 @@ int	an_alloc_aux_memory	(device_t, int, 
 int	an_alloc_irq		(device_t, int, int);
 int	an_pci_probe	(device_t);
 int	an_probe	(device_t);
-void	an_shutdown	(device_t);
+int	an_shutdown	(device_t);
 void	an_resume	(device_t);
 int	an_attach		(struct an_softc *, int, int);
 int	an_detach	(device_t);

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 21:11:32 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 55E9B1065672;
	Wed,  4 Feb 2009 21:11:32 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 41B328FC1E;
	Wed,  4 Feb 2009 21:11:32 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14LBWaO091217;
	Wed, 4 Feb 2009 21:11:32 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14LBWsr091214;
	Wed, 4 Feb 2009 21:11:32 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902042111.n14LBWsr091214@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Wed, 4 Feb 2009 21:11:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188129 - head/sys/dev/pccbb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 21:11:33 -0000

Author: imp
Date: Wed Feb  4 21:11:31 2009
New Revision: 188129
URL: http://svn.freebsd.org/changeset/base/188129

Log:
  Correct signatures to match kobj function definitions.

Modified:
  head/sys/dev/pccbb/pccbb.c
  head/sys/dev/pccbb/pccbb_pci.c
  head/sys/dev/pccbb/pccbbvar.h

Modified: head/sys/dev/pccbb/pccbb.c
==============================================================================
--- head/sys/dev/pccbb/pccbb.c	Wed Feb  4 20:39:45 2009	(r188128)
+++ head/sys/dev/pccbb/pccbb.c	Wed Feb  4 21:11:31 2009	(r188129)
@@ -175,7 +175,7 @@ static int	cbb_cardbus_release_resource(
 		    int type, int rid, struct resource *res);
 static int	cbb_cardbus_power_enable_socket(device_t brdev,
 		    device_t child);
-static void	cbb_cardbus_power_disable_socket(device_t brdev,
+static int	cbb_cardbus_power_disable_socket(device_t brdev,
 		    device_t child);
 static int	cbb_func_filt(void *arg);
 static void	cbb_func_intr(void *arg);
@@ -998,11 +998,12 @@ cbb_cardbus_power_enable_socket(device_t
 	return (0);
 }
 
-static void
+static int
 cbb_cardbus_power_disable_socket(device_t brdev, device_t child)
 {
 	cbb_power(brdev, CARD_OFF);
 	cbb_cardbus_reset(brdev, child, 0);
+	return (0);
 }
 
 /************************************************************************/
@@ -1262,7 +1263,7 @@ cbb_pcic_power_enable_socket(device_t br
 	return (0);
 }
 
-static void
+static int
 cbb_pcic_power_disable_socket(device_t brdev, device_t child)
 {
 	struct cbb_softc *sc = device_get_softc(brdev);
@@ -1282,6 +1283,7 @@ cbb_pcic_power_disable_socket(device_t b
 
 	/* enable CSC interrupts */
 	exca_putb(&sc->exca[0], EXCA_INTR, EXCA_INTR_ENABLE);
+	return (0);
 }
 
 /************************************************************************/
@@ -1295,18 +1297,16 @@ cbb_power_enable_socket(device_t brdev, 
 
 	if (sc->flags & CBB_16BIT_CARD)
 		return (cbb_pcic_power_enable_socket(brdev, child));
-	else
-		return (cbb_cardbus_power_enable_socket(brdev, child));
+	return (cbb_cardbus_power_enable_socket(brdev, child));
 }
 
-void
+int
 cbb_power_disable_socket(device_t brdev, device_t child)
 {
 	struct cbb_softc *sc = device_get_softc(brdev);
 	if (sc->flags & CBB_16BIT_CARD)
-		cbb_pcic_power_disable_socket(brdev, child);
-	else
-		cbb_cardbus_power_disable_socket(brdev, child);
+		return (cbb_pcic_power_disable_socket(brdev, child));
+	return (cbb_cardbus_power_disable_socket(brdev, child));
 }
 
 static int
@@ -1404,7 +1404,7 @@ cbb_pcic_release_resource(device_t brdev
 
 int
 cbb_pcic_set_res_flags(device_t brdev, device_t child, int type, int rid,
-    uint32_t flags)
+    u_long flags)
 {
 	struct cbb_softc *sc = device_get_softc(brdev);
 	struct resource *res;
@@ -1579,9 +1579,9 @@ cbb_resume(device_t self)
 }
 
 int
-cbb_child_present(device_t self)
+cbb_child_present(device_t parent, device_t child)
 {
-	struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(self);
+	struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(parent);
 	uint32_t sockstate;
 
 	sockstate = cbb_get(sc, CBB_SOCKET_STATE);

Modified: head/sys/dev/pccbb/pccbb_pci.c
==============================================================================
--- head/sys/dev/pccbb/pccbb_pci.c	Wed Feb  4 20:39:45 2009	(r188128)
+++ head/sys/dev/pccbb/pccbb_pci.c	Wed Feb  4 21:11:31 2009	(r188129)
@@ -785,20 +785,17 @@ cbb_maxslots(device_t brdev)
 }
 
 static uint32_t
-cbb_read_config(device_t brdev, int b, int s, int f, int reg, int width)
+cbb_read_config(device_t brdev, u_int b, u_int s, u_int f, u_int reg, int width)
 {
-	uint32_t rv;
-
 	/*
 	 * Pass through to the next ppb up the chain (i.e. our grandparent).
 	 */
-	rv = PCIB_READ_CONFIG(device_get_parent(device_get_parent(brdev)),
-	    b, s, f, reg, width);
-	return (rv);
+	return (PCIB_READ_CONFIG(device_get_parent(device_get_parent(brdev)),
+	    b, s, f, reg, width));
 }
 
 static void
-cbb_write_config(device_t brdev, int b, int s, int f, int reg, uint32_t val,
+cbb_write_config(device_t brdev, u_int b, u_int s, u_int f, u_int reg, uint32_t val,
     int width)
 {
 	/*

Modified: head/sys/dev/pccbb/pccbbvar.h
==============================================================================
--- head/sys/dev/pccbb/pccbbvar.h	Wed Feb  4 20:39:45 2009	(r188128)
+++ head/sys/dev/pccbb/pccbbvar.h	Wed Feb  4 21:11:31 2009	(r188129)
@@ -116,7 +116,7 @@ struct resource	*cbb_alloc_resource(devi
 	    int type, int *rid, u_long start, u_long end, u_long count,
 	    u_int flags);
 void	cbb_child_detached(device_t brdev, device_t child);
-int	cbb_child_present(device_t self);
+int	cbb_child_present(device_t parent, device_t child);
 int	cbb_deactivate_resource(device_t brdev, device_t child,
 	    int type, int rid, struct resource *r);
 int	cbb_detach(device_t brdev);
@@ -126,10 +126,10 @@ void	cbb_event_thread(void *arg);
 int	cbb_pcic_set_memory_offset(device_t brdev, device_t child, int rid,
 	    uint32_t cardaddr, uint32_t *deltap);
 int	cbb_pcic_set_res_flags(device_t brdev, device_t child, int type,
-	    int rid, uint32_t flags);
+	    int rid, u_long flags);
 int	cbb_power(device_t brdev, int volts);
 int	cbb_power_enable_socket(device_t brdev, device_t child);
-void	cbb_power_disable_socket(device_t brdev, device_t child);
+int	cbb_power_disable_socket(device_t brdev, device_t child);
 int	cbb_read_ivar(device_t brdev, device_t child, int which,
 	    uintptr_t *result);
 int	cbb_release_resource(device_t brdev, device_t child,

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 22:04:07 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 18B8F1065672;
	Wed,  4 Feb 2009 22:04:07 +0000 (UTC)
	(envelope-from emax@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 045758FC1D;
	Wed,  4 Feb 2009 22:04:07 +0000 (UTC)
	(envelope-from emax@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14M46he095324;
	Wed, 4 Feb 2009 22:04:06 GMT (envelope-from emax@svn.freebsd.org)
Received: (from emax@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14M46j0095320;
	Wed, 4 Feb 2009 22:04:06 GMT (envelope-from emax@svn.freebsd.org)
Message-Id: <200902042204.n14M46j0095320@svn.freebsd.org>
From: Maksim Yevmenkin <emax@FreeBSD.org>
Date: Wed, 4 Feb 2009 22:04:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188130 - in head: usr.bin/bluetooth/rfcomm_sppd
	usr.sbin/bluetooth/hcsecd usr.sbin/bluetooth/hcseriald
	usr.sbin/bluetooth/rfcomm_pppd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 22:04:07 -0000

Author: emax
Date: Wed Feb  4 22:04:06 2009
New Revision: 188130
URL: http://svn.freebsd.org/changeset/base/188130

Log:
  Clenup code a bit and do not call fork(2) before dameon(3) where not needed.
  
  MFC after:	1 month

Modified:
  head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c
  head/usr.sbin/bluetooth/hcsecd/hcsecd.c
  head/usr.sbin/bluetooth/hcseriald/hcseriald.c
  head/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c

Modified: head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c
==============================================================================
--- head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c	Wed Feb  4 21:11:31 2009	(r188129)
+++ head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c	Wed Feb  4 22:04:06 2009	(r188130)
@@ -281,22 +281,8 @@ main(int argc, char *argv[]) 
 	}
 
 	/* Became daemon if required */
-	if (background) {
-		switch (fork()) {
-		case -1:
-			err(1, "Could not fork()");
-			/* NOT REACHED */
-
-		case 0:
-			exit(0);
-			/* NOT REACHED */
-
-		default:
-			if (daemon(0, 0) < 0)
-				err(1, "Could not daemon()");
-			break;
-		}
-	}
+	if (background && daemon(0, 0) < 0)
+		err(1, "Could not daemon()");
 
 	openlog(SPPD_IDENT, LOG_NDELAY|LOG_PERROR|LOG_PID, LOG_DAEMON);
 	syslog(LOG_INFO, "Starting on %s...", (tty != NULL)? tty : "stdin/stdout");

Modified: head/usr.sbin/bluetooth/hcsecd/hcsecd.c
==============================================================================
--- head/usr.sbin/bluetooth/hcsecd/hcsecd.c	Wed Feb  4 21:11:31 2009	(r188129)
+++ head/usr.sbin/bluetooth/hcsecd/hcsecd.c	Wed Feb  4 22:04:06 2009	(r188130)
@@ -128,9 +128,8 @@ main(int argc, char *argv[])
 			(void * const) &filter, sizeof(filter)) < 0)
 		err(1, "Could not set HCI socket filter");
 
-	if (detach)
-		if (daemon(0, 0) < 0)
-			err(1, "Could not daemon()ize");
+	if (detach && daemon(0, 0) < 0)
+		err(1, "Could not daemon()ize");
 
 	openlog(HCSECD_IDENT, LOG_NDELAY|LOG_PERROR|LOG_PID, LOG_DAEMON);
 

Modified: head/usr.sbin/bluetooth/hcseriald/hcseriald.c
==============================================================================
--- head/usr.sbin/bluetooth/hcseriald/hcseriald.c	Wed Feb  4 21:11:31 2009	(r188129)
+++ head/usr.sbin/bluetooth/hcseriald/hcseriald.c	Wed Feb  4 22:04:06 2009	(r188130)
@@ -101,23 +101,10 @@ main(int argc, char *argv[])
 	/* Open device */
 	n = open_device(device, speed, name);
 
-	if (detach) {
-		pid_t	pid = fork();
-
-		if (pid == (pid_t) -1) {
-			syslog(LOG_ERR, "Could not fork(). %s (%d)",
-				strerror(errno), errno);
-			exit(1);
-		}
-
-		if (pid != 0)
-			exit(0);
-
-		if (daemon(0, 0) < 0) {
-			syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)",
-				strerror(errno), errno);
-			exit(1);
-		}
+	if (detach && daemon(0, 0) < 0) {
+		syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)",
+			strerror(errno), errno);
+		exit(1);
 	}
 
 	/* Write PID file */

Modified: head/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c
==============================================================================
--- head/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c	Wed Feb  4 21:11:31 2009	(r188129)
+++ head/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c	Wed Feb  4 22:04:06 2009	(r188130)
@@ -166,22 +166,10 @@ main(int argc, char *argv[])
 
 	openlog(RFCOMM_PPPD, LOG_PID | LOG_PERROR | LOG_NDELAY, LOG_USER);
 
-	if (detach) {
-		pid = fork();
-		if (pid == (pid_t) -1) {
-			syslog(LOG_ERR, "Could not fork(). %s (%d)",
-				strerror(errno), errno);
-			exit(1);
-		}
-
-		if (pid != 0)
-			exit(0);
-
-		if (daemon(0, 0) < 0) {
-			syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)",
-				strerror(errno), errno);
-			exit(1);
-		}
+	if (detach && daemon(0, 0) < 0) {
+		syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)",
+			strerror(errno), errno);
+		exit(1);
 	}
 
 	s = socket(PF_BLUETOOTH, SOCK_STREAM, BLUETOOTH_PROTO_RFCOMM);

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 22:16:28 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8D4E61065670;
	Wed,  4 Feb 2009 22:16:28 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7AF498FC0A;
	Wed,  4 Feb 2009 22:16:28 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14MGS4G096492;
	Wed, 4 Feb 2009 22:16:28 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14MGSK6096491;
	Wed, 4 Feb 2009 22:16:28 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <200902042216.n14MGSK6096491@svn.freebsd.org>
From: Nathan Whitehorn <nwhitehorn@FreeBSD.org>
Date: Wed, 4 Feb 2009 22:16:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188131 - head/sys/dev/bm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 22:16:29 -0000

Author: nwhitehorn
Date: Wed Feb  4 22:16:27 2009
New Revision: 188131
URL: http://svn.freebsd.org/changeset/base/188131

Log:
  Fix bm_shutdown() KOBJ method to correspond to return int, as it should.
  
  Found by:	Andriy Gapon

Modified:
  head/sys/dev/bm/if_bm.c

Modified: head/sys/dev/bm/if_bm.c
==============================================================================
--- head/sys/dev/bm/if_bm.c	Wed Feb  4 22:04:06 2009	(r188130)
+++ head/sys/dev/bm/if_bm.c	Wed Feb  4 22:16:27 2009	(r188131)
@@ -81,7 +81,7 @@ MODULE_DEPEND(bm, miibus, 1, 1, 1);
 static int bm_probe		(device_t);
 static int bm_attach		(device_t);
 static int bm_detach		(device_t);
-static void bm_shutdown		(device_t);
+static int bm_shutdown		(device_t);
 
 static void bm_start		(struct ifnet *);
 static void bm_start_locked	(struct ifnet *);
@@ -654,7 +654,7 @@ bm_detach(device_t dev)
 	return (0);
 }
 
-static void
+static int
 bm_shutdown(device_t dev)
 {
 	struct bm_softc *sc;
@@ -664,6 +664,8 @@ bm_shutdown(device_t dev)
 	BM_LOCK(sc);
 	bm_stop(sc);
 	BM_UNLOCK(sc);
+
+	return (0);
 }
 
 static void

From owner-svn-src-head@FreeBSD.ORG  Wed Feb  4 22:44:09 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DCDAF106564A;
	Wed,  4 Feb 2009 22:44:09 +0000 (UTC)
	(envelope-from emax@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CAFC58FC18;
	Wed,  4 Feb 2009 22:44:09 +0000 (UTC)
	(envelope-from emax@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n14Mi9Kb097101;
	Wed, 4 Feb 2009 22:44:09 GMT (envelope-from emax@svn.freebsd.org)
Received: (from emax@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n14Mi9J0097100;
	Wed, 4 Feb 2009 22:44:09 GMT (envelope-from emax@svn.freebsd.org)
Message-Id: <200902042244.n14Mi9J0097100@svn.freebsd.org>
From: Maksim Yevmenkin <emax@FreeBSD.org>
Date: Wed, 4 Feb 2009 22:44:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188132 - head/sys/netgraph/bluetooth/socket
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Feb 2009 22:44:10 -0000

Author: emax
Date: Wed Feb  4 22:44:09 2009
New Revision: 188132
URL: http://svn.freebsd.org/changeset/base/188132

Log:
  Allow unprivileged users to run l2ping(8).
  
  MFC after:	1 month

Modified:
  head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c

Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c
==============================================================================
--- head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c	Wed Feb  4 22:16:27 2009	(r188131)
+++ head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c	Wed Feb  4 22:44:09 2009	(r188132)
@@ -947,11 +947,6 @@ ng_btsocket_l2cap_raw_control(struct soc
 		ng_l2cap_l2ca_ping_ip			*ip = NULL;
 		ng_l2cap_l2ca_ping_op			*op = NULL;
 
-		if (!(pcb->flags & NG_BTSOCKET_L2CAP_RAW_PRIVILEGED)) {
-			error = EPERM;
-			break;
-		}
-
 		if ((p->echo_size != 0 && p->echo_data == NULL) ||
 		     p->echo_size > NG_L2CAP_MAX_ECHO_SIZE) {
 			error = EINVAL;

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 02:01:18 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AC2B7106567A;
	Thu,  5 Feb 2009 02:01:18 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6C7208FC16;
	Thu,  5 Feb 2009 02:01:18 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1521IkR003858;
	Thu, 5 Feb 2009 02:01:18 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1521IbK003857;
	Thu, 5 Feb 2009 02:01:18 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200902050201.n1521IbK003857@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Thu, 5 Feb 2009 02:01:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188134 - head/sys/i386/xen
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 02:01:19 -0000

Author: kmacy
Date: Thu Feb  5 02:01:18 2009
New Revision: 188134
URL: http://svn.freebsd.org/changeset/base/188134

Log:
  adjust the way that idle happens so as to avoid missing timer interrupts

Modified:
  head/sys/i386/xen/clock.c

Modified: head/sys/i386/xen/clock.c
==============================================================================
--- head/sys/i386/xen/clock.c	Thu Feb  5 01:59:28 2009	(r188133)
+++ head/sys/i386/xen/clock.c	Thu Feb  5 02:01:18 2009	(r188134)
@@ -246,24 +246,29 @@ static void __get_time_values_from_xen(v
 	shared_info_t           *s = HYPERVISOR_shared_info;
 	struct vcpu_time_info   *src;
 	struct shadow_time_info *dst;
+	uint32_t pre_version, post_version;
 
 	src = &s->vcpu_info[smp_processor_id()].time;
 	dst = &per_cpu(shadow_time, smp_processor_id());
 
+	spinlock_enter();
 	do {
-		dst->version = src->version;
+	        pre_version = dst->version = src->version;
 		rmb();
 		dst->tsc_timestamp     = src->tsc_timestamp;
 		dst->system_timestamp  = src->system_time;
 		dst->tsc_to_nsec_mul   = src->tsc_to_system_mul;
 		dst->tsc_shift         = src->tsc_shift;
 		rmb();
+		post_version = src->version;
 	}
-	while ((src->version & 1) | (dst->version ^ src->version));
+	while ((pre_version & 1) | (pre_version ^ post_version));
 
 	dst->tsc_to_usec_mul = dst->tsc_to_nsec_mul / 1000;
+	spinlock_exit();
 }
 
+
 static inline int time_values_up_to_date(int cpu)
 {
 	struct vcpu_time_info   *src;
@@ -311,15 +316,15 @@ clkintr(void *arg)
 	}
 	
 	/* Process elapsed ticks since last call. */
-	if (delta >= NS_PER_TICK) {
-		processed_system_time += (delta / NS_PER_TICK) * NS_PER_TICK;
-		per_cpu(processed_system_time, cpu) += (delta_cpu / NS_PER_TICK) * NS_PER_TICK;
+	while (delta >= NS_PER_TICK) {
+	        delta -= NS_PER_TICK;
+		processed_system_time += NS_PER_TICK;
+		per_cpu(processed_system_time, cpu) +=  NS_PER_TICK;
+		if (PCPU_GET(cpuid) == 0)
+		      hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
+		else
+		      hardclock_cpu(TRAPF_USERMODE(frame));
 	}
-	if (PCPU_GET(cpuid) == 0)
-		hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
-	else
-		hardclock_cpu(TRAPF_USERMODE(frame));
-
 	/*
 	 * Take synchronised time from Xen once a minute if we're not
 	 * synchronised ourselves, and we haven't chosen to keep an independent
@@ -334,61 +339,25 @@ clkintr(void *arg)
 	/* XXX TODO */
 	return (FILTER_HANDLED);
 }
-
-int clkintr2(void *arg);
-
-int 
-clkintr2(void *arg)
-{
-	int64_t delta_cpu, delta;
-	struct trapframe *frame = (struct trapframe *)arg;
-	int cpu = smp_processor_id();
-	struct shadow_time_info *shadow = &per_cpu(shadow_time, cpu);
-
-	do {
-		__get_time_values_from_xen();
-		
-		delta = delta_cpu = 
-			shadow->system_timestamp + get_nsec_offset(shadow);
-		delta     -= processed_system_time;
-		delta_cpu -= per_cpu(processed_system_time, cpu);
-
-	} while (!time_values_up_to_date(cpu));
-	
-	if (unlikely(delta < (int64_t)0) || unlikely(delta_cpu < (int64_t)0)) {
-		printf("Timer ISR: Time went backwards: %lld\n", delta);
-		return (FILTER_HANDLED);
-	}
-	
-	/* Process elapsed ticks since last call. */
-	if (delta >= NS_PER_TICK) {
-		processed_system_time += (delta / NS_PER_TICK) * NS_PER_TICK;
-		per_cpu(processed_system_time, cpu) += (delta_cpu / NS_PER_TICK) * NS_PER_TICK;
-	}
-	hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
-
-	/*
-	 * Take synchronised time from Xen once a minute if we're not
-	 * synchronised ourselves, and we haven't chosen to keep an independent
-	 * time base.
-	 */
-	
-	if (shadow_tv_version != HYPERVISOR_shared_info->wc_version) {
-		update_wallclock();
-		tc_setclock(&shadow_tv);
-	}
-	
-	/* XXX TODO */
-	return (FILTER_HANDLED);
-}
-
 static uint32_t
 getit(void)
 {
 	struct shadow_time_info *shadow;
+	uint64_t time;
+	uint32_t local_time_version;
+
 	shadow = &per_cpu(shadow_time, smp_processor_id());
-	__get_time_values_from_xen();
-	return shadow->system_timestamp + get_nsec_offset(shadow);
+
+	do {
+	  local_time_version = shadow->version;
+	  barrier();
+	  time = shadow->system_timestamp + get_nsec_offset(shadow);
+	  if (!time_values_up_to_date(cpu))
+	    __get_time_values_from_xen(/*cpu */);
+	  barrier();
+	} while (local_time_version != shadow->version);
+
+	  return (time);
 }
 
 
@@ -552,7 +521,6 @@ startrtclock()
         timer_freq = xen_timecounter.tc_frequency = 1000000000LL;
         tc_init(&xen_timecounter);
 
-
 	rdtscll(alarm);
 }
 
@@ -903,13 +871,44 @@ xen_get_offset(void)
 	return edx;
 }
 #endif
+
+/* Convert jiffies to system time. */
+static uint64_t 
+ticks_to_system_time(unsigned long newticks)
+{
+#if 0
+  unsigned long seq;
+#endif
+  long delta;
+  uint64_t st;
+
+
+    delta = newticks - ticks;
+    if (delta < 1) {
+      /* Triggers in some wrap-around cases, but that's okay:
+       * we just end up with a shorter timeout. */
+      st = processed_system_time + NS_PER_TICK;
+    } else if (((unsigned long)delta >> (BITS_PER_LONG-3)) != 0) {
+      /* Very long timeout means there is no pending timer.
+       * We indicate this to Xen by passing zero timeout. */
+      st = 0;
+    } else {
+      st = processed_system_time + delta * (uint64_t)NS_PER_TICK;
+    }
+
+    return (st);
+}
+
 void
 idle_block(void)
 {
+  uint64_t timeout;
 
-	__get_time_values_from_xen();
-	PANIC_IF(HYPERVISOR_set_timer_op(processed_system_time + NS_PER_TICK) != 0);
-	HYPERVISOR_sched_op(SCHEDOP_block, 0);
+  timeout = ticks_to_system_time(ticks + 1)  + NS_PER_TICK/2;
+
+  __get_time_values_from_xen();
+  PANIC_IF(HYPERVISOR_set_timer_op(timeout) != 0);
+  HYPERVISOR_sched_op(SCHEDOP_block, 0);
 }
 
 int

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 04:00:55 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F1C1D106564A;
	Thu,  5 Feb 2009 04:00:55 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E0E708FC0A;
	Thu,  5 Feb 2009 04:00:55 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1540t2Q008170;
	Thu, 5 Feb 2009 04:00:55 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1540tgU008169;
	Thu, 5 Feb 2009 04:00:55 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200902050400.n1540tgU008169@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Thu, 5 Feb 2009 04:00:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188138 - head/sys/i386/xen
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 04:00:56 -0000

Author: kmacy
Date: Thu Feb  5 04:00:55 2009
New Revision: 188138
URL: http://svn.freebsd.org/changeset/base/188138

Log:
  pass in smp_processor_id to identify the cpu in use

Modified:
  head/sys/i386/xen/clock.c

Modified: head/sys/i386/xen/clock.c
==============================================================================
--- head/sys/i386/xen/clock.c	Thu Feb  5 02:16:05 2009	(r188137)
+++ head/sys/i386/xen/clock.c	Thu Feb  5 04:00:55 2009	(r188138)
@@ -352,7 +352,7 @@ getit(void)
 	  local_time_version = shadow->version;
 	  barrier();
 	  time = shadow->system_timestamp + get_nsec_offset(shadow);
-	  if (!time_values_up_to_date(cpu))
+	  if (!time_values_up_to_date(smp_processor_id()))
 	    __get_time_values_from_xen(/*cpu */);
 	  barrier();
 	} while (local_time_version != shadow->version);

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 06:22:07 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1888F106566C;
	Thu,  5 Feb 2009 06:22:07 +0000 (UTC)
	(envelope-from alexander@leidinger.net)
Received: from redbull.bpaserver.net (redbullneu.bpaserver.net
	[213.198.78.217])
	by mx1.freebsd.org (Postfix) with ESMTP id AF4DE8FC16;
	Thu,  5 Feb 2009 06:22:06 +0000 (UTC)
	(envelope-from alexander@leidinger.net)
Received: from outgoing.leidinger.net (pD9E2EA13.dip.t-dialin.net
	[217.226.234.19])
	by redbull.bpaserver.net (Postfix) with ESMTP id 5B3E32E0F8;
	Thu,  5 Feb 2009 07:22:02 +0100 (CET)
Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102])
	by outgoing.leidinger.net (Postfix) with ESMTP id 0741110DF83;
	Thu,  5 Feb 2009 07:21:58 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net;
	s=outgoing-alex; t=1233814919; bh=2eftzojt4DJUvciSV8T7xF0AQTQj1dOZ5
	cyy3nMUhio=; h=Message-ID:Date:From:To:Cc:Subject:References:
	In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding;
	b=tMmFVVRTSrMgJ0IkAOyNAfwsPEvlgmja5H/0gR32PPtfEgyGIURhyHknRxLZlv5jF
	A9O7UCOV7AJcOPk1j/UMf1GgvAwdSvGqHVac7FZfKSzVeZ7XI2URSRJ+RUhepFTmFms
	61xozWKTMZEj3O/I/nxy5u8nLn5U1O6O4690cW4HQQ+z9caISjIoOQBTsrNt5zs5t8R
	oWAM0ZgCyPYO9dlFeE3sxruJ2/PKFya+WhbcVu7YmSdAhOLr6uH8XjY5wkR7UrAO6HY
	4MuP0jPSmkz0klRk5VAFFjs44o+Da3GrfXSXcTC3UApe7X1MJ2OApn4emuUYNHZqdhR
	tPew4iP5Q==
Received: (from www@localhost)
	by webmail.leidinger.net (8.14.3/8.13.8/Submit) id n156LwfE090314;
	Thu, 5 Feb 2009 07:21:58 +0100 (CET)
	(envelope-from Alexander@Leidinger.net)
Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by
	webmail.leidinger.net (Horde Framework) with HTTP; Thu, 05 Feb 2009
	07:21:58 +0100
Message-ID: <20090205072158.23811u1p5tpfkakk@webmail.leidinger.net>
X-Priority: 3 (Normal)
Date: Thu, 05 Feb 2009 07:21:58 +0100
From: Alexander Leidinger <Alexander@Leidinger.net>
To: "M. Warner Losh" <imp@bsdimp.com>
References: <4988AB83.2050203@gmx.de> <20090204212854.F51932@delplex.bde.org>
	<20090204154414.1949765y56lfhi80@webmail.leidinger.net>
	<20090204.103220.1763804960.imp@bsdimp.com>
In-Reply-To: <20090204.103220.1763804960.imp@bsdimp.com>
MIME-Version: 1.0
Content-Type: text/plain;
	charset=UTF-8;
	DelSp="Yes";
	format="flowed"
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
User-Agent: Internet Messaging Program (IMP) H3 (4.3) / FreeBSD-8.0
X-BPAnet-MailScanner-Information: Please contact the ISP for more information
X-MailScanner-ID: 5B3E32E0F8.8CD74
X-BPAnet-MailScanner: Found to be clean
X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, 
	score=-13.427, required 6, BAYES_00 -15.00,
	DKIM_SIGNED 0.00, 
	DKIM_VERIFIED -0.00, MIME_QP_LONG_LINE 1.40, RDNS_DYNAMIC 0.10,
	TW_SV 0.08)
X-BPAnet-MailScanner-From: alexander@leidinger.net
X-Spam-Status: No
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, christoph.mallon@gmx.de,
	src-committers@freebsd.org, brde@optusnet.com.au
Subject: Re: svn commit: r188098 - head/lib/libc/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 06:22:07 -0000

Quoting "M. Warner Losh" <imp@bsdimp.com> (from Wed, 04 Feb 2009 =20
10:32:20 -0700 (MST)):

> In message: <20090204154414.1949765y56lfhi80@webmail.leidinger.net>
>             Alexander Leidinger <Alexander@leidinger.net> writes:
> : Quoting Bruce Evans <brde@optusnet.com.au> (from Wed, 4 Feb 2009
> : 22:27:59 +1100 (EST)):
> :
> : > On Tue, 3 Feb 2009, Christoph Mallon wrote:
> : >
> : >> Warner Losh schrieb:
> : >>> Modified: head/lib/libc/string/strmode.c
> : >>> =20
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> : >>> --- head/lib/libc/string/strmode.c=09Tue Feb  3 20:01:51 2009 (r1880=
97)
> : >>> +++ head/lib/libc/string/strmode.c=09Tue Feb  3 20:25:36 2009 (r1880=
98)
> : >>> @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
> : >>> #include <string.h>
> : >>>  void
> : >>> -strmode(mode_t mode, char *p)
> : >>> +strmode(/* mode_t */ int mode, char *p)
> : >>> {
> : >>> =09 /* print type */
> : >>> =09switch (mode & S_IFMT) {
> : >>
> : >> The manpage states that the first parameter of strmode() is a
> : >> mode_t. What's wrong - the implementation (both in header and
> : >> definition) or the documentation?
> : >
> : > The man page is wrong.  strtomode() should take an int arg (actually
> : > the default (unary) promotion of a mode_t) for the the same reasons
> : > that memchr() does -- because these interfaces should be usable by K&R
> : > compilers and/or by standard C compilers without a protoype in scope.
> : > Even if this is no longer required, binary compatibily requires the
> : > interfaces to be the same as the ones that used to be required.  The
> : > requirement for binary compatibility also prevents "fixing" interfaces
> : > to be "ANSI" in headers (if you "fix" prototypes there then you will
> : > get obscure runtime errors instead of tinderbox errors).
> :
> : Is this also true for the current use of symbol versioning in our
> : libc? I thought this is supposed to "fix" this problem (assuming we
> : add an UPDATING entry that users have to make sure that they to a full
> : installworld to habe the includes and the lib in sync)?
>
> Maybe, but it is a problem worth fixing?  What we have now is correct

It depends if this is seen as a broken window =20
(http://www.pragprog.com/the-pragmatic-programmer/extracts/software-entropy)=
 =20
or not...

At least we should not talk a lot against fixing it. If someone wants =20
to fix it, he should be welcome.

Bye,
Alexander.

--=20
Phosflink, v:
=09To flick a bulb on and off when it burns out (as if, somehow,
=09that will bring it back to life).
=09=09-- Rich Hall & Friends, "Sniglets"

http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID =3D B0063FE7
http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID =3D 72077137

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 07:51:18 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3F3031065672;
	Thu,  5 Feb 2009 07:51:18 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id CB23A8FC0C;
	Thu,  5 Feb 2009 07:51:17 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n157mLYZ012273;
	Thu, 5 Feb 2009 00:48:21 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Thu, 05 Feb 2009 00:48:49 -0700 (MST)
Message-Id: <20090205.004849.-906919470.imp@bsdimp.com>
To: Alexander@leidinger.net
From: "M. Warner Losh" <imp@bsdimp.com>
In-Reply-To: <20090205072158.23811u1p5tpfkakk@webmail.leidinger.net>
References: <20090204154414.1949765y56lfhi80@webmail.leidinger.net>
	<20090204.103220.1763804960.imp@bsdimp.com>
	<20090205072158.23811u1p5tpfkakk@webmail.leidinger.net>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, christoph.mallon@gmx.de,
	src-committers@freebsd.org, brde@optusnet.com.au
Subject: Re: svn commit: r188098 - head/lib/libc/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 07:51:18 -0000

In message: <20090205072158.23811u1p5tpfkakk@webmail.leidinger.net>
            Alexander Leidinger <Alexander@leidinger.net> writes:
: Quoting "M. Warner Losh" <imp@bsdimp.com> (from Wed, 04 Feb 2009  
: 10:32:20 -0700 (MST)):
: 
: > In message: <20090204154414.1949765y56lfhi80@webmail.leidinger.net>
: >             Alexander Leidinger <Alexander@leidinger.net> writes:
: > : Quoting Bruce Evans <brde@optusnet.com.au> (from Wed, 4 Feb 2009
: > : 22:27:59 +1100 (EST)):
: > :
: > : > On Tue, 3 Feb 2009, Christoph Mallon wrote:
: > : >
: > : >> Warner Losh schrieb:
: > : >>> Modified: head/lib/libc/string/strmode.c
: > : >>>  
: > ==============================================================================
: > : >>> --- head/lib/libc/string/strmode.c	Tue Feb  3 20:01:51 2009 (r188097)
: > : >>> +++ head/lib/libc/string/strmode.c	Tue Feb  3 20:25:36 2009 (r188098)
: > : >>> @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
: > : >>> #include <string.h>
: > : >>>  void
: > : >>> -strmode(mode_t mode, char *p)
: > : >>> +strmode(/* mode_t */ int mode, char *p)
: > : >>> {
: > : >>> 	 /* print type */
: > : >>> 	switch (mode & S_IFMT) {
: > : >>
: > : >> The manpage states that the first parameter of strmode() is a
: > : >> mode_t. What's wrong - the implementation (both in header and
: > : >> definition) or the documentation?
: > : >
: > : > The man page is wrong.  strtomode() should take an int arg (actually
: > : > the default (unary) promotion of a mode_t) for the the same reasons
: > : > that memchr() does -- because these interfaces should be usable by K&R
: > : > compilers and/or by standard C compilers without a protoype in scope.
: > : > Even if this is no longer required, binary compatibily requires the
: > : > interfaces to be the same as the ones that used to be required.  The
: > : > requirement for binary compatibility also prevents "fixing" interfaces
: > : > to be "ANSI" in headers (if you "fix" prototypes there then you will
: > : > get obscure runtime errors instead of tinderbox errors).
: > :
: > : Is this also true for the current use of symbol versioning in our
: > : libc? I thought this is supposed to "fix" this problem (assuming we
: > : add an UPDATING entry that users have to make sure that they to a full
: > : installworld to habe the includes and the lib in sync)?
: >
: > Maybe, but it is a problem worth fixing?  What we have now is correct
: 
: It depends if this is seen as a broken window  
: (http://www.pragprog.com/the-pragmatic-programmer/extracts/software-entropy)  
: or not...
: 
: At least we should not talk a lot against fixing it. If someone wants  
: to fix it, he should be welcome.

Yea.  A lot of hair to get right, to test, and to make sure works
everywhere.  If someone has that, and can still make things work in
the no-prototype case, then go for it.

Warner

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 08:46:18 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D539D106564A;
	Thu,  5 Feb 2009 08:46:18 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C348F8FC0A;
	Thu,  5 Feb 2009 08:46:18 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n158kIM0020989;
	Thu, 5 Feb 2009 08:46:18 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n158kI1D020988;
	Thu, 5 Feb 2009 08:46:18 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <200902050846.n158kI1D020988@svn.freebsd.org>
From: Edward Tomasz Napierala <trasz@FreeBSD.org>
Date: Thu, 5 Feb 2009 08:46:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188141 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 08:46:19 -0000

Author: trasz
Date: Thu Feb  5 08:46:18 2009
New Revision: 188141
URL: http://svn.freebsd.org/changeset/base/188141

Log:
  In some situations, mnt_lockref could go negative due to vfs_unbusy() being
  called without calling vfs_busy() first.  This made umount(8) hang waiting
  for mnt_lockref to become zero, which would never happen.
  
  Reviewed by:	kib
  Approved by:	rwatson (mentor)
  Reported by:	pho
  Found with:	stress2
  Sponsored by:	FreeBSD Foundation

Modified:
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c	Thu Feb  5 04:02:15 2009	(r188140)
+++ head/sys/kern/vfs_syscalls.c	Thu Feb  5 08:46:18 2009	(r188141)
@@ -395,14 +395,16 @@ kern_fstatfs(struct thread *td, int fd, 
 		vfs_ref(mp);
 	VOP_UNLOCK(vp, 0);
 	fdrop(fp, td);
-	if (vp->v_iflag & VI_DOOMED) {
+	if (mp == NULL) {
 		error = EBADF;
 		goto out;
 	}
 	error = vfs_busy(mp, 0);
 	vfs_rel(mp);
-	if (error)
-		goto out;
+	if (error) {
+		VFS_UNLOCK_GIANT(vfslocked);
+		return (error);
+	}
 #ifdef MAC
 	error = mac_mount_check_stat(td->td_ucred, mp);
 	if (error)

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 11:48:11 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5CB8B106564A;
	Thu,  5 Feb 2009 11:48:11 +0000 (UTC) (envelope-from dfr@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4A5DC8FC1A;
	Thu,  5 Feb 2009 11:48:11 +0000 (UTC) (envelope-from dfr@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15BmAc1026165;
	Thu, 5 Feb 2009 11:48:10 GMT (envelope-from dfr@svn.freebsd.org)
Received: (from dfr@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15BmA54026164;
	Thu, 5 Feb 2009 11:48:10 GMT (envelope-from dfr@svn.freebsd.org)
Message-Id: <200902051148.n15BmA54026164@svn.freebsd.org>
From: Doug Rabson <dfr@FreeBSD.org>
Date: Thu, 5 Feb 2009 11:48:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188142 - head/sys/rpc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 11:48:11 -0000

Author: dfr
Date: Thu Feb  5 11:48:10 2009
New Revision: 188142
URL: http://svn.freebsd.org/changeset/base/188142

Log:
  Use the correct creds when reconnecting so that we have enough privilege to
  bind reserved ports (if necessary).
  
  Submitted by:	Jaakko Heinonen <jh at saualaht dot fi>

Modified:
  head/sys/rpc/clnt_rc.c

Modified: head/sys/rpc/clnt_rc.c
==============================================================================
--- head/sys/rpc/clnt_rc.c	Thu Feb  5 08:46:18 2009	(r188141)
+++ head/sys/rpc/clnt_rc.c	Thu Feb  5 11:48:10 2009	(r188142)
@@ -181,11 +181,12 @@ again:
 		rpc_createerr.cf_error.re_errno = 0;
 		goto out;
 	}
-	if (rc->rc_privport)
-		bindresvport(so, NULL);
 
 	oldcred = td->td_ucred;
 	td->td_ucred = rc->rc_ucred;
+	if (rc->rc_privport)
+		bindresvport(so, NULL);
+
 	if (rc->rc_nconf->nc_semantics == NC_TPI_CLTS)
 		rc->rc_client = clnt_dg_create(so,
 		    (struct sockaddr *) &rc->rc_addr, rc->rc_prog, rc->rc_vers,

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 14:06:10 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B272B106566B;
	Thu,  5 Feb 2009 14:06:10 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9DBE18FC17;
	Thu,  5 Feb 2009 14:06:10 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15E6Avk028729;
	Thu, 5 Feb 2009 14:06:10 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15E6AeB028715;
	Thu, 5 Feb 2009 14:06:10 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <200902051406.n15E6AeB028715@svn.freebsd.org>
From: Jamie Gritton <jamie@FreeBSD.org>
Date: Thu, 5 Feb 2009 14:06:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188144 - in head: lib/libc/sys sys/kern sys/net
	sys/netinet sys/netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 14:06:11 -0000

Author: jamie
Date: Thu Feb  5 14:06:09 2009
New Revision: 188144
URL: http://svn.freebsd.org/changeset/base/188144

Log:
  Standardize the various prison_foo_ip[46] functions and prison_if to
  return zero on success and an error code otherwise.  The possible errors
  are EADDRNOTAVAIL if an address being checked for doesn't match the
  prison, and EAFNOSUPPORT if the prison doesn't have any addresses in
  that address family.  For most callers of these functions, use the
  returned error code instead of e.g. a hard-coded EADDRNOTAVAIL or
  EINVAL.
  
  Always include a jailed() check in these functions, where a non-jailed
  cred always returns success (and makes no changes).  Remove the explicit
  jailed() checks that preceded many of the function calls.
  
  Approved by:	bz (mentor)

Modified:
  head/lib/libc/sys/send.2
  head/sys/kern/kern_jail.c
  head/sys/net/if.c
  head/sys/net/rtsock.c
  head/sys/netinet/in.c
  head/sys/netinet/in_pcb.c
  head/sys/netinet/raw_ip.c
  head/sys/netinet/tcp_usrreq.c
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet6/in6.c
  head/sys/netinet6/in6_pcb.c
  head/sys/netinet6/in6_src.c
  head/sys/netinet6/raw_ip6.c
  head/sys/netinet6/udp6_usrreq.c

Modified: head/lib/libc/sys/send.2
==============================================================================
--- head/lib/libc/sys/send.2	Thu Feb  5 14:02:04 2009	(r188143)
+++ head/lib/libc/sys/send.2	Thu Feb  5 14:06:09 2009	(r188144)
@@ -28,7 +28,7 @@
 .\"     From: @(#)send.2	8.2 (Berkeley) 2/21/94
 .\" $FreeBSD$
 .\"
-.Dd September 13, 2006
+.Dd February 5, 2009
 .Dt SEND 2
 .Os
 .Sh NAME
@@ -190,7 +190,7 @@ receiver is not listening on the remote 
 The remote host was down.
 .It Bq Er ENETDOWN
 The remote network was down.
-.It Bq Er EPERM
+.It Bq Er EADDRNOTAVAIL
 The process using a
 .Dv SOCK_RAW
 socket was jailed and the source

Modified: head/sys/kern/kern_jail.c
==============================================================================
--- head/sys/kern/kern_jail.c	Thu Feb  5 14:02:04 2009	(r188143)
+++ head/sys/kern/kern_jail.c	Thu Feb  5 14:06:09 2009	(r188144)
@@ -217,7 +217,7 @@ prison_check_conflicting_ips(struct pris
 		if ((p->pr_ip4s >= 1 && pr->pr_ip4s > 1) ||
 		    (p->pr_ip4s > 1 && pr->pr_ip4s >= 1)) {
 			for (i = 0; i < p->pr_ip4s; i++) {
-				if (_prison_check_ip4(pr, &p->pr_ip4[i]))
+				if (_prison_check_ip4(pr, &p->pr_ip4[i]) == 0)
 					return (EINVAL);
 			}
 		}
@@ -226,7 +226,7 @@ prison_check_conflicting_ips(struct pris
 		if ((p->pr_ip6s >= 1 && pr->pr_ip6s > 1) ||
 		    (p->pr_ip6s > 1 && pr->pr_ip6s >= 1)) {
 			for (i = 0; i < p->pr_ip6s; i++) {
-				if (_prison_check_ip6(pr, &p->pr_ip6[i]))
+				if (_prison_check_ip6(pr, &p->pr_ip6[i]) == 0)
 					return (EINVAL);
 			}
 		}
@@ -807,9 +807,10 @@ prison_proc_free(struct prison *pr)
  * Pass back primary IPv4 address of this jail.
  *
  * If not jailed return success but do not alter the address.  Caller has to
- * make sure to intialize it correctly (INADDR_ANY).
+ * make sure to intialize it correctly (e.g. INADDR_ANY).
  *
- * Returns 0 on success, 1 on error.  Address returned in NBO.
+ * Returns 0 on success, EAFNOSUPPORT if the jail doesn't allow IPv4.
+ * Address returned in NBO.
  */
 int
 prison_get_ip4(struct ucred *cred, struct in_addr *ia)
@@ -823,7 +824,7 @@ prison_get_ip4(struct ucred *cred, struc
 		return (0);
 
 	if (cred->cr_prison->pr_ip4 == NULL)
-		return (1);
+		return (EAFNOSUPPORT);
 
 	ia->s_addr = cred->cr_prison->pr_ip4[0].s_addr;
 	return (0);
@@ -833,8 +834,9 @@ prison_get_ip4(struct ucred *cred, struc
  * Make sure our (source) address is set to something meaningful to this
  * jail.
  *
- * Returns 0 on success, 1 on error.  Address passed in in NBO and returned
- * in NBO.
+ * Returns 0 if not jailed or if address belongs to jail, EADDRNOTAVAIL if
+ * the address doesn't belong, or EAFNOSUPPORT if the jail doesn't allow IPv4.
+ * Address passed in in NBO and returned in NBO.
  */
 int
 prison_local_ip4(struct ucred *cred, struct in_addr *ia)
@@ -847,7 +849,7 @@ prison_local_ip4(struct ucred *cred, str
 	if (!jailed(cred))
 		return (0);
 	if (cred->cr_prison->pr_ip4 == NULL)
-		return (1);
+		return (EAFNOSUPPORT);
 
 	ia0.s_addr = ntohl(ia->s_addr);
 	if (ia0.s_addr == INADDR_LOOPBACK) {
@@ -855,25 +857,23 @@ prison_local_ip4(struct ucred *cred, str
 		return (0);
 	}
 
-	/*
-	 * In case there is only 1 IPv4 address, bind directly.
-	 */
-	if (ia0.s_addr == INADDR_ANY && cred->cr_prison->pr_ip4s == 1) {
-		ia->s_addr = cred->cr_prison->pr_ip4[0].s_addr;
+	if (ia0.s_addr == INADDR_ANY) {
+		/*
+		 * In case there is only 1 IPv4 address, bind directly.
+		 */
+		if (cred->cr_prison->pr_ip4s == 1)
+			ia->s_addr = cred->cr_prison->pr_ip4[0].s_addr;
 		return (0);
 	}
 
-	if (ia0.s_addr == INADDR_ANY || prison_check_ip4(cred, ia))
-		return (0);
-
-	return (1);
+	return (_prison_check_ip4(cred->cr_prison, ia));
 }
 
 /*
  * Rewrite destination address in case we will connect to loopback address.
  *
- * Returns 0 on success, 1 on error.  Address passed in in NBO and returned
- * in NBO.
+ * Returns 0 on success, EAFNOSUPPORT if the jail doesn't allow IPv4.
+ * Address passed in in NBO and returned in NBO.
  */
 int
 prison_remote_ip4(struct ucred *cred, struct in_addr *ia)
@@ -885,7 +885,8 @@ prison_remote_ip4(struct ucred *cred, st
 	if (!jailed(cred))
 		return (0);
 	if (cred->cr_prison->pr_ip4 == NULL)
-		return (1);
+		return (EAFNOSUPPORT);
+
 	if (ntohl(ia->s_addr) == INADDR_LOOPBACK) {
 		ia->s_addr = cred->cr_prison->pr_ip4[0].s_addr;
 		return (0);
@@ -898,23 +899,22 @@ prison_remote_ip4(struct ucred *cred, st
 }
 
 /*
- * Check if given address belongs to the jail referenced by cred.
+ * Check if given address belongs to the jail referenced by cred/prison.
  *
- * Returns 1 if address belongs to jail, 0 if not.  Address passed in in NBO.
+ * Returns 0 if not jailed or if address belongs to jail, EADDRNOTAVAIL if
+ * the address doesn't belong, or EAFNOSUPPORT if the jail doesn't allow IPv4.
+ * Address passed in in NBO.
  */
 static int
 _prison_check_ip4(struct prison *pr, struct in_addr *ia)
 {
 	int i, a, z, d;
 
-	if (pr->pr_ip4 == NULL)
-		return (0);
-
 	/*
 	 * Check the primary IP.
 	 */
 	if (pr->pr_ip4[0].s_addr == ia->s_addr)
-		return (1);
+		return (0);
 
 	/*
 	 * All the other IPs are sorted so we can do a binary search.
@@ -929,9 +929,10 @@ _prison_check_ip4(struct prison *pr, str
 		else if (d < 0)
 			a = i + 1;
 		else
-			return (1);
+			return (0);
 	}
-	return (0);
+
+	return (EADDRNOTAVAIL);
 }
 
 int
@@ -942,7 +943,9 @@ prison_check_ip4(struct ucred *cred, str
 	KASSERT(ia != NULL, ("%s: ia is NULL", __func__));
 
 	if (!jailed(cred))
-		return (1);
+		return (0);
+	if (cred->cr_prison->pr_ip4 == NULL)
+		return (EAFNOSUPPORT);
 
 	return (_prison_check_ip4(cred->cr_prison, ia));
 }
@@ -953,9 +956,9 @@ prison_check_ip4(struct ucred *cred, str
  * Pass back primary IPv6 address for this jail.
  *
  * If not jailed return success but do not alter the address.  Caller has to
- * make sure to intialize it correctly (IN6ADDR_ANY_INIT).
+ * make sure to intialize it correctly (e.g. IN6ADDR_ANY_INIT).
  *
- * Returns 0 on success, 1 on error.
+ * Returns 0 on success, EAFNOSUPPORT if the jail doesn't allow IPv6.
  */
 int
 prison_get_ip6(struct ucred *cred, struct in6_addr *ia6)
@@ -967,7 +970,8 @@ prison_get_ip6(struct ucred *cred, struc
 	if (!jailed(cred))
 		return (0);
 	if (cred->cr_prison->pr_ip6 == NULL)
-		return (1);
+		return (EAFNOSUPPORT);
+
 	bcopy(&cred->cr_prison->pr_ip6[0], ia6, sizeof(struct in6_addr));
 	return (0);
 }
@@ -978,7 +982,8 @@ prison_get_ip6(struct ucred *cred, struc
  * v6only should be set based on (inp->inp_flags & IN6P_IPV6_V6ONLY != 0)
  * when needed while binding.
  *
- * Returns 0 on success, 1 on error.
+ * Returns 0 if not jailed or if address belongs to jail, EADDRNOTAVAIL if
+ * the address doesn't belong, or EAFNOSUPPORT if the jail doesn't allow IPv6.
  */
 int
 prison_local_ip6(struct ucred *cred, struct in6_addr *ia6, int v6only)
@@ -990,32 +995,32 @@ prison_local_ip6(struct ucred *cred, str
 	if (!jailed(cred))
 		return (0);
 	if (cred->cr_prison->pr_ip6 == NULL)
-		return (1);
+		return (EAFNOSUPPORT);
+
 	if (IN6_IS_ADDR_LOOPBACK(ia6)) {
 		bcopy(&cred->cr_prison->pr_ip6[0], ia6,
 		    sizeof(struct in6_addr));
 		return (0);
 	}
 
-	/*
-	 * In case there is only 1 IPv6 address, and v6only is true, then
-	 * bind directly.
-	 */
-	if (v6only != 0 && IN6_IS_ADDR_UNSPECIFIED(ia6) &&
-	    cred->cr_prison->pr_ip6s == 1) {
-		bcopy(&cred->cr_prison->pr_ip6[0], ia6,
-		    sizeof(struct in6_addr));
+	if (IN6_IS_ADDR_UNSPECIFIED(ia6)) {
+		/*
+		 * In case there is only 1 IPv6 address, and v6only is true,
+		 * then bind directly.
+		 */
+		if (v6only != 0 && cred->cr_prison->pr_ip6s == 1)
+			bcopy(&cred->cr_prison->pr_ip6[0], ia6,
+			    sizeof(struct in6_addr));
 		return (0);
 	}
-	if (IN6_IS_ADDR_UNSPECIFIED(ia6) || prison_check_ip6(cred, ia6))
-		return (0);
-	return (1);
+
+	return (_prison_check_ip6(cred->cr_prison, ia6));
 }
 
 /*
  * Rewrite destination address in case we will connect to loopback address.
  *
- * Returns 0 on success, 1 on error.
+ * Returns 0 on success, EAFNOSUPPORT if the jail doesn't allow IPv6.
  */
 int
 prison_remote_ip6(struct ucred *cred, struct in6_addr *ia6)
@@ -1027,7 +1032,8 @@ prison_remote_ip6(struct ucred *cred, st
 	if (!jailed(cred))
 		return (0);
 	if (cred->cr_prison->pr_ip6 == NULL)
-		return (1);
+		return (EAFNOSUPPORT);
+
 	if (IN6_IS_ADDR_LOOPBACK(ia6)) {
 		bcopy(&cred->cr_prison->pr_ip6[0], ia6,
 		    sizeof(struct in6_addr));
@@ -1041,23 +1047,21 @@ prison_remote_ip6(struct ucred *cred, st
 }
 
 /*
- * Check if given address belongs to the jail referenced by cred.
+ * Check if given address belongs to the jail referenced by cred/prison.
  *
- * Returns 1 if address belongs to jail, 0 if not.
+ * Returns 0 if not jailed or if address belongs to jail, EADDRNOTAVAIL if
+ * the address doesn't belong, or EAFNOSUPPORT if the jail doesn't allow IPv6.
  */
 static int
 _prison_check_ip6(struct prison *pr, struct in6_addr *ia6)
 {
 	int i, a, z, d;
 
-	if (pr->pr_ip6 == NULL)
-		return (0);
-
 	/*
 	 * Check the primary IP.
 	 */
 	if (IN6_ARE_ADDR_EQUAL(&pr->pr_ip6[0], ia6))
-		return (1);
+		return (0);
 
 	/*
 	 * All the other IPs are sorted so we can do a binary search.
@@ -1072,9 +1076,10 @@ _prison_check_ip6(struct prison *pr, str
 		else if (d < 0)
 			a = i + 1;
 		else
-			return (1);
+			return (0);
 	}
-	return (0);
+
+	return (EADDRNOTAVAIL);
 }
 
 int
@@ -1085,7 +1090,9 @@ prison_check_ip6(struct ucred *cred, str
 	KASSERT(ia6 != NULL, ("%s: ia6 is NULL", __func__));
 
 	if (!jailed(cred))
-		return (1);
+		return (0);
+	if (cred->cr_prison->pr_ip6 == NULL)
+		return (EAFNOSUPPORT);
 
 	return (_prison_check_ip6(cred->cr_prison, ia6));
 }
@@ -1095,8 +1102,9 @@ prison_check_ip6(struct ucred *cred, str
  * Check if given address belongs to the jail referenced by cred (wrapper to
  * prison_check_ip[46]).
  *
- * Returns 1 if address belongs to jail, 0 if not.  IPv4 Address passed in in
- * NBO.
+ * Returns 0 if not jailed or if address belongs to jail, EADDRNOTAVAIL if
+ * the address doesn't belong, or EAFNOSUPPORT if the jail doesn't allow
+ * the address family.  IPv4 Address passed in in NBO.
  */
 int
 prison_if(struct ucred *cred, struct sockaddr *sa)
@@ -1107,35 +1115,31 @@ prison_if(struct ucred *cred, struct soc
 #ifdef INET6
 	struct sockaddr_in6 *sai6;
 #endif
-	int ok;
+	int error;
 
 	KASSERT(cred != NULL, ("%s: cred is NULL", __func__));
 	KASSERT(sa != NULL, ("%s: sa is NULL", __func__));
 
-	ok = 0;
-	switch(sa->sa_family)
+	error = 0;
+	switch (sa->sa_family)
 	{
 #ifdef INET
 	case AF_INET:
 		sai = (struct sockaddr_in *)sa;
-		if (prison_check_ip4(cred, &sai->sin_addr))
-			ok = 1;
+		error = prison_check_ip4(cred, &sai->sin_addr);
 		break;
-
 #endif
 #ifdef INET6
 	case AF_INET6:
 		sai6 = (struct sockaddr_in6 *)sa;
-		if (prison_check_ip6(cred, (struct in6_addr *)&sai6->sin6_addr))
-			ok = 1;
+		error = prison_check_ip6(cred, &sai6->sin6_addr);
 		break;
-
 #endif
 	default:
-		if (!jail_socket_unixiproute_only)
-			ok = 1;
+		if (jailed(cred) && jail_socket_unixiproute_only)
+			error = EAFNOSUPPORT;
 	}
-	return (ok);
+	return (error);
 }
 
 /*

Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c	Thu Feb  5 14:02:04 2009	(r188143)
+++ head/sys/net/if.c	Thu Feb  5 14:06:09 2009	(r188144)
@@ -2271,8 +2271,7 @@ again:
 		TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
 			struct sockaddr *sa = ifa->ifa_addr;
 
-			if (jailed(curthread->td_ucred) &&
-			    !prison_if(curthread->td_ucred, sa))
+			if (prison_if(curthread->td_ucred, sa) != 0)
 				continue;
 			addrs++;
 #ifdef COMPAT_43

Modified: head/sys/net/rtsock.c
==============================================================================
--- head/sys/net/rtsock.c	Thu Feb  5 14:02:04 2009	(r188143)
+++ head/sys/net/rtsock.c	Thu Feb  5 14:06:09 2009	(r188144)
@@ -347,7 +347,7 @@ rtm_get_jailed(struct rt_addrinfo *info,
 		 * 1. Check if the returned address is part of the jail.
 		 */
 		ia = ((struct sockaddr_in *)rt->rt_ifa->ifa_addr)->sin_addr;
-		if (prison_check_ip4(cred, &ia) != 0) {
+		if (prison_check_ip4(cred, &ia) == 0) {
 			info->rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
 
 		} else {
@@ -366,7 +366,7 @@ rtm_get_jailed(struct rt_addrinfo *info,
 				if (sa->sa_family != AF_INET)
 					continue;
 				ia = ((struct sockaddr_in *)sa)->sin_addr;
-				if (prison_check_ip4(cred, &ia) != 0) {
+				if (prison_check_ip4(cred, &ia) == 0) {
 					found = 1;
 					break;
 				}
@@ -399,7 +399,7 @@ rtm_get_jailed(struct rt_addrinfo *info,
 		 */
 		bcopy(&((struct sockaddr_in6 *)rt->rt_ifa->ifa_addr)->sin6_addr,
 		    &ia6, sizeof(struct in6_addr));
-		if (prison_check_ip6(cred, &ia6) != 0) {
+		if (prison_check_ip6(cred, &ia6) == 0) {
 			info->rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
 		} else {
 			struct ifaddr *ifa;
@@ -418,7 +418,7 @@ rtm_get_jailed(struct rt_addrinfo *info,
 					continue;
 				bcopy(&((struct sockaddr_in6 *)sa)->sin6_addr,
 				    &ia6, sizeof(struct in6_addr));
-				if (prison_check_ip6(cred, &ia6) != 0) {
+				if (prison_check_ip6(cred, &ia6) == 0) {
 					found = 1;
 					break;
 				}
@@ -612,9 +612,10 @@ route_output(struct mbuf *m, struct sock
 		case RTM_GET:
 		report:
 			RT_LOCK_ASSERT(rt);
-			if (jailed(curthread->td_ucred) &&
-			    ((rt->rt_flags & RTF_HOST) == 0 ||
-			    !prison_if(curthread->td_ucred, rt_key(rt)))) {
+			if ((rt->rt_flags & RTF_HOST) == 0
+			    ? jailed(curthread->td_ucred)
+			    : prison_if(curthread->td_ucred,
+			    rt_key(rt)) != 0) {
 				RT_UNLOCK(rt);
 				senderr(ESRCH);
 			}
@@ -1263,9 +1264,9 @@ sysctl_dumpentry(struct radix_node *rn, 
 
 	if (w->w_op == NET_RT_FLAGS && !(rt->rt_flags & w->w_arg))
 		return 0;
-	if (jailed(w->w_req->td->td_ucred) &&
-	    ((rt->rt_flags & RTF_HOST) == 0 ||
-	    !prison_if(w->w_req->td->td_ucred, rt_key(rt))))
+	if ((rt->rt_flags & RTF_HOST) == 0
+	    ? jailed(w->w_req->td->td_ucred)
+	    : prison_if(w->w_req->td->td_ucred, rt_key(rt)) != 0)
 		return (0);
 	bzero((caddr_t)&info, sizeof(info));
 	info.rti_info[RTAX_DST] = rt_key(rt);
@@ -1327,8 +1328,8 @@ sysctl_iflist(int af, struct walkarg *w)
 		while ((ifa = TAILQ_NEXT(ifa, ifa_link)) != NULL) {
 			if (af && af != ifa->ifa_addr->sa_family)
 				continue;
-			if (jailed(w->w_req->td->td_ucred) &&
-			    !prison_if(w->w_req->td->td_ucred, ifa->ifa_addr))
+			if (prison_if(w->w_req->td->td_ucred,
+			    ifa->ifa_addr) != 0)
 				continue;
 			info.rti_info[RTAX_IFA] = ifa->ifa_addr;
 			info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask;
@@ -1376,8 +1377,8 @@ sysctl_ifmalist(int af, struct walkarg *
 		TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 			if (af && af != ifma->ifma_addr->sa_family)
 				continue;
-			if (jailed(w->w_req->td->td_ucred) &&
-			    !prison_if(w->w_req->td->td_ucred, ifma->ifma_addr))
+			if (prison_if(w->w_req->td->td_ucred,
+			    ifma->ifma_addr) != 0)
 				continue;
 			info.rti_info[RTAX_IFA] = ifma->ifma_addr;
 			info.rti_info[RTAX_GATEWAY] =

Modified: head/sys/netinet/in.c
==============================================================================
--- head/sys/netinet/in.c	Thu Feb  5 14:02:04 2009	(r188143)
+++ head/sys/netinet/in.c	Thu Feb  5 14:06:09 2009	(r188144)
@@ -264,7 +264,7 @@ in_control(struct socket *so, u_long cmd
 			if (iap->ia_ifp == ifp &&
 			    iap->ia_addr.sin_addr.s_addr == dst.s_addr) {
 				if (td == NULL || prison_check_ip4(
-				    td->td_ucred, &dst))
+				    td->td_ucred, &dst) == 0)
 					ia = iap;
 				break;
 			}
@@ -273,8 +273,8 @@ in_control(struct socket *so, u_long cmd
 				iap = ifatoia(ifa);
 				if (iap->ia_addr.sin_family == AF_INET) {
 					if (td != NULL &&
-					    !prison_check_ip4(td->td_ucred,
-					    &iap->ia_addr.sin_addr))
+					    prison_check_ip4(td->td_ucred,
+					    &iap->ia_addr.sin_addr) != 0)
 						continue;
 					ia = iap;
 					break;
@@ -1199,8 +1199,7 @@ in_lltable_dump(struct lltable *llt, str
 			if ((lle->la_flags & (LLE_DELETED|LLE_VALID)) != LLE_VALID)
 				continue;
 			/* Skip if jailed and not a valid IP of the prison. */
-			if (jailed(wr->td->td_ucred) &&
-			    !prison_if(wr->td->td_ucred, L3_ADDR(lle)))
+			if (prison_if(wr->td->td_ucred, L3_ADDR(lle)) != 0)
 				continue;
 			/*
 			 * produce a msg made of:

Modified: head/sys/netinet/in_pcb.c
==============================================================================
--- head/sys/netinet/in_pcb.c	Thu Feb  5 14:02:04 2009	(r188143)
+++ head/sys/netinet/in_pcb.c	Thu Feb  5 14:06:09 2009	(r188144)
@@ -325,8 +325,9 @@ in_pcbbind_setup(struct inpcb *inp, stru
 		if (sin->sin_family != AF_INET)
 			return (EAFNOSUPPORT);
 #endif
-		if (prison_local_ip4(cred, &sin->sin_addr))
-			return (EINVAL);
+		error = prison_local_ip4(cred, &sin->sin_addr);
+		if (error)
+			return (error);
 		if (sin->sin_port != *lportp) {
 			/* Don't allow the port to change. */
 			if (*lportp != 0)
@@ -391,8 +392,9 @@ in_pcbbind_setup(struct inpcb *inp, stru
 				     t->inp_cred->cr_uid))
 					return (EADDRINUSE);
 			}
-			if (prison_local_ip4(cred, &sin->sin_addr))
-				return (EADDRNOTAVAIL);
+			error = prison_local_ip4(cred, &sin->sin_addr);
+			if (error)
+				return (error);
 			t = in_pcblookup_local(pcbinfo, sin->sin_addr,
 			    lport, wild, cred);
 			if (t && (t->inp_vflag & INP_TIMEWAIT)) {
@@ -426,8 +428,9 @@ in_pcbbind_setup(struct inpcb *inp, stru
 		u_short first, last, aux;
 		int count;
 
-		if (prison_local_ip4(cred, &laddr))
-			return (EINVAL);
+		error = prison_local_ip4(cred, &laddr);
+		if (error)
+			return (error);
 
 		if (inp->inp_flags & INP_HIGHPORT) {
 			first = V_ipport_hifirstauto;	/* sysctl */
@@ -493,8 +496,9 @@ in_pcbbind_setup(struct inpcb *inp, stru
 		} while (in_pcblookup_local(pcbinfo, laddr,
 		    lport, wild, cred));
 	}
-	if (prison_local_ip4(cred, &laddr))
-		return (EINVAL);
+	error = prison_local_ip4(cred, &laddr);
+	if (error)
+		return (error);
 	*laddrp = laddr.s_addr;
 	*lportp = lport;
 	return (0);
@@ -614,7 +618,7 @@ in_pcbladdr(struct inpcb *inp, struct in
 			if (sa->sa_family != AF_INET)
 				continue;
 			sin = (struct sockaddr_in *)sa;
-			if (prison_check_ip4(cred, &sin->sin_addr)) {
+			if (prison_check_ip4(cred, &sin->sin_addr) == 0) {
 				ia = (struct in_ifaddr *)ifa;
 				break;
 			}
@@ -625,8 +629,7 @@ in_pcbladdr(struct inpcb *inp, struct in
 		}
 
 		/* 3. As a last resort return the 'default' jail address. */
-		if (prison_get_ip4(cred, laddr) != 0)
-			error = EADDRNOTAVAIL;
+		error = prison_get_ip4(cred, laddr);
 		goto done;
 	}
 
@@ -651,7 +654,7 @@ in_pcbladdr(struct inpcb *inp, struct in
 		/* Jailed. */
 		/* 1. Check if the iface address belongs to the jail. */
 		sin = (struct sockaddr_in *)sro.ro_rt->rt_ifa->ifa_addr;
-		if (prison_check_ip4(cred, &sin->sin_addr)) {
+		if (prison_check_ip4(cred, &sin->sin_addr) == 0) {
 			ia = (struct in_ifaddr *)sro.ro_rt->rt_ifa;
 			laddr->s_addr = ia->ia_addr.sin_addr.s_addr;
 			goto done;
@@ -667,7 +670,7 @@ in_pcbladdr(struct inpcb *inp, struct in
 			if (sa->sa_family != AF_INET)
 				continue;
 			sin = (struct sockaddr_in *)sa;
-			if (prison_check_ip4(cred, &sin->sin_addr)) {
+			if (prison_check_ip4(cred, &sin->sin_addr) == 0) {
 				ia = (struct in_ifaddr *)ifa;
 				break;
 			}
@@ -678,8 +681,7 @@ in_pcbladdr(struct inpcb *inp, struct in
 		}
 
 		/* 3. As a last resort return the 'default' jail address. */
-		if (prison_get_ip4(cred, laddr) != 0)
-			error = EADDRNOTAVAIL;
+		error = prison_get_ip4(cred, laddr);
 		goto done;
 	}
 
@@ -729,7 +731,8 @@ in_pcbladdr(struct inpcb *inp, struct in
 				if (sa->sa_family != AF_INET)
 					continue;
 				sin = (struct sockaddr_in *)sa;
-				if (prison_check_ip4(cred, &sin->sin_addr)) {
+				if (prison_check_ip4(cred,
+				    &sin->sin_addr) == 0) {
 					ia = (struct in_ifaddr *)ifa;
 					break;
 				}
@@ -741,8 +744,7 @@ in_pcbladdr(struct inpcb *inp, struct in
 		}
 
 		/* 3. As a last resort return the 'default' jail address. */
-		if (prison_get_ip4(cred, laddr) != 0)
-			error = EADDRNOTAVAIL;
+		error = prison_get_ip4(cred, laddr);
 		goto done;
 	}
 
@@ -776,7 +778,7 @@ in_pcbconnect_setup(struct inpcb *inp, s
 	struct sockaddr_in *sin = (struct sockaddr_in *)nam;
 	struct in_ifaddr *ia;
 	struct inpcb *oinp;
-	struct in_addr laddr, faddr, jailia;
+	struct in_addr laddr, faddr;
 	u_short lport, fport;
 	int error;
 
@@ -809,15 +811,11 @@ in_pcbconnect_setup(struct inpcb *inp, s
 		 * choose the broadcast address for that interface.
 		 */
 		if (faddr.s_addr == INADDR_ANY) {
-			if (cred != NULL && jailed(cred)) {
-				if (prison_get_ip4(cred, &jailia) != 0)
-					return (EADDRNOTAVAIL);
-				faddr.s_addr = jailia.s_addr;
-			} else {
-				faddr =
-				    IA_SIN(TAILQ_FIRST(&V_in_ifaddrhead))->
-				    sin_addr;
-			}
+			faddr =
+			    IA_SIN(TAILQ_FIRST(&V_in_ifaddrhead))->sin_addr;
+			if (cred != NULL &&
+			    (error = prison_get_ip4(cred, &faddr)) != 0)
+				return (error);
 		} else if (faddr.s_addr == (u_long)INADDR_BROADCAST &&
 		    (TAILQ_FIRST(&V_in_ifaddrhead)->ia_ifp->if_flags &
 		    IFF_BROADCAST))
@@ -1375,7 +1373,8 @@ in_pcblookup_hash(struct inpcbinfo *pcbi
 
 			injail = jailed(inp->inp_cred);
 			if (injail) {
-				if (!prison_check_ip4(inp->inp_cred, &laddr))
+				if (prison_check_ip4(inp->inp_cred,
+				    &laddr) != 0)
 					continue;
 			} else {
 				if (local_exact != NULL)

Modified: head/sys/netinet/raw_ip.c
==============================================================================
--- head/sys/netinet/raw_ip.c	Thu Feb  5 14:02:04 2009	(r188143)
+++ head/sys/netinet/raw_ip.c	Thu Feb  5 14:06:09 2009	(r188144)
@@ -276,10 +276,8 @@ rip_input(struct mbuf *m, int off)
 			continue;
 		if (inp->inp_faddr.s_addr != ip->ip_src.s_addr)
 			continue;
-		if (jailed(inp->inp_cred)) {
-			if (!prison_check_ip4(inp->inp_cred, &ip->ip_dst))
-				continue;
-		}
+		if (prison_check_ip4(inp->inp_cred, &ip->ip_dst) != 0)
+			continue;
 		if (last != NULL) {
 			struct mbuf *n;
 
@@ -306,10 +304,8 @@ rip_input(struct mbuf *m, int off)
 		if (inp->inp_faddr.s_addr &&
 		    inp->inp_faddr.s_addr != ip->ip_src.s_addr)
 			continue;
-		if (jailed(inp->inp_cred)) {
-			if (!prison_check_ip4(inp->inp_cred, &ip->ip_dst))
-				continue;
-		}
+		if (prison_check_ip4(inp->inp_cred, &ip->ip_dst) != 0)
+			continue;
 		if (last != NULL) {
 			struct mbuf *n;
 
@@ -370,14 +366,12 @@ rip_output(struct mbuf *m, struct socket
 			ip->ip_off = 0;
 		ip->ip_p = inp->inp_ip_p;
 		ip->ip_len = m->m_pkthdr.len;
-		if (jailed(inp->inp_cred)) {
-			if (prison_get_ip4(inp->inp_cred, &ip->ip_src) != 0) {
-				INP_RUNLOCK(inp);
-				m_freem(m);
-				return (EPERM);
-			}
-		} else {
-			ip->ip_src = inp->inp_laddr;
+		ip->ip_src = inp->inp_laddr;
+		error = prison_get_ip4(inp->inp_cred, &ip->ip_src);
+		if (error != 0) {
+			INP_RUNLOCK(inp);
+			m_freem(m);
+			return (error);
 		}
 		ip->ip_dst.s_addr = dst;
 		ip->ip_ttl = inp->inp_ip_ttl;
@@ -388,10 +382,11 @@ rip_output(struct mbuf *m, struct socket
 		}
 		INP_RLOCK(inp);
 		ip = mtod(m, struct ip *);
-		if (!prison_check_ip4(inp->inp_cred, &ip->ip_src)) {
+		error = prison_check_ip4(inp->inp_cred, &ip->ip_src);
+		if (error != 0) {
 			INP_RUNLOCK(inp);
 			m_freem(m);
-			return (EPERM);
+			return (error);
 		}
 
 		/*
@@ -803,12 +798,14 @@ rip_bind(struct socket *so, struct socka
 	INIT_VNET_INET(so->so_vnet);
 	struct sockaddr_in *addr = (struct sockaddr_in *)nam;
 	struct inpcb *inp;
+	int error;
 
 	if (nam->sa_len != sizeof(*addr))
 		return (EINVAL);
 
-	if (!prison_check_ip4(td->td_ucred, &addr->sin_addr))
-		return (EADDRNOTAVAIL);
+	error = prison_check_ip4(td->td_ucred, &addr->sin_addr);
+	if (error != 0)
+		return (error);
 
 	if (TAILQ_EMPTY(&V_ifnet) ||
 	    (addr->sin_family != AF_INET && addr->sin_family != AF_IMPLINK) ||

Modified: head/sys/netinet/tcp_usrreq.c
==============================================================================
--- head/sys/netinet/tcp_usrreq.c	Thu Feb  5 14:02:04 2009	(r188143)
+++ head/sys/netinet/tcp_usrreq.c	Thu Feb  5 14:06:09 2009	(r188144)
@@ -441,8 +441,8 @@ tcp_usr_connect(struct socket *so, struc
 	if (sinp->sin_family == AF_INET
 	    && IN_MULTICAST(ntohl(sinp->sin_addr.s_addr)))
 		return (EAFNOSUPPORT);
-	if (prison_remote_ip4(td->td_ucred, &sinp->sin_addr) != 0)
-		return (EINVAL);
+	if ((error = prison_remote_ip4(td->td_ucred, &sinp->sin_addr)) != 0)
+		return (error);
 
 	TCPDEBUG0;
 	INP_INFO_WLOCK(&V_tcbinfo);
@@ -508,10 +508,9 @@ tcp6_usr_connect(struct socket *so, stru
 		in6_sin6_2_sin(&sin, sin6p);
 		inp->inp_vflag |= INP_IPV4;
 		inp->inp_vflag &= ~INP_IPV6;
-		if (prison_remote_ip4(td->td_ucred, &sin.sin_addr) != 0) {
-			error = EINVAL;
+		if ((error = prison_remote_ip4(td->td_ucred,
+		    &sin.sin_addr)) != 0)
 			goto out;
-		}
 		if ((error = tcp_connect(tp, (struct sockaddr *)&sin, td)) != 0)
 			goto out;
 		error = tcp_output_connect(so, nam);
@@ -520,10 +519,8 @@ tcp6_usr_connect(struct socket *so, stru
 	inp->inp_vflag &= ~INP_IPV4;
 	inp->inp_vflag |= INP_IPV6;
 	inp->inp_inc.inc_flags |= INC_ISIPV6;
-	if (prison_remote_ip6(td->td_ucred, &sin6p->sin6_addr) != 0) {
-		error = EINVAL;
+	if ((error = prison_remote_ip6(td->td_ucred, &sin6p->sin6_addr)) != 0)
 		goto out;
-	}
 	if ((error = tcp6_connect(tp, nam, td)) != 0)
 		goto out;
 	error = tcp_output_connect(so, nam);

Modified: head/sys/netinet/udp_usrreq.c
==============================================================================
--- head/sys/netinet/udp_usrreq.c	Thu Feb  5 14:02:04 2009	(r188143)
+++ head/sys/netinet/udp_usrreq.c	Thu Feb  5 14:06:09 2009	(r188144)
@@ -982,10 +982,9 @@ udp_output(struct inpcb *inp, struct mbu
 		 * Jail may rewrite the destination address, so let it do
 		 * that before we use it.
 		 */
-		if (prison_remote_ip4(td->td_ucred, &sin->sin_addr) != 0) {
-			error = EINVAL;
+		error = prison_remote_ip4(td->td_ucred, &sin->sin_addr);
+		if (error)
 			goto release;
-		}
 
 		/*
 		 * If a local address or port hasn't yet been selected, or if
@@ -1271,10 +1270,11 @@ udp_connect(struct socket *so, struct so
 		return (EISCONN);
 	}
 	sin = (struct sockaddr_in *)nam;
-	if (prison_remote_ip4(td->td_ucred, &sin->sin_addr) != 0) {
+	error = prison_remote_ip4(td->td_ucred, &sin->sin_addr);
+	if (error != 0) {
 		INP_WUNLOCK(inp);
 		INP_INFO_WUNLOCK(&V_udbinfo);
-		return (EAFNOSUPPORT);
+		return (error);
 	}
 	error = in_pcbconnect(inp, nam, td->td_ucred);
 	if (error == 0)

Modified: head/sys/netinet6/in6.c
==============================================================================
--- head/sys/netinet6/in6.c	Thu Feb  5 14:02:04 2009	(r188143)
+++ head/sys/netinet6/in6.c	Thu Feb  5 14:06:09 2009	(r188144)
@@ -330,9 +330,9 @@ in6_control(struct socket *so, u_long cm
 			error = in6_setscope(&sa6->sin6_addr, ifp, NULL);
 		if (error != 0)
 			return (error);
-		if (td != NULL && !prison_check_ip6(td->td_ucred,
-		    &sa6->sin6_addr))
-			return (EADDRNOTAVAIL);
+		if (td != NULL && (error = prison_check_ip6(td->td_ucred,
+		    &sa6->sin6_addr)) != 0)
+			return (error);
 		ia = in6ifa_ifpwithaddr(ifp, &sa6->sin6_addr);
 	} else
 		ia = NULL;
@@ -2241,8 +2241,7 @@ in6_lltable_dump(struct lltable *llt, st
 			if ((lle->la_flags & (LLE_DELETED|LLE_VALID)) != LLE_VALID)
 				continue;
 			/* Skip if jailed and not a valid IP of the prison. */
-			if (jailed(wr->td->td_ucred) &&
-			    !prison_if(wr->td->td_ucred, L3_ADDR(lle)))
+			if (prison_if(wr->td->td_ucred, L3_ADDR(lle)) != 0)
 				continue;
 			/*
 			 * produce a msg made of:

Modified: head/sys/netinet6/in6_pcb.c
==============================================================================
--- head/sys/netinet6/in6_pcb.c	Thu Feb  5 14:02:04 2009	(r188143)
+++ head/sys/netinet6/in6_pcb.c	Thu Feb  5 14:06:09 2009	(r188144)
@@ -119,7 +119,7 @@ in6_pcbbind(register struct inpcb *inp, 
 	struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)NULL;
 	struct inpcbinfo *pcbinfo = inp->inp_pcbinfo;
 	u_short	lport = 0;
-	int wild = 0, reuseport = (so->so_options & SO_REUSEPORT);
+	int error, wild = 0, reuseport = (so->so_options & SO_REUSEPORT);
 
 	INP_INFO_WLOCK_ASSERT(pcbinfo);
 	INP_WLOCK_ASSERT(inp);
@@ -131,8 +131,6 @@ in6_pcbbind(register struct inpcb *inp, 
 	if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0)
 		wild = INPLOOKUP_WILDCARD;
 	if (nam) {
-		int error;
-
 		sin6 = (struct sockaddr_in6 *)nam;
 		if (nam->sa_len != sizeof(*sin6))
 			return (EINVAL);
@@ -145,9 +143,9 @@ in6_pcbbind(register struct inpcb *inp, 
 		if ((error = sa6_embedscope(sin6, V_ip6_use_defzone)) != 0)
 			return(error);
 
-		if (prison_local_ip6(cred, &sin6->sin6_addr,
-		    ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0)) != 0)
-			return (EINVAL);
+		if ((error = prison_local_ip6(cred, &sin6->sin6_addr,
+		    ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0)
+			return (error);
 
 		lport = sin6->sin6_port;
 		if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) {
@@ -223,9 +221,9 @@ in6_pcbbind(register struct inpcb *inp, 
 						return (EADDRINUSE);
 				}
 			}
-			if (prison_local_ip6(cred, &sin6->sin6_addr,
-			    ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0)) != 0)
-				return (EADDRNOTAVAIL);
+			if ((error = prison_local_ip6(cred, &sin6->sin6_addr,
+			    ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0)
+				return (error);
 			t = in6_pcblookup_local(pcbinfo, &sin6->sin6_addr,
 			    lport, wild, cred);
 			if (t && (reuseport & ((t->inp_vflag & INP_TIMEWAIT) ?
@@ -258,13 +256,12 @@ in6_pcbbind(register struct inpcb *inp, 
 		}
 		inp->in6p_laddr = sin6->sin6_addr;
 	}
-	if (prison_local_ip6(cred, &inp->in6p_laddr,
-	    ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0)) != 0)
-		return (EINVAL);
+	if ((error = prison_local_ip6(cred, &inp->in6p_laddr,
+	    ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0)
+		return (error);
 	if (lport == 0) {
-		int e;
-		if ((e = in6_pcbsetport(&inp->in6p_laddr, inp, cred)) != 0)
-			return (e);
+		if ((error = in6_pcbsetport(&inp->in6p_laddr, inp, cred)) != 0)
+			return (error);
 	} else {
 		inp->inp_lport = lport;
 		if (in_pcbinshash(inp) != 0) {
@@ -320,8 +317,8 @@ in6_pcbladdr(register struct inpcb *inp,
 		if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr))
 			sin6->sin6_addr = in6addr_loopback;
 	}
-	if (prison_remote_ip6(inp->inp_cred, &sin6->sin6_addr) != 0)
-		return (EADDRNOTAVAIL);
+	if ((error = prison_remote_ip6(inp->inp_cred, &sin6->sin6_addr)) != 0)
+		return (error);
 
 	/*
 	 * XXX: in6_selectsrc might replace the bound local address
@@ -885,7 +882,8 @@ in6_pcblookup_hash(struct inpcbinfo *pcb
 
 			injail = jailed(inp->inp_cred);
 			if (injail) {
-				if (!prison_check_ip6(inp->inp_cred, laddr))
+				if (prison_check_ip6(inp->inp_cred,
+				    laddr) != 0)
 					continue;
 			} else {
 				if (local_exact != NULL)

Modified: head/sys/netinet6/in6_src.c
==============================================================================
--- head/sys/netinet6/in6_src.c	Thu Feb  5 14:02:04 2009	(r188143)
+++ head/sys/netinet6/in6_src.c	Thu Feb  5 14:06:09 2009	(r188144)
@@ -240,11 +240,10 @@ in6_selectsrc(struct sockaddr_in6 *dstso
 			if (*errorp != 0)
 				return (NULL);
 		}
-		if (cred != NULL && prison_local_ip6(cred, &srcsock.sin6_addr,
-		    (inp != NULL && (inp->inp_flags & IN6P_IPV6_V6ONLY) != 0)) != 0) {
-			*errorp = EADDRNOTAVAIL;
+		if (cred != NULL && (*errorp = prison_local_ip6(cred,
+		    &srcsock.sin6_addr, (inp != NULL &&
+		    (inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0)
 			return (NULL);
-		}
 
 		ia6 = (struct in6_ifaddr *)ifa_ifwithaddr((struct sockaddr *)(&srcsock));
 		if (ia6 == NULL ||
@@ -262,11 +261,10 @@ in6_selectsrc(struct sockaddr_in6 *dstso
 	 * Otherwise, if the socket has already bound the source, just use it.
 	 */
 	if (inp != NULL && !IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) {
-		if (cred != NULL && prison_local_ip6(cred, &inp->in6p_laddr,
-		    ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0)) != 0) {
-			*errorp = EADDRNOTAVAIL;
+		if (cred != NULL &&
+		    (*errorp = prison_local_ip6(cred, &inp->in6p_laddr,
+		    ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0)
 			return (NULL);
-		}
 		return (&inp->in6p_laddr);
 	}
 
@@ -823,15 +821,16 @@ in6_pcbsetport(struct in6_addr *laddr, s
 	INIT_VNET_INET(curvnet);
 	struct socket *so = inp->inp_socket;
 	u_int16_t lport = 0, first, last, *lastport;
-	int count, error = 0, wild = 0, dorandom;
+	int count, error, wild = 0, dorandom;
 	struct inpcbinfo *pcbinfo = inp->inp_pcbinfo;
 
 	INP_INFO_WLOCK_ASSERT(pcbinfo);
 	INP_WLOCK_ASSERT(inp);
 
-	if (prison_local_ip6(cred, laddr,
-	    ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0)) != 0)
-		return(EINVAL);
+	error = prison_local_ip6(cred, laddr,
+	    ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0));
+	if (error)
+		return(error);
 
 	/* XXX: this is redundant when called from in6_pcbbind */
 	if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0)

Modified: head/sys/netinet6/raw_ip6.c
==============================================================================
--- head/sys/netinet6/raw_ip6.c	Thu Feb  5 14:02:04 2009	(r188143)
+++ head/sys/netinet6/raw_ip6.c	Thu Feb  5 14:06:09 2009	(r188144)
@@ -179,10 +179,8 @@ rip6_input(struct mbuf **mp, int *offp, 
 		if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr) &&
 		    !IN6_ARE_ADDR_EQUAL(&in6p->in6p_faddr, &ip6->ip6_src))
 			continue;
-		if (jailed(in6p->inp_cred)) {
-			if (!prison_check_ip6(in6p->inp_cred, &ip6->ip6_dst))
-				continue;
-		}
+		if (prison_check_ip6(in6p->inp_cred, &ip6->ip6_dst) != 0)
+			continue;
 		INP_RLOCK(in6p);
 		if (in6p->in6p_cksum != -1) {
 			V_rip6stat.rip6s_isum++;
@@ -411,11 +409,9 @@ rip6_output(m, va_alist)
 			error = EADDRNOTAVAIL;
 		goto bad;
 	}
-	if (jailed(in6p->inp_cred))
-		if (prison_get_ip6(in6p->inp_cred, in6a) != 0) {
-			error = EPERM;
-			goto bad;
-		}

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 14:15:19 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 24371106564A;
	Thu,  5 Feb 2009 14:15:19 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 083F48FC1B;
	Thu,  5 Feb 2009 14:15:19 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15EFIvl029073;
	Thu, 5 Feb 2009 14:15:18 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15EFIMY029070;
	Thu, 5 Feb 2009 14:15:18 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <200902051415.n15EFIMY029070@svn.freebsd.org>
From: Jamie Gritton <jamie@FreeBSD.org>
Date: Thu, 5 Feb 2009 14:15:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188146 - in head/sys: kern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 14:15:19 -0000

Author: jamie
Date: Thu Feb  5 14:15:18 2009
New Revision: 188146
URL: http://svn.freebsd.org/changeset/base/188146

Log:
  Don't allow creating a socket with a protocol family that the current
  jail doesn't support.  This involves a new function prison_check_af,
  like prison_check_ip[46] but that checks only the family.
  
  With this change, most of the errors generated by jailed sockets
  shouldn't ever occur, at least until jails are changeable.
  
  Approved by:	bz (mentor)

Modified:
  head/sys/kern/kern_jail.c
  head/sys/kern/uipc_socket.c
  head/sys/sys/jail.h

Modified: head/sys/kern/kern_jail.c
==============================================================================
--- head/sys/kern/kern_jail.c	Thu Feb  5 14:06:43 2009	(r188145)
+++ head/sys/kern/kern_jail.c	Thu Feb  5 14:15:18 2009	(r188146)
@@ -1099,6 +1099,48 @@ prison_check_ip6(struct ucred *cred, str
 #endif
 
 /*
+ * Check if a jail supports the given address family.
+ *
+ * Returns 0 if not jailed or the address family is supported, EAFNOSUPPORT
+ * if not.
+ */
+int
+prison_check_af(struct ucred *cred, int af)
+{
+	int error;
+
+	KASSERT(cred != NULL, ("%s: cred is NULL", __func__));
+
+
+	if (!jailed(cred))
+		return (0);
+
+	error = 0;
+	switch (af)
+	{
+#ifdef INET
+	case AF_INET:
+		if (cred->cr_prison->pr_ip4 == NULL)
+			error = EAFNOSUPPORT;
+		break;
+#endif
+#ifdef INET6
+	case AF_INET6:
+		if (cred->cr_prison->pr_ip6 == NULL)
+			error = EAFNOSUPPORT;
+		break;
+#endif
+	case AF_LOCAL:
+	case AF_ROUTE:
+		break;
+	default:
+		if (jail_socket_unixiproute_only)
+			error = EAFNOSUPPORT;
+	}
+	return (error);
+}
+
+/*
  * Check if given address belongs to the jail referenced by cred (wrapper to
  * prison_check_ip[46]).
  *

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c	Thu Feb  5 14:06:43 2009	(r188145)
+++ head/sys/kern/uipc_socket.c	Thu Feb  5 14:15:18 2009	(r188146)
@@ -347,15 +347,8 @@ socreate(int dom, struct socket **aso, i
 	    prp->pr_usrreqs->pru_attach == pru_attach_notsupp)
 		return (EPROTONOSUPPORT);
 
-	if (jailed(cred) && jail_socket_unixiproute_only &&
-	    prp->pr_domain->dom_family != PF_LOCAL &&
-	    prp->pr_domain->dom_family != PF_INET &&
-#ifdef INET6
-	    prp->pr_domain->dom_family != PF_INET6 &&
-#endif
-	    prp->pr_domain->dom_family != PF_ROUTE) {
+	if (prison_check_af(cred, prp->pr_domain->dom_family) != 0)
 		return (EPROTONOSUPPORT);
-	}
 
 	if (prp->pr_type != type)
 		return (EPROTOTYPE);

Modified: head/sys/sys/jail.h
==============================================================================
--- head/sys/sys/jail.h	Thu Feb  5 14:06:43 2009	(r188145)
+++ head/sys/sys/jail.h	Thu Feb  5 14:15:18 2009	(r188146)
@@ -191,6 +191,7 @@ int prison_local_ip6(struct ucred *, str
 int prison_remote_ip6(struct ucred *, struct in6_addr *);
 int prison_check_ip6(struct ucred *, struct in6_addr *);
 #endif
+int prison_check_af(struct ucred *cred, int af);
 int prison_if(struct ucred *cred, struct sockaddr *sa);
 int prison_priv_check(struct ucred *cred, int priv);
 

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 14:21:10 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 35864106566C;
	Thu,  5 Feb 2009 14:21:10 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 228438FC13;
	Thu,  5 Feb 2009 14:21:10 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15ELAs5029234;
	Thu, 5 Feb 2009 14:21:10 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15EL9mp029230;
	Thu, 5 Feb 2009 14:21:09 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200902051421.n15EL9mp029230@svn.freebsd.org>
From: Ed Schouten <ed@FreeBSD.org>
Date: Thu, 5 Feb 2009 14:21:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188147 - in head: sys/kern sys/sys usr.sbin/pstat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 14:21:11 -0000

Author: ed
Date: Thu Feb  5 14:21:09 2009
New Revision: 188147
URL: http://svn.freebsd.org/changeset/base/188147

Log:
  Don't leave the console TTY constantly open.
  
  When we leave the console TTY constantly open, we never reset the
  termios attributes. This causes output processing, echoing, etc. not to
  be reset to the proper values when going into single user mode after the
  system has booted. It also causes nl-to-crnl-conversion not to take
  place during shutdown, which causes a `staircase effect'.
  
  This patch adds a new TTY flag, TF_OPENED_CONS, which is set when the
  TTY is opened through /dev/console. Because the flags are only used by
  the kernel and the pstat(8) utility, I've decided to renumber the TTY
  flags. This shouldn't be an issue, because the TTY layer is not yet part
  of a stable release.
  
  Reported by:	Mark Atkinson <atkin901 yahoo com>
  Tested by:	sepotvin

Modified:
  head/sys/kern/tty.c
  head/sys/sys/tty.h
  head/usr.sbin/pstat/pstat.8
  head/usr.sbin/pstat/pstat.c

Modified: head/sys/kern/tty.c
==============================================================================
--- head/sys/kern/tty.c	Thu Feb  5 14:15:18 2009	(r188146)
+++ head/sys/kern/tty.c	Thu Feb  5 14:21:09 2009	(r188147)
@@ -291,11 +291,12 @@ ttydev_open(struct cdev *dev, int oflags
 		}
 	}
 
-	if (TTY_CALLOUT(tp, dev)) {
+	if (dev == dev_console)
+		tp->t_flags |= TF_OPENED_CONS;
+	else if (TTY_CALLOUT(tp, dev))
 		tp->t_flags |= TF_OPENED_OUT;
-	} else {
+	else
 		tp->t_flags |= TF_OPENED_IN;
-	}
 
 done:	tp->t_flags &= ~TF_OPENCLOSE;
 	ttydev_leave(tp);
@@ -308,22 +309,28 @@ ttydev_close(struct cdev *dev, int fflag
 {
 	struct tty *tp = dev->si_drv1;
 
+	tty_lock(tp);
+
 	/*
 	 * Don't actually close the device if it is being used as the
 	 * console.
 	 */
-	if (dev_console_filename != NULL &&
-	    strcmp(dev_console_filename, tty_devname(tp)) == 0)
-		return (0);
+	MPASS((tp->t_flags & TF_OPENED) != TF_OPENED);
+	if (dev == dev_console)
+		tp->t_flags &= ~TF_OPENED_CONS;
+	else
+		tp->t_flags &= ~(TF_OPENED_IN|TF_OPENED_OUT);
 
-	tty_lock(tp);
+	if (tp->t_flags & TF_OPENED) {
+		tty_unlock(tp);
+		return (0);
+	}
 
 	/*
 	 * This can only be called once. The callin and the callout
 	 * devices cannot be opened at the same time.
 	 */
-	MPASS((tp->t_flags & TF_OPENED) != TF_OPENED);
-	tp->t_flags &= ~(TF_OPENED|TF_EXCLUDE|TF_STOPPED);
+	tp->t_flags &= ~(TF_EXCLUDE|TF_STOPPED);
 
 	/* Properly wake up threads that are stuck - revoke(). */
 	tp->t_revokecnt++;
@@ -1797,13 +1804,14 @@ ttyconsdev_write(struct cdev *dev, struc
 }
 
 /*
- * /dev/console is a little different than normal TTY's. Unlike regular
- * TTY device nodes, this device node will not revoke the entire TTY
- * upon closure and all data written to it will be logged.
+ * /dev/console is a little different than normal TTY's.  When opened,
+ * it determines which TTY to use.  When data gets written to it, it
+ * will be logged in the kernel message buffer.
  */
 static struct cdevsw ttyconsdev_cdevsw = {
 	.d_version	= D_VERSION,
 	.d_open		= ttyconsdev_open,
+	.d_close	= ttydev_close,
 	.d_read		= ttydev_read,
 	.d_write	= ttyconsdev_write,
 	.d_ioctl	= ttydev_ioctl,
@@ -1845,33 +1853,34 @@ static struct {
 	char val;
 } ttystates[] = {
 #if 0
-	{ TF_NOPREFIX,	'N' },
+	{ TF_NOPREFIX,		'N' },
 #endif
-	{ TF_INITLOCK,	'I' },
-	{ TF_CALLOUT,	'C' },
+	{ TF_INITLOCK,		'I' },
+	{ TF_CALLOUT,		'C' },
 
 	/* Keep these together -> 'Oi' and 'Oo'. */
-	{ TF_OPENED,	'O' },
-	{ TF_OPENED_IN,	'i' },
-	{ TF_OPENED_OUT,'o' },
-
-	{ TF_GONE,	'G' },
-	{ TF_OPENCLOSE,	'B' },
-	{ TF_ASYNC,	'Y' },
-	{ TF_LITERAL,	'L' },
+	{ TF_OPENED,		'O' },
+	{ TF_OPENED_IN,		'i' },
+	{ TF_OPENED_OUT,	'o' },
+	{ TF_OPENED_CONS,	'c' },
+
+	{ TF_GONE,		'G' },
+	{ TF_OPENCLOSE,		'B' },
+	{ TF_ASYNC,		'Y' },
+	{ TF_LITERAL,		'L' },
 
 	/* Keep these together -> 'Hi' and 'Ho'. */
-	{ TF_HIWAT,	'H' },
-	{ TF_HIWAT_IN,	'i' },
-	{ TF_HIWAT_OUT,	'o' },
-
-	{ TF_STOPPED,	'S' },
-	{ TF_EXCLUDE,	'X' },
-	{ TF_BYPASS,	'l' },
-	{ TF_ZOMBIE,	'Z' },
-	{ TF_HOOK,	's' },
+	{ TF_HIWAT,		'H' },
+	{ TF_HIWAT_IN,		'i' },
+	{ TF_HIWAT_OUT,		'o' },
+
+	{ TF_STOPPED,		'S' },
+	{ TF_EXCLUDE,		'X' },
+	{ TF_BYPASS,		'l' },
+	{ TF_ZOMBIE,		'Z' },
+	{ TF_HOOK,		's' },
 
-	{ 0,	       '\0' },
+	{ 0,			'\0'},
 };
 
 #define	TTY_FLAG_BITS \

Modified: head/sys/sys/tty.h
==============================================================================
--- head/sys/sys/tty.h	Thu Feb  5 14:15:18 2009	(r188146)
+++ head/sys/sys/tty.h	Thu Feb  5 14:21:09 2009	(r188147)
@@ -64,24 +64,25 @@ struct tty {
 	TAILQ_ENTRY(tty) t_list;	/* (l) TTY list entry. */
 	unsigned int	t_flags;	/* (t) Terminal option flags. */
 /* Keep flags in sync with db_show_tty and pstat(8). */
-#define	TF_NOPREFIX	0x0001	/* Don't prepend "tty" to device name. */
-#define	TF_INITLOCK	0x0002	/* Create init/lock state devices. */
-#define	TF_CALLOUT	0x0004	/* Create "cua" devices. */
-#define	TF_OPENED_IN	0x0008	/* "tty" node is in use. */
-#define	TF_OPENED_OUT	0x0010	/* "cua" node is in use. */
-#define	TF_OPENED	(TF_OPENED_IN|TF_OPENED_OUT)
-#define	TF_GONE		0x0020	/* Device node is gone. */
-#define	TF_OPENCLOSE	0x0040	/* Device is in open()/close(). */
-#define	TF_ASYNC	0x0080	/* Asynchronous I/O enabled. */
-#define	TF_LITERAL	0x0100	/* Accept the next character literally. */
-#define	TF_HIWAT_IN	0x0200	/* We've reached the input watermark. */
-#define	TF_HIWAT_OUT	0x0400	/* We've reached the output watermark. */
+#define	TF_NOPREFIX	0x00001	/* Don't prepend "tty" to device name. */
+#define	TF_INITLOCK	0x00002	/* Create init/lock state devices. */
+#define	TF_CALLOUT	0x00004	/* Create "cua" devices. */
+#define	TF_OPENED_IN	0x00008	/* "tty" node is in use. */
+#define	TF_OPENED_OUT	0x00010	/* "cua" node is in use. */
+#define	TF_OPENED_CONS	0x00020 /* Device in use as console. */
+#define	TF_OPENED	(TF_OPENED_IN|TF_OPENED_OUT|TF_OPENED_CONS)
+#define	TF_GONE		0x00040	/* Device node is gone. */
+#define	TF_OPENCLOSE	0x00080	/* Device is in open()/close(). */
+#define	TF_ASYNC	0x00100	/* Asynchronous I/O enabled. */
+#define	TF_LITERAL	0x00200	/* Accept the next character literally. */
+#define	TF_HIWAT_IN	0x00400	/* We've reached the input watermark. */
+#define	TF_HIWAT_OUT	0x00800	/* We've reached the output watermark. */
 #define	TF_HIWAT	(TF_HIWAT_IN|TF_HIWAT_OUT)
-#define	TF_STOPPED	0x0800	/* Output flow control - stopped. */
-#define	TF_EXCLUDE	0x1000	/* Exclusive access. */
-#define	TF_BYPASS	0x2000	/* Optimized input path. */
-#define	TF_ZOMBIE	0x4000	/* Modem disconnect received. */
-#define	TF_HOOK		0x8000	/* TTY has hook attached. */
+#define	TF_STOPPED	0x01000	/* Output flow control - stopped. */
+#define	TF_EXCLUDE	0x02000	/* Exclusive access. */
+#define	TF_BYPASS	0x04000	/* Optimized input path. */
+#define	TF_ZOMBIE	0x08000	/* Modem disconnect received. */
+#define	TF_HOOK		0x10000	/* TTY has hook attached. */
 	unsigned int	t_revokecnt;	/* (t) revoke() count. */
 
 	/* Buffering mechanisms. */

Modified: head/usr.sbin/pstat/pstat.8
==============================================================================
--- head/usr.sbin/pstat/pstat.8	Thu Feb  5 14:15:18 2009	(r188146)
+++ head/usr.sbin/pstat/pstat.8	Thu Feb  5 14:21:09 2009	(r188147)
@@ -183,6 +183,8 @@ init/lock-state device nodes present
 callout device nodes present
 .It O
 opened
+.It c
+console in use
 .It G
 gone
 .It B

Modified: head/usr.sbin/pstat/pstat.c
==============================================================================
--- head/usr.sbin/pstat/pstat.c	Thu Feb  5 14:15:18 2009	(r188146)
+++ head/usr.sbin/pstat/pstat.c	Thu Feb  5 14:21:09 2009	(r188147)
@@ -288,33 +288,34 @@ static struct {
 	char val;
 } ttystates[] = {
 #if 0
-	{ TF_NOPREFIX,	'N' },
+	{ TF_NOPREFIX,		'N' },
 #endif
-	{ TF_INITLOCK,	'I' },
-	{ TF_CALLOUT,	'C' },
+	{ TF_INITLOCK,		'I' },
+	{ TF_CALLOUT,		'C' },
 
 	/* Keep these together -> 'Oi' and 'Oo'. */
-	{ TF_OPENED,	'O' },
-	{ TF_OPENED_IN,	'i' },
-	{ TF_OPENED_OUT,'o' },
-
-	{ TF_GONE,	'G' },
-	{ TF_OPENCLOSE,	'B' },
-	{ TF_ASYNC,	'Y' },
-	{ TF_LITERAL,	'L' },
+	{ TF_OPENED,		'O' },
+	{ TF_OPENED_IN,		'i' },
+	{ TF_OPENED_OUT,	'o' },
+	{ TF_OPENED_CONS,	'c' },
+
+	{ TF_GONE,		'G' },
+	{ TF_OPENCLOSE,		'B' },
+	{ TF_ASYNC,		'Y' },
+	{ TF_LITERAL,		'L' },
 
 	/* Keep these together -> 'Hi' and 'Ho'. */
-	{ TF_HIWAT,	'H' },
-	{ TF_HIWAT_IN,	'i' },
-	{ TF_HIWAT_OUT,	'o' },
-
-	{ TF_STOPPED,	'S' },
-	{ TF_EXCLUDE,	'X' },
-	{ TF_BYPASS,	'l' },
-	{ TF_ZOMBIE,	'Z' },
-	{ TF_HOOK,	's' },
+	{ TF_HIWAT,		'H' },
+	{ TF_HIWAT_IN,		'i' },
+	{ TF_HIWAT_OUT,		'o' },
+
+	{ TF_STOPPED,		'S' },
+	{ TF_EXCLUDE,		'X' },
+	{ TF_BYPASS,		'l' },
+	{ TF_ZOMBIE,		'Z' },
+	{ TF_HOOK,		's' },
 
-	{ 0,	       '\0' },
+	{ 0,			'\0'},
 };
 
 static void

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 14:25:54 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4F0061065679;
	Thu,  5 Feb 2009 14:25:54 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3D0838FC12;
	Thu,  5 Feb 2009 14:25:54 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15EPsBE029370;
	Thu, 5 Feb 2009 14:25:54 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15EPsrY029368;
	Thu, 5 Feb 2009 14:25:54 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <200902051425.n15EPsrY029368@svn.freebsd.org>
From: Jamie Gritton <jamie@FreeBSD.org>
Date: Thu, 5 Feb 2009 14:25:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188148 - in head/sys: netinet netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 14:25:54 -0000

Author: jamie
Date: Thu Feb  5 14:25:53 2009
New Revision: 188148
URL: http://svn.freebsd.org/changeset/base/188148

Log:
  Remove redundant calls of prison_local_ip4 in in_pcbbind_setup, and of
  prison_local_ip6 in in6_pcbbind.
  
  Approved by:	bz (mentor)

Modified:
  head/sys/netinet/in_pcb.c
  head/sys/netinet6/in6_pcb.c

Modified: head/sys/netinet/in_pcb.c
==============================================================================
--- head/sys/netinet/in_pcb.c	Thu Feb  5 14:21:09 2009	(r188147)
+++ head/sys/netinet/in_pcb.c	Thu Feb  5 14:25:53 2009	(r188148)
@@ -313,7 +313,10 @@ in_pcbbind_setup(struct inpcb *inp, stru
 		return (EINVAL);
 	if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0)
 		wild = INPLOOKUP_WILDCARD;
-	if (nam) {
+	if (nam == NULL) {
+		if ((error = prison_local_ip4(cred, &laddr)) != 0)
+			return (error);
+	} else {
 		sin = (struct sockaddr_in *)nam;
 		if (nam->sa_len != sizeof (*sin))
 			return (EINVAL);
@@ -392,9 +395,6 @@ in_pcbbind_setup(struct inpcb *inp, stru
 				     t->inp_cred->cr_uid))
 					return (EADDRINUSE);
 			}
-			error = prison_local_ip4(cred, &sin->sin_addr);
-			if (error)
-				return (error);
 			t = in_pcblookup_local(pcbinfo, sin->sin_addr,
 			    lport, wild, cred);
 			if (t && (t->inp_vflag & INP_TIMEWAIT)) {
@@ -428,10 +428,6 @@ in_pcbbind_setup(struct inpcb *inp, stru
 		u_short first, last, aux;
 		int count;
 
-		error = prison_local_ip4(cred, &laddr);
-		if (error)
-			return (error);
-
 		if (inp->inp_flags & INP_HIGHPORT) {
 			first = V_ipport_hifirstauto;	/* sysctl */
 			last  = V_ipport_hilastauto;
@@ -496,9 +492,6 @@ in_pcbbind_setup(struct inpcb *inp, stru
 		} while (in_pcblookup_local(pcbinfo, laddr,
 		    lport, wild, cred));
 	}
-	error = prison_local_ip4(cred, &laddr);
-	if (error)
-		return (error);
 	*laddrp = laddr.s_addr;
 	*lportp = lport;
 	return (0);

Modified: head/sys/netinet6/in6_pcb.c
==============================================================================
--- head/sys/netinet6/in6_pcb.c	Thu Feb  5 14:21:09 2009	(r188147)
+++ head/sys/netinet6/in6_pcb.c	Thu Feb  5 14:25:53 2009	(r188148)
@@ -130,7 +130,11 @@ in6_pcbbind(register struct inpcb *inp, 
 		return (EINVAL);
 	if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0)
 		wild = INPLOOKUP_WILDCARD;
-	if (nam) {
+	if (nam == NULL) {
+		if ((error = prison_local_ip6(cred, &inp->in6p_laddr,
+		    ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0)
+			return (error);
+	} else {
 		sin6 = (struct sockaddr_in6 *)nam;
 		if (nam->sa_len != sizeof(*sin6))
 			return (EINVAL);
@@ -221,9 +225,6 @@ in6_pcbbind(register struct inpcb *inp, 
 						return (EADDRINUSE);
 				}
 			}
-			if ((error = prison_local_ip6(cred, &sin6->sin6_addr,
-			    ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0)
-				return (error);
 			t = in6_pcblookup_local(pcbinfo, &sin6->sin6_addr,
 			    lport, wild, cred);
 			if (t && (reuseport & ((t->inp_vflag & INP_TIMEWAIT) ?
@@ -256,9 +257,6 @@ in6_pcbbind(register struct inpcb *inp, 
 		}
 		inp->in6p_laddr = sin6->sin6_addr;
 	}
-	if ((error = prison_local_ip6(cred, &inp->in6p_laddr,
-	    ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0)
-		return (error);
 	if (lport == 0) {
 		if ((error = in6_pcbsetport(&inp->in6p_laddr, inp, cred)) != 0)
 			return (error);

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 14:58:16 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 802FA1065678;
	Thu,  5 Feb 2009 14:58:16 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6DBF18FC08;
	Thu,  5 Feb 2009 14:58:16 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15EwGMj029996;
	Thu, 5 Feb 2009 14:58:16 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15EwGIE029995;
	Thu, 5 Feb 2009 14:58:16 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <200902051458.n15EwGIE029995@svn.freebsd.org>
From: Jamie Gritton <jamie@FreeBSD.org>
Date: Thu, 5 Feb 2009 14:58:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188149 - head/sys/net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 14:58:17 -0000

Author: jamie
Date: Thu Feb  5 14:58:16 2009
New Revision: 188149
URL: http://svn.freebsd.org/changeset/base/188149

Log:
  Call prison_if from rtm_get_jailed, instead of splitting it out into
  prison_check_ip4 and prison_check_ip6.  As prison_if includes a jailed()
  check, remove that check before calling rtm_get_jailed.
  
  Approved by:	bz (mentor)

Modified:
  head/sys/net/rtsock.c

Modified: head/sys/net/rtsock.c
==============================================================================
--- head/sys/net/rtsock.c	Thu Feb  5 14:25:53 2009	(r188148)
+++ head/sys/net/rtsock.c	Thu Feb  5 14:58:16 2009	(r188149)
@@ -337,55 +337,48 @@ rtm_get_jailed(struct rt_addrinfo *info,
     struct rtentry *rt, union sockaddr_union *saun, struct ucred *cred)
 {
 
+	/* First, see if the returned address is part of the jail. */
+	if (prison_if(cred, rt->rt_ifa->ifa_addr) == 0) {
+		info->rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
+		return (0);
+	}
+
 	switch (info->rti_info[RTAX_DST]->sa_family) {
 #ifdef INET
 	case AF_INET:
 	{
 		struct in_addr ia;
+		struct ifaddr *ifa;
+		int found;
 
+		found = 0;
 		/*
-		 * 1. Check if the returned address is part of the jail.
+		 * Try to find an address on the given outgoing interface
+		 * that belongs to the jail.
 		 */
-		ia = ((struct sockaddr_in *)rt->rt_ifa->ifa_addr)->sin_addr;
-		if (prison_check_ip4(cred, &ia) == 0) {
-			info->rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
-
-		} else {
-			struct ifaddr *ifa;
-			int found;
-
-			found = 0;
-
+		TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
+			struct sockaddr *sa;
+			sa = ifa->ifa_addr;
+			if (sa->sa_family != AF_INET)
+				continue;
+			ia = ((struct sockaddr_in *)sa)->sin_addr;
+			if (prison_check_ip4(cred, &ia) == 0) {
+				found = 1;
+				break;
+			}
+		}
+		if (!found) {
 			/*
-			 * 2. Try to find an address on the given outgoing
-			 *    interface that belongs to the jail.
+			 * As a last resort return the 'default' jail address.
 			 */
-			TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
-				struct sockaddr *sa;
-				sa = ifa->ifa_addr;
-				if (sa->sa_family != AF_INET)
-					continue;
-				ia = ((struct sockaddr_in *)sa)->sin_addr;
-				if (prison_check_ip4(cred, &ia) == 0) {
-					found = 1;
-					break;
-				}
-			}
-			if (!found) {
-				/*
-				 * 3. As a last resort return the 'default'
-				 * jail address.
-				 */
-				if (prison_get_ip4(cred, &ia) != 0)
-					return (ESRCH);
-			}
-			bzero(&saun->sin, sizeof(struct sockaddr_in));
-			saun->sin.sin_len = sizeof(struct sockaddr_in);
-			saun->sin.sin_family = AF_INET;
-			saun->sin.sin_addr.s_addr = ia.s_addr;
-			info->rti_info[RTAX_IFA] =
-			    (struct sockaddr *)&saun->sin;
+			if (prison_get_ip4(cred, &ia) != 0)
+				return (ESRCH);
 		}
+		bzero(&saun->sin, sizeof(struct sockaddr_in));
+		saun->sin.sin_len = sizeof(struct sockaddr_in);
+		saun->sin.sin_family = AF_INET;
+		saun->sin.sin_addr.s_addr = ia.s_addr;
+		info->rti_info[RTAX_IFA] = (struct sockaddr *)&saun->sin;
 		break;
 	}
 #endif
@@ -393,54 +386,40 @@ rtm_get_jailed(struct rt_addrinfo *info,
 	case AF_INET6:
 	{
 		struct in6_addr ia6;
+		struct ifaddr *ifa;
+		int found;
 
+		found = 0;
 		/*
-		 * 1. Check if the returned address is part of the jail.
+		 * Try to find an address on the given outgoing interface
+		 * that belongs to the jail.
 		 */
-		bcopy(&((struct sockaddr_in6 *)rt->rt_ifa->ifa_addr)->sin6_addr,
-		    &ia6, sizeof(struct in6_addr));
-		if (prison_check_ip6(cred, &ia6) == 0) {
-			info->rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
-		} else {
-			struct ifaddr *ifa;
-			int found;
-
-			found = 0;
-
+		TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
+			struct sockaddr *sa;
+			sa = ifa->ifa_addr;
+			if (sa->sa_family != AF_INET6)
+				continue;
+			bcopy(&((struct sockaddr_in6 *)sa)->sin6_addr,
+			    &ia6, sizeof(struct in6_addr));
+			if (prison_check_ip6(cred, &ia6) == 0) {
+				found = 1;
+				break;
+			}
+		}
+		if (!found) {
 			/*
-			 * 2. Try to find an address on the given outgoing
-			 *    interface that belongs to the jail.
+			 * As a last resort return the 'default' jail address.
 			 */
-			TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
-				struct sockaddr *sa;
-				sa = ifa->ifa_addr;
-				if (sa->sa_family != AF_INET6)
-					continue;
-				bcopy(&((struct sockaddr_in6 *)sa)->sin6_addr,
-				    &ia6, sizeof(struct in6_addr));
-				if (prison_check_ip6(cred, &ia6) == 0) {
-					found = 1;
-					break;
-				}
-			}
-			if (!found) {
-				/*
-				 * 3. As a last resort return the 'default'
-				 * jail address.
-				 */
-				if (prison_get_ip6(cred, &ia6) != 0)
-					return (ESRCH);
-			}
-			bzero(&saun->sin6, sizeof(struct sockaddr_in6));
-			saun->sin6.sin6_len = sizeof(struct sockaddr_in6);
-			saun->sin6.sin6_family = AF_INET6;
-			bcopy(&ia6, &saun->sin6.sin6_addr,
-			    sizeof(struct in6_addr));
-			if (sa6_recoverscope(&saun->sin6) != 0)
+			if (prison_get_ip6(cred, &ia6) != 0)
 				return (ESRCH);
-			info->rti_info[RTAX_IFA] =
-			    (struct sockaddr *)&saun->sin6;
 		}
+		bzero(&saun->sin6, sizeof(struct sockaddr_in6));
+		saun->sin6.sin6_len = sizeof(struct sockaddr_in6);
+		saun->sin6.sin6_family = AF_INET6;
+		bcopy(&ia6, &saun->sin6.sin6_addr, sizeof(struct in6_addr));
+		if (sa6_recoverscope(&saun->sin6) != 0)
+			return (ESRCH);
+		info->rti_info[RTAX_IFA] = (struct sockaddr *)&saun->sin6;
 		break;
 	}
 #endif
@@ -628,17 +607,11 @@ route_output(struct mbuf *m, struct sock
 				if (ifp) {
 					info.rti_info[RTAX_IFP] =
 					    ifp->if_addr->ifa_addr;
-					if (jailed(curthread->td_ucred)) {
-						error = rtm_get_jailed(
-						    &info, ifp, rt, &saun,
-						    curthread->td_ucred);
-						if (error != 0) {
-							RT_UNLOCK(rt);
-							senderr(ESRCH);
-						}
-					} else {
-						info.rti_info[RTAX_IFA] =
-						    rt->rt_ifa->ifa_addr;
+					error = rtm_get_jailed(&info, ifp, rt,
+					    &saun, curthread->td_ucred);
+					if (error != 0) {
+						RT_UNLOCK(rt);
+						senderr(error);
 					}
 					if (ifp->if_flags & IFF_POINTOPOINT)
 						info.rti_info[RTAX_BRD] =

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 15:03:35 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B9384106566B;
	Thu,  5 Feb 2009 15:03:35 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A63AC8FC21;
	Thu,  5 Feb 2009 15:03:35 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15F3ZsS030153;
	Thu, 5 Feb 2009 15:03:35 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15F3ZZg030151;
	Thu, 5 Feb 2009 15:03:35 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <200902051503.n15F3ZZg030151@svn.freebsd.org>
From: Attilio Rao <attilio@FreeBSD.org>
Date: Thu, 5 Feb 2009 15:03:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188150 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 15:03:36 -0000

Author: attilio
Date: Thu Feb  5 15:03:35 2009
New Revision: 188150
URL: http://svn.freebsd.org/changeset/base/188150

Log:
  Add more KTR_VFS logging point in order to have a more effective tracing.
  
  Reviewed by:	brueffer, kib
  Tested by:	Gianni Trematerra <giovanni D trematerra A gmail D com>

Modified:
  head/sys/kern/vfs_mount.c
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_mount.c
==============================================================================
--- head/sys/kern/vfs_mount.c	Thu Feb  5 14:58:16 2009	(r188149)
+++ head/sys/kern/vfs_mount.c	Thu Feb  5 15:03:35 2009	(r188150)
@@ -386,6 +386,8 @@ nmount(td, uap)
 	u_int iovcnt;
 
 	AUDIT_ARG(fflags, uap->flags);
+	CTR4(KTR_VFS, "%s: iovp %p with iovcnt %d and flags %d", __func__,
+	    uap->iovp, uap->iovcnt, uap->flags);
 
 	/*
 	 * Filter out MNT_ROOTFS.  We do not want clients of nmount() in
@@ -400,16 +402,24 @@ nmount(td, uap)
 	 * Check that we have an even number of iovec's
 	 * and that we have at least two options.
 	 */
-	if ((iovcnt & 1) || (iovcnt < 4))
+	if ((iovcnt & 1) || (iovcnt < 4)) {
+		CTR2(KTR_VFS, "%s: failed for invalid iovcnt %d", __func__,
+		    uap->iovcnt);
 		return (EINVAL);
+	}
 
 	error = copyinuio(uap->iovp, iovcnt, &auio);
-	if (error)
+	if (error) {
+		CTR2(KTR_VFS, "%s: failed for invalid uio op with %d errno",
+		    __func__, error);
 		return (error);
+	}
 	iov = auio->uio_iov;
 	for (i = 0; i < iovcnt; i++) {
 		if (iov->iov_len > MMAXOPTIONLEN) {
 			free(auio, M_IOV);
+			CTR1(KTR_VFS, "%s: failed for invalid new auio",
+			    __func__);
 			return (EINVAL);
 		}
 		iov++;
@@ -429,6 +439,7 @@ void
 vfs_ref(struct mount *mp)
 {
 
+	CTR2(KTR_VFS, "%s: mp %p", __func__, mp);
 	MNT_ILOCK(mp);
 	MNT_REF(mp);
 	MNT_IUNLOCK(mp);
@@ -438,6 +449,7 @@ void
 vfs_rel(struct mount *mp)
 {
 
+	CTR2(KTR_VFS, "%s: mp %p", __func__, mp);
 	MNT_ILOCK(mp);
 	MNT_REL(mp);
 	MNT_IUNLOCK(mp);

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Thu Feb  5 14:58:16 2009	(r188149)
+++ head/sys/kern/vfs_subr.c	Thu Feb  5 15:03:35 2009	(r188150)
@@ -341,6 +341,7 @@ vfs_busy(struct mount *mp, int flags)
 {
 
 	MPASS((flags & ~MBF_MASK) == 0);
+	CTR3(KTR_VFS, "%s: mp %p with flags %d", __func__, mp, flags);
 
 	MNT_ILOCK(mp);
 	MNT_REF(mp);
@@ -348,6 +349,8 @@ vfs_busy(struct mount *mp, int flags)
 		if (flags & MBF_NOWAIT || mp->mnt_kern_flag & MNTK_REFEXPIRE) {
 			MNT_REL(mp);
 			MNT_IUNLOCK(mp);
+			CTR1(KTR_VFS, "%s: failed busying before sleeping",
+			    __func__);
 			return (ENOENT);
 		}
 		if (flags & MBF_MNTLSTLOCK)
@@ -358,6 +361,7 @@ vfs_busy(struct mount *mp, int flags)
 		MNT_IUNLOCK(mp);
 		if (flags & MBF_MNTLSTLOCK)
 			mtx_lock(&mountlist_mtx);
+		CTR1(KTR_VFS, "%s: failed busying after sleep", __func__);
 		return (ENOENT);
 	}
 	if (flags & MBF_MNTLSTLOCK)
@@ -374,11 +378,13 @@ void
 vfs_unbusy(struct mount *mp)
 {
 
+	CTR2(KTR_VFS, "%s: mp %p", __func__, mp);
 	MNT_ILOCK(mp);
 	MNT_REL(mp);
 	mp->mnt_lockref--;
 	if (mp->mnt_lockref == 0 && (mp->mnt_kern_flag & MNTK_DRAINING) != 0) {
 		MPASS(mp->mnt_kern_flag & MNTK_UNMOUNT);
+		CTR1(KTR_VFS, "%s: waking up waiters", __func__);
 		mp->mnt_kern_flag &= ~MNTK_DRAINING;
 		wakeup(&mp->mnt_lockref);
 	}
@@ -393,6 +399,7 @@ vfs_getvfs(fsid_t *fsid)
 {
 	struct mount *mp;
 
+	CTR2(KTR_VFS, "%s: fsid %p", __func__, fsid);
 	mtx_lock(&mountlist_mtx);
 	TAILQ_FOREACH(mp, &mountlist, mnt_list) {
 		if (mp->mnt_stat.f_fsid.val[0] == fsid->val[0] &&
@@ -403,6 +410,7 @@ vfs_getvfs(fsid_t *fsid)
 		}
 	}
 	mtx_unlock(&mountlist_mtx);
+	CTR2(KTR_VFS, "%s: lookup failed for %p id", __func__, fsid);
 	return ((struct mount *) 0);
 }
 
@@ -416,6 +424,7 @@ vfs_busyfs(fsid_t *fsid)
 	struct mount *mp;
 	int error;
 
+	CTR2(KTR_VFS, "%s: fsid %p", __func__, fsid);
 	mtx_lock(&mountlist_mtx);
 	TAILQ_FOREACH(mp, &mountlist, mnt_list) {
 		if (mp->mnt_stat.f_fsid.val[0] == fsid->val[0] &&
@@ -428,6 +437,7 @@ vfs_busyfs(fsid_t *fsid)
 			return (mp);
 		}
 	}
+	CTR2(KTR_VFS, "%s: lookup failed for %p id", __func__, fsid);
 	mtx_unlock(&mountlist_mtx);
 	return ((struct mount *) 0);
 }
@@ -498,6 +508,7 @@ vfs_getnewfsid(struct mount *mp)
 	fsid_t tfsid;
 	int mtype;
 
+	CTR2(KTR_VFS, "%s: mp %p", __func__, mp);
 	mtx_lock(&mntid_mtx);
 	mtype = mp->mnt_vfc->vfc_typenum;
 	tfsid.val[1] = mtype;
@@ -822,7 +833,7 @@ vdestroy(struct vnode *vp)
 {
 	struct bufobj *bo;
 
-	CTR1(KTR_VFS, "vdestroy vp %p", vp);
+	CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
 	mtx_lock(&vnode_free_list_mtx);
 	numvnodes--;
 	mtx_unlock(&vnode_free_list_mtx);
@@ -867,20 +878,27 @@ vtryrecycle(struct vnode *vp)
 {
 	struct mount *vnmp;
 
-	CTR1(KTR_VFS, "vtryrecycle: trying vp %p", vp);
+	CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
 	VNASSERT(vp->v_holdcnt, vp,
 	    ("vtryrecycle: Recycling vp %p without a reference.", vp));
 	/*
 	 * This vnode may found and locked via some other list, if so we
 	 * can't recycle it yet.
 	 */
-	if (VOP_LOCK(vp, LK_EXCLUSIVE | LK_NOWAIT) != 0)
+	if (VOP_LOCK(vp, LK_EXCLUSIVE | LK_NOWAIT) != 0) {
+		CTR2(KTR_VFS,
+		    "%s: impossible to recycle, vp %p lock is already held",
+		    __func__, vp);
 		return (EWOULDBLOCK);
+	}
 	/*
 	 * Don't recycle if its filesystem is being suspended.
 	 */
 	if (vn_start_write(vp, &vnmp, V_NOWAIT) != 0) {
 		VOP_UNLOCK(vp, 0);
+		CTR2(KTR_VFS,
+		    "%s: impossible to recycle, cannot start the write for %p",
+		    __func__, vp);
 		return (EBUSY);
 	}
 	/*
@@ -893,13 +911,15 @@ vtryrecycle(struct vnode *vp)
 	if (vp->v_usecount) {
 		VOP_UNLOCK(vp, LK_INTERLOCK);
 		vn_finished_write(vnmp);
+		CTR2(KTR_VFS,
+		    "%s: impossible to recycle, %p is already referenced",
+		    __func__, vp);
 		return (EBUSY);
 	}
 	if ((vp->v_iflag & VI_DOOMED) == 0)
 		vgonel(vp);
 	VOP_UNLOCK(vp, LK_INTERLOCK);
 	vn_finished_write(vnmp);
-	CTR1(KTR_VFS, "vtryrecycle: recycled vp %p", vp);
 	return (0);
 }
 
@@ -913,6 +933,7 @@ getnewvnode(const char *tag, struct moun
 	struct vnode *vp = NULL;
 	struct bufobj *bo;
 
+	CTR3(KTR_VFS, "%s: mp %p with tag %s", __func__, mp, tag);
 	mtx_lock(&vnode_free_list_mtx);
 	/*
 	 * Lend our context to reclaim vnodes if they've exceeded the max.
@@ -995,7 +1016,6 @@ alloc:
 			vp->v_vflag |= VV_NOKNOTE;
 	}
 
-	CTR2(KTR_VFS, "getnewvnode: mp %p vp %p", mp, vp);
 	*vpp = vp;
 	return (0);
 }
@@ -1173,7 +1193,7 @@ int
 vinvalbuf(struct vnode *vp, int flags, int slpflag, int slptimeo)
 {
 
-	CTR2(KTR_VFS, "vinvalbuf vp %p flags %d", vp, flags);
+	CTR3(KTR_VFS, "%s: vp %p with flags %d", __func__, vp, flags);
 	ASSERT_VOP_LOCKED(vp, "vinvalbuf");
 	return (bufobj_invalbuf(&vp->v_bufobj, flags, slpflag, slptimeo));
 }
@@ -1265,7 +1285,9 @@ vtruncbuf(struct vnode *vp, struct ucred
 	int trunclbn;
 	struct bufobj *bo;
 
-	CTR2(KTR_VFS, "vtruncbuf vp %p length %jd", vp, length);
+	CTR5(KTR_VFS, "%s: vp %p with cred %p and block %d:%ju", __func__,
+	    vp, cred, blksize, (uintmax_t)length);
+
 	/*
 	 * Round up to the *next* lbn.
 	 */
@@ -1974,8 +1996,7 @@ static void
 v_incr_usecount(struct vnode *vp)
 {
 
-	CTR3(KTR_VFS, "v_incr_usecount: vp %p holdcnt %d usecount %d\n",
-	    vp, vp->v_holdcnt, vp->v_usecount);
+	CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
 	vp->v_usecount++;
 	if (vp->v_type == VCHR && vp->v_rdev != NULL) {
 		dev_lock();
@@ -1993,8 +2014,7 @@ static void
 v_upgrade_usecount(struct vnode *vp)
 {
 
-	CTR3(KTR_VFS, "v_upgrade_usecount: vp %p holdcnt %d usecount %d\n",
-	    vp, vp->v_holdcnt, vp->v_usecount);
+	CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
 	vp->v_usecount++;
 	if (vp->v_type == VCHR && vp->v_rdev != NULL) {
 		dev_lock();
@@ -2012,11 +2032,10 @@ static void
 v_decr_usecount(struct vnode *vp)
 {
 
-	CTR3(KTR_VFS, "v_decr_usecount: vp %p holdcnt %d usecount %d\n",
-	    vp, vp->v_holdcnt, vp->v_usecount);
 	ASSERT_VI_LOCKED(vp, __FUNCTION__);
 	VNASSERT(vp->v_usecount > 0, vp,
 	    ("v_decr_usecount: negative usecount"));
+	CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
 	vp->v_usecount--;
 	if (vp->v_type == VCHR && vp->v_rdev != NULL) {
 		dev_lock();
@@ -2036,11 +2055,10 @@ static void
 v_decr_useonly(struct vnode *vp)
 {
 
-	CTR3(KTR_VFS, "v_decr_useonly: vp %p holdcnt %d usecount %d\n",
-	    vp, vp->v_holdcnt, vp->v_usecount);
 	ASSERT_VI_LOCKED(vp, __FUNCTION__);
 	VNASSERT(vp->v_usecount > 0, vp,
 	    ("v_decr_useonly: negative usecount"));
+	CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
 	vp->v_usecount--;
 	if (vp->v_type == VCHR && vp->v_rdev != NULL) {
 		dev_lock();
@@ -2065,11 +2083,15 @@ vget(struct vnode *vp, int flags, struct
 	VFS_ASSERT_GIANT(vp->v_mount);
 	VNASSERT((flags & LK_TYPE_MASK) != 0, vp,
 	    ("vget: invalid lock operation"));
+	CTR3(KTR_VFS, "%s: vp %p with flags %d", __func__, vp, flags);
+
 	if ((flags & LK_INTERLOCK) == 0)
 		VI_LOCK(vp);
 	vholdl(vp);
 	if ((error = vn_lock(vp, flags | LK_INTERLOCK)) != 0) {
 		vdrop(vp);
+		CTR2(KTR_VFS, "%s: impossible to lock vnode %p", __func__,
+		    vp);
 		return (error);
 	}
 	if (vp->v_iflag & VI_DOOMED && (flags & LK_RETRY) == 0)
@@ -2100,6 +2122,7 @@ void
 vref(struct vnode *vp)
 {
 
+	CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
 	VI_LOCK(vp);
 	v_incr_usecount(vp);
 	VI_UNLOCK(vp);
@@ -2144,6 +2167,7 @@ vrele(struct vnode *vp)
 	/* Skip this v_writecount check if we're going to panic below. */
 	VNASSERT(vp->v_writecount < vp->v_usecount || vp->v_usecount < 1, vp,
 	    ("vrele: missed vn_close"));
+	CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
 
 	if (vp->v_usecount > 1 || ((vp->v_iflag & VI_DOINGINACT) &&
 	    vp->v_usecount == 1)) {
@@ -2157,6 +2181,7 @@ vrele(struct vnode *vp)
 		VI_UNLOCK(vp);
 		panic("vrele: negative ref cnt");
 	}
+	CTR2(KTR_VFS, "%s: return vnode %p to the freelist", __func__, vp);
 	/*
 	 * We want to hold the vnode until the inactive finishes to
 	 * prevent vgone() races.  We drop the use count here and the
@@ -2197,6 +2222,7 @@ vput(struct vnode *vp)
 	KASSERT(vp != NULL, ("vput: null vp"));
 	ASSERT_VOP_LOCKED(vp, "vput");
 	VFS_ASSERT_GIANT(vp->v_mount);
+	CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
 	VI_LOCK(vp);
 	/* Skip this v_writecount check if we're going to panic below. */
 	VNASSERT(vp->v_writecount < vp->v_usecount || vp->v_usecount < 1, vp,
@@ -2216,6 +2242,7 @@ vput(struct vnode *vp)
 #endif
 		panic("vput: negative ref cnt");
 	}
+	CTR2(KTR_VFS, "%s: return to freelist the vnode %p", __func__, vp);
 	/*
 	 * We want to hold the vnode until the inactive finishes to
 	 * prevent vgone() races.  We drop the use count here and the
@@ -2257,6 +2284,7 @@ void
 vholdl(struct vnode *vp)
 {
 
+	CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
 	vp->v_holdcnt++;
 	if (VSHOULDBUSY(vp))
 		vbusy(vp);
@@ -2284,11 +2312,14 @@ vdropl(struct vnode *vp)
 {
 
 	ASSERT_VI_LOCKED(vp, "vdropl");
+	CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
 	if (vp->v_holdcnt <= 0)
 		panic("vdrop: holdcnt %d", vp->v_holdcnt);
 	vp->v_holdcnt--;
 	if (vp->v_holdcnt == 0) {
 		if (vp->v_iflag & VI_DOOMED) {
+			CTR2(KTR_VFS, "%s: destroying the vnode %p", __func__,
+			    vp);
 			vdestroy(vp);
 			return;
 		} else
@@ -2311,6 +2342,7 @@ vinactive(struct vnode *vp, struct threa
 	ASSERT_VI_LOCKED(vp, "vinactive");
 	VNASSERT((vp->v_iflag & VI_DOINGINACT) == 0, vp,
 	    ("vinactive: recursed on VI_DOINGINACT"));
+	CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
 	vp->v_iflag |= VI_DOINGINACT;
 	vp->v_iflag &= ~VI_OWEINACT;
 	VI_UNLOCK(vp);
@@ -2353,7 +2385,8 @@ vflush( struct mount *mp, int rootrefs, 
 	struct vattr vattr;
 	int busy = 0, error;
 
-	CTR1(KTR_VFS, "vflush: mp %p", mp);
+	CTR4(KTR_VFS, "%s: mp %p with rootrefs %d and flags %d", __func__, mp,
+	    rootrefs, flags);
 	if (rootrefs > 0) {
 		KASSERT((flags & (SKIPSYSTEM | WRITECLOSE)) == 0,
 		    ("vflush: bad args"));
@@ -2361,8 +2394,11 @@ vflush( struct mount *mp, int rootrefs, 
 		 * Get the filesystem root vnode. We can vput() it
 		 * immediately, since with rootrefs > 0, it won't go away.
 		 */
-		if ((error = VFS_ROOT(mp, LK_EXCLUSIVE, &rootvp, td)) != 0)
+		if ((error = VFS_ROOT(mp, LK_EXCLUSIVE, &rootvp, td)) != 0) {
+			CTR2(KTR_VFS, "%s: vfs_root lookup failed with %d",
+			    __func__, error);
 			return (error);
+		}
 		vput(rootvp);
 
 	}
@@ -2449,8 +2485,11 @@ loop:
 		} else
 			VI_UNLOCK(rootvp);
 	}
-	if (busy)
+	if (busy) {
+		CTR2(KTR_VFS, "%s: failing as %d vnodes are busy", __func__,
+		    busy);
 		return (EBUSY);
+	}
 	for (; rootrefs > 0; rootrefs--)
 		vrele(rootvp);
 	return (0);
@@ -2465,6 +2504,7 @@ vrecycle(struct vnode *vp, struct thread
 	int recycled;
 
 	ASSERT_VOP_ELOCKED(vp, "vrecycle");
+	CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
 	recycled = 0;
 	VI_LOCK(vp);
 	if (vp->v_usecount == 0) {
@@ -2498,11 +2538,11 @@ vgonel(struct vnode *vp)
 	int active;
 	struct mount *mp;
 
-	CTR1(KTR_VFS, "vgonel: vp %p", vp);
 	ASSERT_VOP_ELOCKED(vp, "vgonel");
 	ASSERT_VI_LOCKED(vp, "vgonel");
 	VNASSERT(vp->v_holdcnt, vp,
 	    ("vgonel: vp %p has no reference.", vp));
+	CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
 	td = curthread;
 
 	/*
@@ -3099,7 +3139,9 @@ vfs_unmountall(void)
 	int error;
 
 	KASSERT(curthread != NULL, ("vfs_unmountall: NULL curthread"));
+	CTR1(KTR_VFS, "%s: unmounting all filesystems", __func__);
 	td = curthread;
+
 	/*
 	 * Since this only runs when rebooting, it is not interlocked.
 	 */
@@ -3140,6 +3182,7 @@ vfs_msync(struct mount *mp, int flags)
 	struct vnode *vp, *mvp;
 	struct vm_object *obj;
 
+	CTR2(KTR_VFS, "%s: mp %p", __func__, mp);
 	MNT_ILOCK(mp);
 	MNT_VNODE_FOREACH(vp, mp, mvp) {
 		VI_LOCK(vp);
@@ -3179,7 +3222,6 @@ static void
 vfree(struct vnode *vp)
 {
 
-	CTR1(KTR_VFS, "vfree vp %p", vp);
 	ASSERT_VI_LOCKED(vp, "vfree");
 	mtx_lock(&vnode_free_list_mtx);
 	VNASSERT(vp->v_op != NULL, vp, ("vfree: vnode already reclaimed."));
@@ -3187,6 +3229,7 @@ vfree(struct vnode *vp)
 	VNASSERT(VSHOULDFREE(vp), vp, ("vfree: freeing when we shouldn't"));
 	VNASSERT((vp->v_iflag & VI_DOOMED) == 0, vp,
 	    ("vfree: Freeing doomed vnode"));
+	CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
 	if (vp->v_iflag & VI_AGE) {
 		TAILQ_INSERT_HEAD(&vnode_free_list, vp, v_freelist);
 	} else {
@@ -3204,10 +3247,10 @@ vfree(struct vnode *vp)
 static void
 vbusy(struct vnode *vp)
 {
-	CTR1(KTR_VFS, "vbusy vp %p", vp);
 	ASSERT_VI_LOCKED(vp, "vbusy");
 	VNASSERT((vp->v_iflag & VI_FREE) != 0, vp, ("vnode not free"));
 	VNASSERT(vp->v_op != NULL, vp, ("vbusy: vnode already reclaimed."));
+	CTR2(KTR_VFS, "%s: vp %p", __func__, vp);
 
 	mtx_lock(&vnode_free_list_mtx);
 	TAILQ_REMOVE(&vnode_free_list, vp, v_freelist);

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 15:04:24 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 49255106564A;
	Thu,  5 Feb 2009 15:04:24 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1D6668FC1C;
	Thu,  5 Feb 2009 15:04:24 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15F4ODI030208;
	Thu, 5 Feb 2009 15:04:24 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15F4O46030207;
	Thu, 5 Feb 2009 15:04:24 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <200902051504.n15F4O46030207@svn.freebsd.org>
From: Jamie Gritton <jamie@FreeBSD.org>
Date: Thu, 5 Feb 2009 15:04:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188151 - head/sys/netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 15:04:24 -0000

Author: jamie
Date: Thu Feb  5 15:04:23 2009
New Revision: 188151
URL: http://svn.freebsd.org/changeset/base/188151

Log:
  Don't bother null-checking the thread pointer before the prison checks
  in udp6_connect (td is already dereferenced elsewhere without such a
  check).  This makes the conversion from a sockaddr to a sockaddr_in6
  always happen, so convert once at the beginning of the function rather
  than twice in the middle.
  
  Approved by:	bz (mentor)

Modified:
  head/sys/netinet6/udp6_usrreq.c

Modified: head/sys/netinet6/udp6_usrreq.c
==============================================================================
--- head/sys/netinet6/udp6_usrreq.c	Thu Feb  5 15:03:35 2009	(r188150)
+++ head/sys/netinet6/udp6_usrreq.c	Thu Feb  5 15:04:23 2009	(r188151)
@@ -883,48 +883,43 @@ udp6_connect(struct socket *so, struct s
 {
 	INIT_VNET_INET(so->so_vnet);
 	struct inpcb *inp;
+	struct sockaddr_in6 *sin6;
 	int error;
 
 	inp = sotoinpcb(so);
+	sin6 = (struct sockaddr_in6 *)nam;
 	KASSERT(inp != NULL, ("udp6_connect: inp == NULL"));
 
 	INP_INFO_WLOCK(&V_udbinfo);
 	INP_WLOCK(inp);
-	if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) {
-		struct sockaddr_in6 *sin6_p;
-
-		sin6_p = (struct sockaddr_in6 *)nam;
-		if (IN6_IS_ADDR_V4MAPPED(&sin6_p->sin6_addr)) {
-			struct sockaddr_in sin;
+	if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0 &&
+	    IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
+		struct sockaddr_in sin;
 
-			if (inp->inp_faddr.s_addr != INADDR_ANY) {
-				error = EISCONN;
-				goto out;
-			}
-			in6_sin6_2_sin(&sin, sin6_p);
-			if (td && (error = prison_remote_ip4(td->td_ucred,
-			    &sin.sin_addr)) != 0)
-				goto out;
-			error = in_pcbconnect(inp, (struct sockaddr *)&sin,
-			    td->td_ucred);
-			if (error == 0) {
-				inp->inp_vflag |= INP_IPV4;
-				inp->inp_vflag &= ~INP_IPV6;
-				soisconnected(so);
-			}
+		if (inp->inp_faddr.s_addr != INADDR_ANY) {
+			error = EISCONN;
 			goto out;
 		}
+		in6_sin6_2_sin(&sin, sin6);
+		error = prison_remote_ip4(td->td_ucred, &sin.sin_addr);
+		if (error != 0)
+			goto out;
+		error = in_pcbconnect(inp, (struct sockaddr *)&sin,
+		    td->td_ucred);
+		if (error == 0) {
+			inp->inp_vflag |= INP_IPV4;
+			inp->inp_vflag &= ~INP_IPV6;
+			soisconnected(so);
+		}
+		goto out;
 	}
 	if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {
 		error = EISCONN;
 		goto out;
 	}
-	if (td) {
-		struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam;
-		if ((error = prison_remote_ip6(td->td_ucred,
-		    &sin6->sin6_addr)) != 0)
-			goto out;
-	}
+	error = prison_remote_ip6(td->td_ucred, &sin6->sin6_addr);
+	if (error != 0)
+		goto out;
 	error = in6_pcbconnect(inp, nam, td->td_ucred);
 	if (error == 0) {
 		if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) {

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 15:09:05 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 37F57106566C;
	Thu,  5 Feb 2009 15:09:05 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 25EDD8FC1B;
	Thu,  5 Feb 2009 15:09:05 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15F954P030327;
	Thu, 5 Feb 2009 15:09:05 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15F94bL030325;
	Thu, 5 Feb 2009 15:09:04 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <200902051509.n15F94bL030325@svn.freebsd.org>
From: Attilio Rao <attilio@FreeBSD.org>
Date: Thu, 5 Feb 2009 15:09:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188152 - in head: share/man/man9 sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 15:09:05 -0000

Author: attilio
Date: Thu Feb  5 15:09:04 2009
New Revision: 188152
URL: http://svn.freebsd.org/changeset/base/188152

Log:
  Remove the assertive KA_HELD and KA_UNHELD as long as they are dangerous,
  and not really helpful.

Modified:
  head/share/man/man9/lock.9
  head/sys/sys/lockmgr.h

Modified: head/share/man/man9/lock.9
==============================================================================
--- head/share/man/man9/lock.9	Thu Feb  5 15:04:23 2009	(r188151)
+++ head/share/man/man9/lock.9	Thu Feb  5 15:09:04 2009	(r188152)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 12, 2008
+.Dd February 05, 2009
 .Dt LOCK 9
 .Os
 .Sh NAME
@@ -279,14 +279,6 @@ lock pointed to by the first argument.
 Assert that the current thread has no lock on the
 .Vt lkp
 lock pointed to by the first argument.
-.It Dv KA_HELD
-Assert that an unspecified thread has a lock on the
-.Vt lkp
-lock pointed to by the first argument.
-.It Dv KA_UNHELD
-Assert that no thread has a lock on the
-.Vt lkp
-lock pointed to by the first argument.
 .El
 .Pp
 In addition, one of the following optional assertions can be used with
@@ -305,15 +297,6 @@ Assert that the current thread does not 
 .Fa lkp .
 .El
 .Pp
-Note that
-.Dv KA_HELD
-and
-.Dv KA_UNHELD
-usage is highly discouraged.
-They are intended to cater a bad behaviour
-introduced by buffer cache lock handling.
-They will hopefully be
-made useless by revisiting such locks.
 .Sh RETURN VALUES
 The
 .Fn lockmgr

Modified: head/sys/sys/lockmgr.h
==============================================================================
--- head/sys/sys/lockmgr.h	Thu Feb  5 15:04:23 2009	(r188151)
+++ head/sys/sys/lockmgr.h	Thu Feb  5 15:09:04 2009	(r188152)
@@ -183,8 +183,6 @@ _lockmgr_args_rw(struct lock *lk, u_int 
 #define	KA_UNLOCKED	LA_UNLOCKED
 #define	KA_RECURSED	LA_RECURSED
 #define	KA_NOTRECURSED	LA_NOTRECURSED
-#define	KA_HELD
-#define	KA_UNHELD
 #endif
 
 #endif /* _KERNEL */

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 17:43:12 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DDEF31065692;
	Thu,  5 Feb 2009 17:43:12 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CC2458FC13;
	Thu,  5 Feb 2009 17:43:12 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15HhCvY033131;
	Thu, 5 Feb 2009 17:43:12 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15HhCMx033130;
	Thu, 5 Feb 2009 17:43:12 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902051743.n15HhCMx033130@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 5 Feb 2009 17:43:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188154 - head/sys/opencrypto
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 17:43:13 -0000

Author: imp
Date: Thu Feb  5 17:43:12 2009
New Revision: 188154
URL: http://svn.freebsd.org/changeset/base/188154

Log:
  Fix return type for detach routine (should be int)
  Fix first parameter for identify routine (should be driver_t *)

Modified:
  head/sys/opencrypto/cryptosoft.c

Modified: head/sys/opencrypto/cryptosoft.c
==============================================================================
--- head/sys/opencrypto/cryptosoft.c	Thu Feb  5 15:09:42 2009	(r188153)
+++ head/sys/opencrypto/cryptosoft.c	Thu Feb  5 17:43:12 2009	(r188154)
@@ -986,7 +986,7 @@ done:
 }
 
 static void
-swcr_identify(device_t *dev, device_t parent)
+swcr_identify(driver_t *drv, device_t parent)
 {
 	/* NB: order 10 is so we get attached after h/w devices */
 	if (device_find_child(parent, "cryptosoft", -1) == NULL &&
@@ -1040,12 +1040,13 @@ swcr_attach(device_t dev)
 	return 0;
 }
 
-static void
+static int
 swcr_detach(device_t dev)
 {
 	crypto_unregister_all(swcr_id);
 	if (swcr_sessions != NULL)
 		free(swcr_sessions, M_CRYPTO_DATA);
+	return 0;
 }
 
 static device_method_t swcr_methods[] = {

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 17:51:47 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 348B21065675;
	Thu,  5 Feb 2009 17:51:47 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 23C708FC1B;
	Thu,  5 Feb 2009 17:51:47 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15Hpk8G033329;
	Thu, 5 Feb 2009 17:51:46 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15HpkEP033327;
	Thu, 5 Feb 2009 17:51:46 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902051751.n15HpkEP033327@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Thu, 5 Feb 2009 17:51:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188155 - head/sbin/ifconfig
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 17:51:47 -0000

Author: sam
Date: Thu Feb  5 17:51:46 2009
New Revision: 188155
URL: http://svn.freebsd.org/changeset/base/188155

Log:
  add support for max antenna gain (not used at the moment)

Modified:
  head/sbin/ifconfig/regdomain.c
  head/sbin/ifconfig/regdomain.h

Modified: head/sbin/ifconfig/regdomain.c
==============================================================================
--- head/sbin/ifconfig/regdomain.c	Thu Feb  5 17:43:12 2009	(r188154)
+++ head/sbin/ifconfig/regdomain.c	Thu Feb  5 17:51:46 2009	(r188155)
@@ -289,6 +289,10 @@ end_element(void *data, const char *name
 		mt->netband->maxPowerDFS = strtoul(p, NULL, 0);
 		goto done;
 	}
+	if (iseq(name, "maxantgain") && mt->netband != NULL) {
+		mt->netband->maxAntGain = strtoul(p, NULL, 0);
+		goto done;
+	}
 
 	/* <country>...</country> */
 	if (iseq(name, "isocc") && mt->country != NULL) {

Modified: head/sbin/ifconfig/regdomain.h
==============================================================================
--- head/sbin/ifconfig/regdomain.h	Thu Feb  5 17:43:12 2009	(r188154)
+++ head/sbin/ifconfig/regdomain.h	Thu Feb  5 17:51:46 2009	(r188155)
@@ -49,6 +49,7 @@ struct netband {
 	const struct freqband *band;	/* channel list description */
 	uint8_t		maxPower;	/* regulatory cap on tx power (dBm) */
 	uint8_t		maxPowerDFS;	/* regulatory cap w/ DFS (dBm) */
+	uint8_t		maxAntGain;	/* max allowed antenna gain (.5 dBm) */
 	uint32_t	flags;		/* net80211 channel flags */
 
 	LIST_ENTRY(netband) next;

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 18:12:08 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F02BC106564A;
	Thu,  5 Feb 2009 18:12:07 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DE2058FC18;
	Thu,  5 Feb 2009 18:12:07 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15IC7nI033738;
	Thu, 5 Feb 2009 18:12:07 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15IC7Tp033732;
	Thu, 5 Feb 2009 18:12:07 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902051812.n15IC7Tp033732@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Thu, 5 Feb 2009 18:12:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188156 - in head/sys: conf dev/cfi sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 18:12:08 -0000

Author: sam
Date: Thu Feb  5 18:12:07 2009
New Revision: 188156
URL: http://svn.freebsd.org/changeset/base/188156

Log:
  Add support for frobbing Intel StrataFlash Protection Registers:
  o add CFI_SUPPORT_STRATAFLASH compile option to enable support
  o add new ioctls to get/set the factory and user/oem segments of the PR
    and to get/set Protection Lock Register that fuses the user segment
  o add #defines for bits in the status register
  o update cfi_wait_ready to take an offset so it can be used to wait for
    PR write completion and replace constants w/ symbolic names
  
  Note: writing the user segment isn't correct; committing now to get review.
  
  Sponsored by:	Carlson Wireless
  Reviewed by:	imp, Chris Anderson

Modified:
  head/sys/conf/options
  head/sys/dev/cfi/cfi_core.c
  head/sys/dev/cfi/cfi_dev.c
  head/sys/dev/cfi/cfi_reg.h
  head/sys/dev/cfi/cfi_var.h
  head/sys/sys/cfictl.h

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Thu Feb  5 17:51:46 2009	(r188155)
+++ head/sys/conf/options	Thu Feb  5 18:12:07 2009	(r188156)
@@ -804,3 +804,7 @@ TDMA_TXRATE_11A_DEFAULT	opt_tdma.h
 # Virtualize the network stack
 VIMAGE			opt_global.h
 VIMAGE_GLOBALS		opt_global.h
+
+# Common Flash Interface (CFI) options
+CFI_SUPPORT_STRATAFLASH	opt_cfi.h
+CFI_ARMEDANDDANGEROUS	opt_cfi.h

Modified: head/sys/dev/cfi/cfi_core.c
==============================================================================
--- head/sys/dev/cfi/cfi_core.c	Thu Feb  5 17:51:46 2009	(r188155)
+++ head/sys/dev/cfi/cfi_core.c	Thu Feb  5 18:12:07 2009	(r188156)
@@ -30,6 +30,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include "opt_cfi.h"
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/bus.h>
@@ -70,7 +72,6 @@ cfi_read(struct cfi_softc *sc, u_int ofs
 		val = ~0;
 		break;
 	}
-
 	return (val);
 }
 
@@ -300,10 +301,10 @@ cfi_detach(device_t dev)
 }
 
 static int
-cfi_wait_ready(struct cfi_softc *sc, u_int timeout)
+cfi_wait_ready(struct cfi_softc *sc, u_int ofs, u_int timeout)
 {
 	int done, error;
-	uint32_t st0, st;
+	uint32_t st0 = 0, st = 0;
 
 	done = 0;
 	error = 0;
@@ -315,21 +316,27 @@ cfi_wait_ready(struct cfi_softc *sc, u_i
 		switch (sc->sc_cmdset) {
 		case CFI_VEND_INTEL_ECS:
 		case CFI_VEND_INTEL_SCS:
-			st = cfi_read(sc, sc->sc_wrofs);
-			done = (st & 0x80);
+			st = cfi_read(sc, ofs);
+			done = (st & CFI_INTEL_STATUS_WSMS);
 			if (done) {
-				if (st & 0x02)
+				/* NB: bit 0 is reserved */
+				st &= ~(CFI_INTEL_XSTATUS_RSVD |
+					CFI_INTEL_STATUS_WSMS |
+					CFI_INTEL_STATUS_RSVD);
+				if (st & CFI_INTEL_STATUS_DPS)
 					error = EPERM;
-				else if (st & 0x10)
+				else if (st & CFI_INTEL_STATUS_PSLBS)
 					error = EIO;
-				else if (st & 0x20)
+				else if (st & CFI_INTEL_STATUS_ECLBS)
 					error = ENXIO;
+				else if (st)
+					error = EACCES;
 			}
 			break;
 		case CFI_VEND_AMD_SCS:
 		case CFI_VEND_AMD_ECS:
-			st0 = cfi_read(sc, sc->sc_wrofs);
-			st = cfi_read(sc, sc->sc_wrofs);
+			st0 = cfi_read(sc, ofs);
+			st = cfi_read(sc, ofs);
 			done = ((st & 0x40) == (st0 & 0x40)) ? 1 : 0;
 			break;
 		}
@@ -337,7 +344,7 @@ cfi_wait_ready(struct cfi_softc *sc, u_i
 	if (!done && !error)
 		error = ETIMEDOUT;
 	if (error)
-		printf("\nerror=%d\n", error);
+		printf("\nerror=%d (st 0x%x st0 0x%x)\n", error, st, st0);
 	return (error);
 }
 
@@ -369,7 +376,7 @@ cfi_write_block(struct cfi_softc *sc)
 		/* Better safe than sorry... */
 		return (ENODEV);
 	}
-	error = cfi_wait_ready(sc, sc->sc_erase_timeout);
+	error = cfi_wait_ready(sc, sc->sc_wrofs, sc->sc_erase_timeout);
 	if (error)
 		goto out;
 
@@ -411,7 +418,7 @@ cfi_write_block(struct cfi_softc *sc)
 
 		intr_restore(intr);
 
-		error = cfi_wait_ready(sc, sc->sc_write_timeout);
+		error = cfi_wait_ready(sc, sc->sc_wrofs, sc->sc_write_timeout);
 		if (error)
 			goto out;
 	}
@@ -422,3 +429,145 @@ cfi_write_block(struct cfi_softc *sc)
 	cfi_write(sc, 0, CFI_BCS_READ_ARRAY);
 	return (error);
 }
+
+#ifdef CFI_SUPPORT_STRATAFLASH
+/*
+ * Intel StrataFlash Protection Register Support.
+ *
+ * The memory includes a 128-bit Protection Register that can be
+ * used for security.  There are two 64-bit segments; one is programmed
+ * at the factory with a unique 64-bit number which is immutable.
+ * The other segment is left blank for User (OEM) programming.
+ * Once the User/OEM segment is programmed it can be locked
+ * to prevent future programming by writing bit 0 of the Protection
+ * Lock Register (PLR).  The PLR can written only once.
+ */
+
+static uint16_t
+cfi_get16(struct cfi_softc *sc, int off)
+{
+	uint16_t v = bus_space_read_2(sc->sc_tag, sc->sc_handle, off<<1);
+	return v;
+}
+
+static void
+cfi_put16(struct cfi_softc *sc, int off, uint16_t v)
+{
+	bus_space_write_2(sc->sc_tag, sc->sc_handle, off<<1, v);
+}
+
+/*
+ * Read the factory-defined 64-bit segment of the PR.
+ */
+int 
+cfi_intel_get_factory_pr(struct cfi_softc *sc, uint64_t *id)
+{
+	if (sc->sc_cmdset != CFI_VEND_INTEL_ECS)
+		return EOPNOTSUPP;
+	KASSERT(sc->sc_width == 2, ("sc_width %d", sc->sc_width));
+
+	cfi_write(sc, 0, CFI_INTEL_READ_ID);
+	*id = ((uint64_t)cfi_get16(sc, CFI_INTEL_PR(0)))<<48 |
+	      ((uint64_t)cfi_get16(sc, CFI_INTEL_PR(1)))<<32 |
+	      ((uint64_t)cfi_get16(sc, CFI_INTEL_PR(2)))<<16 |
+	      ((uint64_t)cfi_get16(sc, CFI_INTEL_PR(3)));
+	cfi_write(sc, 0, CFI_BCS_READ_ARRAY);
+	return 0;
+}
+
+/*
+ * Read the User/OEM 64-bit segment of the PR.
+ */
+int 
+cfi_intel_get_oem_pr(struct cfi_softc *sc, uint64_t *id)
+{
+	if (sc->sc_cmdset != CFI_VEND_INTEL_ECS)
+		return EOPNOTSUPP;
+	KASSERT(sc->sc_width == 2, ("sc_width %d", sc->sc_width));
+
+	cfi_write(sc, 0, CFI_INTEL_READ_ID);
+	*id = ((uint64_t)cfi_get16(sc, CFI_INTEL_PR(4)))<<48 |
+	      ((uint64_t)cfi_get16(sc, CFI_INTEL_PR(5)))<<32 |
+	      ((uint64_t)cfi_get16(sc, CFI_INTEL_PR(6)))<<16 |
+	      ((uint64_t)cfi_get16(sc, CFI_INTEL_PR(7)));
+	cfi_write(sc, 0, CFI_BCS_READ_ARRAY);
+	return 0;
+}
+
+/*
+ * Write the User/OEM 64-bit segment of the PR.
+ */
+int
+cfi_intel_set_oem_pr(struct cfi_softc *sc, uint64_t id)
+{
+	register_t intr;
+	int i, error;
+
+	if (sc->sc_cmdset != CFI_VEND_INTEL_ECS)
+		return EOPNOTSUPP;
+	KASSERT(sc->sc_width == 2, ("sc_width %d", sc->sc_width));
+
+	for (i = 7; i >= 4; i--, id >>= 16) {
+		intr = intr_disable();
+		cfi_write(sc, 0, CFI_INTEL_PP_SETUP);
+		cfi_put16(sc, CFI_INTEL_PR(i), id&0xffff);
+		intr_restore(intr);
+		error = cfi_wait_ready(sc, CFI_BCS_READ_STATUS,
+		    sc->sc_write_timeout);
+		if (error)
+			break;
+	}
+	cfi_write(sc, 0, CFI_BCS_READ_ARRAY);
+	return error;
+}
+
+/*
+ * Read the contents of the Protection Lock Register.
+ */
+int 
+cfi_intel_get_plr(struct cfi_softc *sc, uint32_t *plr)
+{
+	if (sc->sc_cmdset != CFI_VEND_INTEL_ECS)
+		return EOPNOTSUPP;
+	KASSERT(sc->sc_width == 2, ("sc_width %d", sc->sc_width));
+
+	cfi_write(sc, 0, CFI_INTEL_READ_ID);
+	*plr = cfi_get16(sc, CFI_INTEL_PLR);
+	cfi_write(sc, 0, CFI_BCS_READ_ARRAY);
+	return 0;
+}
+
+/*
+ * Write the Protection Lock Register to lock down the
+ * user-settable segment of the Protection Register.
+ * NOTE: this operation is not reversible.
+ */
+int 
+cfi_intel_set_plr(struct cfi_softc *sc)
+{
+#ifdef CFI_ARMEDANDDANGEROUS
+	register_t intr;
+#endif
+	int error;
+
+	if (sc->sc_cmdset != CFI_VEND_INTEL_ECS)
+		return EOPNOTSUPP;
+	KASSERT(sc->sc_width == 2, ("sc_width %d", sc->sc_width));
+
+#ifdef CFI_ARMEDANDDANGEROUS
+	/* worthy of console msg */
+	device_printf(sc->sc_dev, "set PLR\n");
+	intr = intr_disable();
+	cfi_write(sc, 0, CFI_INTEL_PP_SETUP);
+	cfi_put16(sc, CFI_INTEL_PLR, 0xFFFD);
+	intr_restore(intr);
+	error = cfi_wait_ready(sc, CFI_BCS_READ_STATUS, sc->sc_write_timeout);
+	cfi_write(sc, 0, CFI_BCS_READ_ARRAY);
+#else
+	device_printf(sc->sc_dev, "%s: PLR not set, "
+	    "CFI_ARMEDANDDANGEROUS not configured\n", __func__);
+	error = ENXIO;
+#endif
+	return error;
+}
+#endif /* CFI_SUPPORT_STRATAFLASH */

Modified: head/sys/dev/cfi/cfi_dev.c
==============================================================================
--- head/sys/dev/cfi/cfi_dev.c	Thu Feb  5 17:51:46 2009	(r188155)
+++ head/sys/dev/cfi/cfi_dev.c	Thu Feb  5 18:12:07 2009	(r188156)
@@ -30,6 +30,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include "opt_cfi.h"
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/bus.h>
@@ -255,14 +257,13 @@ cfi_devioctl(struct cdev *dev, u_long cm
 	sc = dev->si_drv1;
 	error = 0;
 
-	switch(cmd) {
+	switch (cmd) {
 	case CFIOCQRY:
 		if (sc->sc_writing) {
 			error = cfi_block_finish(sc);
 			if (error)
 				break;
 		}
-
 		rq = (struct cfiocqry *)data;
 		if (rq->offset >= sc->sc_size / sc->sc_width)
 			return (ESPIPE);
@@ -274,6 +275,23 @@ cfi_devioctl(struct cdev *dev, u_long cm
 			error = copyout(&val, rq->buffer++, 1);
 		}
 		break;
+#ifdef CFI_SUPPORT_STRATAFLASH
+	case CFIOCGFACTORYPR:
+		error = cfi_intel_get_factory_pr(sc, (uint64_t *)data);
+		break;
+	case CFIOCGOEMPR:
+		error = cfi_intel_get_oem_pr(sc, (uint64_t *)data);
+		break;
+	case CFIOCSOEMPR:
+		error = cfi_intel_set_oem_pr(sc, *(uint64_t *)data);
+		break;
+	case CFIOCGPLR:
+		error = cfi_intel_get_plr(sc, (uint32_t *)data);
+		break;
+	case CFIOCSPLR:
+		error = cfi_intel_set_plr(sc);
+		break;
+#endif /* CFI_SUPPORT_STRATAFLASH */
 	default:
 		error = ENOIOCTL;
 		break;

Modified: head/sys/dev/cfi/cfi_reg.h
==============================================================================
--- head/sys/dev/cfi/cfi_reg.h	Thu Feb  5 17:51:46 2009	(r188155)
+++ head/sys/dev/cfi/cfi_reg.h	Thu Feb  5 18:12:07 2009	(r188156)
@@ -104,6 +104,28 @@ struct cfi_qry {
 #define	CFI_BCS_CONFIRM		0xd0
 #define	CFI_BCS_READ_ARRAY	0xff
 
+/* Intel commands. */
+#define	CFI_INTEL_READ_ID	0x90	/* Read Identifier */
+#define	CFI_INTEL_PP_SETUP	0xc0	/* Protection Program Setup */
+
+/* NB: these are addresses for 16-bit accesses */
+#define	CFI_INTEL_PLR		0x80	/* Protection Lock Register */
+#define	CFI_INTEL_PR(n)		(0x81+(n)) /* Protection Register */
+
+/* Status register definitions */
+#define	CFI_INTEL_STATUS_WSMS	0x0080	/* Write Machine Status */
+#define	CFI_INTEL_STATUS_ESS	0x0040	/* Erase Suspend Status */
+#define	CFI_INTEL_STATUS_ECLBS	0x0020	/* Erase and Clear Lock-Bit Status */
+#define	CFI_INTEL_STATUS_PSLBS	0x0010	/* Program and Set Lock-Bit Status */
+#define	CFI_INTEL_STATUS_VPENS	0x0008	/* Programming Voltage Status */
+#define	CFI_INTEL_STATUS_PSS	0x0004	/* Program Suspend Status */
+#define	CFI_INTEL_STATUS_DPS	0x0002	/* Device Protect Status */
+#define	CFI_INTEL_STATUS_RSVD	0x0001	/* reserved */
+
+/* eXtended Status register definitions */
+#define	CFI_INTEL_XSTATUS_WBS	0x8000	/* Write Buffer Status */
+#define	CFI_INTEL_XSTATUS_RSVD	0x7f00	/* reserved */
+
 /* AMD commands. */
 #define	CFI_AMD_BLOCK_ERASE	0x30
 #define	CFI_AMD_UNLOCK_ACK	0x55

Modified: head/sys/dev/cfi/cfi_var.h
==============================================================================
--- head/sys/dev/cfi/cfi_var.h	Thu Feb  5 17:51:46 2009	(r188155)
+++ head/sys/dev/cfi/cfi_var.h	Thu Feb  5 18:12:07 2009	(r188156)
@@ -74,4 +74,11 @@ uint32_t cfi_read(struct cfi_softc *, u_
 uint8_t cfi_read_qry(struct cfi_softc *, u_int);
 int cfi_write_block(struct cfi_softc *);
 
+#ifdef CFI_SUPPORT_STRATAFLASH
+int	cfi_intel_get_factory_pr(struct cfi_softc *sc, uint64_t *);
+int	cfi_intel_get_oem_pr(struct cfi_softc *sc, uint64_t *);
+int	cfi_intel_set_oem_pr(struct cfi_softc *sc, uint64_t);
+int	cfi_intel_get_plr(struct cfi_softc *sc, uint32_t *);
+int	cfi_intel_set_plr(struct cfi_softc *sc);
+#endif /* CFI_SUPPORT_STRATAFLASH */
 #endif /* _DEV_CFI_VAR_H_ */

Modified: head/sys/sys/cfictl.h
==============================================================================
--- head/sys/sys/cfictl.h	Thu Feb  5 17:51:46 2009	(r188155)
+++ head/sys/sys/cfictl.h	Thu Feb  5 18:12:07 2009	(r188156)
@@ -44,4 +44,10 @@ struct cfiocqry {
 
 #define	CFIOCQRY	_IOWR('q', 0, struct cfiocqry)
 
+/* Intel StrataFlash Protection Register support */
+#define	CFIOCGFACTORYPR	_IOR('q', 1, uint64_t)	/* get factory protection reg */
+#define	CFIOCGOEMPR	_IOR('q', 2, uint64_t)	/* get oem protection reg */
+#define	CFIOCSOEMPR	_IOW('q', 3, uint64_t)	/* set oem protection reg */
+#define	CFIOCGPLR	_IOR('q', 4, uint32_t)	/* get protection lock reg */
+#define	CFIOCSPLR	_IO('q', 5)		/* set protection log reg */
 #endif	/* _SYS_CFICTL_H_ */

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 18:15:21 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B59751065673;
	Thu,  5 Feb 2009 18:15:21 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E40238FC18;
	Thu,  5 Feb 2009 18:15:20 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15IFKJo033833;
	Thu, 5 Feb 2009 18:15:20 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15IFKwc033830;
	Thu, 5 Feb 2009 18:15:20 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902051815.n15IFKwc033830@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Thu, 5 Feb 2009 18:15:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188157 - in head/tools/tools: . cfi
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 18:15:22 -0000

Author: sam
Date: Thu Feb  5 18:15:20 2009
New Revision: 188157
URL: http://svn.freebsd.org/changeset/base/188157

Log:
  add cfi test tool
  
  Sponsored by:	Carlson Wireless
  Reviewed by:	imp, Chris Andreson

Added:
  head/tools/tools/cfi/
  head/tools/tools/cfi/Makefile   (contents, props changed)
  head/tools/tools/cfi/cfi.c   (contents, props changed)
Modified:
  head/tools/tools/README

Modified: head/tools/tools/README
==============================================================================
--- head/tools/tools/README	Thu Feb  5 18:12:07 2009	(r188156)
+++ head/tools/tools/README	Thu Feb  5 18:15:20 2009	(r188157)
@@ -12,6 +12,7 @@ ansify		Convert K&R-style function defin
 ath		Tools specific to the Atheros 802.11 support
 backout_commit	A tool for reading in a commit message and generating
 		a script that will backout the commit.
+cfi		Common Flash Interface (CFI) tool
 commitsdb	A tool for reconstructing commit history using md5
 		checksums of the commit logs.
 crypto		Test and exercise tools related to the crypto framework

Added: head/tools/tools/cfi/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/cfi/Makefile	Thu Feb  5 18:15:20 2009	(r188157)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PROG=	cfi
+BINDIR=	/usr/local/bin
+NO_MAN=
+
+.include <bsd.prog.mk>

Added: head/tools/tools/cfi/cfi.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/cfi/cfi.c	Thu Feb  5 18:15:20 2009	(r188157)
@@ -0,0 +1,156 @@
+/*-
+ * Copyright (c) 2009 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ *    redistribution must be conditioned upon including a substantially
+ *    similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * cfi [-f device] op
+ * (default device is /dev/cfi0).
+ */
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#include <sys/cfictl.h>
+
+#include <stdio.h>
+#include <getopt.h>
+#include <stdlib.h>
+
+const char *progname;
+const char *dvname;
+
+static void
+usage(void)
+{
+	int i;
+
+	fprintf(stderr, "usage: %s [-f device] op...\n", progname);
+	fprintf(stderr, "where op's are:\n");
+	fprintf(stderr, "fact\t\tread factory PR segment\n");
+	fprintf(stderr, "oem\t\tread OEM segment\n");
+	fprintf(stderr, "woem value\twrite OEM segment\n");
+	fprintf(stderr, "plr\t\tread PLR\n");
+	fprintf(stderr, "wplr\t\twrite PLR\n");
+	exit(-1);
+}
+
+static int
+getfd(int mode)
+{
+	int fd = open(dvname, mode, 0);
+	if (fd < 0)
+		err(-1, "open");
+	return fd;
+}
+
+static uint64_t
+getfactorypr(void)
+{
+	uint64_t v;
+	int fd = getfd(O_RDONLY);
+	if (ioctl(fd, CFIOCGFACTORYPR, &v) < 0)
+		err(-1, "ioctl(CFIOCGFACTORYPR)");
+	close(fd);
+	return v;
+}
+
+static uint64_t
+getoempr(void)
+{
+	uint64_t v;
+	int fd = getfd(O_RDONLY);
+	if (ioctl(fd, CFIOCGOEMPR, &v) < 0)
+		err(-1, "ioctl(CFIOCGOEMPR)");
+	close(fd);
+	return v;
+}
+
+static void
+setoempr(uint64_t v)
+{
+	int fd = getfd(O_WRONLY);
+	if (ioctl(fd, CFIOCSOEMPR, &v) < 0)
+		err(-1, "ioctl(CFIOCGOEMPR)");
+	close(fd);
+}
+
+static uint32_t
+getplr(void)
+{
+	uint32_t plr;
+	int fd = getfd(O_RDONLY);
+	if (ioctl(fd, CFIOCGPLR, &plr) < 0)
+		err(-1, "ioctl(CFIOCGPLR)");
+	close(fd);
+	return plr;
+}
+
+static void
+setplr(void)
+{
+	int fd = getfd(O_WRONLY);
+	if (ioctl(fd, CFIOCSPLR, 0) < 0)
+		err(-1, "ioctl(CFIOCPLR)");
+	close(fd);
+}
+
+int
+main(int argc, char *argv[])
+{
+	dvname = getenv("CFI");
+	if (dvname == NULL)
+		dvname = "/dev/cfi0";
+	progname = argv[0];
+	if (argc > 1) {
+		if (strcmp(argv[1], "-f") == 0) {
+			if (argc < 2)
+				errx(1, "missing device name for -f option");
+			dvname = argv[2];
+			argc -= 2, argv += 2;
+		} else if (strcmp(argv[1], "-?") == 0)
+			usage();
+	}
+	for (; argc > 1; argc--, argv++) {
+		if (strcasecmp(argv[1], "fact") == 0) {
+			printf("0x%llx\n", (unsigned long long) getfactorypr());
+		} else if (strcasecmp(argv[1], "oem") == 0) {
+			printf("0x%llx\n", (unsigned long long) getoempr());
+		} else if (strcasecmp(argv[1], "woem") == 0) {
+			if (argc < 2)
+				errx(1, "missing value for woem");
+			setoempr((uint64_t) strtoull(argv[2], NULL, 0));
+			argc--, argv++;
+		} else if (strcasecmp(argv[1], "plr") == 0) {
+			printf("0x%x\n", getplr());
+		} else if (strcasecmp(argv[1], "wplr") == 0) {
+			setplr();
+		} else
+			usage();
+	}
+}

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 18:23:43 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DF0EA10656C2;
	Thu,  5 Feb 2009 18:23:43 +0000 (UTC)
	(envelope-from niclas.zeising@gmail.com)
Received: from mx6.bahnhof.se (mx6.bahnhof.se [213.80.101.16])
	by mx1.freebsd.org (Postfix) with ESMTP id 920B28FC1E;
	Thu,  5 Feb 2009 18:23:43 +0000 (UTC)
	(envelope-from niclas.zeising@gmail.com)
Received: from localhost (mx6.local [127.0.0.1])
	by mx6-reinject (Postfix) with ESMTP id 393222110B0;
	Thu,  5 Feb 2009 18:56:08 +0100 (CET)
Received: from mx6.bahnhof.se ([127.0.0.1])
	by localhost (mx6.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 62680-02; Thu,  5 Feb 2009 18:56:04 +0100 (CET)
Received: from [10.0.0.3] (h-85-24-219-30.NA.cust.bahnhof.se [85.24.219.30])
	by mx6.bahnhof.se (Postfix) with ESMTP id 9CF3F21106B;
	Thu,  5 Feb 2009 18:56:04 +0100 (CET)
Received: from 127.0.0.1 (AVG SMTP 8.0.233 [270.10.18/1935]);
	Thu, 05 Feb 2009 18:55:54 +0100
Message-ID: <498B2829.9000608@gmail.com>
Date: Thu, 05 Feb 2009 18:55:53 +0100
From: Niclas Zeising <niclas.zeising@gmail.com>
User-Agent: Thunderbird 2.0.0.19 (Windows/20081209)
MIME-Version: 1.0
To: Warner Losh <imp@FreeBSD.org>
References: <200902051743.n15HhCMx033130@svn.freebsd.org>
In-Reply-To: <200902051743.n15HhCMx033130@svn.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: by amavisd-new using ClamAV at bahnhof.se (MX6)
X-Spam-Status: No, score=1.708 tagged_above=-99 required=5
	tests=[DNS_FROM_RFC_POST=1.708]
X-Spam-Score: 1.708
X-Spam-Level: *
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r188154 - head/sys/opencrypto
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 18:23:44 -0000

Warner Losh wrote:
> Author: imp
> Date: Thu Feb  5 17:43:12 2009
> New Revision: 188154
> URL: http://svn.freebsd.org/changeset/base/188154
> 
> Log:
>   Fix return type for detach routine (should be int)
>   Fix first parameter for identify routine (should be driver_t *)
> 
> Modified:
>   head/sys/opencrypto/cryptosoft.c
> 
> Modified: head/sys/opencrypto/cryptosoft.c
> ==============================================================================
> --- head/sys/opencrypto/cryptosoft.c	Thu Feb  5 15:09:42 2009	(r188153)
> +++ head/sys/opencrypto/cryptosoft.c	Thu Feb  5 17:43:12 2009	(r188154)
> @@ -986,7 +986,7 @@ done:
>  }
>  
>  static void
> -swcr_identify(device_t *dev, device_t parent)
> +swcr_identify(driver_t *drv, device_t parent)
                            ^^^

Was this name change intentional?

>  {
>  	/* NB: order 10 is so we get attached after h/w devices */
>  	if (device_find_child(parent, "cryptosoft", -1) == NULL &&
> @@ -1040,12 +1040,13 @@ swcr_attach(device_t dev)
>  	return 0;
>  }
>  
> -static void
> +static int
>  swcr_detach(device_t dev)
>  {
>  	crypto_unregister_all(swcr_id);
>  	if (swcr_sessions != NULL)
>  		free(swcr_sessions, M_CRYPTO_DATA);
> +	return 0;
>  }
>  
>  static device_method_t swcr_methods[] = {

Regards!
//Niclas


From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 18:36:11 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7E4A6106566B;
	Thu,  5 Feb 2009 18:36:11 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 2A23B8FC13;
	Thu,  5 Feb 2009 18:36:11 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n15IYlmu027411;
	Thu, 5 Feb 2009 11:34:47 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Thu, 05 Feb 2009 11:35:16 -0700 (MST)
Message-Id: <20090205.113516.113804072.imp@bsdimp.com>
To: niclas.zeising@gmail.com
From: "M. Warner Losh" <imp@bsdimp.com>
In-Reply-To: <498B2829.9000608@gmail.com>
References: <200902051743.n15HhCMx033130@svn.freebsd.org>
	<498B2829.9000608@gmail.com>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r188154 - head/sys/opencrypto
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 18:36:11 -0000

In message: <498B2829.9000608@gmail.com>
            Niclas Zeising <niclas.zeising@gmail.com> writes:
: Warner Losh wrote:
: > Author: imp
: > Date: Thu Feb  5 17:43:12 2009
: > New Revision: 188154
: > URL: http://svn.freebsd.org/changeset/base/188154
: > 
: > Log:
: >   Fix return type for detach routine (should be int)
: >   Fix first parameter for identify routine (should be driver_t *)
: > 
: > Modified:
: >   head/sys/opencrypto/cryptosoft.c
: > 
: > Modified: head/sys/opencrypto/cryptosoft.c
: > ==============================================================================
: > --- head/sys/opencrypto/cryptosoft.c	Thu Feb  5 15:09:42 2009	(r188153)
: > +++ head/sys/opencrypto/cryptosoft.c	Thu Feb  5 17:43:12 2009	(r188154)
: > @@ -986,7 +986,7 @@ done:
: >  }
: >  
: >  static void
: > -swcr_identify(device_t *dev, device_t parent)
: > +swcr_identify(driver_t *drv, device_t parent)
:                             ^^^
: 
: Was this name change intentional?

Yes.  It 'dev' is typically used for 'device_t' types.  However, by
changing this to drv, it shows it isn't a device_t, and also breaks
any code that used the old variable with a compiler error.

Warner

: >  {
: >  	/* NB: order 10 is so we get attached after h/w devices */
: >  	if (device_find_child(parent, "cryptosoft", -1) == NULL &&
: > @@ -1040,12 +1040,13 @@ swcr_attach(device_t dev)
: >  	return 0;
: >  }
: >  
: > -static void
: > +static int
: >  swcr_detach(device_t dev)
: >  {
: >  	crypto_unregister_all(swcr_id);
: >  	if (swcr_sessions != NULL)
: >  		free(swcr_sessions, M_CRYPTO_DATA);
: > +	return 0;
: >  }
: >  
: >  static device_method_t swcr_methods[] = {
: 
: Regards!
: //Niclas
: 
: 

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 18:38:40 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3B6BA106566C;
	Thu,  5 Feb 2009 18:38:40 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2AB888FC19;
	Thu,  5 Feb 2009 18:38:40 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15IceeR034481;
	Thu, 5 Feb 2009 18:38:40 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15IceDM034480;
	Thu, 5 Feb 2009 18:38:40 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902051838.n15IceDM034480@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 5 Feb 2009 18:38:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188160 - head/sys/dev/atkbdc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 18:38:41 -0000

Author: imp
Date: Thu Feb  5 18:38:39 2009
New Revision: 188160
URL: http://svn.freebsd.org/changeset/base/188160

Log:
  bus_add_child takes a const char *.

Modified:
  head/sys/dev/atkbdc/atkbdc_isa.c

Modified: head/sys/dev/atkbdc/atkbdc_isa.c
==============================================================================
--- head/sys/dev/atkbdc/atkbdc_isa.c	Thu Feb  5 18:23:28 2009	(r188159)
+++ head/sys/dev/atkbdc/atkbdc_isa.c	Thu Feb  5 18:38:39 2009	(r188160)
@@ -47,8 +47,8 @@ __FBSDID("$FreeBSD$");
 
 static int	atkbdc_isa_probe(device_t dev);
 static int	atkbdc_isa_attach(device_t dev);
-static device_t	atkbdc_isa_add_child(device_t bus, int order, char *name,
-				 int unit);
+static device_t	atkbdc_isa_add_child(device_t bus, int order, const char *name,
+		    int unit);
 
 static device_method_t atkbdc_isa_methods[] = {
 	DEVMETHOD(device_probe,		atkbdc_isa_probe),
@@ -227,7 +227,7 @@ atkbdc_isa_attach(device_t dev)
 }
 
 static device_t
-atkbdc_isa_add_child(device_t bus, int order, char *name, int unit)
+atkbdc_isa_add_child(device_t bus, int order, const char *name, int unit)
 {
 	atkbdc_device_t	*ivar;
 	device_t	child;

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 18:39:33 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B5462106566B;
	Thu,  5 Feb 2009 18:39:33 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A4F438FC16;
	Thu,  5 Feb 2009 18:39:33 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15IdXPs034575;
	Thu, 5 Feb 2009 18:39:33 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15IdXQK034574;
	Thu, 5 Feb 2009 18:39:33 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902051839.n15IdXQK034574@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 5 Feb 2009 18:39:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188162 - head/sys/dev/acpi_support
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 18:39:34 -0000

Author: imp
Date: Thu Feb  5 18:39:33 2009
New Revision: 188162
URL: http://svn.freebsd.org/changeset/base/188162

Log:
  device_shutdown returns int.

Modified:
  head/sys/dev/acpi_support/acpi_panasonic.c

Modified: head/sys/dev/acpi_support/acpi_panasonic.c
==============================================================================
--- head/sys/dev/acpi_support/acpi_panasonic.c	Thu Feb  5 18:39:28 2009	(r188161)
+++ head/sys/dev/acpi_support/acpi_panasonic.c	Thu Feb  5 18:39:33 2009	(r188162)
@@ -79,7 +79,7 @@ typedef int hkey_fn_t(ACPI_HANDLE, int, 
 static int	acpi_panasonic_probe(device_t dev);
 static int	acpi_panasonic_attach(device_t dev);
 static int	acpi_panasonic_detach(device_t dev);
-static void	acpi_panasonic_shutdown(device_t dev);
+static int	acpi_panasonic_shutdown(device_t dev);
 static int	acpi_panasonic_sysctl(SYSCTL_HANDLER_ARGS);
 static ACPI_INTEGER acpi_panasonic_sinf(ACPI_HANDLE h, ACPI_INTEGER index);
 static void	acpi_panasonic_sset(ACPI_HANDLE h, ACPI_INTEGER index,
@@ -220,7 +220,7 @@ acpi_panasonic_detach(device_t dev)
 	return (0);
 }
 
-static void
+static int
 acpi_panasonic_shutdown(device_t dev)
 {
 	struct acpi_panasonic_softc *sc;
@@ -230,6 +230,7 @@ acpi_panasonic_shutdown(device_t dev)
 	sc = device_get_softc(dev);
 	mute = 1;
 	hkey_sound_mute(sc->handle, HKEY_SET, &mute);
+	return (0);
 }
 
 static int

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 18:40:43 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5EEB910656C3;
	Thu,  5 Feb 2009 18:40:43 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4E0B18FC3A;
	Thu,  5 Feb 2009 18:40:42 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15IegHS034639;
	Thu, 5 Feb 2009 18:40:42 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15Iegbd034638;
	Thu, 5 Feb 2009 18:40:42 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902051840.n15Iegbd034638@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 5 Feb 2009 18:40:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188163 - head/sys/dev/acpica
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 18:40:45 -0000

Author: imp
Date: Thu Feb  5 18:40:42 2009
New Revision: 188163
URL: http://svn.freebsd.org/changeset/base/188163

Log:
  pcib_read_config and pcib_write_config take u_int params.

Modified:
  head/sys/dev/acpica/acpi_pcib_acpi.c

Modified: head/sys/dev/acpica/acpi_pcib_acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi_pcib_acpi.c	Thu Feb  5 18:39:33 2009	(r188162)
+++ head/sys/dev/acpica/acpi_pcib_acpi.c	Thu Feb  5 18:40:42 2009	(r188163)
@@ -68,10 +68,11 @@ static int		acpi_pcib_read_ivar(device_t
 			    int which, uintptr_t *result);
 static int		acpi_pcib_write_ivar(device_t dev, device_t child,
 			    int which, uintptr_t value);
-static uint32_t		acpi_pcib_read_config(device_t dev, int bus, int slot,
-			    int func, int reg, int bytes);
-static void		acpi_pcib_write_config(device_t dev, int bus, int slot,
-			    int func, int reg, uint32_t data, int bytes);
+static uint32_t		acpi_pcib_read_config(device_t dev, u_int bus,
+			    u_int slot, u_int func, u_int reg, int bytes);
+static void		acpi_pcib_write_config(device_t dev, u_int bus,
+			    u_int slot, u_int func, u_int reg, uint32_t data,
+			    int bytes);
 static int		acpi_pcib_acpi_route_interrupt(device_t pcib,
 			    device_t dev, int pin);
 static int		acpi_pcib_alloc_msi(device_t pcib, device_t dev,
@@ -297,15 +298,15 @@ acpi_pcib_write_ivar(device_t dev, devic
 }
 
 static uint32_t
-acpi_pcib_read_config(device_t dev, int bus, int slot, int func, int reg,
-    int bytes)
+acpi_pcib_read_config(device_t dev, u_int bus, u_int slot, u_int func,
+    u_int reg, int bytes)
 {
     return (pci_cfgregread(bus, slot, func, reg, bytes));
 }
 
 static void
-acpi_pcib_write_config(device_t dev, int bus, int slot, int func, int reg,
-    uint32_t data, int bytes)
+acpi_pcib_write_config(device_t dev, u_int bus, u_int slot, u_int func,
+    u_int reg, uint32_t data, int bytes)
 {
     pci_cfgregwrite(bus, slot, func, reg, data, bytes);
 }

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 18:43:14 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4B13E1065670;
	Thu,  5 Feb 2009 18:43:14 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3A39A8FC08;
	Thu,  5 Feb 2009 18:43:14 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15IhEHC034722;
	Thu, 5 Feb 2009 18:43:14 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15IhEvR034721;
	Thu, 5 Feb 2009 18:43:14 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902051843.n15IhEvR034721@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 5 Feb 2009 18:43:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188164 - head/sys/dev/bge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 18:43:14 -0000

Author: imp
Date: Thu Feb  5 18:43:13 2009
New Revision: 188164
URL: http://svn.freebsd.org/changeset/base/188164

Log:
  device_shutdown returns an int.

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Thu Feb  5 18:40:42 2009	(r188163)
+++ head/sys/dev/bge/if_bge.c	Thu Feb  5 18:43:13 2009	(r188164)
@@ -348,7 +348,7 @@ static void bge_init_locked(struct bge_s
 static void bge_init(void *);
 static void bge_stop(struct bge_softc *);
 static void bge_watchdog(struct bge_softc *);
-static void bge_shutdown(device_t);
+static int bge_shutdown(device_t);
 static int bge_ifmedia_upd_locked(struct ifnet *);
 static int bge_ifmedia_upd(struct ifnet *);
 static void bge_ifmedia_sts(struct ifnet *, struct ifmediareq *);
@@ -4280,17 +4280,18 @@ bge_stop(struct bge_softc *sc)
  * Stop all chip I/O so that the kernel's probe routines don't
  * get confused by errant DMAs when rebooting.
  */
-static void
+static int
 bge_shutdown(device_t dev)
 {
 	struct bge_softc *sc;
 
 	sc = device_get_softc(dev);
-
 	BGE_LOCK(sc);
 	bge_stop(sc);
 	bge_reset(sc);
 	BGE_UNLOCK(sc);
+
+	return (0);
 }
 
 static int

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 18:51:14 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D12431065672;
	Thu,  5 Feb 2009 18:51:14 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A58AA8FC18;
	Thu,  5 Feb 2009 18:51:14 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15IpEm8034996;
	Thu, 5 Feb 2009 18:51:14 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15IpEqD034995;
	Thu, 5 Feb 2009 18:51:14 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902051851.n15IpEqD034995@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 5 Feb 2009 18:51:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188167 - head/sys/dev/exca
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 18:51:15 -0000

Author: imp
Date: Thu Feb  5 18:51:14 2009
New Revision: 188167
URL: http://svn.freebsd.org/changeset/base/188167

Log:
  Add some additional debugging for the memory code.

Modified:
  head/sys/dev/exca/exca.c

Modified: head/sys/dev/exca/exca.c
==============================================================================
--- head/sys/dev/exca/exca.c	Thu Feb  5 18:46:01 2009	(r188166)
+++ head/sys/dev/exca/exca.c	Thu Feb  5 18:51:14 2009	(r188167)
@@ -209,12 +209,9 @@ exca_do_mem_map(struct exca_softc *sc, i
 	exca_putb(sc, map->cardmem_msb, ((offset >> 8) &
 	    EXCA_CARDMEM_ADDRX_MSB_ADDR_MASK) | attrmem);
 
-#ifdef EXCA_DEBUG
-	if (mem->kind & PCCARD_MEM_ATTR)
-		printf("attribtue memory\n");
-	else
-		printf("common memory\n");
-#endif
+	DPRINTF("%s %d-bit memory",
+	    mem->kind & PCCARD_MEM_ATTR ? "attrubute" : "common",
+	    mem->kind & PCCARD_MEM_16BIT ? 16 : 8);
 	exca_setb(sc, EXCA_ADDRWIN_ENABLE, map->memenable |
 	    EXCA_ADDRWIN_ENABLE_MEMCS16);
 
@@ -229,11 +226,11 @@ exca_do_mem_map(struct exca_softc *sc, i
 		r5 = exca_getb(sc, map->cardmem_msb);
 		r6 = exca_getb(sc, map->cardmem_lsb);
 		r7 = exca_getb(sc, map->sysmem_win);
-		printf("exca_do_mem_map win %d: %02x%02x %02x%02x "
-		    "%02x%02x %02x (%08x+%06x.%06x*%06x)\n",
+		printf("exca_do_mem_map win %d: %#02x%#02x %#02x%#02x "
+		    "%#02x%#02x %#02x (%#08x+%#06x.%#06x*%#06x) flags %#x\n",
 		    win, r1, r2, r3, r4, r5, r6, r7,
 		    mem->addr, mem->size, mem->realsize,
-		    mem->cardaddr);
+		    mem->cardaddr, mem->kind);
 	}
 #endif
 }
@@ -259,10 +256,18 @@ exca_mem_map(struct exca_softc *sc, int 
 	}
 	if (win >= EXCA_MEM_WINS)
 		return (ENOSPC);
-	if (((rman_get_start(res) >> EXCA_MEMREG_WIN_SHIFT) & 0xff) != 0 &&
-	    (sc->flags & EXCA_HAS_MEMREG_WIN) == 0) {
-		device_printf(sc->dev, "Does not support mapping above 24M.");
-		return (EINVAL);
+	if (sc->flags & EXCA_HAS_MEMREG_WIN) {
+		if (rman_get_start(res) >> (EXCA_MEMREG_WIN_SHIFT + 8) != 0) {
+			device_printf(sc->dev,
+			    "Does not support mapping above 4GB.");
+			return (EINVAL);
+		}
+	} else {
+		if (rman_get_start(res) >> EXCA_MEMREG_WIN_SHIFT != 0) {
+			device_printf(sc->dev,
+			    "Does not support mapping above 16M.");
+			return (EINVAL);
+		}
 	}
 
 	sc->mem[win].cardaddr = 0;

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 18:59:41 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E2B17106564A;
	Thu,  5 Feb 2009 18:59:41 +0000 (UTC)
	(envelope-from niclas.zeising@gmail.com)
Received: from mxf2.bahnhof.se (mxf2.bahnhof.se [213.80.101.26])
	by mx1.freebsd.org (Postfix) with ESMTP id 93E808FC1B;
	Thu,  5 Feb 2009 18:59:41 +0000 (UTC)
	(envelope-from niclas.zeising@gmail.com)
Received: from localhost (mxf2.local [127.0.0.1])
	by mxf2-reinject (Postfix) with ESMTP id BEB006BD12E;
	Thu,  5 Feb 2009 19:59:39 +0100 (CET)
X-Virus-Scanned: by amavisd-new using ClamAV at bahnhof.se (MXF2)
X-Spam-Score: 2.777
X-Spam-Level: **
X-Spam-Status: No, score=2.777 tagged_above=-99 required=5
	tests=[DNS_FROM_RFC_POST=1.708, SPF_NEUTRAL=1.069]
Received: from mxf2.bahnhof.se ([127.0.0.1])
	by localhost (mxf2.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id EGiPnwdxjUpY; Thu,  5 Feb 2009 19:59:38 +0100 (CET)
Received: from [10.0.0.3] (h-85-24-219-30.NA.cust.bahnhof.se [85.24.219.30])
	by mxf2.bahnhof.se (Postfix) with ESMTP id 8535A6BD102;
	Thu,  5 Feb 2009 19:59:38 +0100 (CET)
Received: from 127.0.0.1 (AVG SMTP 8.0.233 [270.10.18/1935]);
	Thu, 05 Feb 2009 19:59:27 +0100
Message-ID: <498B370F.5090805@gmail.com>
Date: Thu, 05 Feb 2009 19:59:27 +0100
From: Niclas Zeising <niclas.zeising@gmail.com>
User-Agent: Thunderbird 2.0.0.19 (Windows/20081209)
MIME-Version: 1.0
To: "M. Warner Losh" <imp@bsdimp.com>
References: <200902051743.n15HhCMx033130@svn.freebsd.org>	<498B2829.9000608@gmail.com>
	<20090205.113516.113804072.imp@bsdimp.com>
In-Reply-To: <20090205.113516.113804072.imp@bsdimp.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r188154 - head/sys/opencrypto
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 18:59:42 -0000

M. Warner Losh wrote:
> In message: <498B2829.9000608@gmail.com>
>             Niclas Zeising <niclas.zeising@gmail.com> writes:
> : Warner Losh wrote:
> : > Author: imp
> : > Date: Thu Feb  5 17:43:12 2009
> : > New Revision: 188154
> : > URL: http://svn.freebsd.org/changeset/base/188154
> : > 
> : > Log:
> : >   Fix return type for detach routine (should be int)
> : >   Fix first parameter for identify routine (should be driver_t *)
> : > 
> : > Modified:
> : >   head/sys/opencrypto/cryptosoft.c
> : > 
> : > Modified: head/sys/opencrypto/cryptosoft.c
> : > ==============================================================================
> : > --- head/sys/opencrypto/cryptosoft.c	Thu Feb  5 15:09:42 2009	(r188153)
> : > +++ head/sys/opencrypto/cryptosoft.c	Thu Feb  5 17:43:12 2009	(r188154)
> : > @@ -986,7 +986,7 @@ done:
> : >  }
> : >  
> : >  static void
> : > -swcr_identify(device_t *dev, device_t parent)
> : > +swcr_identify(driver_t *drv, device_t parent)
> :                             ^^^
> : 
> : Was this name change intentional?
> 
> Yes.  It 'dev' is typically used for 'device_t' types.  However, by
> changing this to drv, it shows it isn't a device_t, and also breaks
> any code that used the old variable with a compiler error.
> 
> Warner

Ok, thanks for the education and sorry for the noise :)
Regards
Niclas
> 
> : >  {
> : >  	/* NB: order 10 is so we get attached after h/w devices */
> : >  	if (device_find_child(parent, "cryptosoft", -1) == NULL &&
> : > @@ -1040,12 +1040,13 @@ swcr_attach(device_t dev)
> : >  	return 0;
> : >  }
> : >  
> : > -static void
> : > +static int
> : >  swcr_detach(device_t dev)
> : >  {
> : >  	crypto_unregister_all(swcr_id);
> : >  	if (swcr_sessions != NULL)
> : >  		free(swcr_sessions, M_CRYPTO_DATA);
> : > +	return 0;
> : >  }
> : >  
> : >  static device_method_t swcr_methods[] = {
> : 
> : Regards!
> : //Niclas
> : 
> : 
> 


From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 19:20:35 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 484CA1065686;
	Thu,  5 Feb 2009 19:20:35 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 378298FC27;
	Thu,  5 Feb 2009 19:20:35 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15JKZK2035717;
	Thu, 5 Feb 2009 19:20:35 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15JKZwA035715;
	Thu, 5 Feb 2009 19:20:35 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902051920.n15JKZwA035715@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Thu, 5 Feb 2009 19:20:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188170 - head/sys/net80211
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 19:20:35 -0000

Author: sam
Date: Thu Feb  5 19:20:34 2009
New Revision: 188170
URL: http://svn.freebsd.org/changeset/base/188170

Log:
  o add IEEE80211_KEY_BITS for %b printing of wk_flags
  o replace hand-rolled code to print wk_flags
  o add display of ni_ucastkey in show sta
  o fix \n in _db_show_key

Modified:
  head/sys/net80211/ieee80211_crypto.h
  head/sys/net80211/ieee80211_ddb.c

Modified: head/sys/net80211/ieee80211_crypto.h
==============================================================================
--- head/sys/net80211/ieee80211_crypto.h	Thu Feb  5 19:09:15 2009	(r188169)
+++ head/sys/net80211/ieee80211_crypto.h	Thu Feb  5 19:20:34 2009	(r188170)
@@ -104,6 +104,10 @@ struct ieee80211_key {
 	(IEEE80211_KEY_SWENCRYPT | IEEE80211_KEY_SWDECRYPT)
 #define	IEEE80211_KEY_SWMIC	(IEEE80211_KEY_SWENMIC | IEEE80211_KEY_SWDEMIC)
 
+#define	IEEE80211_KEY_BITS \
+	"\20\1XMIT\2RECV\3GROUP\4SWENCRYPT\5SWDECRYPT\6SWENMIC\7SWDEMIC" \
+	"\10DEVKEY\11CIPHER0\12CIPHER1"
+
 #define	IEEE80211_KEYIX_NONE	((ieee80211_keyix) -1)
 
 /*

Modified: head/sys/net80211/ieee80211_ddb.c
==============================================================================
--- head/sys/net80211/ieee80211_ddb.c	Thu Feb  5 19:09:15 2009	(r188169)
+++ head/sys/net80211/ieee80211_ddb.c	Thu Feb  5 19:20:34 2009	(r188170)
@@ -219,6 +219,7 @@ _db_show_sta(const struct ieee80211_node
 		ni->ni_rxfragstamp);
 	db_printf("\trxfrag[0] %p rxfrag[1] %p rxfrag[2] %p\n",
 		ni->ni_rxfrag[0], ni->ni_rxfrag[1], ni->ni_rxfrag[2]);
+	_db_show_key("\tucastkey", 0, &ni->ni_ucastkey);
 	db_printf("\trstamp %u avgrssi 0x%x (rssi %d) noise %d\n",
 		ni->ni_rstamp, ni->ni_avgrssi,
 		IEEE80211_RSSI_GET(ni->ni_avgrssi), ni->ni_noise);
@@ -670,6 +671,8 @@ _db_show_key(const char *tag, int ix, co
 			cip->ic_cipher, wk->wk_keyix, 8*keylen);
 		break;
 	}
+	if (wk->wk_rxkeyix != wk->wk_keyix)
+		db_printf(" rxkeyix %u", wk->wk_rxkeyix);
 	if (memcmp(wk->wk_key, zerodata, keylen) != 0) {
 		int i;
 
@@ -683,22 +686,9 @@ _db_show_key(const char *tag, int ix, co
 		if (cip->ic_cipher != IEEE80211_CIPHER_WEP &&
 		    wk->wk_keytsc != 0)
 			db_printf(" tsc %ju", (uintmax_t)wk->wk_keytsc);
-		if (wk->wk_flags != 0) {
-			const char *sep = " ";
-
-			if (wk->wk_flags & IEEE80211_KEY_XMIT)
-				db_printf("%stx", sep), sep = "+";
-			if (wk->wk_flags & IEEE80211_KEY_RECV)
-				db_printf("%srx", sep), sep = "+";
-			if (wk->wk_flags & IEEE80211_KEY_DEFAULT)
-				db_printf("%sdef", sep), sep = "+";
-			if (wk->wk_flags & IEEE80211_KEY_SWCRYPT)
-				db_printf("%sswcrypt", sep), sep = "+";
-			if (wk->wk_flags & IEEE80211_KEY_SWMIC)
-				db_printf("%sswmic", sep), sep = "+";
-		}
-		db_printf("\n");
+		db_printf(" flags=%b", wk->wk_flags, IEEE80211_KEY_BITS);
 	}
+	db_printf("\n");
 }
 
 static void

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 19:30:29 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0FC19106570A;
	Thu,  5 Feb 2009 19:30:29 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F1D078FC0C;
	Thu,  5 Feb 2009 19:30:28 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15JUSZO035938;
	Thu, 5 Feb 2009 19:30:28 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15JUS76035937;
	Thu, 5 Feb 2009 19:30:28 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902051930.n15JUS76035937@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 5 Feb 2009 19:30:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188171 - head/sys/crypto/via
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 19:30:30 -0000

Author: imp
Date: Thu Feb  5 19:30:28 2009
New Revision: 188171
URL: http://svn.freebsd.org/changeset/base/188171

Log:
  identify routine takes driver_t *, not device_t *.

Modified:
  head/sys/crypto/via/padlock.c

Modified: head/sys/crypto/via/padlock.c
==============================================================================
--- head/sys/crypto/via/padlock.c	Thu Feb  5 19:20:34 2009	(r188170)
+++ head/sys/crypto/via/padlock.c	Thu Feb  5 19:30:28 2009	(r188171)
@@ -72,7 +72,7 @@ static int padlock_process(device_t, str
 MALLOC_DEFINE(M_PADLOCK, "padlock_data", "PadLock Data");
 
 static void
-padlock_identify(device_t *dev, device_t parent)
+padlock_identify(driver_t *drv, device_t parent)
 {
 	/* NB: order 10 is so we get attached after h/w devices */
 	if (device_find_child(parent, "padlock", -1) == NULL &&

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 19:30:55 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 685BD106566C;
	Thu,  5 Feb 2009 19:30:55 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 576DF8FC1A;
	Thu,  5 Feb 2009 19:30:55 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15JUtC1035980;
	Thu, 5 Feb 2009 19:30:55 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15JUtt9035979;
	Thu, 5 Feb 2009 19:30:55 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902051930.n15JUtt9035979@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 5 Feb 2009 19:30:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188172 - head/sys/dev/my
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 19:30:56 -0000

Author: imp
Date: Thu Feb  5 19:30:55 2009
New Revision: 188172
URL: http://svn.freebsd.org/changeset/base/188172

Log:
  Shutdown returns an int.

Modified:
  head/sys/dev/my/if_my.c

Modified: head/sys/dev/my/if_my.c
==============================================================================
--- head/sys/dev/my/if_my.c	Thu Feb  5 19:30:28 2009	(r188171)
+++ head/sys/dev/my/if_my.c	Thu Feb  5 19:30:55 2009	(r188172)
@@ -127,7 +127,7 @@ static void     my_init(void *);
 static void     my_init_locked(struct my_softc *);
 static void     my_stop(struct my_softc *);
 static void     my_watchdog(struct ifnet *);
-static void     my_shutdown(device_t);
+static int      my_shutdown(device_t);
 static int      my_ifmedia_upd(struct ifnet *);
 static void     my_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 static u_int16_t my_phy_readreg(struct my_softc *, int);
@@ -1753,7 +1753,7 @@ my_stop(struct my_softc * sc)
  * Stop all chip I/O so that the kernel's probe routines don't get confused
  * by errant DMAs when rebooting.
  */
-static void
+static int
 my_shutdown(device_t dev)
 {
 	struct my_softc *sc;
@@ -1762,5 +1762,5 @@ my_shutdown(device_t dev)
 	MY_LOCK(sc);
 	my_stop(sc);
 	MY_UNLOCK(sc);
-	return;
+	return 0;
 }

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 19:31:56 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0F02A1065677;
	Thu,  5 Feb 2009 19:31:56 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D79AD8FC1A;
	Thu,  5 Feb 2009 19:31:55 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15JVtht036037;
	Thu, 5 Feb 2009 19:31:55 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15JVtnO036035;
	Thu, 5 Feb 2009 19:31:55 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902051931.n15JVtnO036035@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 5 Feb 2009 19:31:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188173 - head/sys/dev/ppc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 19:31:57 -0000

Author: imp
Date: Thu Feb  5 19:31:55 2009
New Revision: 188173
URL: http://svn.freebsd.org/changeset/base/188173

Log:
  reset_epp and ecp_sync both return int.

Modified:
  head/sys/dev/ppc/ppc.c
  head/sys/dev/ppc/ppcvar.h

Modified: head/sys/dev/ppc/ppc.c
==============================================================================
--- head/sys/dev/ppc/ppc.c	Thu Feb  5 19:30:55 2009	(r188172)
+++ head/sys/dev/ppc/ppc.c	Thu Feb  5 19:31:55 2009	(r188173)
@@ -115,7 +115,7 @@ static char *ppc_epp_protocol[] = { " (E
 /*
  * ppc_ecp_sync()		XXX
  */
-void
+int
 ppc_ecp_sync(device_t dev)
 {
 	int i, r;
@@ -123,22 +123,22 @@ ppc_ecp_sync(device_t dev)
 
 	PPC_ASSERT_LOCKED(ppc);
 	if (!(ppc->ppc_avm & PPB_ECP) && !(ppc->ppc_dtm & PPB_ECP))
-		return;
+		return 0;
 
 	r = r_ecr(ppc);
 	if ((r & 0xe0) != PPC_ECR_EPP)
-		return;
+		return 0;
 
 	for (i = 0; i < 100; i++) {
 		r = r_ecr(ppc);
 		if (r & 0x1)
-			return;
+			return 0;
 		DELAY(100);
 	}
 
 	device_printf(dev, "ECP sync failed as data still present in FIFO.\n");
 
-	return;
+	return 0;
 }
 
 /*
@@ -1613,7 +1613,7 @@ ppc_write(device_t dev, char *buf, int l
 	return (EINVAL);
 }
 
-void
+int
 ppc_reset_epp(device_t dev)
 {
 	struct ppc_data *ppc = DEVTOSOFTC(dev);
@@ -1621,7 +1621,7 @@ ppc_reset_epp(device_t dev)
 	PPC_ASSERT_LOCKED(ppc);
 	ppc_reset_epp_timeout(ppc);
 
-	return;
+	return 0;
 }
 
 int

Modified: head/sys/dev/ppc/ppcvar.h
==============================================================================
--- head/sys/dev/ppc/ppcvar.h	Thu Feb  5 19:30:55 2009	(r188172)
+++ head/sys/dev/ppc/ppcvar.h	Thu Feb  5 19:31:55 2009	(r188173)
@@ -44,8 +44,8 @@ struct resource *ppc_alloc_resource(devi
     int *rid, u_long start, u_long end, u_long count, u_int flags);
 int ppc_release_resource(device_t bus, device_t child, int type, int rid,
     struct resource *r);
-void ppc_reset_epp(device_t);
-void ppc_ecp_sync(device_t);
+int ppc_reset_epp(device_t);
+int ppc_ecp_sync(device_t);
 int ppc_setmode(device_t, int);
 
 extern devclass_t ppc_devclass;

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 19:32:34 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 917DE1065675;
	Thu,  5 Feb 2009 19:32:34 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8110E8FC16;
	Thu,  5 Feb 2009 19:32:34 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15JWYT2036087;
	Thu, 5 Feb 2009 19:32:34 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15JWYMg036086;
	Thu, 5 Feb 2009 19:32:34 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902051932.n15JWYMg036086@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 5 Feb 2009 19:32:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188174 - head/sys/dev/scc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 19:32:35 -0000

Author: imp
Date: Thu Feb  5 19:32:34 2009
New Revision: 188174
URL: http://svn.freebsd.org/changeset/base/188174

Log:
  Make iclear return int, since that matches all function definitions of it.

Modified:
  head/sys/dev/scc/scc_if.m

Modified: head/sys/dev/scc/scc_if.m
==============================================================================
--- head/sys/dev/scc/scc_if.m	Thu Feb  5 19:31:55 2009	(r188173)
+++ head/sys/dev/scc/scc_if.m	Thu Feb  5 19:32:34 2009	(r188174)
@@ -66,7 +66,7 @@ METHOD int enabled {
 } DEFAULT default_enabled;
 
 # iclear()
-METHOD void iclear {
+METHOD int iclear {
 	struct scc_softc *this;
 	struct scc_chan *chan;
 };

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 19:33:20 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 585CD1065672;
	Thu,  5 Feb 2009 19:33:20 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 47F5C8FC0C;
	Thu,  5 Feb 2009 19:33:20 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15JXK9l036150;
	Thu, 5 Feb 2009 19:33:20 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15JXKKe036149;
	Thu, 5 Feb 2009 19:33:20 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902051933.n15JXKKe036149@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 5 Feb 2009 19:33:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188175 - head/sys/dev/nve
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 19:33:21 -0000

Author: imp
Date: Thu Feb  5 19:33:20 2009
New Revision: 188175
URL: http://svn.freebsd.org/changeset/base/188175

Log:
  writereg returns an int.

Modified:
  head/sys/dev/nve/if_nve.c

Modified: head/sys/dev/nve/if_nve.c
==============================================================================
--- head/sys/dev/nve/if_nve.c	Thu Feb  5 19:32:34 2009	(r188174)
+++ head/sys/dev/nve/if_nve.c	Thu Feb  5 19:33:20 2009	(r188175)
@@ -147,7 +147,7 @@ static int      nve_ifmedia_upd(struct i
 static void	nve_ifmedia_upd_locked(struct ifnet *);
 static void     nve_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 static int      nve_miibus_readreg(device_t, int, int);
-static void     nve_miibus_writereg(device_t, int, int, int);
+static int      nve_miibus_writereg(device_t, int, int, int);
 
 static void     nve_dmamap_cb(void *, bus_dma_segment_t *, int, int);
 static void     nve_dmamap_tx_cb(void *, bus_dma_segment_t *, int, bus_size_t, int);
@@ -1292,7 +1292,7 @@ nve_miibus_readreg(device_t dev, int phy
 }
 
 /* miibus Write PHY register wrapper - calls Nvidia API entry point */
-static void
+static int
 nve_miibus_writereg(device_t dev, int phy, int reg, int data)
 {
 	struct nve_softc *sc = device_get_softc(dev);
@@ -1303,7 +1303,7 @@ nve_miibus_writereg(device_t dev, int ph
 
 	DEBUGOUT(NVE_DEBUG_MII, "nve: nve_miibus_writereg - exit\n");
 
-	return;
+	return 0;
 }
 
 /* Watchdog timer to prevent PHY lockups */

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 19:33:35 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C2365106566B;
	Thu,  5 Feb 2009 19:33:35 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B1C8E8FC13;
	Thu,  5 Feb 2009 19:33:35 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15JXZrh036190;
	Thu, 5 Feb 2009 19:33:35 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15JXZ2j036189;
	Thu, 5 Feb 2009 19:33:35 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902051933.n15JXZ2j036189@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 5 Feb 2009 19:33:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188176 - head/sys/dev/fxp
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 19:33:36 -0000

Author: imp
Date: Thu Feb  5 19:33:35 2009
New Revision: 188176
URL: http://svn.freebsd.org/changeset/base/188176

Log:
  writereg returns an int.

Modified:
  head/sys/dev/fxp/if_fxp.c

Modified: head/sys/dev/fxp/if_fxp.c
==============================================================================
--- head/sys/dev/fxp/if_fxp.c	Thu Feb  5 19:33:20 2009	(r188175)
+++ head/sys/dev/fxp/if_fxp.c	Thu Feb  5 19:33:35 2009	(r188176)
@@ -255,7 +255,7 @@ static int		fxp_serial_ifmedia_upd(struc
 static void		fxp_serial_ifmedia_sts(struct ifnet *ifp,
 			    struct ifmediareq *ifmr);
 static int		fxp_miibus_readreg(device_t dev, int phy, int reg);
-static void		fxp_miibus_writereg(device_t dev, int phy, int reg,
+static int		fxp_miibus_writereg(device_t dev, int phy, int reg,
 			    int value);
 static void		fxp_load_ucode(struct fxp_softc *sc);
 static int		sysctl_int_range(SYSCTL_HANDLER_ARGS,
@@ -2642,7 +2642,7 @@ fxp_miibus_readreg(device_t dev, int phy
 	return (value & 0xffff);
 }
 
-static void
+static int
 fxp_miibus_writereg(device_t dev, int phy, int reg, int value)
 {
 	struct fxp_softc *sc = device_get_softc(dev);
@@ -2658,6 +2658,7 @@ fxp_miibus_writereg(device_t dev, int ph
 
 	if (count <= 0)
 		device_printf(dev, "fxp_miibus_writereg: timed out\n");
+	return (0);
 }
 
 static int

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 19:36:14 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A3B8E106566B;
	Thu,  5 Feb 2009 19:36:14 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 934DB8FC08;
	Thu,  5 Feb 2009 19:36:14 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15JaEQn036283;
	Thu, 5 Feb 2009 19:36:14 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15JaEBE036282;
	Thu, 5 Feb 2009 19:36:14 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902051936.n15JaEBE036282@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 5 Feb 2009 19:36:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188177 - head/sys/dev/pcn
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 19:36:15 -0000

Author: imp
Date: Thu Feb  5 19:36:14 2009
New Revision: 188177
URL: http://svn.freebsd.org/changeset/base/188177

Log:
  shutdown returns an int

Modified:
  head/sys/dev/pcn/if_pcn.c

Modified: head/sys/dev/pcn/if_pcn.c
==============================================================================
--- head/sys/dev/pcn/if_pcn.c	Thu Feb  5 19:33:35 2009	(r188176)
+++ head/sys/dev/pcn/if_pcn.c	Thu Feb  5 19:36:14 2009	(r188177)
@@ -144,7 +144,7 @@ static void pcn_init(void *);
 static void pcn_init_locked(struct pcn_softc *);
 static void pcn_stop(struct pcn_softc *);
 static void pcn_watchdog(struct ifnet *);
-static void pcn_shutdown(device_t);
+static int pcn_shutdown(device_t);
 static int pcn_ifmedia_upd(struct ifnet *);
 static void pcn_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 
@@ -1458,8 +1458,7 @@ pcn_watchdog(ifp)
  * RX and TX lists.
  */
 static void
-pcn_stop(sc)
-	struct pcn_softc	*sc;
+pcn_stop(struct pcn_softc *sc)
 {
 	register int		i;
 	struct ifnet		*ifp;
@@ -1510,9 +1509,8 @@ pcn_stop(sc)
  * Stop all chip I/O so that the kernel's probe routines don't
  * get confused by errant DMAs when rebooting.
  */
-static void
-pcn_shutdown(dev)
-	device_t		dev;
+static int
+pcn_shutdown(device_t dev)
 {
 	struct pcn_softc	*sc;
 
@@ -1523,5 +1521,5 @@ pcn_shutdown(dev)
 	pcn_stop(sc);
 	PCN_UNLOCK(sc);
 
-	return;
+	return 0;
 }

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 19:37:50 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 28F0A106566C;
	Thu,  5 Feb 2009 19:37:50 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0CF7D8FC14;
	Thu,  5 Feb 2009 19:37:50 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15Jbn3r036354;
	Thu, 5 Feb 2009 19:37:49 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15JbnuC036350;
	Thu, 5 Feb 2009 19:37:49 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902051937.n15JbnuC036350@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 5 Feb 2009 19:37:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188178 - in head/sys/dev: hifn lmc safe
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 19:37:50 -0000

Author: imp
Date: Thu Feb  5 19:37:49 2009
New Revision: 188178
URL: http://svn.freebsd.org/changeset/base/188178

Log:
  shutdown returns an int

Modified:
  head/sys/dev/hifn/hifn7751.c
  head/sys/dev/lmc/if_lmc.c
  head/sys/dev/lmc/if_lmc.h
  head/sys/dev/safe/safe.c

Modified: head/sys/dev/hifn/hifn7751.c
==============================================================================
--- head/sys/dev/hifn/hifn7751.c	Thu Feb  5 19:36:14 2009	(r188177)
+++ head/sys/dev/hifn/hifn7751.c	Thu Feb  5 19:37:49 2009	(r188178)
@@ -98,7 +98,7 @@ static	int hifn_attach(device_t);
 static	int hifn_detach(device_t);
 static	int hifn_suspend(device_t);
 static	int hifn_resume(device_t);
-static	void hifn_shutdown(device_t);
+static	int hifn_shutdown(device_t);
 
 static	int hifn_newsession(device_t, u_int32_t *, struct cryptoini *);
 static	int hifn_freesession(device_t, u_int64_t);
@@ -691,12 +691,13 @@ hifn_detach(device_t dev)
  * Stop all chip I/O so that the kernel's probe routines don't
  * get confused by errant DMAs when rebooting.
  */
-static void
+static int
 hifn_shutdown(device_t dev)
 {
 #ifdef notyet
 	hifn_stop(device_get_softc(dev));
 #endif
+	return (0);
 }
 
 /*

Modified: head/sys/dev/lmc/if_lmc.c
==============================================================================
--- head/sys/dev/lmc/if_lmc.c	Thu Feb  5 19:36:14 2009	(r188177)
+++ head/sys/dev/lmc/if_lmc.c	Thu Feb  5 19:37:49 2009	(r188178)
@@ -5643,10 +5643,11 @@ fbsd_detach(device_t dev)
   return 0; /* no error */
   }
 
-static void
+static int
 fbsd_shutdown(device_t dev)
   {
   shutdown_card(device_get_softc(dev));
+  return 0;
   }
 
 static int

Modified: head/sys/dev/lmc/if_lmc.h
==============================================================================
--- head/sys/dev/lmc/if_lmc.h	Thu Feb  5 19:36:14 2009	(r188177)
+++ head/sys/dev/lmc/if_lmc.h	Thu Feb  5 19:37:49 2009	(r188178)
@@ -1642,7 +1642,7 @@ static void detach_card(softc_t *);
 #ifdef __FreeBSD__
 static int fbsd_probe(device_t);
 static int fbsd_detach(device_t);
-static void fbsd_shutdown(device_t);
+static int fbsd_shutdown(device_t);
 static int fbsd_attach(device_t);
 #endif /* __FreeBSD__ */
 

Modified: head/sys/dev/safe/safe.c
==============================================================================
--- head/sys/dev/safe/safe.c	Thu Feb  5 19:36:14 2009	(r188177)
+++ head/sys/dev/safe/safe.c	Thu Feb  5 19:37:49 2009	(r188178)
@@ -84,7 +84,7 @@ static	int safe_attach(device_t);
 static	int safe_detach(device_t);
 static	int safe_suspend(device_t);
 static	int safe_resume(device_t);
-static	void safe_shutdown(device_t);
+static	int safe_shutdown(device_t);
 
 static	int safe_newsession(device_t, u_int32_t *, struct cryptoini *);
 static	int safe_freesession(device_t, u_int64_t);
@@ -503,12 +503,13 @@ safe_detach(device_t dev)
  * Stop all chip i/o so that the kernel's probe routines don't
  * get confused by errant DMAs when rebooting.
  */
-static void
+static int
 safe_shutdown(device_t dev)
 {
 #ifdef notyet
 	safe_stop(device_get_softc(dev));
 #endif
+	return (0);
 }
 
 /*

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 19:38:31 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 607D610656C8;
	Thu,  5 Feb 2009 19:38:31 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4E3538FC14;
	Thu,  5 Feb 2009 19:38:31 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15JcVon036406;
	Thu, 5 Feb 2009 19:38:31 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15JcVRh036405;
	Thu, 5 Feb 2009 19:38:31 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902051938.n15JcVRh036405@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 5 Feb 2009 19:38:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188179 - head/sys/dev/pccard
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 19:38:32 -0000

Author: imp
Date: Thu Feb  5 19:38:31 2009
New Revision: 188179
URL: http://svn.freebsd.org/changeset/base/188179

Log:
  Fix parameter types for set_res_flags and read_ivars

Modified:
  head/sys/dev/pccard/pccard.c

Modified: head/sys/dev/pccard/pccard.c
==============================================================================
--- head/sys/dev/pccard/pccard.c	Thu Feb  5 19:37:49 2009	(r188178)
+++ head/sys/dev/pccard/pccard.c	Thu Feb  5 19:38:31 2009	(r188179)
@@ -105,14 +105,14 @@ static int	pccard_get_resource(device_t 
 static void	pccard_delete_resource(device_t dev, device_t child, int type,
 		    int rid);
 static int	pccard_set_res_flags(device_t dev, device_t child, int type,
-		    int rid, uint32_t flags);
+		    int rid, u_long flags);
 static int	pccard_set_memory_offset(device_t dev, device_t child, int rid,
 		    uint32_t offset, uint32_t *deltap);
 static int	pccard_probe_and_attach_child(device_t dev, device_t child,
 		    struct pccard_function *pf);
 static void	pccard_probe_nomatch(device_t cbdev, device_t child);
 static int	pccard_read_ivar(device_t bus, device_t child, int which,
-		    u_char *result);
+		    uintptr_t *result);
 static void	pccard_driver_added(device_t dev, driver_t *driver);
 static struct resource *pccard_alloc_resource(device_t dev,
 		    device_t child, int type, int *rid, u_long start,
@@ -972,7 +972,7 @@ pccard_delete_resource(device_t dev, dev
 
 static int
 pccard_set_res_flags(device_t dev, device_t child, int type, int rid,
-    uint32_t flags)
+    u_long flags)
 {
 	return (CARD_SET_RES_FLAGS(device_get_parent(dev), child, type,
 	    rid, flags));
@@ -1055,7 +1055,7 @@ pccard_child_pnpinfo_str(device_t bus, d
 }
 
 static int
-pccard_read_ivar(device_t bus, device_t child, int which, u_char *result)
+pccard_read_ivar(device_t bus, device_t child, int which, uintptr_t *result)
 {
 	struct pccard_ivar *devi = PCCARD_IVAR(child);
 	struct pccard_function *pf = devi->pf;

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 19:39:07 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 835051065673;
	Thu,  5 Feb 2009 19:39:07 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 72A8A8FC21;
	Thu,  5 Feb 2009 19:39:07 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15Jd7ZQ036459;
	Thu, 5 Feb 2009 19:39:07 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15Jd70M036458;
	Thu, 5 Feb 2009 19:39:07 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902051939.n15Jd70M036458@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 5 Feb 2009 19:39:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188180 - head/sys/dev/pccard
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 19:39:08 -0000

Author: imp
Date: Thu Feb  5 19:39:07 2009
New Revision: 188180
URL: http://svn.freebsd.org/changeset/base/188180

Log:
  do_product_lookup should return a const struct pccard_product *.

Modified:
  head/sys/dev/pccard/card_if.m

Modified: head/sys/dev/pccard/card_if.m
==============================================================================
--- head/sys/dev/pccard/card_if.m	Thu Feb  5 19:38:31 2009	(r188179)
+++ head/sys/dev/pccard/card_if.m	Thu Feb  5 19:39:07 2009	(r188180)
@@ -93,7 +93,7 @@ METHOD int detach_card {
 #
 # Find "dev" in the passed table of devices.  Return it or NULL.
 #
-METHOD struct pccard_product * do_product_lookup {
+METHOD const struct pccard_product * do_product_lookup {
 	device_t bus;
 	device_t dev;
 	const struct pccard_product *tab;

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 20:26:53 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6B859106567B;
	Thu,  5 Feb 2009 20:26:53 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5A6E98FC2A;
	Thu,  5 Feb 2009 20:26:53 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15KQr47037482;
	Thu, 5 Feb 2009 20:26:53 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15KQrmK037481;
	Thu, 5 Feb 2009 20:26:53 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902052026.n15KQrmK037481@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Thu, 5 Feb 2009 20:26:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188182 - head/sys/net80211
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 20:26:54 -0000

Author: sam
Date: Thu Feb  5 20:26:53 2009
New Revision: 188182
URL: http://svn.freebsd.org/changeset/base/188182

Log:
  o change _db_show_key to always dump the contents instead of checking
    IEEE80211_KEY_DEVKEY
  o fix channel power printing (they are signed values)
  o add show statab to dump a node table and automatically dump the sta
    table of a com structure with /s

Modified:
  head/sys/net80211/ieee80211_ddb.c

Modified: head/sys/net80211/ieee80211_ddb.c
==============================================================================
--- head/sys/net80211/ieee80211_ddb.c	Thu Feb  5 20:13:51 2009	(r188181)
+++ head/sys/net80211/ieee80211_ddb.c	Thu Feb  5 20:26:53 2009	(r188182)
@@ -61,6 +61,8 @@ static void _db_show_vap(const struct ie
 static void _db_show_com(const struct ieee80211com *,
 	int showvaps, int showsta, int showprocs);
 
+static void _db_show_node_table(const char *tag,
+	const struct ieee80211_node_table *);
 static void _db_show_channel(const char *tag, const struct ieee80211_channel *);
 static void _db_show_ssid(const char *tag, int ix, int len, const uint8_t *);
 static void _db_show_appie(const char *tag, const struct ieee80211_appie *);
@@ -80,6 +82,15 @@ DB_SHOW_COMMAND(sta, db_show_sta)
 	_db_show_sta((const struct ieee80211_node *) addr);
 }
 
+DB_SHOW_COMMAND(statab, db_show_statab)
+{
+	if (!have_addr) {
+		db_printf("usage: show statab <addr>\n");
+		return;
+	}
+	_db_show_node_table("", (const struct ieee80211_node_table *) addr);
+}
+
 DB_SHOW_COMMAND(vap, db_show_vap)
 {
 	int i, showprocs = 0;
@@ -509,9 +520,12 @@ _db_show_com(const struct ieee80211com *
 	db_printf("\n");
 
 	db_printf("\tmax_keyix %d", ic->ic_max_keyix);
-	db_printf(" sta %p", &ic->ic_sta);
 	db_printf(" wme %p", &ic->ic_wme);
+	if (!showsta)
+		db_printf(" sta %p", &ic->ic_sta);
 	db_printf("\n");
+	if (showsta)
+		_db_show_node_table("\t", &ic->ic_sta);
 
 	db_printf("\tprotmode %d", ic->ic_protmode);
 	db_printf(" nonerpsta %u", ic->ic_nonerpsta);
@@ -576,6 +590,26 @@ _db_show_com(const struct ieee80211com *
 }
 
 static void
+_db_show_node_table(const char *tag, const struct ieee80211_node_table *nt)
+{
+	int i;
+
+	db_printf("%s%s@%p:\n", tag, nt->nt_name, nt);
+	db_printf("%s  nodelock %p", tag, &nt->nt_nodelock);
+	db_printf(" inact_init %d", nt->nt_inact_init);
+	db_printf(" scanlock %p", &nt->nt_scanlock);
+	db_printf(" scangen %u\n", nt->nt_scangen);
+	db_printf("%s  keyixmax %d keyixmap %p\n",
+	    tag, nt->nt_keyixmax, nt->nt_keyixmap);
+	for (i = 0; i < nt->nt_keyixmax; i++) {
+		const struct ieee80211_node *ni = nt->nt_keyixmap[i];
+		if (ni != NULL)
+			db_printf("%s  [%3u] %p %s\n", tag, i, ni,
+			    ether_sprintf(ni->ni_macaddr));
+	}
+}
+
+static void
 _db_show_channel(const char *tag, const struct ieee80211_channel *c)
 {
 	db_printf("%s ", tag);
@@ -584,7 +618,7 @@ _db_show_channel(const char *tag, const 
 	else if (c == IEEE80211_CHAN_ANYC)
 		db_printf("<ANY>");
 	else
-		db_printf("[%u (%u) flags=%b maxreg %u maxpow %u minpow %u state 0x%x extieee %u]",
+		db_printf("[%u (%u) flags=%b maxreg %d maxpow %d minpow %d state 0x%x extieee %u]",
 		    c->ic_freq, c->ic_ieee,
 		    c->ic_flags, IEEE80211_CHAN_BITS,
 		    c->ic_maxregpower, c->ic_maxpower, c->ic_minpower,
@@ -639,8 +673,6 @@ _db_show_key(const char *tag, int ix, co
 	const struct ieee80211_cipher *cip = wk->wk_cipher;
 	int keylen = wk->wk_keylen;
 
-	if ((wk->wk_flags & IEEE80211_KEY_DEVKEY) == 0)
-		return;
 	db_printf(tag, ix);
 	switch (cip->ic_cipher) {
 	case IEEE80211_CIPHER_WEP:

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 20:39:54 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 09D78106564A;
	Thu,  5 Feb 2009 20:39:54 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E215F8FC1C;
	Thu,  5 Feb 2009 20:39:53 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15Kdr0E038028;
	Thu, 5 Feb 2009 20:39:53 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15KdrmU038027;
	Thu, 5 Feb 2009 20:39:53 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902052039.n15KdrmU038027@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Thu, 5 Feb 2009 20:39:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188187 - head/tools/tools/net80211/wlanstats
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 20:39:54 -0000

Author: sam
Date: Thu Feb  5 20:39:53 2009
New Revision: 188187
URL: http://svn.freebsd.org/changeset/base/188187

Log:
  o fix identification of ahdemo mode
  o split out code to get the bssid for use in the future
  o include more information in error diags when unable to collect sta info/stats

Modified:
  head/tools/tools/net80211/wlanstats/wlanstats.c

Modified: head/tools/tools/net80211/wlanstats/wlanstats.c
==============================================================================
--- head/tools/tools/net80211/wlanstats/wlanstats.c	Thu Feb  5 20:37:07 2009	(r188186)
+++ head/tools/tools/net80211/wlanstats/wlanstats.c	Thu Feb  5 20:39:53 2009	(r188187)
@@ -390,9 +390,12 @@ wlan_getopmode(struct wlanstatfoo *wf0)
 		strlcpy(ifmr.ifm_name, wf->ifr.ifr_name, sizeof(ifmr.ifm_name));
 		if (ioctl(wf->s, SIOCGIFMEDIA, &ifmr) < 0)
 			err(1, "%s (SIOCGIFMEDIA)", wf->ifr.ifr_name);
-		if (ifmr.ifm_current & IFM_IEEE80211_ADHOC)
-			wf->opmode = IEEE80211_M_IBSS;	/* XXX ahdemo */
-		else if (ifmr.ifm_current & IFM_IEEE80211_HOSTAP)
+		if (ifmr.ifm_current & IFM_IEEE80211_ADHOC) {
+			if (ifmr.ifm_current & IFM_FLAG0)
+				wf->opmode = IEEE80211_M_AHDEMO;
+			else
+				wf->opmode = IEEE80211_M_IBSS;
+		} else if (ifmr.ifm_current & IFM_IEEE80211_HOSTAP)
 			wf->opmode = IEEE80211_M_HOSTAP;
 		else if (ifmr.ifm_current & IFM_IEEE80211_MONITOR)
 			wf->opmode = IEEE80211_M_MONITOR;
@@ -422,6 +425,15 @@ getlladdr(struct wlanstatfoo_p *wf)
 	freeifaddrs(ifp);
 }
 
+static int
+getbssid(struct wlanstatfoo_p *wf)
+{
+	wf->ireq.i_type = IEEE80211_IOC_BSSID;
+	wf->ireq.i_data = wf->mac;
+	wf->ireq.i_len = IEEE80211_ADDR_LEN;
+	return ioctl(wf->s, SIOCG80211, &wf->ireq);
+}
+
 static void
 wlan_setstamac(struct wlanstatfoo *wf0, const uint8_t *mac)
 {
@@ -436,11 +448,9 @@ wlan_setstamac(struct wlanstatfoo *wf0, 
 			getlladdr(wf);
 			break;
 		case IEEE80211_M_STA:
-			wf->ireq.i_type = IEEE80211_IOC_BSSID;
-			wf->ireq.i_data = wf->mac;
-			wf->ireq.i_len = IEEE80211_ADDR_LEN;
-			if (ioctl(wf->s, SIOCG80211, &wf->ireq) <0)
-				err(1, "%s (IEEE80211_IOC_BSSID)", wf->ireq.i_name);
+			if (getbssid(wf) < 0)
+				err(1, "%s (IEEE80211_IOC_BSSID)",
+				    wf->ireq.i_name);
 			break;
 		}
 	} else
@@ -457,15 +467,18 @@ wlan_collect(struct wlanstatfoo_p *wf,
 	wf->ireq.i_type = IEEE80211_IOC_STA_INFO;
 	wf->ireq.i_data = (caddr_t) &wf->u_info;
 	wf->ireq.i_len = sizeof(wf->u_info);
-	if (ioctl(wf->s, SIOCG80211, &wf->ireq) < 0)
-		warn("%s (IEEE80211_IOC_STA_INFO)", wf->ireq.i_name);
+	if (ioctl(wf->s, SIOCG80211, &wf->ireq) < 0) {
+		warn("%s:%s (IEEE80211_IOC_STA_INFO)", wf->ireq.i_name,
+		    ether_ntoa((const struct ether_addr*) wf->mac));
+	}
 
 	IEEE80211_ADDR_COPY(nstats->is_u.macaddr, wf->mac);
 	wf->ireq.i_type = IEEE80211_IOC_STA_STATS;
 	wf->ireq.i_data = (caddr_t) nstats;
 	wf->ireq.i_len = sizeof(*nstats);
 	if (ioctl(wf->s, SIOCG80211, &wf->ireq) < 0)
-		warn("%s (IEEE80211_IOC_STA_STATS)", wf->ireq.i_name);
+		warn("%s:%s (IEEE80211_IOC_STA_STATS)", wf->ireq.i_name,
+		    ether_ntoa((const struct ether_addr*) wf->mac));
 
 	wf->ifr.ifr_data = (caddr_t) stats;
 	if (ioctl(wf->s, SIOCG80211STATS, &wf->ifr) < 0)

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 20:44:07 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F3964106566C;
	Thu,  5 Feb 2009 20:44:06 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E2A9E8FC13;
	Thu,  5 Feb 2009 20:44:06 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15Ki6PW038266;
	Thu, 5 Feb 2009 20:44:06 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15Ki6CM038265;
	Thu, 5 Feb 2009 20:44:06 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902052044.n15Ki6CM038265@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Thu, 5 Feb 2009 20:44:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188190 - head/sys/dev/exca
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 20:44:07 -0000

Author: imp
Date: Thu Feb  5 20:44:06 2009
New Revision: 188190
URL: http://svn.freebsd.org/changeset/base/188190

Log:
  Don't check for mapping above 4GB on 32-bit platforms.

Modified:
  head/sys/dev/exca/exca.c

Modified: head/sys/dev/exca/exca.c
==============================================================================
--- head/sys/dev/exca/exca.c	Thu Feb  5 20:43:47 2009	(r188189)
+++ head/sys/dev/exca/exca.c	Thu Feb  5 20:44:06 2009	(r188190)
@@ -257,11 +257,13 @@ exca_mem_map(struct exca_softc *sc, int 
 	if (win >= EXCA_MEM_WINS)
 		return (ENOSPC);
 	if (sc->flags & EXCA_HAS_MEMREG_WIN) {
+#ifdef _LP64
 		if (rman_get_start(res) >> (EXCA_MEMREG_WIN_SHIFT + 8) != 0) {
 			device_printf(sc->dev,
 			    "Does not support mapping above 4GB.");
 			return (EINVAL);
 		}
+#endif
 	} else {
 		if (rman_get_start(res) >> EXCA_MEMREG_WIN_SHIFT != 0) {
 			device_printf(sc->dev,

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 20:48:30 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7F2791065674;
	Thu,  5 Feb 2009 20:48:30 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6D64C8FC14;
	Thu,  5 Feb 2009 20:48:30 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15KmUXh038382;
	Thu, 5 Feb 2009 20:48:30 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15KmUvP038381;
	Thu, 5 Feb 2009 20:48:30 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902052048.n15KmUvP038381@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Thu, 5 Feb 2009 20:48:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188191 - head/sys/dev/ath/ath_hal/ar5212
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 20:48:31 -0000

Author: sam
Date: Thu Feb  5 20:48:30 2009
New Revision: 188191
URL: http://svn.freebsd.org/changeset/base/188191

Log:
  replace r/w idiom with OS_REG_SET_BIT (to match other code)

Modified:
  head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c	Thu Feb  5 20:44:06 2009	(r188190)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c	Thu Feb  5 20:48:30 2009	(r188191)
@@ -990,9 +990,8 @@ ar5212PerCalibrationN(struct ath_hal *ah
 			if (powerMeasI && powerMeasQ)
 				break;
 			/* Do we really need this??? */
-			OS_REG_WRITE (ah,  AR_PHY_TIMING_CTRL4,
-				      OS_REG_READ(ah,  AR_PHY_TIMING_CTRL4) |
-				      AR_PHY_TIMING_CTRL4_DO_IQCAL);
+			OS_REG_SET_BIT(ah, AR_PHY_TIMING_CTRL4,
+			    AR_PHY_TIMING_CTRL4_DO_IQCAL);
 		} while (++i < IQ_CAL_TRIES);
 
 		/*

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 20:49:13 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CB032106566C;
	Thu,  5 Feb 2009 20:49:13 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BA7D78FC1E;
	Thu,  5 Feb 2009 20:49:13 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15KnDJM038436;
	Thu, 5 Feb 2009 20:49:13 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15KnD28038435;
	Thu, 5 Feb 2009 20:49:13 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902052049.n15KnD28038435@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Thu, 5 Feb 2009 20:49:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188192 - head/sys/dev/ath/ath_hal/ar5212
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 20:49:14 -0000

Author: sam
Date: Thu Feb  5 20:49:13 2009
New Revision: 188192
URL: http://svn.freebsd.org/changeset/base/188192

Log:
  style

Modified:
  head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c	Thu Feb  5 20:48:30 2009	(r188191)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c	Thu Feb  5 20:49:13 2009	(r188192)
@@ -1047,7 +1047,8 @@ ar5212PerCalibrationN(struct ath_hal *ah
 			ichan->iCoff = iCoff;
 			ichan->qCoff = qCoff;
 		}
-	} else if (!IEEE80211_IS_CHAN_B(chan) && ahp->ah_bIQCalibration == IQ_CAL_DONE &&
+	} else if (!IEEE80211_IS_CHAN_B(chan) &&
+	    ahp->ah_bIQCalibration == IQ_CAL_DONE &&
 	    (ichan->privFlags & CHANNEL_IQVALID) == 0) {
 		/*
 		 * Start IQ calibration if configured channel has changed.

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 20:51:53 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 60DBF1065670;
	Thu,  5 Feb 2009 20:51:53 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 503408FC12;
	Thu,  5 Feb 2009 20:51:53 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15KprbI038518;
	Thu, 5 Feb 2009 20:51:53 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15Kprce038517;
	Thu, 5 Feb 2009 20:51:53 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902052051.n15Kprce038517@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Thu, 5 Feb 2009 20:51:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188193 - head/sys/dev/ath/ath_hal/ar5212
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 20:51:53 -0000

Author: sam
Date: Thu Feb  5 20:51:53 2009
New Revision: 188193
URL: http://svn.freebsd.org/changeset/base/188193

Log:
  fill in ar5212ResetCalValid; reset the IQ valid flag on the channel
  so IQ calibration will be started on the next periodic cal

Modified:
  head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c	Thu Feb  5 20:49:13 2009	(r188192)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c	Thu Feb  5 20:51:53 2009	(r188193)
@@ -1089,7 +1089,16 @@ ar5212PerCalibration(struct ath_hal *ah,
 HAL_BOOL
 ar5212ResetCalValid(struct ath_hal *ah, const struct ieee80211_channel *chan)
 {
-	/* XXX */
+	HAL_CHANNEL_INTERNAL *ichan;
+
+	ichan = ath_hal_checkchannel(ah, chan);
+	if (ichan == AH_NULL) {
+		HALDEBUG(ah, HAL_DEBUG_ANY,
+		    "%s: invalid channel %u/0x%x; no mapping\n",
+		    __func__, chan->ic_freq, chan->ic_flags);
+		return AH_FALSE;
+	}
+	ichan->privFlags &= ~CHANNEL_IQVALID;
 	return AH_TRUE;
 }
 

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 20:56:33 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D2CED1065727;
	Thu,  5 Feb 2009 20:56:33 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C1A038FC1D;
	Thu,  5 Feb 2009 20:56:33 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15KuXb3038752;
	Thu, 5 Feb 2009 20:56:33 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15KuX6X038751;
	Thu, 5 Feb 2009 20:56:33 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902052056.n15KuX6X038751@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Thu, 5 Feb 2009 20:56:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188194 - head/sys/dev/ath/ath_hal/ar5212
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 20:56:34 -0000

Author: sam
Date: Thu Feb  5 20:56:33 2009
New Revision: 188194
URL: http://svn.freebsd.org/changeset/base/188194

Log:
  improve IQ cal debug msgs; in particular don't scare people by screaming
  "MISGATED IQ CAL!" when it's not

Modified:
  head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c	Thu Feb  5 20:51:53 2009	(r188193)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c	Thu Feb  5 20:56:33 2009	(r188194)
@@ -994,6 +994,12 @@ ar5212PerCalibrationN(struct ath_hal *ah
 			    AR_PHY_TIMING_CTRL4_DO_IQCAL);
 		} while (++i < IQ_CAL_TRIES);
 
+		HALDEBUG(ah, HAL_DEBUG_PERCAL,
+		    "%s: IQ cal finished: %d tries\n", __func__, i);
+		HALDEBUG(ah, HAL_DEBUG_PERCAL,
+		    "%s: powerMeasI %u powerMeasQ %u iqCorrMeas %d\n",
+		    __func__, powerMeasI, powerMeasQ, iqCorrMeas);
+
 		/*
 		 * Prescale these values to remove 64-bit operation
 		 * requirement at the loss of a little precision.
@@ -1020,19 +1026,7 @@ ar5212PerCalibrationN(struct ath_hal *ah
 			}
 
 			HALDEBUG(ah, HAL_DEBUG_PERCAL,
-			    "****************** MISGATED IQ CAL! *******************\n");
-			HALDEBUG(ah, HAL_DEBUG_PERCAL,
-			    "time       = %d, i = %d, \n", OS_GETUPTIME(ah), i);
-			HALDEBUG(ah, HAL_DEBUG_PERCAL,
-			    "powerMeasI = 0x%08x\n", powerMeasI);
-			HALDEBUG(ah, HAL_DEBUG_PERCAL,
-			    "powerMeasQ = 0x%08x\n", powerMeasQ);
-			HALDEBUG(ah, HAL_DEBUG_PERCAL,
-			    "iqCorrMeas = 0x%08x\n", iqCorrMeas);
-			HALDEBUG(ah, HAL_DEBUG_PERCAL,
-			    "iCoff      = %d\n", iCoff);
-			HALDEBUG(ah, HAL_DEBUG_PERCAL,
-			    "qCoff      = %d\n", qCoff);
+			    "%s: iCoff %d qCoff %d\n", __func__, iCoff, qCoff);
 
 			/* Write values and enable correction */
 			OS_REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4,

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 21:02:41 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5ACEA106566C;
	Thu,  5 Feb 2009 21:02:41 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2FAD98FC20;
	Thu,  5 Feb 2009 21:02:41 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15L2eMQ038932;
	Thu, 5 Feb 2009 21:02:40 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15L2ejF038929;
	Thu, 5 Feb 2009 21:02:40 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902052102.n15L2ejF038929@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Thu, 5 Feb 2009 21:02:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188195 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 21:02:41 -0000

Author: sam
Date: Thu Feb  5 21:02:40 2009
New Revision: 188195
URL: http://svn.freebsd.org/changeset/base/188195

Log:
  Minor packet drop improvements:
  o change tdma packet drop msg when ack required to ATH_DEBUG_TDMA
    (ATH_DEBUG_XMIT is too noisy)
  o add a debug msg for raw packet drop due to interface down/invalid
  o add stats for these two cases
  o explain how another drop case is handled

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_athioctl.h

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Thu Feb  5 20:56:33 2009	(r188194)
+++ head/sys/dev/ath/if_ath.c	Thu Feb  5 21:02:40 2009	(r188195)
@@ -4994,9 +4994,9 @@ ath_tx_start(struct ath_softc *sc, struc
 		sc->sc_stats.ast_tx_noack++;
 #ifdef ATH_SUPPORT_TDMA
 	if (sc->sc_tdma && (flags & HAL_TXDESC_NOACK) == 0) {
-		DPRINTF(sc, ATH_DEBUG_XMIT, "%s: ACK required w/ TDMA\n",
-		    __func__);
-		/* XXX statistic */
+		DPRINTF(sc, ATH_DEBUG_TDMA,
+		    "%s: discard frame, ACK required w/ TDMA\n", __func__);
+		sc->sc_stats.ast_tdma_ack++;
 		ath_freetx(m0);
 		return EIO;
 	}
@@ -7198,6 +7198,10 @@ ath_raw_xmit(struct ieee80211_node *ni, 
 	struct ath_buf *bf;
 
 	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || sc->sc_invalid) {
+		DPRINTF(sc, ATH_DEBUG_XMIT, "%s: discard frame, %s", __func__,
+		    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 ?
+			"!running" : "invalid");
+		sc->sc_stats.ast_tx_raw_fail++;
 		ieee80211_free_node(ni);
 		m_freem(m);
 		return ENETDOWN;
@@ -7207,6 +7211,7 @@ ath_raw_xmit(struct ieee80211_node *ni, 
 	 */
 	bf = ath_getbuf(sc);
 	if (bf == NULL) {
+		/* NB: ath_getbuf handles stat+msg */
 		ieee80211_free_node(ni);
 		m_freem(m);
 		return ENOBUFS;

Modified: head/sys/dev/ath/if_athioctl.h
==============================================================================
--- head/sys/dev/ath/if_athioctl.h	Thu Feb  5 20:56:33 2009	(r188194)
+++ head/sys/dev/ath/if_athioctl.h	Thu Feb  5 21:02:40 2009	(r188195)
@@ -115,7 +115,9 @@ struct ath_stats {
 	u_int32_t	ast_tdma_tsf;	/* TDMA slot update set TSF */
 	u_int16_t	ast_tdma_tsfadjp;/* TDMA slot adjust+ (usec, smoothed)*/
 	u_int16_t	ast_tdma_tsfadjm;/* TDMA slot adjust- (usec, smoothed)*/
-	u_int32_t	ast_pad[17];
+	u_int32_t	ast_tdma_ack;	/* TDMA tx failed 'cuz ACK required */
+	u_int32_t	ast_tx_raw_fail;/* raw tx failed 'cuz h/w down */
+	u_int32_t	ast_pad[15];
 };
 
 #define	SIOCGATHSTATS	_IOWR('i', 137, struct ifreq)

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 21:09:47 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 02C88106564A;
	Thu,  5 Feb 2009 21:09:47 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CBA9D8FC1D;
	Thu,  5 Feb 2009 21:09:46 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15L9k2O039094;
	Thu, 5 Feb 2009 21:09:46 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15L9klk039093;
	Thu, 5 Feb 2009 21:09:46 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902052109.n15L9klk039093@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Thu, 5 Feb 2009 21:09:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188196 - head/tools/tools/ath/athstats
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 21:09:47 -0000

Author: sam
Date: Thu Feb  5 21:09:46 2009
New Revision: 188196
URL: http://svn.freebsd.org/changeset/base/188196

Log:
  add new stats and missing tx_raw stat

Modified:
  head/tools/tools/ath/athstats/athstats.c

Modified: head/tools/tools/ath/athstats/athstats.c
==============================================================================
--- head/tools/tools/ath/athstats/athstats.c	Thu Feb  5 21:02:40 2009	(r188195)
+++ head/tools/tools/ath/athstats/athstats.c	Thu Feb  5 21:09:46 2009	(r188196)
@@ -217,7 +217,9 @@ static const struct fmt athstats[] = {
 	{ 5,	"tdmat",	"tdmat",	"TDMA slot update set TSF" },
 #define	S_TDMA_TSFADJ	AFTER(S_TDMA_TSF)
 	{ 8,	"tdmadj",	"tdmadj",	"TDMA slot adjust (usecs, smoothed)" },
-#define	S_RATE_CALLS	AFTER(S_TDMA_TSFADJ)
+#define	S_TDMA_ACK	AFTER(S_TDMA_TSFADJ)
+	{ 5,	"tdmack",	"tdmack",	"TDMA tx failed 'cuz ACK required" },
+#define	S_RATE_CALLS	AFTER(S_TDMA_ACK)
 #else
 #define	S_RATE_CALLS	AFTER(S_PER_RFGAIN)
 #endif
@@ -236,7 +238,9 @@ static const struct fmt athstats[] = {
 	{ 5,	"bmissphantom",	"bmissphantom",	"phantom beacon misses" },
 #define	S_TX_RAW	AFTER(S_BMISS_PHANTOM)
 	{ 5,	"txraw",	"txraw",	"tx frames through raw api" },
-#define	S_RX_TOOBIG	AFTER(S_TX_RAW)
+#define	S_TX_RAW_FAIL	AFTER(S_TX_RAW)
+	{ 5,	"txrawfail",	"txrawfail",	"raw tx failed 'cuz interface/hw down" },
+#define	S_RX_TOOBIG	AFTER(S_TX_RAW_FAIL)
 	{ 5,	"rx2big",	"rx2big",	"rx failed 'cuz frame too large"  },
 #ifndef __linux__
 #define	S_CABQ_XMIT	AFTER(S_RX_TOOBIG)
@@ -557,6 +561,8 @@ ath_get_curstat(struct statfoo *sf, int 
 	case S_TX_SHORTPRE:	STAT(tx_shortpre);
 	case S_TX_ALTRATE:	STAT(tx_altrate);
 	case S_TX_PROTECT:	STAT(tx_protect);
+	case S_TX_RAW:		STAT(tx_raw);
+	case S_TX_RAW_FAIL:	STAT(tx_raw_fail);
 	case S_RX_NOMBUF:	STAT(rx_nombuf);
 #ifdef S_RX_BUSDMA
 	case S_RX_BUSDMA:	STAT(rx_busdma);
@@ -609,6 +615,7 @@ ath_get_curstat(struct statfoo *sf, int 
 		snprintf(b, bs, "-%d/+%d",
 		    wf->cur.ath.ast_tdma_tsfadjm, wf->cur.ath.ast_tdma_tsfadjp);
 		return 1;
+	case S_TDMA_ACK:	STAT(tdma_ack);
 #endif
 	case S_RATE_CALLS:	STAT(rate_calls);
 	case S_RATE_RAISE:	STAT(rate_raise);
@@ -771,6 +778,8 @@ ath_get_totstat(struct statfoo *sf, int 
 	case S_TX_SHORTPRE:	STAT(tx_shortpre);
 	case S_TX_ALTRATE:	STAT(tx_altrate);
 	case S_TX_PROTECT:	STAT(tx_protect);
+	case S_TX_RAW:		STAT(tx_raw);
+	case S_TX_RAW_FAIL:	STAT(tx_raw_fail);
 	case S_RX_NOMBUF:	STAT(rx_nombuf);
 #ifdef S_RX_BUSDMA
 	case S_RX_BUSDMA:	STAT(rx_busdma);
@@ -824,6 +833,7 @@ ath_get_totstat(struct statfoo *sf, int 
 		    wf->total.ath.ast_tdma_tsfadjm,
 		    wf->total.ath.ast_tdma_tsfadjp);
 		return 1;
+	case S_TDMA_ACK:	STAT(tdma_ack);
 #endif
 	case S_RATE_CALLS:	STAT(rate_calls);
 	case S_RATE_RAISE:	STAT(rate_raise);

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 21:13:31 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 79772106564A;
	Thu,  5 Feb 2009 21:13:31 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4DD718FC19;
	Thu,  5 Feb 2009 21:13:31 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15LDV4u039273;
	Thu, 5 Feb 2009 21:13:31 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15LDVxT039271;
	Thu, 5 Feb 2009 21:13:31 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902052113.n15LDVxT039271@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Thu, 5 Feb 2009 21:13:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188197 - head/sys/dev/ath/ath_hal/ar5212
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 21:13:31 -0000

Author: sam
Date: Thu Feb  5 21:13:31 2009
New Revision: 188197
URL: http://svn.freebsd.org/changeset/base/188197

Log:
  eliminate gainFCorrection; just have ar5212GetGainFCorrection return
  the calculated value as it's only used in one place

Modified:
  head/sys/dev/ath/ath_hal/ar5212/ar5212.h
  head/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212.h	Thu Feb  5 21:09:46 2009	(r188196)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h	Thu Feb  5 21:13:31 2009	(r188197)
@@ -122,7 +122,6 @@ typedef struct {
 	uint32_t	targetGain;
 	uint32_t	loTrig;
 	uint32_t	hiTrig;
-	uint32_t	gainFCorrection;
 	uint32_t	active;
 	const GAIN_OPTIMIZATION_STEP *currStep;
 } GAIN_VALUES;

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c	Thu Feb  5 21:09:46 2009	(r188196)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c	Thu Feb  5 21:13:31 2009	(r188197)
@@ -239,34 +239,36 @@ ar5212AdjustGain(struct ath_hal *ah, GAI
 /*
  * Read rf register to determine if gainF needs correction
  */
-static void
+static uint32_t
 ar5212GetGainFCorrection(struct ath_hal *ah)
 {
 	struct ath_hal_5212 *ahp = AH5212(ah);
-	GAIN_VALUES *gv = &ahp->ah_gainValues;
+	uint32_t correction;
 
 	HALASSERT(IS_RADX112_REV2(ah));
 
-	gv->gainFCorrection = 0;
+	correction = 0;
 	if (ar5212GetRfField(ar5212GetRfBank(ah, 7), 1, 36, 0) == 1) {
+		const GAIN_VALUES *gv = &ahp->ah_gainValues;
 		uint32_t mixGain = gv->currStep->paramVal[0];
 		uint32_t gainStep =
 			ar5212GetRfField(ar5212GetRfBank(ah, 7), 4, 32, 0);
 		switch (mixGain) {
 		case 0 :
-			gv->gainFCorrection = 0;
+			correction = 0;
 			break;
 		case 1 :
-			gv->gainFCorrection = gainStep;
+			correction = gainStep;
 			break;
 		case 2 :
-			gv->gainFCorrection = 2 * gainStep - 5;
+			correction = 2 * gainStep - 5;
 			break;
 		case 3 :
-			gv->gainFCorrection = 2 * gainStep;
+			correction = 2 * gainStep;
 			break;
 		}
 	}
+	return correction;
 }
 
 /*
@@ -303,9 +305,9 @@ ar5212GetRfgain(struct ath_hal *ah)
 					gv->currGain += PHY_PROBE_CCK_CORRECTION;
 			}
 			if (IS_RADX112_REV2(ah)) {
-				ar5212GetGainFCorrection(ah);
-				if (gv->currGain >= gv->gainFCorrection)
-					gv->currGain -= gv->gainFCorrection;
+				uint32_t correct = ar5212GetGainFCorrection(ah);
+				if (gv->currGain >= correct)
+					gv->currGain -= correct;
 				else
 					gv->currGain = 0;
 			}

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 21:18:39 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5CE1D106566C;
	Thu,  5 Feb 2009 21:18:39 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4C26A8FC13;
	Thu,  5 Feb 2009 21:18:39 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15LIdAY039424;
	Thu, 5 Feb 2009 21:18:39 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15LIdTp039423;
	Thu, 5 Feb 2009 21:18:39 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200902052118.n15LIdTp039423@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Thu, 5 Feb 2009 21:18:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188198 - head/sys/dev/xen/netfront
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 21:18:39 -0000

Author: kmacy
Date: Thu Feb  5 21:18:39 2009
New Revision: 188198
URL: http://svn.freebsd.org/changeset/base/188198

Log:
  fix non-witness compile

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==============================================================================
--- head/sys/dev/xen/netfront/netfront.c	Thu Feb  5 21:13:31 2009	(r188197)
+++ head/sys/dev/xen/netfront/netfront.c	Thu Feb  5 21:18:39 2009	(r188198)
@@ -24,6 +24,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/systm.h>
 #include <sys/sockio.h>
 #include <sys/mbuf.h>
+#include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/module.h>
 #include <sys/kernel.h>

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 21:35:40 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7CF75106568A;
	Thu,  5 Feb 2009 21:35:40 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6BE9B8FC08;
	Thu,  5 Feb 2009 21:35:40 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15LZeFm039771;
	Thu, 5 Feb 2009 21:35:40 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15LZeCR039770;
	Thu, 5 Feb 2009 21:35:40 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200902052135.n15LZeCR039770@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Thu, 5 Feb 2009 21:35:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188199 - head/sys/i386/i386
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 21:35:41 -0000

Author: kmacy
Date: Thu Feb  5 21:35:40 2009
New Revision: 188199
URL: http://svn.freebsd.org/changeset/base/188199

Log:
  reboot instance on reset

Modified:
  head/sys/i386/i386/vm_machdep.c

Modified: head/sys/i386/i386/vm_machdep.c
==============================================================================
--- head/sys/i386/i386/vm_machdep.c	Thu Feb  5 21:18:39 2009	(r188198)
+++ head/sys/i386/i386/vm_machdep.c	Thu Feb  5 21:35:40 2009	(r188199)
@@ -616,7 +616,10 @@ cpu_reset_real()
 
 	disable_intr();
 #ifdef XEN
-	HYPERVISOR_shutdown(SHUTDOWN_poweroff);
+	if (smp_processor_id() == 0)
+		HYPERVISOR_shutdown(SHUTDOWN_reboot);
+	else
+		HYPERVISOR_shutdown(SHUTDOWN_reboot);
 #endif 
 #ifdef CPU_ELAN
 	if (elan_mmcr != NULL)

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 21:41:27 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 690801065673;
	Thu,  5 Feb 2009 21:41:27 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 582668FC13;
	Thu,  5 Feb 2009 21:41:27 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15LfRKE039905;
	Thu, 5 Feb 2009 21:41:27 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15LfRnB039904;
	Thu, 5 Feb 2009 21:41:27 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200902052141.n15LfRnB039904@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Thu, 5 Feb 2009 21:41:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188200 - head/sys/i386/i386
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 21:41:28 -0000

Author: kmacy
Date: Thu Feb  5 21:41:27 2009
New Revision: 188200
URL: http://svn.freebsd.org/changeset/base/188200

Log:
  halt APs on reboot

Modified:
  head/sys/i386/i386/vm_machdep.c

Modified: head/sys/i386/i386/vm_machdep.c
==============================================================================
--- head/sys/i386/i386/vm_machdep.c	Thu Feb  5 21:35:40 2009	(r188199)
+++ head/sys/i386/i386/vm_machdep.c	Thu Feb  5 21:41:27 2009	(r188200)
@@ -619,7 +619,7 @@ cpu_reset_real()
 	if (smp_processor_id() == 0)
 		HYPERVISOR_shutdown(SHUTDOWN_reboot);
 	else
-		HYPERVISOR_shutdown(SHUTDOWN_reboot);
+		HYPERVISOR_shutdown(SHUTDOWN_poweroff);
 #endif 
 #ifdef CPU_ELAN
 	if (elan_mmcr != NULL)

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 22:16:10 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 196EA106566C;
	Thu,  5 Feb 2009 22:16:10 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0865B8FC0A;
	Thu,  5 Feb 2009 22:16:10 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15MG9pw040889;
	Thu, 5 Feb 2009 22:16:09 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15MG9uV040888;
	Thu, 5 Feb 2009 22:16:09 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902052216.n15MG9uV040888@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Thu, 5 Feb 2009 22:16:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188205 - head/tools/tools/ath/athstats
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 22:16:10 -0000

Author: sam
Date: Thu Feb  5 22:16:09 2009
New Revision: 188205
URL: http://svn.freebsd.org/changeset/base/188205

Log:
  unbreak -o

Modified:
  head/tools/tools/ath/athstats/main.c

Modified: head/tools/tools/ath/athstats/main.c
==============================================================================
--- head/tools/tools/ath/athstats/main.c	Thu Feb  5 22:06:41 2009	(r188204)
+++ head/tools/tools/ath/athstats/main.c	Thu Feb  5 22:16:09 2009	(r188205)
@@ -72,8 +72,7 @@ getfmt(const char *tag)
 	for (i = 0; i < N(tags); i++)
 		if (strcasecmp(tags[i].tag, tag) == 0)
 			return tags[i].fmt;
-	errx(-1, "unknown tag \%s\"", tag);
-	/*NOTREACHED*/
+	return tag;
 #undef N
 }
 

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 22:17:11 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9137710656D0;
	Thu,  5 Feb 2009 22:17:11 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 62E668FC1D;
	Thu,  5 Feb 2009 22:17:11 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15MHBg3040944;
	Thu, 5 Feb 2009 22:17:11 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15MHBxL040943;
	Thu, 5 Feb 2009 22:17:11 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902052217.n15MHBxL040943@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Thu, 5 Feb 2009 22:17:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188206 - head/tools/tools/net80211/wlanstats
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 22:17:13 -0000

Author: sam
Date: Thu Feb  5 22:17:10 2009
New Revision: 188206
URL: http://svn.freebsd.org/changeset/base/188206

Log:
  make -o handling like athstats

Modified:
  head/tools/tools/net80211/wlanstats/main.c

Modified: head/tools/tools/net80211/wlanstats/main.c
==============================================================================
--- head/tools/tools/net80211/wlanstats/main.c	Thu Feb  5 22:16:09 2009	(r188205)
+++ head/tools/tools/net80211/wlanstats/main.c	Thu Feb  5 22:17:10 2009	(r188206)
@@ -48,10 +48,30 @@
 
 #include "wlanstats.h"
 
-#define	S_DEFAULT \
-	"input,rx_mgmt,output,rx_badkeyid,scan_active,scan_bg,bmiss,rssi,noise,rate"
-#define	S_AMPDU \
-	"input,output,ampdu_reorder,ampdu_oor,rx_dup,ampdu_flush,ampdu_move,ampdu_drop,ampdu_bar,ampdu_baroow,ampdu_barmove,rssi,rate"
+static struct {
+	const char *tag;
+	const char *fmt;
+} tags[] = {
+  { "default",
+    "input,rx_mgmt,output,rx_badkeyid,scan_active,scan_bg,bmiss,rssi,noise,rate"
+  },
+  { "ampdu",
+    "input,output,ampdu_reorder,ampdu_oor,rx_dup,ampdu_flush,ampdu_move,"
+    "ampdu_drop,ampdu_bar,ampdu_baroow,ampdu_barmove,rssi,rate"
+  },
+};
+
+static const char *
+getfmt(const char *tag)
+{
+#define	N(a)	(sizeof(a)/sizeof(a[0]))
+	int i;
+	for (i = 0; i < N(tags); i++)
+		if (strcasecmp(tags[i].tag, tag) == 0)
+			return tags[i].fmt;
+	return tag;
+#undef N
+}
 
 static int signalled;
 
@@ -138,10 +158,14 @@ main(int argc, char *argv[])
 	struct wlanstatfoo *wf;
 	struct ether_addr *ea;
 	const uint8_t *mac = NULL;
+	const char *ifname;
 	int allnodes = 0;
 	int c, mode;
 
-	wf = wlanstats_new("wlan0", S_DEFAULT);
+	ifname = getenv("WLAN");
+	if (ifname == NULL)
+		ifname = "wlan0";
+	wf = wlanstats_new(ifname, getfmt("default"));
 	while ((c = getopt(argc, argv, "ai:lm:o:")) != -1) {
 		switch (c) {
 		case 'a':
@@ -160,10 +184,7 @@ main(int argc, char *argv[])
 			mac = ea->octet;
 			break;
 		case 'o':
-			if (strcasecmp(optarg, "ampdu") == 0)
-				wf->setfmt(wf, S_AMPDU);
-			else
-				wf->setfmt(wf, optarg);
+			wf->setfmt(wf, getfmt(optarg));
 			break;
 		default:
 			errx(-1, "usage: %s [-a] [-i ifname] [-l] [-o fmt] [interval]\n", argv[0]);

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 23:01:37 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 23B3D1065675;
	Thu,  5 Feb 2009 23:01:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 121E48FC19;
	Thu,  5 Feb 2009 23:01:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15N1aju041964;
	Thu, 5 Feb 2009 23:01:36 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15N1a04041963;
	Thu, 5 Feb 2009 23:01:36 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200902052301.n15N1a04041963@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Thu, 5 Feb 2009 23:01:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188209 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 23:01:37 -0000

Author: jhb
Date: Thu Feb  5 23:01:36 2009
New Revision: 188209
URL: http://svn.freebsd.org/changeset/base/188209

Log:
  Drop the kernel linker lock while running SYSUNINIT routines and removing
  sysctls during a linker file unload.  We drop the lock when doing similar
  operations during a linker file load.  To close races, clear the LINKED
  flag before dropping the lock so that the linker file is no longer visible
  to userland.
  
  MFC after:	1 week

Modified:
  head/sys/kern/kern_linker.c

Modified: head/sys/kern/kern_linker.c
==============================================================================
--- head/sys/kern/kern_linker.c	Thu Feb  5 22:19:13 2009	(r188208)
+++ head/sys/kern/kern_linker.c	Thu Feb  5 23:01:36 2009	(r188209)
@@ -643,8 +643,11 @@ linker_file_unload(linker_file_t file, i
 	 * link error.
 	 */
 	if (file->flags & LINKER_FILE_LINKED) {
+		file->flags &= ~LINKER_FILE_LINKED;
+		KLD_UNLOCK();
 		linker_file_sysuninit(file);
 		linker_file_unregister_sysctls(file);
+		KLD_LOCK();
 	}
 	TAILQ_REMOVE(&linker_files, file, link);
 

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 23:15:40 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 369F3106566C;
	Thu,  5 Feb 2009 23:15:40 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 24D6B8FC1B;
	Thu,  5 Feb 2009 23:15:40 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15NFeGe042236;
	Thu, 5 Feb 2009 23:15:40 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15NFewu042235;
	Thu, 5 Feb 2009 23:15:40 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902052315.n15NFewu042235@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Thu, 5 Feb 2009 23:15:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188210 - head/tools/tools/net80211/wlanstats
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 23:15:41 -0000

Author: sam
Date: Thu Feb  5 23:15:39 2009
New Revision: 188210
URL: http://svn.freebsd.org/changeset/base/188210

Log:
  for adhoc and ahdemo modes try to find the "bss node": use the bssid
  unless it's not setup or zero's; this may not work as the bssid of
  the ibss isn't certain to the "right mac address" but for many cases
  it is

Modified:
  head/tools/tools/net80211/wlanstats/wlanstats.c

Modified: head/tools/tools/net80211/wlanstats/wlanstats.c
==============================================================================
--- head/tools/tools/net80211/wlanstats/wlanstats.c	Thu Feb  5 23:01:36 2009	(r188209)
+++ head/tools/tools/net80211/wlanstats/wlanstats.c	Thu Feb  5 23:15:39 2009	(r188210)
@@ -437,15 +437,24 @@ getbssid(struct wlanstatfoo_p *wf)
 static void
 wlan_setstamac(struct wlanstatfoo *wf0, const uint8_t *mac)
 {
+	static const uint8_t zeromac[IEEE80211_ADDR_LEN];
 	struct wlanstatfoo_p *wf = (struct wlanstatfoo_p *) wf0;
 
 	if (mac == NULL) {
 		switch (wlan_getopmode(wf0)) {
 		case IEEE80211_M_HOSTAP:
 		case IEEE80211_M_MONITOR:
+			getlladdr(wf);
+			break;
 		case IEEE80211_M_IBSS:
 		case IEEE80211_M_AHDEMO:
-			getlladdr(wf);
+			/*
+			 * NB: this may not work in which case the
+			 * mac must be specified on the command line
+			 */
+			if (getbssid(wf) < 0 ||
+			    IEEE80211_ADDR_EQ(wf->mac, zeromac))
+				getlladdr(wf);
 			break;
 		case IEEE80211_M_STA:
 			if (getbssid(wf) < 0)

From owner-svn-src-head@FreeBSD.ORG  Thu Feb  5 23:51:11 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6AF5C10656DE;
	Thu,  5 Feb 2009 23:51:11 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 56B028FC1D;
	Thu,  5 Feb 2009 23:51:11 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15NpBG1042947;
	Thu, 5 Feb 2009 23:51:11 GMT (envelope-from wkoszek@svn.freebsd.org)
Received: (from wkoszek@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15NpBKq042945;
	Thu, 5 Feb 2009 23:51:11 GMT (envelope-from wkoszek@svn.freebsd.org)
Message-Id: <200902052351.n15NpBKq042945@svn.freebsd.org>
From: "Wojciech A. Koszek" <wkoszek@FreeBSD.org>
Date: Thu, 5 Feb 2009 23:51:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188212 - head/sys/dev/pccard
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Feb 2009 23:51:12 -0000

Author: wkoszek
Date: Thu Feb  5 23:51:11 2009
New Revision: 188212
URL: http://svn.freebsd.org/changeset/base/188212

Log:
  Bring consistent debugging output for all values that are supposed
  to be printed in a hexadecimal format. Otherwise, '270' doesn't say
  much.
  
  Reviewed by:	imp

Modified:
  head/sys/dev/pccard/pccard.c
  head/sys/dev/pccard/pccard_cis.c

Modified: head/sys/dev/pccard/pccard.c
==============================================================================
--- head/sys/dev/pccard/pccard.c	Thu Feb  5 23:16:33 2009	(r188211)
+++ head/sys/dev/pccard/pccard.c	Thu Feb  5 23:51:11 2009	(r188212)
@@ -173,7 +173,7 @@ pccard_set_default_descr(device_t dev)
 		if (pccard_get_product(dev, &prod))
 			return (0);
 		str = malloc(100, M_DEVBUF, M_WAITOK);
-		snprintf(str, 100, "vendor=0x%x product=0x%x", vendor, prod);
+		snprintf(str, 100, "vendor=%#x product=%#x", vendor, prod);
 		device_set_desc_copy(dev, str);
 		free(str, M_DEVBUF);
 	}
@@ -297,8 +297,8 @@ pccard_probe_and_attach_child(device_t d
 	if (pccard_function_enable(pf) == 0 &&
 	    pccard_set_default_descr(child) == 0 &&
 	    device_attach(child) == 0) {
-		DEVPRINTF((sc->dev, "function %d CCR at %d offset %x mask %x: "
-		    "%x %x %x %x, %x %x %x %x, %x\n",
+		DEVPRINTF((sc->dev, "function %d CCR at %d offset %#x "
+		    "mask %#x: %#x %#x %#x %#x, %#x %#x %#x %#x, %#x\n",
 		    pf->number, pf->pf_ccr_window, pf->pf_ccr_offset,
 		    pf->ccr_mask, pccard_ccr_read(pf, 0x00),
 		    pccard_ccr_read(pf, 0x02), pccard_ccr_read(pf, 0x04),
@@ -506,7 +506,7 @@ pccard_function_init(struct pccard_funct
 				end = start + cfe->iospace[i].length - 1;
 			else
 				end = ~0UL;
-			DEVPRINTF((bus, "I/O rid %d start %lx end %lx\n",
+			DEVPRINTF((bus, "I/O rid %d start %#lx end %#lx\n",
 			    i, start, end));
 			rid = i;
 			len = cfe->iospace[i].length;
@@ -528,7 +528,7 @@ pccard_function_init(struct pccard_funct
 				end = start + cfe->memspace[i].length - 1;
 			else
 				end = ~0UL;
-			DEVPRINTF((bus, "Memory rid %d start %lx end %lx\n",
+			DEVPRINTF((bus, "Memory rid %d start %#lx end %#lx\n",
 			    i, start, end));
 			rid = i;
 			len = cfe->memspace[i].length;
@@ -594,7 +594,7 @@ pccard_function_free(struct pccard_funct
 				device_printf(pf->sc->dev,
 				    "function_free: Resource still owned by "
 				    "child, oops. "
-				    "(type=%d, rid=%d, addr=%lx)\n",
+				    "(type=%d, rid=%d, addr=%#lx)\n",
 				    rle->type, rle->rid,
 				    rman_get_start(rle->res));
 			BUS_RELEASE_RESOURCE(device_get_parent(pf->sc->dev),
@@ -689,7 +689,7 @@ pccard_function_enable(struct pccard_fun
 		    &pf->ccr_rid, 0, ~0, PCCARD_MEM_PAGE_SIZE, RF_ACTIVE);
 		if (!pf->ccr_res)
 			goto bad;
-		DEVPRINTF((dev, "ccr_res == %lx-%lx, base=%x\n",
+		DEVPRINTF((dev, "ccr_res == %#lx-%#lx, base=%#x\n",
 		    rman_get_start(pf->ccr_res), rman_get_end(pf->ccr_res),
 		    pf->ccr_base));
 		CARD_SET_RES_FLAGS(device_get_parent(dev), dev, SYS_RES_MEMORY,
@@ -726,8 +726,8 @@ pccard_function_enable(struct pccard_fun
 	if (pccard_debug) {
 		STAILQ_FOREACH(tmp, &pf->sc->card.pf_head, pf_list) {
 			device_printf(tmp->sc->dev,
-			    "function %d CCR at %d offset %x: "
-			    "%x %x %x %x, %x %x %x %x, %x\n",
+			    "function %d CCR at %d offset %#x: "
+			    "%#x %#x %#x %#x, %#x %#x %#x %#x, %#x\n",
 			    tmp->number, tmp->pf_ccr_window,
 			    tmp->pf_ccr_offset,
 			    pccard_ccr_read(tmp, 0x00),
@@ -1185,7 +1185,7 @@ pccard_release_resource(device_t dev, de
 
 	if (!rle) {
 		device_printf(dev, "Allocated resource not found, "
-		    "%d %x %lx %lx\n",
+		    "%d %#x %#lx %#lx\n",
 		    type, rid, rman_get_start(r), rman_get_size(r));
 		return ENOENT;
 	}

Modified: head/sys/dev/pccard/pccard_cis.c
==============================================================================
--- head/sys/dev/pccard/pccard_cis.c	Thu Feb  5 23:16:33 2009	(r188211)
+++ head/sys/dev/pccard/pccard_cis.c	Thu Feb  5 23:51:11 2009	(r188212)
@@ -151,7 +151,7 @@ pccard_scan_cis(device_t bus, device_t d
 	tuple.memh = rman_get_bushandle(res);
 	tuple.ptr = 0;
 
-	DPRINTF(("cis mem map 0x%x (resource: 0x%lx)\n",
+	DPRINTF(("cis mem map %#x (resource: %#lx)\n",
 	    (unsigned int) tuple.memh, rman_get_start(res)));
 
 	tuple.mult = 2;
@@ -230,7 +230,7 @@ pccard_scan_cis(device_t bus, device_t d
 				longlink_common = (tuple.code ==
 				    CISTPL_LONGLINK_C) ? 1 : 0;
 				longlink_addr = pccard_tuple_read_4(&tuple, 0);
-				DPRINTF(("CISTPL_LONGLINK_%s %lx\n",
+				DPRINTF(("CISTPL_LONGLINK_%s %#lx\n",
 				    longlink_common ? "C" : "A",
 				    longlink_addr));
 				break;
@@ -264,8 +264,8 @@ pccard_scan_cis(device_t bus, device_t d
 
 					addr = tuple.ptr + offset;
 
-					DPRINTF(("CISTPL_CHECKSUM addr=%lx "
-					    "len=%lx cksum=%x",
+					DPRINTF(("CISTPL_CHECKSUM addr=%#lx "
+					    "len=%#lx cksum=%#x",
 					    addr, length, cksum));
 
 					/*
@@ -286,7 +286,7 @@ pccard_scan_cis(device_t bus, device_t d
 						    tuple.memh,
 						    addr + tuple.mult * i);
 					if (cksum != (sum & 0xff)) {
-						DPRINTF((" failed sum=%x\n",
+						DPRINTF((" failed sum=%#x\n",
 						    sum));
 						device_printf(dev, 
 						    "CIS checksum failed\n");
@@ -361,7 +361,7 @@ pccard_scan_cis(device_t bus, device_t d
 						mfc[i].addr =
 						    pccard_tuple_read_4(&tuple,
 						    1 + 5 * i + 1);
-						DPRINTF((" %s:%lx",
+						DPRINTF((" %s:%#lx",
 						    mfc[i].common ? "common" :
 						    "attr", mfc[i].addr));
 					}
@@ -386,11 +386,11 @@ pccard_scan_cis(device_t bus, device_t d
 			{
 				int i;
 
-				DPRINTF((" %02x %02x", tuple.code,
+				DPRINTF((" %#02x %#02x", tuple.code,
 				    tuple.length));
 
 				for (i = 0; i < tuple.length; i++) {
-					DPRINTF((" %02x",
+					DPRINTF((" %#02x",
 					    pccard_tuple_read_1(&tuple, i)));
 					if ((i % 16) == 13)
 						DPRINTF(("\n"));
@@ -416,7 +416,7 @@ pccard_scan_cis(device_t bus, device_t d
 				CARD_SET_RES_FLAGS(bus, dev, SYS_RES_MEMORY,
 				    rid, longlink_common ?
 				    PCCARD_A_MEM_COM : PCCARD_A_MEM_ATTR);
-				DPRINTF(("cis mem map %x\n",
+				DPRINTF(("cis mem map %#x\n",
 				    (unsigned int) tuple.memh));
 				tuple.mult = longlink_common ? 1 : 2;
 				tuple.ptr = longlink_addr;
@@ -427,7 +427,7 @@ pccard_scan_cis(device_t bus, device_t d
 				CARD_SET_RES_FLAGS(bus, dev, SYS_RES_MEMORY,
 				    rid, mfc[mfc_index].common ?
 				    PCCARD_A_MEM_COM : PCCARD_A_MEM_ATTR);
-				DPRINTF(("cis mem map %x\n",
+				DPRINTF(("cis mem map %#x\n",
 				    (unsigned int) tuple.memh));
 				/* set parse state, and point at the next one */
 				tuple.mult = mfc[mfc_index].common ? 1 : 2;
@@ -441,7 +441,7 @@ pccard_scan_cis(device_t bus, device_t d
 			tuple.code = pccard_cis_read_1(&tuple, tuple.ptr);
 			if (tuple.code != CISTPL_LINKTARGET) {
 				DPRINTF(("CISTPL_LINKTARGET expected, "
-				    "code %02x observed\n", tuple.code));
+				    "code %#02x observed\n", tuple.code));
 				continue;
 			}
 			tuple.length = pccard_cis_read_1(&tuple, tuple.ptr + 1);
@@ -504,7 +504,7 @@ pccard_print_cis(device_t dev)
 	}
 	printf("\n");
 
-	device_printf(dev, "Manufacturer code 0x%x, product 0x%x\n",
+	device_printf(dev, "Manufacturer code %#x, product %#x\n",
 	    card->manufacturer, card->product);
 
 	STAILQ_FOREACH(pf, &card->pf_head, pf_list) {
@@ -552,7 +552,7 @@ pccard_print_cis(device_t dev)
 			break;
 		}
 
-		printf(", ccr addr %x mask %x\n", pf->ccr_base, pf->ccr_mask);
+		printf(", ccr addr %#x mask %#x\n", pf->ccr_base, pf->ccr_mask);
 
 		STAILQ_FOREACH(cfe, &pf->cfe_head, cfe_list) {
 			device_printf(dev, "function %d, config table entry "
@@ -570,15 +570,15 @@ pccard_print_cis(device_t dev)
 				break;
 			}
 
-			printf("; irq mask %x", cfe->irqmask);
+			printf("; irq mask %#x", cfe->irqmask);
 
 			if (cfe->num_iospace) {
-				printf("; iomask %lx, iospace", cfe->iomask);
+				printf("; iomask %#lx, iospace", cfe->iomask);
 
 				for (i = 0; i < cfe->num_iospace; i++) {
-					printf(" %lx", cfe->iospace[i].start);
+					printf(" %#lx", cfe->iospace[i].start);
 					if (cfe->iospace[i].length)
-						printf("-%lx",
+						printf("-%#lx",
 						    cfe->iospace[i].start +
 						    cfe->iospace[i].length - 1);
 				}
@@ -587,14 +587,14 @@ pccard_print_cis(device_t dev)
 				printf("; memspace");
 
 				for (i = 0; i < cfe->num_memspace; i++) {
-					printf(" %lx",
+					printf(" %#lx",
 					    cfe->memspace[i].cardaddr);
 					if (cfe->memspace[i].length)
-						printf("-%lx",
+						printf("-%#lx",
 						    cfe->memspace[i].cardaddr +
 						    cfe->memspace[i].length - 1);
 					if (cfe->memspace[i].hostaddr)
-						printf("@%lx",
+						printf("@%#lx",
 						    cfe->memspace[i].hostaddr);
 				}
 			}
@@ -1264,7 +1264,7 @@ pccard_parse_cis_tuple(const struct pcca
 		DPRINTF(("CISTPL_CFTABLE_ENTRY\n"));
 		break;
 	default:
-		DPRINTF(("unhandled CISTPL %x\n", tuple->code));
+		DPRINTF(("unhandled CISTPL %#x\n", tuple->code));
 		break;
 	}
 

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 00:48:56 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BAE3B1065670;
	Fri,  6 Feb 2009 00:48:56 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A8FAA8FC18;
	Fri,  6 Feb 2009 00:48:56 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n160muKl044107;
	Fri, 6 Feb 2009 00:48:56 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n160muWY044106;
	Fri, 6 Feb 2009 00:48:56 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902060048.n160muWY044106@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Fri, 6 Feb 2009 00:48:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188213 - head/sys/dev/ath/ath_hal
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 00:48:57 -0000

Author: sam
Date: Fri Feb  6 00:48:56 2009
New Revision: 188213
URL: http://svn.freebsd.org/changeset/base/188213

Log:
  add PSB channels to the calibration list

Modified:
  head/sys/dev/ath/ath_hal/ah_regdomain.c

Modified: head/sys/dev/ath/ath_hal/ah_regdomain.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_regdomain.c	Thu Feb  5 23:51:11 2009	(r188212)
+++ head/sys/dev/ath/ath_hal/ah_regdomain.c	Fri Feb  6 00:48:56 2009	(r188213)
@@ -1026,9 +1026,18 @@ static REG_DOMAIN regDomains[] = {
 	{.regDmnEnum		= DEBUG_REG_DMN,
 	 .conformanceTestLimit	= FCC,
 	 .dfsMask		= DFS_FCC3,
-	 .chan11a		= BM3(F1_5120_5240, F1_5260_5700, F1_5745_5825),
-	 .chan11a_half		= BM3(F2_5120_5240, F2_5260_5700, F7_5745_5825),
-	 .chan11a_quarter	= BM3(F3_5120_5240, F3_5260_5700, F8_5745_5825),
+	 .chan11a		= BM4(F1_4950_4980,
+				      F1_5120_5240,
+				      F1_5260_5700,
+				      F1_5745_5825),
+	 .chan11a_half		= BM4(F1_4945_4985,
+				      F2_5120_5240,
+				      F2_5260_5700,
+				      F7_5745_5825),
+	 .chan11a_quarter	= BM4(F1_4942_4987,
+				      F3_5120_5240,
+				      F3_5260_5700,
+				      F8_5745_5825),
 	 .chan11a_turbo		= BM8(T1_5130_5210,
 				      T1_5250_5330,
 				      T1_5370_5490,

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 00:50:21 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D89F8106566C;
	Fri,  6 Feb 2009 00:50:21 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C67748FC13;
	Fri,  6 Feb 2009 00:50:21 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n160oLpg044186;
	Fri, 6 Feb 2009 00:50:21 GMT (envelope-from wkoszek@svn.freebsd.org)
Received: (from wkoszek@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n160oLBS044185;
	Fri, 6 Feb 2009 00:50:21 GMT (envelope-from wkoszek@svn.freebsd.org)
Message-Id: <200902060050.n160oLBS044185@svn.freebsd.org>
From: "Wojciech A. Koszek" <wkoszek@FreeBSD.org>
Date: Fri, 6 Feb 2009 00:50:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188214 - head/usr.sbin/config
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 00:50:22 -0000

Author: wkoszek
Date: Fri Feb  6 00:50:21 2009
New Revision: 188214
URL: http://svn.freebsd.org/changeset/base/188214

Log:
  Make config -x <kernel> only return non-zero characters,
  so that:
  
  	config -x <kernel> | grep <something>
  
  just works.
  
  Reported by:	Danny Braniss <danny@cs.huji.ac.il>

Modified:
  head/usr.sbin/config/main.c

Modified: head/usr.sbin/config/main.c
==============================================================================
--- head/usr.sbin/config/main.c	Fri Feb  6 00:48:56 2009	(r188213)
+++ head/usr.sbin/config/main.c	Fri Feb  6 00:50:21 2009	(r188214)
@@ -669,7 +669,7 @@ kernconfdump(const char *file)
 	struct stat st;
 	FILE *fp, *pp;
 	int error, len, osz, r;
-	unsigned int off, size;
+	unsigned int i, off, size;
 	char *cmd, *o;
 
 	r = open(file, O_RDONLY);
@@ -707,7 +707,18 @@ kernconfdump(const char *file)
 	r = fseek(fp, off, SEEK_CUR);
 	if (r != 0)
 		errx(EXIT_FAILURE, "fseek() failed");
-	while ((r = fgetc(fp)) != EOF && size-- > 0)
+	for (i = 0; i < size - 1; i++) {
+		r = fgetc(fp);
+		if (r == EOF)
+			break;
+		/* 
+		 * If '\0' is present in the middle of the configuration
+		 * string, this means something very weird is happening.
+		 * Make such case very visible.
+		 */
+		assert(r != '\0' && ("Char present in the configuration "
+		    "string mustn't be equal to 0"));
 		fputc(r, stdout);
+	}
 	fclose(fp);
 }

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 00:55:20 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2EDC3106567D;
	Fri,  6 Feb 2009 00:55:20 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1BE2A8FC16;
	Fri,  6 Feb 2009 00:55:20 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n160tKsD044349;
	Fri, 6 Feb 2009 00:55:20 GMT (envelope-from wkoszek@svn.freebsd.org)
Received: (from wkoszek@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n160tKn0044348;
	Fri, 6 Feb 2009 00:55:20 GMT (envelope-from wkoszek@svn.freebsd.org)
Message-Id: <200902060055.n160tKn0044348@svn.freebsd.org>
From: "Wojciech A. Koszek" <wkoszek@FreeBSD.org>
Date: Fri, 6 Feb 2009 00:55:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188216 - head/sys/dev/cardbus
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 00:55:20 -0000

Author: wkoszek
Date: Fri Feb  6 00:55:19 2009
New Revision: 188216
URL: http://svn.freebsd.org/changeset/base/188216

Log:
  Remove unused variable.
  
  Found with:	Coverity Prevent(tm)
  CID:		4138

Modified:
  head/sys/dev/cardbus/cardbus_device.c

Modified: head/sys/dev/cardbus/cardbus_device.c
==============================================================================
--- head/sys/dev/cardbus/cardbus_device.c	Fri Feb  6 00:50:46 2009	(r188215)
+++ head/sys/dev/cardbus/cardbus_device.c	Fri Feb  6 00:55:19 2009	(r188216)
@@ -98,12 +98,10 @@ static int
 cardbus_device_buffer_cis(device_t parent, device_t child,
     struct cis_buffer *cbp)
 {
-	struct cardbus_softc *sc;
 	struct tuple_callbacks cb[] = {
 		{CISTPL_GENERIC, "GENERIC", cardbus_build_cis}
 	};
 
-	sc = device_get_softc(parent);
 	return (cardbus_parse_cis(parent, child, cb, cbp));
 }
 

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 07:42:22 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 636841065670;
	Fri,  6 Feb 2009 07:42:22 +0000 (UTC)
	(envelope-from rodrigc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5258D8FC16;
	Fri,  6 Feb 2009 07:42:22 +0000 (UTC)
	(envelope-from rodrigc@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n167gLlT053427;
	Fri, 6 Feb 2009 07:42:22 GMT (envelope-from rodrigc@svn.freebsd.org)
Received: (from rodrigc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n167gLGj053426;
	Fri, 6 Feb 2009 07:42:21 GMT (envelope-from rodrigc@svn.freebsd.org)
Message-Id: <200902060742.n167gLGj053426@svn.freebsd.org>
From: Craig Rodrigues <rodrigc@FreeBSD.org>
Date: Fri, 6 Feb 2009 07:42:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188217 - head/sbin/mount_nfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 07:42:22 -0000

Author: rodrigc
Date: Fri Feb  6 07:42:21 2009
New Revision: 188217
URL: http://svn.freebsd.org/changeset/base/188217

Log:
  Set NFSMNT_ACREGMIN, NFSMNT_ACREGMAX, and NFSMNT_ACDIRMIN flags
  in fallback_mount() function.
  Add a comment to indicate that the fallback_mount() function
  should eventually go away.
  
  Submitted by:	Jaakko Heinonen <jh saunalahti fi>

Modified:
  head/sbin/mount_nfs/mount_nfs.c

Modified: head/sbin/mount_nfs/mount_nfs.c
==============================================================================
--- head/sbin/mount_nfs/mount_nfs.c	Fri Feb  6 00:55:19 2009	(r188216)
+++ head/sbin/mount_nfs/mount_nfs.c	Fri Feb  6 07:42:21 2009	(r188217)
@@ -469,6 +469,12 @@ copyopt(struct iovec **newiov, int *newi
 		build_iovec(newiov, newiovlen, name, value, len);
 }
 
+/*
+ * XXX: This function is provided for backwards
+ *      compatibility with older kernels which did not support
+ *      passing NFS mount options to nmount() as individual
+ *      parameters.  It should be eventually be removed.
+ */
 int
 fallback_mount(struct iovec *iov, int iovlen, int mntflags)
 {
@@ -587,18 +593,21 @@ fallback_mount(struct iovec *iov, int io
 		if (ret != 1 || args.acregmin < 0) {
 			errx(1, "illegal acregmin: %s", opt);
 		}
+		args.flags |= NFSMNT_ACREGMIN;
 	}
 	if (findopt(iov, iovlen, "acregmax", &opt, NULL) == 0) {
 		ret = sscanf(opt, "%d", &args.acregmax);
 		if (ret != 1 || args.acregmax < 0) {
 			errx(1, "illegal acregmax: %s", opt);
 		}
+		args.flags |= NFSMNT_ACREGMAX;
 	}
 	if (findopt(iov, iovlen, "acdirmin", &opt, NULL) == 0) {
 		ret = sscanf(opt, "%d", &args.acdirmin);
 		if (ret != 1 || args.acdirmin < 0) {
 			errx(1, "illegal acdirmin: %s", opt);
 		}
+		args.flags |= NFSMNT_ACDIRMIN;
 	}
 	if (findopt(iov, iovlen, "acdirmax", &opt, NULL) == 0) {
 		ret = sscanf(opt, "%d", &args.acdirmax);

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 07:47:53 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9D2F8106564A;
	Fri,  6 Feb 2009 07:47:53 +0000 (UTC)
	(envelope-from rodrigc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8BCC88FC13;
	Fri,  6 Feb 2009 07:47:53 +0000 (UTC)
	(envelope-from rodrigc@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n167lrt5053569;
	Fri, 6 Feb 2009 07:47:53 GMT (envelope-from rodrigc@svn.freebsd.org)
Received: (from rodrigc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n167lrPB053568;
	Fri, 6 Feb 2009 07:47:53 GMT (envelope-from rodrigc@svn.freebsd.org)
Message-Id: <200902060747.n167lrPB053568@svn.freebsd.org>
From: Craig Rodrigues <rodrigc@FreeBSD.org>
Date: Fri, 6 Feb 2009 07:47:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188218 - head/sbin/mount_nfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 07:47:54 -0000

Author: rodrigc
Date: Fri Feb  6 07:47:53 2009
New Revision: 188218
URL: http://svn.freebsd.org/changeset/base/188218

Log:
  Set NFSMNT_ACDIRMAX flag in fallback_mount() function.

Modified:
  head/sbin/mount_nfs/mount_nfs.c

Modified: head/sbin/mount_nfs/mount_nfs.c
==============================================================================
--- head/sbin/mount_nfs/mount_nfs.c	Fri Feb  6 07:42:21 2009	(r188217)
+++ head/sbin/mount_nfs/mount_nfs.c	Fri Feb  6 07:47:53 2009	(r188218)
@@ -614,6 +614,7 @@ fallback_mount(struct iovec *iov, int io
 		if (ret != 1 || args.acdirmax < 0) {
 			errx(1, "illegal acdirmax: %s", opt);
 		}
+		args.flags |= NFSMNT_ACDIRMAX;
 	}
 	if (findopt(iov, iovlen, "deadthresh", &opt, NULL) == 0) {
 		ret = sscanf(opt, "%d", &args.deadthresh);

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 07:49:03 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9A309106566C;
	Fri,  6 Feb 2009 07:49:03 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6F63D8FC16;
	Fri,  6 Feb 2009 07:49:03 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n167n3qh053643;
	Fri, 6 Feb 2009 07:49:03 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n167n3DZ053641;
	Fri, 6 Feb 2009 07:49:03 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902060749.n167n3DZ053641@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Fri, 6 Feb 2009 07:49:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188219 - head/sys/dev/pccard
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 07:49:04 -0000

Author: imp
Date: Fri Feb  6 07:49:03 2009
New Revision: 188219
URL: http://svn.freebsd.org/changeset/base/188219

Log:
  Store the entire funce for disk type functions (eg CF cards and the
  like).

Modified:
  head/sys/dev/pccard/pccard_cis.c
  head/sys/dev/pccard/pccardvarp.h

Modified: head/sys/dev/pccard/pccard_cis.c
==============================================================================
--- head/sys/dev/pccard/pccard_cis.c	Fri Feb  6 07:47:53 2009	(r188218)
+++ head/sys/dev/pccard/pccard_cis.c	Fri Feb  6 07:49:03 2009	(r188219)
@@ -1283,6 +1283,8 @@ decode_funce(const struct pccard_tuple *
 		if (type == PCCARD_TPLFE_TYPE_DISK_DEVICE_INTERFACE) {
 			pf->pf_funce_disk_interface
 				= pccard_tuple_read_1(tuple, 1);
+			pf->pf_funce_disk_power
+				= pccard_tuple_read_1(tuple, 2);
 		}
 		break;
 	case PCCARD_FUNCTION_NETWORK:

Modified: head/sys/dev/pccard/pccardvarp.h
==============================================================================
--- head/sys/dev/pccard/pccardvarp.h	Fri Feb  6 07:47:53 2009	(r188218)
+++ head/sys/dev/pccard/pccardvarp.h	Fri Feb  6 07:49:03 2009	(r188219)
@@ -75,7 +75,23 @@ struct pccard_config_entry {
 };
 
 struct pccard_funce_disk {
-	int pfd_interface;
+	uint8_t pfd_interface;
+#define	PFD_I_V_MASK		0x3
+#define PFD_I_V_NONE_REQUIRED	0x0
+#define PFD_I_V_REQ_MOD_ACC	0x1
+#define PFD_I_V_REQ_ACC		0x2
+#define PFD_I_V_REQ_ALWYS	0x1
+#define PFD_I_S			0x4	/* 0 rotating, 1 silicon */
+#define PFD_I_U			0x8	/* SN Uniq? */
+#define	PFD_I_D			0x10	/* 0 - 1 drive, 1 - 2 drives */
+	uint8_t pfd_power;
+#define PFD_P_P0		0x1
+#define PFD_P_P1		0x2
+#define PFD_P_P2		0x4
+#define PFD_P_P3		0x8
+#define PFD_P_N			0x10	/* 3f7/377 excluded? */
+#define PFD_P_E			0x20	/* Index bit supported? */
+#define	PFD_P_I			0x40	/* twincard */
 };
 
 struct pccard_funce_lan {
@@ -119,6 +135,7 @@ struct pccard_function {
 
 	union pccard_funce pf_funce; /* CISTPL_FUNCE */
 #define pf_funce_disk_interface pf_funce.pfv_disk.pfd_interface
+#define pf_funce_disk_power pf_funce.pfv_disk.pfd_power
 #define pf_funce_lan_nid pf_funce.pfv_lan.pfl_nid
 #define pf_funce_lan_nidlen pf_funce.pfv_lan.pfl_nidlen
 };

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 09:34:18 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3E16D106564A;
	Fri,  6 Feb 2009 09:34:18 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2D3BA8FC1E;
	Fri,  6 Feb 2009 09:34:18 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n169YI74055607;
	Fri, 6 Feb 2009 09:34:18 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n169YIgk055606;
	Fri, 6 Feb 2009 09:34:18 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902060934.n169YIgk055606@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Fri, 6 Feb 2009 09:34:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188220 - head/sys/dev/exca
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 09:34:18 -0000

Author: imp
Date: Fri Feb  6 09:34:17 2009
New Revision: 188220
URL: http://svn.freebsd.org/changeset/base/188220

Log:
  fix spelling error
  
  Submitted by:	trasz

Modified:
  head/sys/dev/exca/exca.c

Modified: head/sys/dev/exca/exca.c
==============================================================================
--- head/sys/dev/exca/exca.c	Fri Feb  6 07:49:03 2009	(r188219)
+++ head/sys/dev/exca/exca.c	Fri Feb  6 09:34:17 2009	(r188220)
@@ -210,7 +210,7 @@ exca_do_mem_map(struct exca_softc *sc, i
 	    EXCA_CARDMEM_ADDRX_MSB_ADDR_MASK) | attrmem);
 
 	DPRINTF("%s %d-bit memory",
-	    mem->kind & PCCARD_MEM_ATTR ? "attrubute" : "common",
+	    mem->kind & PCCARD_MEM_ATTR ? "attribute" : "common",
 	    mem->kind & PCCARD_MEM_16BIT ? 16 : 8);
 	exca_setb(sc, EXCA_ADDRWIN_ENABLE, map->memenable |
 	    EXCA_ADDRWIN_ENABLE_MEMCS16);

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 10:30:46 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E9D9F10656C3;
	Fri,  6 Feb 2009 10:30:46 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BD0FB8FC0A;
	Fri,  6 Feb 2009 10:30:46 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16AUkU2058572;
	Fri, 6 Feb 2009 10:30:46 GMT (envelope-from wkoszek@svn.freebsd.org)
Received: (from wkoszek@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16AUknS058570;
	Fri, 6 Feb 2009 10:30:46 GMT (envelope-from wkoszek@svn.freebsd.org)
Message-Id: <200902061030.n16AUknS058570@svn.freebsd.org>
From: "Wojciech A. Koszek" <wkoszek@FreeBSD.org>
Date: Fri, 6 Feb 2009 10:30:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188221 - head/sys/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 10:30:47 -0000

Author: wkoszek
Date: Fri Feb  6 10:30:46 2009
New Revision: 188221
URL: http://svn.freebsd.org/changeset/base/188221

Log:
  Consistently use <TAB> instead of spaces as option name and file
  separator.

Modified:
  head/sys/conf/options
  head/sys/conf/options.mips

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Fri Feb  6 09:34:17 2009	(r188220)
+++ head/sys/conf/options	Fri Feb  6 10:30:46 2009	(r188221)
@@ -36,7 +36,7 @@ AHC_TMODE_ENABLE	opt_aic7xxx.h
 AHC_DUMP_EEPROM		opt_aic7xxx.h
 AHC_DEBUG		opt_aic7xxx.h
 AHC_DEBUG_OPTS		opt_aic7xxx.h
-AHC_REG_PRETTY_PRINT    opt_aic7xxx.h
+AHC_REG_PRETTY_PRINT	opt_aic7xxx.h
 AHD_DEBUG		opt_aic79xx.h
 AHD_DEBUG_OPTS		opt_aic79xx.h
 AHD_TMODE_ENABLE	opt_aic79xx.h	
@@ -137,7 +137,7 @@ NSWBUF_MIN	opt_swap.h
 MBUF_PACKET_ZONE_DISABLE	opt_global.h
 PANIC_REBOOT_WAIT_TIME	opt_panic.h
 PPC_DEBUG	opt_ppc.h
-PPC_PROBE_CHIPSET opt_ppc.h
+PPC_PROBE_CHIPSET	opt_ppc.h
 PPS_SYNC	opt_ntp.h
 PREEMPTION	opt_sched.h
 QUOTA
@@ -424,13 +424,13 @@ XBONEHACK
 #
 SCTP			opt_sctp.h
 SCTP_DEBUG		opt_sctp.h # Enable debug printfs
-SCTP_WITH_NO_CSUM       opt_sctp.h # Use this at your peril
-SCTP_LOCK_LOGGING       opt_sctp.h # Log to KTR lock activity
-SCTP_MBUF_LOGGING       opt_sctp.h # Log to KTR general mbuf aloc/free
+SCTP_WITH_NO_CSUM	opt_sctp.h # Use this at your peril
+SCTP_LOCK_LOGGING	opt_sctp.h # Log to KTR lock activity
+SCTP_MBUF_LOGGING	opt_sctp.h # Log to KTR general mbuf aloc/free
 SCTP_MBCNT_LOGGING	opt_sctp.h # Log to KTR mbcnt activity
-SCTP_PACKET_LOGGING     opt_sctp.h # Log to a packet buffer last N packets
-SCTP_LTRACE_CHUNKS      opt_sctp.h # Log to KTR chunks processed
-SCTP_LTRACE_ERRORS      opt_sctp.h # Log to KTR error returns.
+SCTP_PACKET_LOGGING	opt_sctp.h # Log to a packet buffer last N packets
+SCTP_LTRACE_CHUNKS	opt_sctp.h # Log to KTR chunks processed
+SCTP_LTRACE_ERRORS	opt_sctp.h # Log to KTR error returns.
 #
 #
 #

Modified: head/sys/conf/options.mips
==============================================================================
--- head/sys/conf/options.mips	Fri Feb  6 09:34:17 2009	(r188220)
+++ head/sys/conf/options.mips	Fri Feb  6 10:30:46 2009	(r188221)
@@ -48,7 +48,7 @@ CFE_CONSOLE	opt_global.h
 KERNPHYSADDR	opt_global.h
 KERNVIRTADDR	opt_global.h
 PHYSADDR	opt_global.h
-SOFTFLOAT       opt_global.h
+SOFTFLOAT	opt_global.h
 
 TARGET_OCTEON	opt_global.h
 TARGET_EMULATOR	opt_ddb.h

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 14:51:32 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 82BC8106564A;
	Fri,  6 Feb 2009 14:51:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 700678FC0A;
	Fri,  6 Feb 2009 14:51:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16EpWLt064147;
	Fri, 6 Feb 2009 14:51:32 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16EpWoJ064143;
	Fri, 6 Feb 2009 14:51:32 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200902061451.n16EpWoJ064143@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Fri, 6 Feb 2009 14:51:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188232 - in head/sys: kern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 14:51:33 -0000

Author: jhb
Date: Fri Feb  6 14:51:32 2009
New Revision: 188232
URL: http://svn.freebsd.org/changeset/base/188232

Log:
  Expand the scope of the sysctllock sx lock to protect the sysctl tree itself.
  Back in 1.1 of kern_sysctl.c the sysctl() routine wired the "old" userland
  buffer for most sysctls (everything except kern.vnode.*).  I think to prevent
  issues with wiring too much memory it used a 'memlock' to serialize all
  sysctl(2) invocations, meaning that only one user buffer could be wired at
  a time.  In 5.0 the 'memlock' was converted to an sx lock and renamed to
  'sysctl lock'.  However, it still only served the purpose of serializing
  sysctls to avoid wiring too much memory and didn't actually protect the
  sysctl tree as its name suggested.  These changes expand the lock to actually
  protect the tree.
  
  Later on in 5.0, sysctl was changed to not wire buffers for requests by
  default (sysctl_handle_opaque() will still wire buffers larger than a single
  page, however).  As a result, user buffers are no longer wired as often.
  However, many sysctl handlers still wire user buffers, so it is still
  desirable to serialize userland sysctl requests.  Kernel sysctl requests
  are allowed to run in parallel, however.
  
  - Expose sysctl_lock()/sysctl_unlock() routines to exclusively lock the
    sysctl tree for a few places outside of kern_sysctl.c that manipulate
    the sysctl tree directly including the kernel linker and vfs_register().
  - sysctl_register() and sysctl_unregister() require the caller to lock
    the sysctl lock using sysctl_lock() and sysctl_unlock().  The rest of
    the public sysctl API manage the locking internally.
  - Add a locked variant of sysctl_remove_oid() for internal use so that
    external uses of the API do not need to be aware of locking requirements.
  - The kernel linker no longer needs Giant when manipulating the sysctl
    tree.
  - Add a missing break to the loop in vfs_register() so that we stop looking
    at the sysctl MIB once we have changed it.
  
  MFC after:	1 month

Modified:
  head/sys/kern/kern_linker.c
  head/sys/kern/kern_sysctl.c
  head/sys/kern/vfs_init.c
  head/sys/sys/sysctl.h

Modified: head/sys/kern/kern_linker.c
==============================================================================
--- head/sys/kern/kern_linker.c	Fri Feb  6 12:39:42 2009	(r188231)
+++ head/sys/kern/kern_linker.c	Fri Feb  6 14:51:32 2009	(r188232)
@@ -293,10 +293,10 @@ linker_file_register_sysctls(linker_file
 	if (linker_file_lookup_set(lf, "sysctl_set", &start, &stop, NULL) != 0)
 		return;
 
-	mtx_lock(&Giant);
+	sysctl_lock();
 	for (oidp = start; oidp < stop; oidp++)
 		sysctl_register_oid(*oidp);
-	mtx_unlock(&Giant);
+	sysctl_unlock();
 }
 
 static void
@@ -310,10 +310,10 @@ linker_file_unregister_sysctls(linker_fi
 	if (linker_file_lookup_set(lf, "sysctl_set", &start, &stop, NULL) != 0)
 		return;
 
-	mtx_lock(&Giant);
+	sysctl_lock();
 	for (oidp = start; oidp < stop; oidp++)
 		sysctl_unregister_oid(*oidp);
-	mtx_unlock(&Giant);
+	sysctl_unlock();
 }
 
 static int

Modified: head/sys/kern/kern_sysctl.c
==============================================================================
--- head/sys/kern/kern_sysctl.c	Fri Feb  6 12:39:42 2009	(r188231)
+++ head/sys/kern/kern_sysctl.c	Fri Feb  6 14:51:32 2009	(r188232)
@@ -65,24 +65,41 @@ static MALLOC_DEFINE(M_SYSCTLOID, "sysct
 static MALLOC_DEFINE(M_SYSCTLTMP, "sysctltmp", "sysctl temp output buffer");
 
 /*
- * Locking - this locks the sysctl tree in memory.
+ * The sysctllock protects the MIB tree.  It also protects sysctl
+ * contexts used with dynamic sysctls.  The sysctl_register_oid() and
+ * sysctl_unregister_oid() routines require the sysctllock to already
+ * be held, so the sysctl_lock() and sysctl_unlock() routines are
+ * provided for the few places in the kernel which need to use that
+ * API rather than using the dynamic API.  Use of the dynamic API is
+ * strongly encouraged for most code.
+ *
+ * This lock is also used to serialize userland sysctl requests.  Some
+ * sysctls wire user memory, and serializing the requests limits the
+ * amount of wired user memory in use.
  */
 static struct sx sysctllock;
 
-#define	SYSCTL_LOCK()		sx_xlock(&sysctllock)
-#define	SYSCTL_UNLOCK()		sx_xunlock(&sysctllock)
-#define	SYSCTL_LOCK_ASSERT()	sx_assert(&sysctllock, SX_XLOCKED)
+#define	SYSCTL_SLOCK()		sx_slock(&sysctllock)
+#define	SYSCTL_SUNLOCK()	sx_sunlock(&sysctllock)
+#define	SYSCTL_XLOCK()		sx_xlock(&sysctllock)
+#define	SYSCTL_XUNLOCK()	sx_xunlock(&sysctllock)
+#define	SYSCTL_ASSERT_XLOCKED()	sx_assert(&sysctllock, SA_XLOCKED)
+#define	SYSCTL_ASSERT_LOCKED()	sx_assert(&sysctllock, SA_LOCKED)
 #define	SYSCTL_INIT()		sx_init(&sysctllock, "sysctl lock")
 
 static int sysctl_root(SYSCTL_HANDLER_ARGS);
 
 struct sysctl_oid_list sysctl__children; /* root list */
 
+static int	sysctl_remove_oid_locked(struct sysctl_oid *oidp, int del,
+		    int recurse);
+
 static struct sysctl_oid *
 sysctl_find_oidname(const char *name, struct sysctl_oid_list *list)
 {
 	struct sysctl_oid *oidp;
 
+	SYSCTL_ASSERT_LOCKED();
 	SLIST_FOREACH(oidp, list, oid_link) {
 		if (strcmp(oidp->oid_name, name) == 0) {
 			return (oidp);
@@ -96,6 +113,19 @@ sysctl_find_oidname(const char *name, st
  *
  * Order by number in each list.
  */
+void
+sysctl_lock(void)
+{
+
+	SYSCTL_XLOCK();
+}
+
+void
+sysctl_unlock(void)
+{
+
+	SYSCTL_XUNLOCK();
+}
 
 void
 sysctl_register_oid(struct sysctl_oid *oidp)
@@ -108,6 +138,7 @@ sysctl_register_oid(struct sysctl_oid *o
 	 * First check if another oid with the same name already
 	 * exists in the parent's list.
 	 */
+	SYSCTL_ASSERT_XLOCKED();
 	p = sysctl_find_oidname(oidp->oid_name, parent);
 	if (p != NULL) {
 		if ((p->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
@@ -160,6 +191,7 @@ sysctl_unregister_oid(struct sysctl_oid 
 	struct sysctl_oid *p;
 	int error;
 
+	SYSCTL_ASSERT_XLOCKED();
 	error = ENOENT;
 	if (oidp->oid_number == OID_AUTO) {
 		error = EINVAL;
@@ -191,6 +223,12 @@ sysctl_ctx_init(struct sysctl_ctx_list *
 	if (c == NULL) {
 		return (EINVAL);
 	}
+
+	/*
+	 * No locking here, the caller is responsible for not adding
+	 * new nodes to a context until after this function has
+	 * returned.
+	 */
 	TAILQ_INIT(c);
 	return (0);
 }
@@ -209,8 +247,9 @@ sysctl_ctx_free(struct sysctl_ctx_list *
 	 * XXX This algorithm is a hack. But I don't know any
 	 * XXX better solution for now...
 	 */
+	SYSCTL_XLOCK();
 	TAILQ_FOREACH(e, clist, link) {
-		error = sysctl_remove_oid(e->entry, 0, 0);
+		error = sysctl_remove_oid_locked(e->entry, 0, 0);
 		if (error)
 			break;
 	}
@@ -227,19 +266,22 @@ sysctl_ctx_free(struct sysctl_ctx_list *
 		sysctl_register_oid(e1->entry);
 		e1 = TAILQ_PREV(e1, sysctl_ctx_list, link);
 	}
-	if (error)
+	if (error) {
+		SYSCTL_XUNLOCK();
 		return(EBUSY);
+	}
 	/* Now really delete the entries */
 	e = TAILQ_FIRST(clist);
 	while (e != NULL) {
 		e1 = TAILQ_NEXT(e, link);
-		error = sysctl_remove_oid(e->entry, 1, 0);
+		error = sysctl_remove_oid_locked(e->entry, 1, 0);
 		if (error)
 			panic("sysctl_remove_oid: corrupt tree, entry: %s",
 			    e->entry->oid_name);
 		free(e, M_SYSCTLOID);
 		e = e1;
 	}
+	SYSCTL_XUNLOCK();
 	return (error);
 }
 
@@ -249,6 +291,7 @@ sysctl_ctx_entry_add(struct sysctl_ctx_l
 {
 	struct sysctl_ctx_entry *e;
 
+	SYSCTL_ASSERT_XLOCKED();
 	if (clist == NULL || oidp == NULL)
 		return(NULL);
 	e = malloc(sizeof(struct sysctl_ctx_entry), M_SYSCTLOID, M_WAITOK);
@@ -263,6 +306,7 @@ sysctl_ctx_entry_find(struct sysctl_ctx_
 {
 	struct sysctl_ctx_entry *e;
 
+	SYSCTL_ASSERT_LOCKED();
 	if (clist == NULL || oidp == NULL)
 		return(NULL);
 	TAILQ_FOREACH(e, clist, link) {
@@ -284,13 +328,17 @@ sysctl_ctx_entry_del(struct sysctl_ctx_l
 
 	if (clist == NULL || oidp == NULL)
 		return (EINVAL);
+	SYSCTL_XLOCK();
 	e = sysctl_ctx_entry_find(clist, oidp);
 	if (e != NULL) {
 		TAILQ_REMOVE(clist, e, link);
+		SYSCTL_XUNLOCK();
 		free(e, M_SYSCTLOID);
 		return (0);
-	} else
+	} else {
+		SYSCTL_XUNLOCK();
 		return (ENOENT);
+	}
 }
 
 /*
@@ -302,9 +350,21 @@ sysctl_ctx_entry_del(struct sysctl_ctx_l
 int
 sysctl_remove_oid(struct sysctl_oid *oidp, int del, int recurse)
 {
+	int error;
+
+	SYSCTL_XLOCK();
+	error = sysctl_remove_oid_locked(oidp, del, recurse);
+	SYSCTL_XUNLOCK();
+	return (error);
+}
+
+static int
+sysctl_remove_oid_locked(struct sysctl_oid *oidp, int del, int recurse)
+{
 	struct sysctl_oid *p;
 	int error;
 
+	SYSCTL_ASSERT_XLOCKED();
 	if (oidp == NULL)
 		return(EINVAL);
 	if ((oidp->oid_kind & CTLFLAG_DYN) == 0) {
@@ -323,7 +383,8 @@ sysctl_remove_oid(struct sysctl_oid *oid
 			SLIST_FOREACH(p, SYSCTL_CHILDREN(oidp), oid_link) {
 				if (!recurse)
 					return (ENOTEMPTY);
-				error = sysctl_remove_oid(p, del, recurse);
+				error = sysctl_remove_oid_locked(p, del,
+				    recurse);
 				if (error)
 					return (error);
 			}
@@ -368,6 +429,7 @@ sysctl_add_oid(struct sysctl_ctx_list *c
 	if (parent == NULL)
 		return(NULL);
 	/* Check if the node already exists, otherwise create it */
+	SYSCTL_XLOCK();
 	oidp = sysctl_find_oidname(name, parent);
 	if (oidp != NULL) {
 		if ((oidp->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
@@ -375,8 +437,10 @@ sysctl_add_oid(struct sysctl_ctx_list *c
 			/* Update the context */
 			if (clist != NULL)
 				sysctl_ctx_entry_add(clist, oidp);
+			SYSCTL_XUNLOCK();
 			return (oidp);
 		} else {
+			SYSCTL_XUNLOCK();
 			printf("can't re-use a leaf (%s)!\n", name);
 			return (NULL);
 		}
@@ -414,6 +478,7 @@ sysctl_add_oid(struct sysctl_ctx_list *c
 		sysctl_ctx_entry_add(clist, oidp);
 	/* Register this oid */
 	sysctl_register_oid(oidp);
+	SYSCTL_XUNLOCK();
 	return (oidp);
 }
 
@@ -427,12 +492,14 @@ sysctl_rename_oid(struct sysctl_oid *oid
 	char *newname;
 	void *oldname;
 
-	oldname = (void *)(uintptr_t)(const void *)oidp->oid_name;
 	len = strlen(name);
 	newname = malloc(len + 1, M_SYSCTLOID, M_WAITOK);
 	bcopy(name, newname, len + 1);
 	newname[len] = '\0';
+	SYSCTL_XLOCK();
+	oldname = (void *)(uintptr_t)(const void *)oidp->oid_name;
 	oidp->oid_name = newname;
+	SYSCTL_XUNLOCK();
 	free(oldname, M_SYSCTLOID);
 }
 
@@ -444,15 +511,21 @@ sysctl_move_oid(struct sysctl_oid *oid, 
 {
 	struct sysctl_oid *oidp;
 
-	if (oid->oid_parent == parent)
+	SYSCTL_XLOCK();
+	if (oid->oid_parent == parent) {
+		SYSCTL_XUNLOCK();
 		return (0);
+	}
 	oidp = sysctl_find_oidname(oid->oid_name, parent);
-	if (oidp != NULL)
+	if (oidp != NULL) {
+		SYSCTL_XUNLOCK();
 		return (EEXIST);
+	}
 	sysctl_unregister_oid(oid);
 	oid->oid_parent = parent;
 	oid->oid_number = OID_AUTO;
 	sysctl_register_oid(oid);
+	SYSCTL_XUNLOCK();
 	return (0);
 }
 
@@ -467,8 +540,10 @@ sysctl_register_all(void *arg)
 	struct sysctl_oid **oidp;
 
 	SYSCTL_INIT();
+	SYSCTL_XLOCK();
 	SET_FOREACH(oidp, sysctl_set)
 		sysctl_register_oid(*oidp);
+	SYSCTL_XUNLOCK();
 }
 SYSINIT(sysctl, SI_SUB_KMEM, SI_ORDER_ANY, sysctl_register_all, 0);
 
@@ -498,6 +573,7 @@ sysctl_sysctl_debug_dump_node(struct sys
 	int k;
 	struct sysctl_oid *oidp;
 
+	SYSCTL_ASSERT_LOCKED();
 	SLIST_FOREACH(oidp, l, oid_link) {
 
 		for (k=0; k<i; k++)
@@ -556,6 +632,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS)
 	struct sysctl_oid_list *lsp = &sysctl__children, *lsp2;
 	char buf[10];
 
+	SYSCTL_ASSERT_LOCKED();
 	while (namelen) {
 		if (!lsp) {
 			snprintf(buf,sizeof(buf),"%d",*name);
@@ -607,6 +684,7 @@ sysctl_sysctl_next_ls(struct sysctl_oid_
 {
 	struct sysctl_oid *oidp;
 
+	SYSCTL_ASSERT_LOCKED();
 	*len = level;
 	SLIST_FOREACH(oidp, lsp, oid_link) {
 		*next = oidp->oid_number;
@@ -687,7 +765,7 @@ name2oid (char *name, int *oid, int *len
 	struct sysctl_oid_list *lsp = &sysctl__children;
 	char *p;
 
-	SYSCTL_LOCK_ASSERT();
+	SYSCTL_ASSERT_LOCKED();
 
 	if (!*name)
 		return (ENOENT);
@@ -745,7 +823,7 @@ sysctl_sysctl_name2oid(SYSCTL_HANDLER_AR
 	int error, oid[CTL_MAXNAME], len;
 	struct sysctl_oid *op = 0;
 
-	SYSCTL_LOCK_ASSERT();
+	SYSCTL_ASSERT_LOCKED();
 
 	if (!req->newlen) 
 		return (ENOENT);
@@ -1091,9 +1169,9 @@ kernel_sysctl(struct thread *td, int *na
 	req.newfunc = sysctl_new_kernel;
 	req.lock = REQ_LOCKED;
 
-	SYSCTL_LOCK();
+	SYSCTL_SLOCK();
 	error = sysctl_root(0, name, namelen, &req);
-	SYSCTL_UNLOCK();
+	SYSCTL_SUNLOCK();
 
 	if (req.lock == REQ_WIRED && req.validlen > 0)
 		vsunlock(req.oldptr, req.validlen);
@@ -1125,6 +1203,9 @@ kernel_sysctlbyname(struct thread *td, c
 	/*
 	 * XXX: Prone to a possible race condition between lookup and
 	 * execution? Maybe put locking around it?
+	 *
+	 * Userland is just as racy, so I think the current implementation
+	 * is fine.
 	 */
 
 	error = kernel_sysctl(td, oid, 2, oid, &oidlen,
@@ -1236,6 +1317,7 @@ sysctl_find_oid(int *name, u_int namelen
 	struct sysctl_oid *oid;
 	int indx;
 
+	SYSCTL_ASSERT_LOCKED();
 	oid = SLIST_FIRST(&sysctl__children);
 	indx = 0;
 	while (oid && indx < CTL_MAXNAME) {
@@ -1279,7 +1361,7 @@ sysctl_root(SYSCTL_HANDLER_ARGS)
 	struct sysctl_oid *oid;
 	int error, indx, lvl;
 
-	SYSCTL_LOCK_ASSERT();
+	SYSCTL_ASSERT_LOCKED();
 
 	error = sysctl_find_oid(arg1, arg2, &oid, &indx, req);
 	if (error)
@@ -1357,7 +1439,7 @@ struct sysctl_args {
 int
 __sysctl(struct thread *td, struct sysctl_args *uap)
 {
-	int error, name[CTL_MAXNAME];
+	int error, i, name[CTL_MAXNAME];
 	size_t j;
 
 	if (uap->namelen > CTL_MAXNAME || uap->namelen < 2)
@@ -1373,7 +1455,7 @@ __sysctl(struct thread *td, struct sysct
 	if (error && error != ENOMEM)
 		return (error);
 	if (uap->oldlenp) {
-		int i = copyout(&j, uap->oldlenp, sizeof(j));
+		i = copyout(&j, uap->oldlenp, sizeof(j));
 		if (i)
 			return (i);
 	}
@@ -1425,7 +1507,7 @@ userland_sysctl(struct thread *td, int *
 	req.newfunc = sysctl_new_user;
 	req.lock = REQ_LOCKED;
 
-	SYSCTL_LOCK();
+	SYSCTL_XLOCK();
 	CURVNET_SET(TD_TO_VNET(curthread));
 
 	for (;;) {
@@ -1438,7 +1520,7 @@ userland_sysctl(struct thread *td, int *
 	}
 
 	CURVNET_RESTORE();
-	SYSCTL_UNLOCK();
+	SYSCTL_XUNLOCK();
 
 	if (req.lock == REQ_WIRED && req.validlen > 0)
 		vsunlock(req.oldptr, req.validlen);

Modified: head/sys/kern/vfs_init.c
==============================================================================
--- head/sys/kern/vfs_init.c	Fri Feb  6 12:39:42 2009	(r188231)
+++ head/sys/kern/vfs_init.c	Fri Feb  6 14:51:32 2009	(r188232)
@@ -165,12 +165,15 @@ vfs_register(struct vfsconf *vfc)
 	 * preserved by re-registering the oid after modifying its
 	 * number.
 	 */
+	sysctl_lock();
 	SLIST_FOREACH(oidp, &sysctl__vfs_children, oid_link)
 		if (strcmp(oidp->oid_name, vfc->vfc_name) == 0) {
 			sysctl_unregister_oid(oidp);
 			oidp->oid_number = vfc->vfc_typenum;
 			sysctl_register_oid(oidp);
+			break;
 		}
+	sysctl_unlock();
 
 	/*
 	 * Initialise unused ``struct vfsops'' fields, to use

Modified: head/sys/sys/sysctl.h
==============================================================================
--- head/sys/sys/sysctl.h	Fri Feb  6 12:39:42 2009	(r188231)
+++ head/sys/sys/sysctl.h	Fri Feb  6 14:51:32 2009	(r188232)
@@ -799,6 +799,8 @@ int	userland_sysctl(struct thread *td, i
 			size_t *retval, int flags);
 int	sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid,
 			int *nindx, struct sysctl_req *req);
+void	sysctl_lock(void);
+void	sysctl_unlock(void);
 int	sysctl_wire_old_buffer(struct sysctl_req *req, size_t len);
 
 #else	/* !_KERNEL */

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 15:03:15 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4040E106566C;
	Fri,  6 Feb 2009 15:03:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2EE4E8FC21;
	Fri,  6 Feb 2009 15:03:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16F3F38064414;
	Fri, 6 Feb 2009 15:03:15 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16F3F76064413;
	Fri, 6 Feb 2009 15:03:15 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200902061503.n16F3F76064413@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Fri, 6 Feb 2009 15:03:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188233 - head
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 15:03:15 -0000

Author: jhb
Date: Fri Feb  6 15:03:14 2009
New Revision: 188233
URL: http://svn.freebsd.org/changeset/base/188233

Log:
  Add a note to document that ichsmb(4) now uses left-justified SMBus slave
  addresses.

Modified:
  head/UPDATING

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Fri Feb  6 14:51:32 2009	(r188232)
+++ head/UPDATING	Fri Feb  6 15:03:14 2009	(r188233)
@@ -22,6 +22,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.
 	to maximize performance.  (To disable malloc debugging, run
 	ln -s aj /etc/malloc.conf.)
 
+20090203:
+	The ichsmb(4) driver has been changed to require SMBus slave
+	addresses be left-justified (xxxxxxx0b) rather than right-justified.
+	All of the other SMBus controller drivers require left-justified
+	slave addresses, so this change makes all the drivers provide the
+	same interface.
+
 20090201:
 	INET6 statistics (struct ip6stat) was updated.
 	netstat(1) needs to be recompiled.

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 15:03:18 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5A22B1065672;
	Fri,  6 Feb 2009 15:03:18 +0000 (UTC)
	(envelope-from kevlo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2DB098FC0A;
	Fri,  6 Feb 2009 15:03:18 +0000 (UTC)
	(envelope-from kevlo@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16F3I9U064453;
	Fri, 6 Feb 2009 15:03:18 GMT (envelope-from kevlo@svn.freebsd.org)
Received: (from kevlo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16F3HdW064449;
	Fri, 6 Feb 2009 15:03:17 GMT (envelope-from kevlo@svn.freebsd.org)
Message-Id: <200902061503.n16F3HdW064449@svn.freebsd.org>
From: Kevin Lo <kevlo@FreeBSD.org>
Date: Fri, 6 Feb 2009 15:03:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188234 - in head: share/man/man4 sys/dev/usb
	sys/dev/usb2/wlan
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 15:03:18 -0000

Author: kevlo
Date: Fri Feb  6 15:03:17 2009
New Revision: 188234
URL: http://svn.freebsd.org/changeset/base/188234

Log:
  Add the Buffalo WLI-U2-SG54HG

Modified:
  head/share/man/man4/rum.4
  head/sys/dev/usb/if_rum.c
  head/sys/dev/usb/usbdevs
  head/sys/dev/usb2/wlan/if_rum2.c

Modified: head/share/man/man4/rum.4
==============================================================================
--- head/share/man/man4/rum.4	Fri Feb  6 15:03:14 2009	(r188233)
+++ head/share/man/man4/rum.4	Fri Feb  6 15:03:17 2009	(r188234)
@@ -91,6 +91,7 @@ including:
 .It "Belkin F5D7050 ver 3" Ta USB
 .It "Belkin F5D9050 ver 3" Ta USB
 .It "Buffalo WLI-U2-SG54HP" Ta USB
+.It "Buffalo WLI-U2-SG54HG" Ta USB
 .It "Buffalo WLI-U2-G54HP" Ta USB
 .It "CNet CWD-854 ver F" Ta USB
 .It "Conceptronic C54RU ver 2" Ta USB

Modified: head/sys/dev/usb/if_rum.c
==============================================================================
--- head/sys/dev/usb/if_rum.c	Fri Feb  6 15:03:14 2009	(r188233)
+++ head/sys/dev/usb/if_rum.c	Fri Feb  6 15:03:17 2009	(r188234)
@@ -108,6 +108,7 @@ static const struct usb_devno rum_devs[]
 	{ USB_VENDOR_HUAWEI3COM,        USB_PRODUCT_HUAWEI3COM_WUB320G },
 	{ USB_VENDOR_MELCO,             USB_PRODUCT_MELCO_G54HP },
 	{ USB_VENDOR_MELCO,             USB_PRODUCT_MELCO_SG54HP },
+	{ USB_VENDOR_MELCO,             USB_PRODUCT_MELCO_SG54HG },
 	{ USB_VENDOR_MSI,               USB_PRODUCT_MSI_RT2573_1 },
 	{ USB_VENDOR_MSI,               USB_PRODUCT_MSI_RT2573_2 },
 	{ USB_VENDOR_MSI,               USB_PRODUCT_MSI_RT2573_3 },

Modified: head/sys/dev/usb/usbdevs
==============================================================================
--- head/sys/dev/usb/usbdevs	Fri Feb  6 15:03:14 2009	(r188233)
+++ head/sys/dev/usb/usbdevs	Fri Feb  6 15:03:17 2009	(r188234)
@@ -1681,6 +1681,7 @@ product MELCO PCOPRS1		0x00b3	PC-OP-RS1 
 product MELCO SG54HP		0x00d8	WLI-U2-SG54HP
 product MELCO G54HP		0x00d9	WLI-U2-G54HP
 product MELCO KG54L		0x00da	WLI-U2-KG54L
+product MELCO SG54HG		0x00f4	WLI-U2-SG54HG
 
 /* Merlin products */
 product MERLIN V620             0x1110  Merlin V620

Modified: head/sys/dev/usb2/wlan/if_rum2.c
==============================================================================
--- head/sys/dev/usb2/wlan/if_rum2.c	Fri Feb  6 15:03:14 2009	(r188233)
+++ head/sys/dev/usb2/wlan/if_rum2.c	Fri Feb  6 15:03:17 2009	(r188234)
@@ -188,6 +188,7 @@ static const struct usb2_device_id rum_d
 	{USB_VPI(USB_VENDOR_HUAWEI3COM, USB_PRODUCT_HUAWEI3COM_WUB320G, 0)},
 	{USB_VPI(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_G54HP, 0)},
 	{USB_VPI(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_SG54HP, 0)},
+	{USB_VPI(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_SG54HG, 0)},
 	{USB_VPI(USB_VENDOR_MSI, USB_PRODUCT_MSI_RT2573_1, 0)},
 	{USB_VPI(USB_VENDOR_MSI, USB_PRODUCT_MSI_RT2573_2, 0)},
 	{USB_VPI(USB_VENDOR_MSI, USB_PRODUCT_MSI_RT2573_3, 0)},

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 15:04:06 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8C0A5106564A;
	Fri,  6 Feb 2009 15:04:06 +0000 (UTC)
	(envelope-from kevlo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 604C18FC0A;
	Fri,  6 Feb 2009 15:04:06 +0000 (UTC)
	(envelope-from kevlo@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16F46Xc064515;
	Fri, 6 Feb 2009 15:04:06 GMT (envelope-from kevlo@svn.freebsd.org)
Received: (from kevlo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16F46SU064513;
	Fri, 6 Feb 2009 15:04:06 GMT (envelope-from kevlo@svn.freebsd.org)
Message-Id: <200902061504.n16F46SU064513@svn.freebsd.org>
From: Kevin Lo <kevlo@FreeBSD.org>
Date: Fri, 6 Feb 2009 15:04:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188235 - head/sys/dev/usb2/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 15:04:07 -0000

Author: kevlo
Date: Fri Feb  6 15:04:06 2009
New Revision: 188235
URL: http://svn.freebsd.org/changeset/base/188235

Log:
  Regen

Modified:
  head/sys/dev/usb2/include/usb2_devid.h
  head/sys/dev/usb2/include/usb2_devtable.h

Modified: head/sys/dev/usb2/include/usb2_devid.h
==============================================================================
--- head/sys/dev/usb2/include/usb2_devid.h	Fri Feb  6 15:03:17 2009	(r188234)
+++ head/sys/dev/usb2/include/usb2_devid.h	Fri Feb  6 15:04:06 2009	(r188235)
@@ -4,7 +4,7 @@
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	FreeBSD: head/sys/dev/usb/usbdevs 187726 2009-01-26 17:43:58Z thompsa 
+ *	FreeBSD: head/sys/dev/usb/usbdevs 188234 2009-02-06 15:03:17Z kevlo 
  */
 /* $NetBSD: usbdevs,v 1.392 2004/12/29 08:38:44 imp Exp $ */
 
@@ -1688,6 +1688,7 @@
 #define	USB_PRODUCT_MELCO_SG54HP	0x00d8		/* WLI-U2-SG54HP */
 #define	USB_PRODUCT_MELCO_G54HP	0x00d9		/* WLI-U2-G54HP */
 #define	USB_PRODUCT_MELCO_KG54L	0x00da		/* WLI-U2-KG54L */
+#define	USB_PRODUCT_MELCO_SG54HG	0x00f4		/* WLI-U2-SG54HG */
 
 /* Merlin products */
 #define	USB_PRODUCT_MERLIN_V620	0x1110		/* Merlin V620 */

Modified: head/sys/dev/usb2/include/usb2_devtable.h
==============================================================================
--- head/sys/dev/usb2/include/usb2_devtable.h	Fri Feb  6 15:03:17 2009	(r188234)
+++ head/sys/dev/usb2/include/usb2_devtable.h	Fri Feb  6 15:04:06 2009	(r188235)
@@ -4,7 +4,7 @@
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	FreeBSD: head/sys/dev/usb/usbdevs 187726 2009-01-26 17:43:58Z thompsa 
+ *	FreeBSD: head/sys/dev/usb/usbdevs 188234 2009-02-06 15:03:17Z kevlo 
  */
 /* $NetBSD: usbdevs,v 1.392 2004/12/29 08:38:44 imp Exp $ */
 
@@ -4133,6 +4133,12 @@ const struct usb_knowndev usb_knowndevs[
 	    "WLI-U2-KG54L",
 	},
 	{
+	    USB_VENDOR_MELCO, USB_PRODUCT_MELCO_SG54HG,
+	    0,
+	    "Melco",
+	    "WLI-U2-SG54HG",
+	},
+	{
 	    USB_VENDOR_MERLIN, USB_PRODUCT_MERLIN_V620,
 	    0,
 	    "Merlin",

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 15:09:31 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 65BC410656C6;
	Fri,  6 Feb 2009 15:09:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 539608FC1F;
	Fri,  6 Feb 2009 15:09:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16F9V7m064635;
	Fri, 6 Feb 2009 15:09:31 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16F9V6U064634;
	Fri, 6 Feb 2009 15:09:31 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200902061509.n16F9V6U064634@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Fri, 6 Feb 2009 15:09:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188236 - head/share/man/man4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 15:09:33 -0000

Author: jhb
Date: Fri Feb  6 15:09:31 2009
New Revision: 188236
URL: http://svn.freebsd.org/changeset/base/188236

Log:
  Note that the slave address passed to smb(4) commands must be left-justified
  (LSB is 0).  The iic(4) manpage probably needs similar language to describe
  the format it expects.

Modified:
  head/share/man/man4/smb.4

Modified: head/share/man/man4/smb.4
==============================================================================
--- head/share/man/man4/smb.4	Fri Feb  6 15:04:06 2009	(r188235)
+++ head/share/man/man4/smb.4	Fri Feb  6 15:09:31 2009	(r188236)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 25, 1998
+.Dd February 6, 2009
 .Dt SMB 4
 .Os
 .Sh NAME
@@ -72,6 +72,9 @@ The
 .Fa slave
 field is always used, and provides the address of the
 SMBus slave device to talk to.
+The slave address is specified in the seven most significant bits
+.Pq i.e. Dq "left-justified" .
+The least significant bit of the slave address must be zero.
 .Pp
 .Bl -column ".Dv SMB_QUICK_WRITE" -compact
 .It Em Ioctl Ta Em Description

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 15:27:40 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5E26D106566B;
	Fri,  6 Feb 2009 15:27:40 +0000 (UTC)
	(envelope-from kevlo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4C6C88FC20;
	Fri,  6 Feb 2009 15:27:40 +0000 (UTC)
	(envelope-from kevlo@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16FRefJ064991;
	Fri, 6 Feb 2009 15:27:40 GMT (envelope-from kevlo@svn.freebsd.org)
Received: (from kevlo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16FRemZ064990;
	Fri, 6 Feb 2009 15:27:40 GMT (envelope-from kevlo@svn.freebsd.org)
Message-Id: <200902061527.n16FRemZ064990@svn.freebsd.org>
From: Kevin Lo <kevlo@FreeBSD.org>
Date: Fri, 6 Feb 2009 15:27:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188237 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 15:27:41 -0000

Author: kevlo
Date: Fri Feb  6 15:27:40 2009
New Revision: 188237
URL: http://svn.freebsd.org/changeset/base/188237

Log:
  In urtw_init() call urtw_stop(ifp, 0) rather than urtw_stop(ifp, 1)
  to stop the device.

Modified:
  head/sys/dev/usb/if_urtw.c

Modified: head/sys/dev/usb/if_urtw.c
==============================================================================
--- head/sys/dev/usb/if_urtw.c	Fri Feb  6 15:09:31 2009	(r188236)
+++ head/sys/dev/usb/if_urtw.c	Fri Feb  6 15:27:40 2009	(r188237)
@@ -2076,7 +2076,7 @@ urtw_init(void *arg)
 	struct ifnet *ifp = sc->sc_ifp;
 	usbd_status error;
 
-	urtw_stop(ifp, 1);
+	urtw_stop(ifp, 0);
 
 	error = urtw_adapter_start(sc);
 	if (error != 0)

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 17:14:07 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CF64E106564A;
	Fri,  6 Feb 2009 17:14:07 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A39798FC0C;
	Fri,  6 Feb 2009 17:14:07 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16HE7vK066981;
	Fri, 6 Feb 2009 17:14:07 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16HE7Lr066980;
	Fri, 6 Feb 2009 17:14:07 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <200902061714.n16HE7Lr066980@svn.freebsd.org>
From: Edward Tomasz Napierala <trasz@FreeBSD.org>
Date: Fri, 6 Feb 2009 17:14:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188240 - head/sys/ufs/ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 17:14:08 -0000

Author: trasz
Date: Fri Feb  6 17:14:07 2009
New Revision: 188240
URL: http://svn.freebsd.org/changeset/base/188240

Log:
  When a device containing mounted UFS filesystem disappears, the type
  of devvp becomes VBAD, which UFS incorrectly interprets as snapshot
  vnode, which in turns causes panic.  Fix it by replacing '!= VCHR'
  with '== VREG'.
  
  With this fix in place, you should no longer be able to panic the system
  by removing a device with an UFS filesystem mounted from it - assuming
  you don't use softupdates.
  
  Reviewed by:	kib
  Tested by:	pho
  Approved by:	rwatson (mentor)
  Sponsored by:	FreeBSD Foundation

Modified:
  head/sys/ufs/ffs/ffs_alloc.c

Modified: head/sys/ufs/ffs/ffs_alloc.c
==============================================================================
--- head/sys/ufs/ffs/ffs_alloc.c	Fri Feb  6 16:05:00 2009	(r188239)
+++ head/sys/ufs/ffs/ffs_alloc.c	Fri Feb  6 17:14:07 2009	(r188240)
@@ -1858,7 +1858,7 @@ ffs_blkfree(ump, fs, devvp, bno, size, i
 	struct cdev *dev;
 
 	cg = dtog(fs, bno);
-	if (devvp->v_type != VCHR) {
+	if (devvp->v_type == VREG) {
 		/* devvp is a snapshot */
 		dev = VTOI(devvp)->i_devvp->v_rdev;
 		cgblkno = fragstoblks(fs, cgtod(fs, cg));
@@ -1903,7 +1903,7 @@ ffs_blkfree(ump, fs, devvp, bno, size, i
 	if (size == fs->fs_bsize) {
 		fragno = fragstoblks(fs, cgbno);
 		if (!ffs_isfreeblock(fs, blksfree, fragno)) {
-			if (devvp->v_type != VCHR) {
+			if (devvp->v_type == VREG) {
 				UFS_UNLOCK(ump);
 				/* devvp is a snapshot */
 				brelse(bp);
@@ -2056,7 +2056,7 @@ ffs_freefile(ump, fs, devvp, ino, mode)
 	struct cdev *dev;
 
 	cg = ino_to_cg(fs, ino);
-	if (devvp->v_type != VCHR) {
+	if (devvp->v_type == VREG) {
 		/* devvp is a snapshot */
 		dev = VTOI(devvp)->i_devvp->v_rdev;
 		cgbno = fragstoblks(fs, cgtod(fs, cg));
@@ -2122,7 +2122,7 @@ ffs_checkfreefile(fs, devvp, ino)
 	u_int8_t *inosused;
 
 	cg = ino_to_cg(fs, ino);
-	if (devvp->v_type != VCHR) {
+	if (devvp->v_type == VREG) {
 		/* devvp is a snapshot */
 		cgbno = fragstoblks(fs, cgtod(fs, cg));
 	} else {

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 18:16:01 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DEEB5106566B;
	Fri,  6 Feb 2009 18:16:01 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CD6168FC13;
	Fri,  6 Feb 2009 18:16:01 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16IG1OH068212;
	Fri, 6 Feb 2009 18:16:01 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16IG1u2068210;
	Fri, 6 Feb 2009 18:16:01 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <200902061816.n16IG1u2068210@svn.freebsd.org>
From: Edward Tomasz Napierala <trasz@FreeBSD.org>
Date: Fri, 6 Feb 2009 18:16:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188243 - in head/sys: kern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 18:16:02 -0000

Author: trasz
Date: Fri Feb  6 18:16:01 2009
New Revision: 188243
URL: http://svn.freebsd.org/changeset/base/188243

Log:
  Add KASSERTs to make it easier to debug problems like the one fixed
  in r188141.
  
  Reviewed by:	kib,attilio
  Approved by:	rwatson (mentor)
  Tested by:	pho
  Sponsored by:	FreeBSD Foundation

Modified:
  head/sys/kern/vfs_subr.c
  head/sys/sys/mount.h

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Fri Feb  6 17:21:41 2009	(r188242)
+++ head/sys/kern/vfs_subr.c	Fri Feb  6 18:16:01 2009	(r188243)
@@ -381,6 +381,7 @@ vfs_unbusy(struct mount *mp)
 	CTR2(KTR_VFS, "%s: mp %p", __func__, mp);
 	MNT_ILOCK(mp);
 	MNT_REL(mp);
+	KASSERT(mp->mnt_lockref > 0, ("negative mnt_lockref"));
 	mp->mnt_lockref--;
 	if (mp->mnt_lockref == 0 && (mp->mnt_kern_flag & MNTK_DRAINING) != 0) {
 		MPASS(mp->mnt_kern_flag & MNTK_UNMOUNT);

Modified: head/sys/sys/mount.h
==============================================================================
--- head/sys/sys/mount.h	Fri Feb  6 17:21:41 2009	(r188242)
+++ head/sys/sys/mount.h	Fri Feb  6 18:16:01 2009	(r188243)
@@ -206,6 +206,7 @@ void          __mnt_vnode_markerfree(str
 #define	MNT_MTX(mp)	(&(mp)->mnt_mtx)
 #define	MNT_REF(mp)	(mp)->mnt_ref++
 #define	MNT_REL(mp)	do {						\
+	KASSERT((mp)->mnt_ref > 0, ("negative mnt_ref"));			\
 	(mp)->mnt_ref--;						\
 	if ((mp)->mnt_ref == 0)						\
 		wakeup((mp));						\

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 20:06:49 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4B529106566B;
	Fri,  6 Feb 2009 20:06:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1F5D68FC16;
	Fri,  6 Feb 2009 20:06:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16K6npB070278;
	Fri, 6 Feb 2009 20:06:49 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16K6mNa070274;
	Fri, 6 Feb 2009 20:06:48 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200902062006.n16K6mNa070274@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Fri, 6 Feb 2009 20:06:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188244 - in head/sys: fs/fifofs kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 20:06:49 -0000

Author: jhb
Date: Fri Feb  6 20:06:48 2009
New Revision: 188244
URL: http://svn.freebsd.org/changeset/base/188244

Log:
  Tweak the output of VOP_PRINT/vn_printf() some.
  - Align the fifo output in fifo_print() with other vn_printf() output.
  - Remove the leading space from lockmgr_printinfo() so its output lines up
    in vn_printf().
  - lockmgr_printinfo() now ends with a newline, so remove an extra newline
    from vn_printf().

Modified:
  head/sys/fs/fifofs/fifo_vnops.c
  head/sys/kern/kern_lock.c
  head/sys/kern/vfs_bio.c
  head/sys/kern/vfs_subr.c

Modified: head/sys/fs/fifofs/fifo_vnops.c
==============================================================================
--- head/sys/fs/fifofs/fifo_vnops.c	Fri Feb  6 18:16:01 2009	(r188243)
+++ head/sys/fs/fifofs/fifo_vnops.c	Fri Feb  6 20:06:48 2009	(r188244)
@@ -468,6 +468,7 @@ fifo_print(ap)
 		struct vnode *a_vp;
 	} */ *ap;
 {
+	printf("    ");
 	fifo_printinfo(ap->a_vp);
 	printf("\n");
 	return (0);

Modified: head/sys/kern/kern_lock.c
==============================================================================
--- head/sys/kern/kern_lock.c	Fri Feb  6 18:16:01 2009	(r188243)
+++ head/sys/kern/kern_lock.c	Fri Feb  6 20:06:48 2009	(r188244)
@@ -897,14 +897,14 @@ lockmgr_printinfo(struct lock *lk)
 	uintptr_t x;
 
 	if (lk->lk_lock == LK_UNLOCKED)
-		printf(" lock type %s: UNLOCKED\n", lk->lock_object.lo_name);
+		printf("lock type %s: UNLOCKED\n", lk->lock_object.lo_name);
 	else if (lk->lk_lock & LK_SHARE)
-		printf(" lock type %s: SHARED (count %ju)\n",
+		printf("lock type %s: SHARED (count %ju)\n",
 		    lk->lock_object.lo_name,
 		    (uintmax_t)LK_SHARERS(lk->lk_lock));
 	else {
 		td = lockmgr_xholder(lk);
-		printf(" lock type %s: EXCL by thread %p (pid %d)\n",
+		printf("lock type %s: EXCL by thread %p (pid %d)\n",
 		    lk->lock_object.lo_name, td, td->td_proc->p_pid);
 	}
 

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c	Fri Feb  6 18:16:01 2009	(r188243)
+++ head/sys/kern/vfs_bio.c	Fri Feb  6 20:06:48 2009	(r188244)
@@ -3920,6 +3920,7 @@ DB_SHOW_COMMAND(buffer, db_show_buffer)
 		}
 		db_printf("\n");
 	}
+	db_printf(" ");
 	lockmgr_printinfo(&bp->b_lock);
 }
 

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Fri Feb  6 18:16:01 2009	(r188243)
+++ head/sys/kern/vfs_subr.c	Fri Feb  6 20:06:48 2009	(r188244)
@@ -2719,7 +2719,6 @@ vn_printf(struct vnode *vp, const char *
 		    vp->v_object->resident_page_count);
 	printf("    ");
 	lockmgr_printinfo(vp->v_vnlock);
-	printf("\n");
 	if (vp->v_data != NULL)
 		VOP_PRINT(vp);
 }

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 20:09:15 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E1FC11065673;
	Fri,  6 Feb 2009 20:09:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D04A98FC12;
	Fri,  6 Feb 2009 20:09:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16K9Eb2070357;
	Fri, 6 Feb 2009 20:09:14 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16K9Esa070354;
	Fri, 6 Feb 2009 20:09:14 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200902062009.n16K9Esa070354@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Fri, 6 Feb 2009 20:09:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188245 - head/sys/fs/udf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 20:09:15 -0000

Author: jhb
Date: Fri Feb  6 20:09:14 2009
New Revision: 188245
URL: http://svn.freebsd.org/changeset/base/188245

Log:
  Add support for fifos to UDF:
  - Add a separate set of vnode operations that inherits from the fifo ops
    and use it for fifo nodes.
  - Add a VOP_SETATTR() method that allows setting the size (by silently
    ignoring the requests) of fifos.  This is to allow O_TRUNC opens of
    fifo devices (e.g. I/O redirection in shells using ">").
  - Add a VOP_PRINT() handler while I'm here.

Modified:
  head/sys/fs/udf/udf.h
  head/sys/fs/udf/udf_vfsops.c
  head/sys/fs/udf/udf_vnops.c

Modified: head/sys/fs/udf/udf.h
==============================================================================
--- head/sys/fs/udf/udf.h	Fri Feb  6 20:06:48 2009	(r188244)
+++ head/sys/fs/udf/udf.h	Fri Feb  6 20:09:14 2009	(r188245)
@@ -137,3 +137,5 @@ int udf_vget(struct mount *, ino_t, int,
 extern uma_zone_t udf_zone_trans;
 extern uma_zone_t udf_zone_node;
 extern uma_zone_t udf_zone_ds;
+
+extern struct vop_vector udf_fifoops;

Modified: head/sys/fs/udf/udf_vfsops.c
==============================================================================
--- head/sys/fs/udf/udf_vfsops.c	Fri Feb  6 20:06:48 2009	(r188244)
+++ head/sys/fs/udf/udf_vfsops.c	Fri Feb  6 20:09:14 2009	(r188245)
@@ -680,6 +680,7 @@ udf_vget(struct mount *mp, ino_t ino, in
 		break;
 	case 9:
 		vp->v_type = VFIFO;
+		vp->v_op = &udf_fifoops;
 		break;
 	case 10:
 		vp->v_type = VSOCK;

Modified: head/sys/fs/udf/udf_vnops.c
==============================================================================
--- head/sys/fs/udf/udf_vnops.c	Fri Feb  6 20:06:48 2009	(r188244)
+++ head/sys/fs/udf/udf_vnops.c	Fri Feb  6 20:09:14 2009	(r188245)
@@ -48,6 +48,7 @@
 
 #include <vm/uma.h>
 
+#include <fs/fifofs/fifo.h>
 #include <fs/udf/ecma167-udf.h>
 #include <fs/udf/osta.h>
 #include <fs/udf/udf.h>
@@ -60,9 +61,11 @@ static vop_getattr_t	udf_getattr;
 static vop_open_t	udf_open;
 static vop_ioctl_t	udf_ioctl;
 static vop_pathconf_t	udf_pathconf;
+static vop_print_t	udf_print;
 static vop_read_t	udf_read;
 static vop_readdir_t	udf_readdir;
 static vop_readlink_t	udf_readlink;
+static vop_setattr_t	udf_setattr;
 static vop_strategy_t	udf_strategy;
 static vop_bmap_t	udf_bmap;
 static vop_cachedlookup_t	udf_lookup;
@@ -84,14 +87,26 @@ static struct vop_vector udf_vnodeops = 
 	.vop_lookup =		vfs_cache_lookup,
 	.vop_open =		udf_open,
 	.vop_pathconf =		udf_pathconf,
+	.vop_print =		udf_print,
 	.vop_read =		udf_read,
 	.vop_readdir =		udf_readdir,
 	.vop_readlink =		udf_readlink,
 	.vop_reclaim =		udf_reclaim,
+	.vop_setattr =		udf_setattr,
 	.vop_strategy =		udf_strategy,
 	.vop_vptofh =		udf_vptofh,
 };
 
+struct vop_vector udf_fifoops = {
+	.vop_default =		&fifo_specops,
+	.vop_access =		udf_access,
+	.vop_getattr =		udf_getattr,
+	.vop_print =		udf_print,
+	.vop_reclaim =		udf_reclaim,
+	.vop_setattr =		udf_setattr,
+	.vop_vptofh =		udf_vptofh,
+};
+
 MALLOC_DEFINE(M_UDFFID, "udf_fid", "UDF FileId structure");
 MALLOC_DEFINE(M_UDFDS, "udf_ds", "UDF Dirstream structure");
 
@@ -318,6 +333,38 @@ udf_getattr(struct vop_getattr_args *a)
 	return (0);
 }
 
+static int
+udf_setattr(struct vop_setattr_args *a)
+{
+	struct vnode *vp;
+	struct vattr *vap;
+
+	vp = a->a_vp;
+	vap = a->a_vap;
+	if (vap->va_flags != (u_long)VNOVAL || vap->va_uid != (uid_t)VNOVAL ||
+	    vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL ||
+	    vap->va_mtime.tv_sec != VNOVAL || vap->va_mode != (mode_t)VNOVAL)
+		return (EROFS);
+	if (vap->va_size != (u_quad_t)VNOVAL) {
+		switch (vp->v_type) {
+		case VDIR:
+			return (EISDIR);
+		case VLNK:
+		case VREG:
+			return (EROFS);
+		case VCHR:
+		case VBLK:
+		case VSOCK:
+		case VFIFO:
+		case VNON:
+		case VBAD:
+		case VMARKER:
+			return (0);
+		}
+	}
+	return (0);
+}
+
 /*
  * File specific ioctls.
  */
@@ -354,6 +401,20 @@ udf_pathconf(struct vop_pathconf_args *a
 	}
 }
 
+static int
+udf_print(struct vop_print_args *ap)
+{
+	struct vnode *vp = ap->a_vp;
+	struct udf_node *node = VTON(vp);
+
+	printf("    ino %lu, on dev %s", (u_long)node->hash_id,
+	    devtoname(node->udfmp->im_dev));
+	if (vp->v_type == VFIFO)
+		fifo_printinfo(vp);
+	printf("\n");
+	return (0);
+}
+
 #define lblkno(udfmp, loc)	((loc) >> (udfmp)->bshift)
 #define blkoff(udfmp, loc)	((loc) & (udfmp)->bmask)
 #define lblktosize(imp, blk)	((blk) << (udfmp)->bshift)

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 20:57:10 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C97561065696;
	Fri,  6 Feb 2009 20:57:10 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B59958FC0A;
	Fri,  6 Feb 2009 20:57:10 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16KvAOW071304;
	Fri, 6 Feb 2009 20:57:10 GMT (envelope-from wkoszek@svn.freebsd.org)
Received: (from wkoszek@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16KvA98071296;
	Fri, 6 Feb 2009 20:57:10 GMT (envelope-from wkoszek@svn.freebsd.org)
Message-Id: <200902062057.n16KvA98071296@svn.freebsd.org>
From: "Wojciech A. Koszek" <wkoszek@FreeBSD.org>
Date: Fri, 6 Feb 2009 20:57:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188247 - in head/sys: amd64/conf conf dev/agp
	i386/conf pc98/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 20:57:12 -0000

Author: wkoszek
Date: Fri Feb  6 20:57:10 2009
New Revision: 188247
URL: http://svn.freebsd.org/changeset/base/188247

Log:
  Fix AGP debugging code:
  - correct format strings
  - fill opt_agp.h if AGP_DEBUG is defined
  - bring AGP_DEBUG to LINT by mentioning it in NOTES
  
  This should hopefully fix a warning that was...
  
  Found by:	Coverity Prevent(tm)
  CID:		3676
  Tested on:	amd64, i386

Modified:
  head/sys/amd64/conf/NOTES
  head/sys/conf/options.amd64
  head/sys/conf/options.i386
  head/sys/conf/options.pc98
  head/sys/dev/agp/agp.c
  head/sys/i386/conf/NOTES
  head/sys/pc98/conf/NOTES

Modified: head/sys/amd64/conf/NOTES
==============================================================================
--- head/sys/amd64/conf/NOTES	Fri Feb  6 20:41:30 2009	(r188246)
+++ head/sys/amd64/conf/NOTES	Fri Feb  6 20:57:10 2009	(r188247)
@@ -150,6 +150,11 @@ device		pci
 # AGP GART support
 device		agp
 
+#
+# AGP debugging.
+#
+options		AGP_DEBUG
+
 
 #####################################################################
 # HARDWARE DEVICE CONFIGURATION

Modified: head/sys/conf/options.amd64
==============================================================================
--- head/sys/conf/options.amd64	Fri Feb  6 20:41:30 2009	(r188246)
+++ head/sys/conf/options.amd64	Fri Feb  6 20:57:10 2009	(r188247)
@@ -37,6 +37,9 @@ VGA_NO_MODE_CHANGE	opt_vga.h
 VGA_SLOW_IOACCESS	opt_vga.h
 VGA_WIDTH90		opt_vga.h
 
+# AGP debugging support
+AGP_DEBUG		opt_agp.h
+
 ATKBD_DFLT_KEYMAP	opt_atkbd.h
 
 # -------------------------------

Modified: head/sys/conf/options.i386
==============================================================================
--- head/sys/conf/options.i386	Fri Feb  6 20:41:30 2009	(r188246)
+++ head/sys/conf/options.i386	Fri Feb  6 20:57:10 2009	(r188247)
@@ -88,6 +88,9 @@ VGA_WIDTH90		opt_vga.h
 VESA
 VESA_DEBUG		opt_vesa.h
 
+# AGP debugging support
+AGP_DEBUG		opt_agp.h
+
 PSM_DEBUG		opt_psm.h
 PSM_HOOKRESUME		opt_psm.h
 PSM_RESETAFTERSUSPEND	opt_psm.h

Modified: head/sys/conf/options.pc98
==============================================================================
--- head/sys/conf/options.pc98	Fri Feb  6 20:41:30 2009	(r188246)
+++ head/sys/conf/options.pc98	Fri Feb  6 20:57:10 2009	(r188247)
@@ -96,6 +96,7 @@ DEV_NPX			opt_npx.h
 # Debugging
 NPX_DEBUG		opt_npx.h
 STOP_NMI		opt_cpu.h
+AGP_DEBUG		opt_agp.h
 
 # BPF just-in-time compiler
 BPF_JITTER		opt_bpf.h

Modified: head/sys/dev/agp/agp.c
==============================================================================
--- head/sys/dev/agp/agp.c	Fri Feb  6 20:41:30 2009	(r188246)
+++ head/sys/dev/agp/agp.c	Fri Feb  6 20:57:10 2009	(r188247)
@@ -27,6 +27,7 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include "opt_agp.h"
 #include "opt_bus.h"
 
 #include <sys/param.h>
@@ -554,7 +555,7 @@ agp_generic_bind_memory(device_t dev, st
 		 */
 		m = vm_page_grab(mem->am_obj, OFF_TO_IDX(i),
 		    VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_RETRY);
-		AGP_DPF("found page pa=%#x\n", VM_PAGE_TO_PHYS(m));
+		AGP_DPF("found page pa=%#jx\n", (uintmax_t)VM_PAGE_TO_PHYS(m));
 	}
 	VM_OBJECT_UNLOCK(mem->am_obj);
 
@@ -585,8 +586,8 @@ agp_generic_bind_memory(device_t dev, st
 		for (j = 0; j < PAGE_SIZE && i + j < mem->am_size;
 		     j += AGP_PAGE_SIZE) {
 			vm_offset_t pa = VM_PAGE_TO_PHYS(m) + j;
-			AGP_DPF("binding offset %#x to pa %#x\n",
-				offset + i + j, pa);
+			AGP_DPF("binding offset %#jx to pa %#jx\n",
+				(uintmax_t)offset + i + j, (uintmax_t)pa);
 			error = AGP_BIND_PAGE(dev, offset + i + j, pa);
 			if (error) {
 				/*

Modified: head/sys/i386/conf/NOTES
==============================================================================
--- head/sys/i386/conf/NOTES	Fri Feb  6 20:41:30 2009	(r188246)
+++ head/sys/i386/conf/NOTES	Fri Feb  6 20:57:10 2009	(r188247)
@@ -347,6 +347,9 @@ device		pci
 # AGP GART support
 device		agp
 
+# AGP debugging.
+options		AGP_DEBUG
+
 
 #####################################################################
 # HARDWARE DEVICE CONFIGURATION

Modified: head/sys/pc98/conf/NOTES
==============================================================================
--- head/sys/pc98/conf/NOTES	Fri Feb  6 20:41:30 2009	(r188246)
+++ head/sys/pc98/conf/NOTES	Fri Feb  6 20:57:10 2009	(r188247)
@@ -288,6 +288,9 @@ device		pci
 # AGP GART support
 device		agp
 
+# AGP debugging.
+options		AGP_DEBUG
+
 
 #####################################################################
 # HARDWARE DEVICE CONFIGURATION

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 21:56:55 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E06A6106564A;
	Fri,  6 Feb 2009 21:56:55 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CE7D08FC14;
	Fri,  6 Feb 2009 21:56:55 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16LutiC072399;
	Fri, 6 Feb 2009 21:56:55 GMT (envelope-from wkoszek@svn.freebsd.org)
Received: (from wkoszek@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16Lut8x072398;
	Fri, 6 Feb 2009 21:56:55 GMT (envelope-from wkoszek@svn.freebsd.org)
Message-Id: <200902062156.n16Lut8x072398@svn.freebsd.org>
From: "Wojciech A. Koszek" <wkoszek@FreeBSD.org>
Date: Fri, 6 Feb 2009 21:56:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188249 - head/sys/amd64/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 21:56:56 -0000

Author: wkoszek
Date: Fri Feb  6 21:56:55 2009
New Revision: 188249
URL: http://svn.freebsd.org/changeset/base/188249

Log:
  ural(4) is already present in global NOTES, thus there is no
  need to explicitly list it here once again. This removes:
  
  	WARNING: duplicate option `DEV_URAL' encountered.
  	WARNING: duplicate device `ural' encountered.
  
  Warnings when compiling LINT on amd64.

Modified:
  head/sys/amd64/conf/NOTES

Modified: head/sys/amd64/conf/NOTES
==============================================================================
--- head/sys/amd64/conf/NOTES	Fri Feb  6 21:22:35 2009	(r188248)
+++ head/sys/amd64/conf/NOTES	Fri Feb  6 21:56:55 2009	(r188249)
@@ -272,7 +272,6 @@ options 	DRM_DEBUG	# Include debug print
 # nfe:	nVidia nForce MCP on-board Ethernet Networking (BSD open source)
 # nve:	nVidia nForce MCP on-board Ethernet Networking
 # ral:	Ralink Technology IEEE 802.11 wireless adapter
-# ural:	Ralink Technology RT2500USB IEEE 802.11 wireless adapter
 # wpi:	Intel 3945ABG Wireless LAN controller
 
 device		ed
@@ -285,7 +284,6 @@ device		ipw
 device		nfe		# nVidia nForce MCP on-board Ethernet Networking
 device		nve		# nVidia nForce MCP on-board Ethernet Networking
 device		ral
-device		ural
 device		wpi
 
 device		ath			# Atheros pci/cardbus NIC's

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 22:22:09 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3FDF11065672;
	Fri,  6 Feb 2009 22:22:09 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2E0AF8FC1E;
	Fri,  6 Feb 2009 22:22:09 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16MM9Va072915;
	Fri, 6 Feb 2009 22:22:09 GMT (envelope-from wkoszek@svn.freebsd.org)
Received: (from wkoszek@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16MM9xZ072914;
	Fri, 6 Feb 2009 22:22:09 GMT (envelope-from wkoszek@svn.freebsd.org)
Message-Id: <200902062222.n16MM9xZ072914@svn.freebsd.org>
From: "Wojciech A. Koszek" <wkoszek@FreeBSD.org>
Date: Fri, 6 Feb 2009 22:22:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188250 - head/sys/i386/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 22:22:09 -0000

Author: wkoszek
Date: Fri Feb  6 22:22:08 2009
New Revision: 188250
URL: http://svn.freebsd.org/changeset/base/188250

Log:
  Comment about ural(4) isn't approprate here, since the driver is present in
  global NOTES file.
  
  cx(4) driver isn't present in this file, though it could be. However, cx(4)
  seems to be more or less dead -- it hasn't been linked to the modules build,
  and after TTY-ng transformations it doesn't compile.
  
  Remove it until cx(4) is broken.

Modified:
  head/sys/i386/conf/NOTES

Modified: head/sys/i386/conf/NOTES
==============================================================================
--- head/sys/i386/conf/NOTES	Fri Feb  6 21:56:55 2009	(r188249)
+++ head/sys/i386/conf/NOTES	Fri Feb  6 22:22:08 2009	(r188250)
@@ -542,8 +542,6 @@ hint.mse.0.irq="5"
 # ctau: Cronyx Tau sync dual port V.35/RS-232/RS-530/RS-449/X.21/G.703/E1
 #       serial adaptor (requires sppp (default), or NETGRAPH if
 #       NETGRAPH_CRONYX is configured)
-# cx:   Cronyx Sigma multiport sync/async adapter (requires sppp (default),
-#       or NETGRAPH if NETGRAPH_CRONYX is configured)
 # ed:   Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503
 #       HP PC Lan+, various PC Card devices
 #       (requires miibus)
@@ -557,7 +555,6 @@ hint.mse.0.irq="5"
 # ral:	Ralink Technology IEEE 802.11 wireless adapter
 # sbni: Granch SBNI12-xx ISA and PCI adapters
 # sr:   RISCom/N2 hdlc sync 1/2 port V.35/X.21 serial driver (requires sppp)
-# ural:	Ralink Technology RT2500USB IEEE 802.11 wireless adapter
 # wl:   Lucent Wavelan (ISA card only).
 # wpi:	Intel 3945ABG Wireless LAN controller
 

From owner-svn-src-head@FreeBSD.ORG  Fri Feb  6 22:24:03 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 64231106566C;
	Fri,  6 Feb 2009 22:24:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 529FA8FC0C;
	Fri,  6 Feb 2009 22:24:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n16MO3WQ072996;
	Fri, 6 Feb 2009 22:24:03 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16MO3gm072994;
	Fri, 6 Feb 2009 22:24:03 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200902062224.n16MO3gm072994@svn.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
Date: Fri, 6 Feb 2009 22:24:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188251 - head/sys/fs/udf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2009 22:24:04 -0000

Author: jhb
Date: Fri Feb  6 22:24:03 2009
New Revision: 188251
URL: http://svn.freebsd.org/changeset/base/188251

Log:
  Add rudimentary support for symbolic links on UDF.  Links are stored as a
  sequence of pathname components.  We walk the list building a string in
  the caller's passed in buffer.  Currently this only handles path names
  in CS8 (character set 8) as that is what mkisofs generates for UDF images.
  
  MFC after:	1 month

Modified:
  head/sys/fs/udf/ecma167-udf.h
  head/sys/fs/udf/udf_vnops.c

Modified: head/sys/fs/udf/ecma167-udf.h
==============================================================================
--- head/sys/fs/udf/ecma167-udf.h	Fri Feb  6 22:22:08 2009	(r188250)
+++ head/sys/fs/udf/ecma167-udf.h	Fri Feb  6 22:24:03 2009	(r188251)
@@ -354,6 +354,18 @@ struct file_entry {
 #define	UDF_FENTRY_PERM_GRP_MASK	0xE0
 #define	UDF_FENTRY_PERM_OWNER_MASK	0x1C00
 
+/* Path Component [4/14.16.1] */
+struct path_component {
+	uint8_t			type;
+	uint8_t			length;
+	uint16_t		version;
+	uint8_t			identifier[0];
+} __packed;
+#define	UDF_PATH_ROOT		2
+#define	UDF_PATH_DOTDOT		3
+#define	UDF_PATH_DOT		4
+#define	UDF_PATH_PATH		5
+
 union dscrptr {
 	struct desc_tag		tag;
 	struct anchor_vdp	avdp;

Modified: head/sys/fs/udf/udf_vnops.c
==============================================================================
--- head/sys/fs/udf/udf_vnops.c	Fri Feb  6 22:22:08 2009	(r188250)
+++ head/sys/fs/udf/udf_vnops.c	Fri Feb  6 22:24:03 2009	(r188251)
@@ -859,12 +859,121 @@ udf_readdir(struct vop_readdir_args *a)
 	return (error);
 }
 
-/* Are there any implementations out there that do soft-links? */
 static int
 udf_readlink(struct vop_readlink_args *ap)
 {
-	printf("%s called\n", __func__);
-	return (EOPNOTSUPP);
+	struct path_component *pc, *end;
+	struct vnode *vp;
+	struct uio uio;
+	struct iovec iov[1];
+	struct udf_node *node;
+	void *buf;
+	char *cp;
+	int error, len, root;
+
+	/*
+	 * A symbolic link in UDF is a list of variable-length path
+	 * component structures.  We build a pathname in the caller's
+	 * uio by traversing this list.
+	 */
+	vp = ap->a_vp;
+	node = VTON(vp);
+	len = le64toh(node->fentry->inf_len);
+	buf = malloc(iov[0].iov_len, M_DEVBUF, M_WAITOK);
+	iov[0].iov_base = buf;
+	iov[0].iov_len = len;
+	uio.uio_iov = iov;
+	uio.uio_iovcnt = 1;
+	uio.uio_offset = 0;
+	uio.uio_resid = iov[0].iov_len;
+	uio.uio_segflg = UIO_SYSSPACE;
+	uio.uio_rw = UIO_READ;
+	uio.uio_td = curthread;
+	error = VOP_READ(vp, &uio, 0, ap->a_cred);
+	if (error)
+		goto error;
+
+	pc = buf;
+	end = (void *)((char *)buf + len);
+	root = 0;
+	while (pc < end) {
+		switch (pc->type) {
+		case UDF_PATH_ROOT:
+			/* Only allow this at the beginning of a path. */
+			if ((void *)pc != buf) {
+				error = EINVAL;
+				goto error;
+			}
+			cp = "/";
+			len = 1;
+			root = 1;
+			break;
+		case UDF_PATH_DOT:
+			cp = ".";
+			len = 1;
+			break;
+		case UDF_PATH_DOTDOT:
+			cp = "..";
+			len = 2;
+			break;
+		case UDF_PATH_PATH:
+			if (pc->length == 0) {
+				error = EINVAL;
+				goto error;
+			}
+			/*
+			 * XXX: We only support CS8 which appears to map
+			 * to ASCII directly.
+			 */
+			switch (pc->identifier[0]) {
+			case 8:
+				cp = pc->identifier + 1;
+				len = pc->length - 1;
+				break;
+			default:
+				error = EOPNOTSUPP;
+				goto error;
+			}
+			break;
+		default:
+			error = EINVAL;
+			goto error;
+		}
+
+		/*
+		 * If this is not the first component, insert a path
+		 * separator.
+		 */
+		if (pc != buf) {
+			/* If we started with root we already have a "/". */
+			if (root)
+				goto skipslash;
+			root = 0;
+			if (ap->a_uio->uio_resid < 1) {
+				error = ENAMETOOLONG;
+				goto error;
+			}
+			error = uiomove("/", 1, ap->a_uio);
+			if (error)
+				break;
+		}
+	skipslash:
+
+		/* Append string at 'cp' of length 'len' to our path. */
+		if (len > ap->a_uio->uio_resid) {
+			error = ENAMETOOLONG;
+			goto error;
+		}
+		error = uiomove(cp, len, ap->a_uio);
+		if (error)
+			break;
+
+		/* Advance to next component. */
+		pc = (void *)((char *)pc + 4 + pc->length);
+	}
+error:
+	free(buf, M_DEVBUF);
+	return (error);
 }
 
 static int

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 00:01:11 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 40B8910656E6;
	Sat,  7 Feb 2009 00:01:11 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2DFF28FC0A;
	Sat,  7 Feb 2009 00:01:11 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1701BtB074971;
	Sat, 7 Feb 2009 00:01:11 GMT (envelope-from wkoszek@svn.freebsd.org)
Received: (from wkoszek@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1701B4s074970;
	Sat, 7 Feb 2009 00:01:11 GMT (envelope-from wkoszek@svn.freebsd.org)
Message-Id: <200902070001.n1701B4s074970@svn.freebsd.org>
From: "Wojciech A. Koszek" <wkoszek@FreeBSD.org>
Date: Sat, 7 Feb 2009 00:01:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188254 - head/sys/amd64/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 00:01:12 -0000

Author: wkoszek
Date: Sat Feb  7 00:01:10 2009
New Revision: 188254
URL: http://svn.freebsd.org/changeset/base/188254

Log:
  Tidy NOTES a bit:
  - remove misleading nve/nfe comments, which make it hard to
    distinguish those two at a first glance
  - bring pbio documentation to the block comment together with
    other drivers
  
  I also brought commented out line responsible for si(4), since it
  seems to compile and already has respective comment in this file.

Modified:
  head/sys/amd64/conf/NOTES

Modified: head/sys/amd64/conf/NOTES
==============================================================================
--- head/sys/amd64/conf/NOTES	Fri Feb  6 23:56:02 2009	(r188253)
+++ head/sys/amd64/conf/NOTES	Sat Feb  7 00:01:10 2009	(r188254)
@@ -281,8 +281,8 @@ options 	ED_SIC
 device		iwi
 device		iwn
 device		ipw
-device		nfe		# nVidia nForce MCP on-board Ethernet Networking
-device		nve		# nVidia nForce MCP on-board Ethernet Networking
+device		nfe
+device		nve
 device		ral
 device		wpi
 
@@ -359,9 +359,11 @@ options 	SAFE_RNDTEST	# enable rndtest s
 # Miscellaneous hardware:
 #
 # ipmi: Intelligent Platform Management Interface
+# pbio: Parallel (8255 PPI) basic I/O (mode 0) port (e.g. Advantech PCL-724)
 # smbios: DMI/SMBIOS entry point
 # vpd: Vital Product Data kernel interface
 # asmc: Apple System Management Controller
+# si: Specialix International SI/XIO or SX intelligent serial card
 
 # Notes on the Specialix SI/XIO driver:
 #  The host card is memory, not IO mapped.
@@ -370,13 +372,14 @@ options 	SAFE_RNDTEST	# enable rndtest s
 #  The cards can use an IRQ of 11, 12 or 15.
 
 device		ipmi
-# Parallel (8255 PPI) basic I/O (mode 0) port (e.g. Advantech PCL-724)
 device		pbio
 hint.pbio.0.at="isa"
 hint.pbio.0.port="0x360"
 device		smbios
 device		vpd
 device		asmc
+#device		si
+
 #
 # Laptop/Notebook options:
 #

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 00:06:14 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 53E581065761;
	Sat,  7 Feb 2009 00:06:14 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 40FCC8FC08;
	Sat,  7 Feb 2009 00:06:14 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1706EaX075151;
	Sat, 7 Feb 2009 00:06:14 GMT (envelope-from wkoszek@svn.freebsd.org)
Received: (from wkoszek@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1706EZJ075150;
	Sat, 7 Feb 2009 00:06:14 GMT (envelope-from wkoszek@svn.freebsd.org)
Message-Id: <200902070006.n1706EZJ075150@svn.freebsd.org>
From: "Wojciech A. Koszek" <wkoszek@FreeBSD.org>
Date: Sat, 7 Feb 2009 00:06:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188256 - head/sys/i386/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 00:06:15 -0000

Author: wkoszek
Date: Sat Feb  7 00:06:13 2009
New Revision: 188256
URL: http://svn.freebsd.org/changeset/base/188256

Log:
  Tidy NOTES a bit:
  - leave pmtimer comment that is common to other architectures.
  - bring pbio explanation to the block comment relating to other
    drivers in the same block.

Modified:
  head/sys/i386/conf/NOTES

Modified: head/sys/i386/conf/NOTES
==============================================================================
--- head/sys/i386/conf/NOTES	Sat Feb  7 00:05:10 2009	(r188255)
+++ head/sys/i386/conf/NOTES	Sat Feb  7 00:06:13 2009	(r188256)
@@ -714,10 +714,11 @@ device		glxsb		# AMD Geode LX Security B
 #
 # apm: Laptop Advanced Power Management (experimental)
 # ipmi: Intelligent Platform Management Interface
-# pmtimer: Timer device driver for power management events (APM or ACPI)
 # smapi: System Management Application Program Interface driver
 # smbios: DMI/SMBIOS entry point
 # vpd: Vital Product Data kernel interface
+# pmtimer: Adjust system timer at wakeup time
+# pbio: Parallel (8255 PPI) basic I/O (mode 0) port (e.g. Advantech PCL-724)
 # spic: Sony Programmable I/O controller (VAIO notebooks)
 # asmc: Apple System Management Controller
 
@@ -749,8 +750,7 @@ device		ipmi
 device		smapi
 device		smbios
 device		vpd
-device		pmtimer			# Adjust system timer at wakeup time
-# Parallel (8255 PPI) basic I/O (mode 0) port (e.g. Advantech PCL-724)
+device		pmtimer
 device		pbio
 hint.pbio.0.at="isa"
 hint.pbio.0.port="0x360"

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 00:15:31 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0210F106568E;
	Sat,  7 Feb 2009 00:15:31 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DAA4D8FC19;
	Sat,  7 Feb 2009 00:15:30 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n170FUEM075373;
	Sat, 7 Feb 2009 00:15:30 GMT (envelope-from wkoszek@svn.freebsd.org)
Received: (from wkoszek@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n170FU58075372;
	Sat, 7 Feb 2009 00:15:30 GMT (envelope-from wkoszek@svn.freebsd.org)
Message-Id: <200902070015.n170FU58075372@svn.freebsd.org>
From: "Wojciech A. Koszek" <wkoszek@FreeBSD.org>
Date: Sat, 7 Feb 2009 00:15:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188257 - head/sys/pc98/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 00:15:31 -0000

Author: wkoszek
Date: Sat Feb  7 00:15:30 2009
New Revision: 188257
URL: http://svn.freebsd.org/changeset/base/188257

Log:
  Tidy NOTES a bit:
  - ath(4) is the last listed device, so make it's comment last as well
  - since we have hints for le(4), bring it back by inserting commented
    out line until I check, if it can be safely enabled.
  - bring snc(4) explanation
  - put pmtimer comment together with other drivers' comments in a block
  - bring comments for canbus, canbepm, pmc
  
  olpt comment has been left blank, since I don't know how does this
  driver differ from other printer drivers.

Modified:
  head/sys/pc98/conf/NOTES

Modified: head/sys/pc98/conf/NOTES
==============================================================================
--- head/sys/pc98/conf/NOTES	Sat Feb  7 00:06:13 2009	(r188256)
+++ head/sys/pc98/conf/NOTES	Sat Feb  7 00:15:30 2009	(r188257)
@@ -271,6 +271,9 @@ device		isa
 # BROKEN_KEYBOARD_RESET disables the use of the keyboard controller to
 # reset the CPU for reboot.  This is needed on some systems with broken
 # keyboard controllers.
+#
+# EPSON_BOUNCEDMA: XXX
+# EPSON_MEMWIN: XXX
 
 options 	AUTO_EOI_1
 
@@ -368,7 +371,6 @@ hint.mse.0.irq="13"
 
 # ar:   Arnet SYNC/570i hdlc sync 2/4 port V.35/X.21 serial driver
 #       (requires sppp)
-# ath:  Atheros a/b/g WiFi adapters (requires ath_hal and wlan)
 # ce:   Cronyx Tau-PCI/32 sync single/dual port G.703/E1 serial adaptor
 #       with 32 HDLC subchannels (requires sppp (default), or NETGRAPH if
 #       NETGRAPH_CRONYX is configured)
@@ -382,10 +384,13 @@ hint.mse.0.irq="13"
 #       (requires miibus)
 # ie:   AT&T StarLAN 10 and EN100; 3Com 3C507; unknown NI5210;
 #       Intel EtherExpress
+# le:	AMD Am7900 LANCE and Am79C9xx ILACC/PCnet Ethernet interface driver
 # ral:	Ralink Technology IEEE 802.11 wireless adapter
 # sbni: Granch SBNI12-xx ISA and PCI adapters
+# snc:	National Semiconductor DP8393X SONIC Ethernet adapter driver
 # sr:   RISCom/N2 hdlc sync 1/2 port V.35/X.21 serial driver (requires sppp)
 # ural:	Ralink Technology RT2500USB IEEE 802.11 wireless adapter
+# ath:  Atheros a/b/g WiFi adapters (requires ath_hal and wlan)
 
 # Order for ISA/EISA devices is important here
 
@@ -403,6 +408,7 @@ hint.ie.2.at="isa"
 hint.ie.2.port="0x300"
 hint.ie.2.irq="5"
 hint.ie.2.maddr="0xd0000"
+#device		le
 # Hint for the PC98-only C-NET(98)S C-bus front-end of le(4).
 hint.le.0.at="isa"
 hint.le.0.port="0x03d0"
@@ -464,8 +470,13 @@ options 	SAFE_RNDTEST	# enable rndtest s
 # Miscellaneous hardware:
 #
 # apm: Laptop Advanced Power Management (experimental)
+# canbus: CanBe I/O Bus
+# canbepm: CanBe Power Management Controller
+# olpt: XXX
+# pmc: Power Management Controller of NEC PC-98Note
 # pmtimer: Timer device driver for power management events (APM or ACPI)
-
+#          Adjusts system timer at wakeup time
+#
 # Notes on APM
 #  The flags takes the following meaning for apm0:
 #    0x0020  Statclock is broken.
@@ -480,7 +491,7 @@ hint.olpt.0.port="0x040"
 device		pmc
 hint.pmc.0.at="isa"
 hint.pmc.0.port="0x8f0"
-device		pmtimer			# Adjust system timer at wakeup time
+device		pmtimer
 
 #
 # Laptop/Notebook options:

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 00:52:13 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7E6F8106566B;
	Sat,  7 Feb 2009 00:52:13 +0000 (UTC)
	(envelope-from wkoszek@freebsd.czest.pl)
Received: from freebsd.czest.pl (l95h.icis.pcz.pl [212.87.224.105])
	by mx1.freebsd.org (Postfix) with ESMTP id 072AB8FC13;
	Sat,  7 Feb 2009 00:52:12 +0000 (UTC)
	(envelope-from wkoszek@freebsd.czest.pl)
Received: from freebsd.czest.pl (l95h.icis.pcz.pl [212.87.224.105])
	by freebsd.czest.pl (8.14.2/8.14.2) with ESMTP id n16NsOYg034631;
	Fri, 6 Feb 2009 23:54:24 GMT (envelope-from wkoszek@freebsd.czest.pl)
Received: (from wkoszek@localhost)
	by freebsd.czest.pl (8.14.2/8.14.2/Submit) id n16NsOap034630;
	Fri, 6 Feb 2009 23:54:24 GMT (envelope-from wkoszek)
Date: Fri, 6 Feb 2009 23:54:24 +0000
From: "Wojciech A. Koszek" <wkoszek@FreeBSD.org>
To: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org,
	svn-src-head@FreeBSD.org
Message-ID: <20090206235424.GK83537@FreeBSD.org>
Mail-Followup-To: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org,
	svn-src-head@FreeBSD.org
References: <200902070015.n170FU58075372@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
In-Reply-To: <200902070015.n170FU58075372@svn.freebsd.org>
User-Agent: Mutt/1.5.17 (2007-11-01)
X-Greylist: Sender DNS name whitelisted, not delayed by milter-greylist-3.0
	(freebsd.czest.pl [212.87.224.105]);
	Fri, 06 Feb 2009 23:54:24 +0000 (UTC)
Cc: 
Subject: Re: svn commit: r188257 - head/sys/pc98/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 00:52:13 -0000

On Sat, Feb 07, 2009 at 12:15:30AM +0000, Wojciech A. Koszek wrote:
> Author: wkoszek
> Date: Sat Feb  7 00:15:30 2009
> New Revision: 188257
> URL: http://svn.freebsd.org/changeset/base/188257
> 

[..]
> Modified: head/sys/pc98/conf/NOTES
> ==============================================================================
> --- head/sys/pc98/conf/NOTES	Sat Feb  7 00:06:13 2009	(r188256)
> +++ head/sys/pc98/conf/NOTES	Sat Feb  7 00:15:30 2009	(r188257)
> @@ -271,6 +271,9 @@ device		isa
>  # BROKEN_KEYBOARD_RESET disables the use of the keyboard controller to
>  # reset the CPU for reboot.  This is needed on some systems with broken
>  # keyboard controllers.
> +#
> +# EPSON_BOUNCEDMA: XXX
> +# EPSON_MEMWIN: XXX

Those had no respective comment lines, and I didn't know what those options do.
I expect someone to fill those, or at least present 'ready to commit' comments
on what they do.

-- 
Wojciech A. Koszek
wkoszek@FreeBSD.org
http://people.freebsd.org/~wkoszek/

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 01:12:52 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 73D0E106566B;
	Sat,  7 Feb 2009 01:12:52 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 615468FC17;
	Sat,  7 Feb 2009 01:12:52 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n171Cq6c076471;
	Sat, 7 Feb 2009 01:12:52 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n171CpZg076468;
	Sat, 7 Feb 2009 01:12:51 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902070112.n171CpZg076468@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Sat, 7 Feb 2009 01:12:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188258 - head/sbin/ifconfig
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 01:12:52 -0000

Author: sam
Date: Sat Feb  7 01:12:51 2009
New Revision: 188258
URL: http://svn.freebsd.org/changeset/base/188258

Log:
  Regulatory fixups:
  o add missing channel flags for ECM, indoor, and outdoor constraints
  o use HT capabilities to short-circuit HT20/HT40 channel construction
  o rewrite 1/2 and 1/4 width channel handling yet again; previously
    we assumed there was a full-width version of the channel in the
    calibration table but that's not always true (e.g. for the Public
    Safety Band), now we first check the calibration table for the
    exact channel we want then fall back to the heuristics we used before
  o fix HT channel construction; wasn't adjusting band edges for HT40
    channel bandwidth requirements

Modified:
  head/sbin/ifconfig/ifieee80211.c
  head/sbin/ifconfig/regdomain.c
  head/sbin/ifconfig/regdomain.h

Modified: head/sbin/ifconfig/ifieee80211.c
==============================================================================
--- head/sbin/ifconfig/ifieee80211.c	Sat Feb  7 00:15:30 2009	(r188257)
+++ head/sbin/ifconfig/ifieee80211.c	Sat Feb  7 01:12:51 2009	(r188258)
@@ -99,10 +99,6 @@
 #define	IEEE80211_FIXED_RATE_NONE	0xff
 #endif
 
-#define	REQ_ECM		0x01000000	/* enable if ECM set */
-#define	REQ_OUTDOOR	0x02000000	/* enable for outdoor operation */
-#define	REQ_FLAGS	0xff000000	/* private flags, don't pass to os */
-
 /* XXX need these publicly defined or similar */
 #ifndef IEEE80211_NODE_AUTH
 #define	IEEE80211_NODE_AUTH	0x0001		/* authorized for data */
@@ -1802,6 +1798,57 @@ chanfind(const struct ieee80211_channel 
 	return 0;
 }
 
+/*
+ * Check channel compatibility.
+ */
+static int
+checkchan(const struct ieee80211req_chaninfo *avail, int freq, int flags)
+{
+	flags &= ~REQ_FLAGS;
+	/*
+	 * Check if exact channel is in the calibration table;
+	 * everything below is to deal with channels that we
+	 * want to include but that are not explicitly listed.
+	 */
+	if (flags & IEEE80211_CHAN_HT40) {
+		/* NB: we use an HT40 channel center that matches HT20 */
+		flags = (flags &~ IEEE80211_CHAN_HT40) | IEEE80211_CHAN_HT20;
+	}
+	if (chanlookup(avail->ic_chans, avail->ic_nchans, freq, flags) != NULL)
+		return 1;
+	if (flags & IEEE80211_CHAN_GSM) {
+		/*
+		 * XXX GSM frequency mapping is handled in the kernel
+		 * so we cannot find them in the calibration table;
+		 * just accept the channel and the kernel will reject
+		 * the channel list if it's wrong.
+		 */
+		return 1;
+	}
+	/*
+	 * If this is a 1/2 or 1/4 width channel allow it if a full
+	 * width channel is present for this frequency, and the device
+	 * supports fractional channels on this band.  This is a hack
+	 * that avoids bloating the calibration table; it may be better
+	 * by per-band attributes though (we are effectively calculating
+	 * this attribute by scanning the channel list ourself).
+	 */
+	if ((flags & (IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER)) == 0)
+		return 0;
+	if (chanlookup(avail->ic_chans, avail->ic_nchans, freq,
+	    flags &~ (IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER)) == NULL)
+		return 0;
+	if (flags & IEEE80211_CHAN_HALF) {
+		return chanfind(avail->ic_chans, avail->ic_nchans,
+		    IEEE80211_CHAN_HALF |
+		       (flags & (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ)));
+	} else {
+		return chanfind(avail->ic_chans, avail->ic_nchans,
+		    IEEE80211_CHAN_QUARTER |
+			(flags & (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ)));
+	}
+}
+
 static void
 regdomain_addchans(struct ieee80211req_chaninfo *ci,
 	const netband_head *bands,
@@ -1812,15 +1859,12 @@ regdomain_addchans(struct ieee80211req_c
 	const struct netband *nb;
 	const struct freqband *b;
 	struct ieee80211_channel *c, *prev;
-	int freq, channelSep, hasHalfChans, hasQuarterChans;
+	int freq, hi_adj, lo_adj, channelSep;
+	uint32_t flags;
 
+	hi_adj = (chanFlags & IEEE80211_CHAN_HT40U) ? -20 : 0;
+	lo_adj = (chanFlags & IEEE80211_CHAN_HT40D) ? 20 : 0;
 	channelSep = (chanFlags & IEEE80211_CHAN_2GHZ) ? 0 : 40;
-	hasHalfChans = chanfind(avail->ic_chans, avail->ic_nchans,
-	    IEEE80211_CHAN_HALF |
-	       (chanFlags & (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ)));
-	hasQuarterChans = chanfind(avail->ic_chans, avail->ic_nchans,
-	    IEEE80211_CHAN_QUARTER |
-	        (chanFlags & (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ)));
 	LIST_FOREACH(nb, bands, next) {
 		b = nb->band;
 		if (verbose) {
@@ -1831,63 +1875,80 @@ regdomain_addchans(struct ieee80211req_c
 			putchar('\n');
 		}
 		prev = NULL;
-		for (freq = b->freqStart; freq <= b->freqEnd; freq += b->chanSep) {
-			uint32_t flags = nb->flags | b->flags;
-
-			/* check if device can operate on this frequency */
+		for (freq = b->freqStart + lo_adj;
+		     freq <= b->freqEnd + hi_adj; freq += b->chanSep) {
+			/*
+			 * Construct flags for the new channel.  We take
+			 * the attributes from the band descriptions except
+			 * for HT40 which is enabled generically (i.e. +/-
+			 * extension channel) in the band description and
+			 * then constrained according by channel separation.
+			 */
+			flags = nb->flags | b->flags;
+			if (flags & IEEE80211_CHAN_HT) {
+				/*
+				 * HT channels are generated specially; we're
+				 * called to add HT20, HT40+, and HT40- chan's
+				 * so we need to expand only band specs for
+				 * the HT channel type being added.
+				 */
+				if ((chanFlags & IEEE80211_CHAN_HT20) &&
+				    (flags & IEEE80211_CHAN_HT20) == 0) {
+					if (verbose)
+						printf("%u: skip, not an "
+						    "HT20 channel\n", freq);
+					continue;
+				}
+				if ((chanFlags & IEEE80211_CHAN_HT40) &&
+				    (flags & IEEE80211_CHAN_HT40) == 0) {
+					if (verbose)
+						printf("%u: skip, not an "
+						    "HT40 channel\n", freq);
+					continue;
+				}
+				/*
+				 * DFS and HT40 don't mix.  This should be
+				 * expressed in the regdomain database but
+				 * just in case enforce it here.
+				 */
+				if ((chanFlags & IEEE80211_CHAN_HT40) &&
+				    (flags & IEEE80211_CHAN_DFS)) {
+					if (verbose)
+						printf("%u: skip, HT40+DFS "
+						    "not permitted\n", freq);
+					continue;
+				}
+				/* NB: HT attribute comes from caller */
+				flags &= ~IEEE80211_CHAN_HT;
+				flags |= chanFlags & IEEE80211_CHAN_HT;
+			}
 			/*
-			 * XXX GSM frequency mapping is handled in the kernel
-			 * so we cannot find them in the calibration table;
-			 * just construct the list and the kernel will reject
-			 * if it's wrong.
+			 * Check if device can operate on this frequency.
 			 */
-			if (chanlookup(avail->ic_chans, avail->ic_nchans, freq, chanFlags) == NULL &&
-			    (flags & IEEE80211_CHAN_GSM) == 0) {
+			if (!checkchan(avail, freq, flags)) {
 				if (verbose) {
 					printf("%u: skip, ", freq);
-					printb("flags", chanFlags,
+					printb("flags", flags,
 					    IEEE80211_CHAN_BITS);
 					printf(" not available\n");
 				}
 				continue;
 			}
-			if ((flags & IEEE80211_CHAN_HALF) && !hasHalfChans) {
+			if ((flags & REQ_ECM) && !reg->ecm) {
 				if (verbose)
-					printf("%u: skip, device does not "
-					    "support half-rate channel\n",
-					    freq);
+					printf("%u: skip, ECM channel\n", freq);
 				continue;
 			}
-			if ((flags & IEEE80211_CHAN_QUARTER) &&
-			    !hasQuarterChans) {
+			if ((flags & REQ_INDOOR) && reg->location == 'O') {
 				if (verbose)
-					printf("%u: skip, device does not "
-					    "support quarter-rate channel\n",
+					printf("%u: skip, indoor channel\n",
 					    freq);
 				continue;
 			}
-			if ((flags & IEEE80211_CHAN_HT20) &&
-			    (chanFlags & IEEE80211_CHAN_HT20) == 0) {
-				if (verbose)
-					printf("%u: skip, device does not "
-					    "support HT20 operation\n", freq);
-				continue;
-			}
-			if ((flags & IEEE80211_CHAN_HT40) &&
-			    (chanFlags & IEEE80211_CHAN_HT40) == 0) {
-				if (verbose)
-					printf("%u: skip, device does not "
-					    "support HT40 operation\n", freq);
-				continue;
-			}
-			if ((flags & REQ_ECM) && !reg->ecm) {
-				if (verbose)
-					printf("%u: skip, ECM channel\n", freq);
-				continue;
-			}
 			if ((flags & REQ_OUTDOOR) && reg->location == 'I') {
 				if (verbose)
-					printf("%u: skip, outdoor channel\n", freq);
+					printf("%u: skip, outdoor channel\n",
+					    freq);
 				continue;
 			}
 			if ((flags & IEEE80211_CHAN_HT40) &&
@@ -1907,8 +1968,7 @@ regdomain_addchans(struct ieee80211req_c
 			c = &ci->ic_chans[ci->ic_nchans++];
 			memset(c, 0, sizeof(*c));
 			c->ic_freq = freq;
-			c->ic_flags = chanFlags |
-			    (flags &~ (REQ_FLAGS | IEEE80211_CHAN_HT40));
+			c->ic_flags = flags;
 			if (c->ic_flags & IEEE80211_CHAN_DFS)
 				c->ic_maxregpower = nb->maxPowerDFS;
 			else
@@ -1973,27 +2033,31 @@ regdomain_makechannels(
 		if (!LIST_EMPTY(&rd->bands_11a))
 			regdomain_addchans(ci, &rd->bands_11a, reg,
 			    IEEE80211_CHAN_A, &dc->dc_chaninfo);
-		if (!LIST_EMPTY(&rd->bands_11na)) {
+		if (!LIST_EMPTY(&rd->bands_11na) && dc->dc_htcaps != 0) {
 			regdomain_addchans(ci, &rd->bands_11na, reg,
 			    IEEE80211_CHAN_A | IEEE80211_CHAN_HT20,
 			    &dc->dc_chaninfo);
-			regdomain_addchans(ci, &rd->bands_11na, reg,
-			    IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U,
-			    &dc->dc_chaninfo);
-			regdomain_addchans(ci, &rd->bands_11na, reg,
-			    IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D,
-			    &dc->dc_chaninfo);
+			if (dc->dc_htcaps & IEEE80211_HTCAP_CHWIDTH40) {
+				regdomain_addchans(ci, &rd->bands_11na, reg,
+				    IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U,
+				    &dc->dc_chaninfo);
+				regdomain_addchans(ci, &rd->bands_11na, reg,
+				    IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D,
+				    &dc->dc_chaninfo);
+			}
 		}
-		if (!LIST_EMPTY(&rd->bands_11ng)) {
+		if (!LIST_EMPTY(&rd->bands_11ng) && dc->dc_htcaps != 0) {
 			regdomain_addchans(ci, &rd->bands_11ng, reg,
 			    IEEE80211_CHAN_G | IEEE80211_CHAN_HT20,
 			    &dc->dc_chaninfo);
-			regdomain_addchans(ci, &rd->bands_11ng, reg,
-			    IEEE80211_CHAN_G | IEEE80211_CHAN_HT40U,
-			    &dc->dc_chaninfo);
-			regdomain_addchans(ci, &rd->bands_11ng, reg,
-			    IEEE80211_CHAN_G | IEEE80211_CHAN_HT40D,
-			    &dc->dc_chaninfo);
+			if (dc->dc_htcaps & IEEE80211_HTCAP_CHWIDTH40) {
+				regdomain_addchans(ci, &rd->bands_11ng, reg,
+				    IEEE80211_CHAN_G | IEEE80211_CHAN_HT40U,
+				    &dc->dc_chaninfo);
+				regdomain_addchans(ci, &rd->bands_11ng, reg,
+				    IEEE80211_CHAN_G | IEEE80211_CHAN_HT40D,
+				    &dc->dc_chaninfo);
+			}
 		}
 		qsort(ci->ic_chans, ci->ic_nchans, sizeof(ci->ic_chans[0]),
 		    regdomain_sort);

Modified: head/sbin/ifconfig/regdomain.c
==============================================================================
--- head/sbin/ifconfig/regdomain.c	Sat Feb  7 00:15:30 2009	(r188257)
+++ head/sbin/ifconfig/regdomain.c	Sat Feb  7 01:12:51 2009	(r188258)
@@ -208,6 +208,9 @@ decode_flag(struct mystate *mt, const ch
 		FLAG(IEEE80211_CHAN_108A),
 		FLAG(IEEE80211_CHAN_108G),
 #undef FLAG
+		{ "ECM",	3,	REQ_ECM },
+		{ "INDOOR",	6,	REQ_INDOOR },
+		{ "OUTDOOR",	7,	REQ_OUTDOOR },
 	};
 	int i;
 

Modified: head/sbin/ifconfig/regdomain.h
==============================================================================
--- head/sbin/ifconfig/regdomain.h	Sat Feb  7 00:15:30 2009	(r188257)
+++ head/sbin/ifconfig/regdomain.h	Sat Feb  7 01:12:51 2009	(r188258)
@@ -45,6 +45,13 @@ struct freqband {
 	LIST_ENTRY(freqband) next;
 };
 
+/* private flags, don't pass to os */
+#define	REQ_ECM		0x1		/* enable if ECM set */
+#define	REQ_INDOOR	0x2		/* enable only for indoor operation */
+#define	REQ_OUTDOOR	0x4		/* enable only for outdoor operation */
+
+#define	REQ_FLAGS	(REQ_ECM|REQ_INDOOR|REQ_OUTDOOR)
+
 struct netband {
 	const struct freqband *band;	/* channel list description */
 	uint8_t		maxPower;	/* regulatory cap on tx power (dBm) */

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 01:15:14 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1A3491065670;
	Sat,  7 Feb 2009 01:15:14 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 06A9B8FC1D;
	Sat,  7 Feb 2009 01:15:14 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n171FDVi076559;
	Sat, 7 Feb 2009 01:15:13 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n171FD48076553;
	Sat, 7 Feb 2009 01:15:13 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <200902070115.n171FD48076553@svn.freebsd.org>
From: Nathan Whitehorn <nwhitehorn@FreeBSD.org>
Date: Sat, 7 Feb 2009 01:15:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188259 - head/sys/dev/sound/macio
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 01:15:14 -0000

Author: nwhitehorn
Date: Sat Feb  7 01:15:13 2009
New Revision: 188259
URL: http://svn.freebsd.org/changeset/base/188259

Log:
  Rearrange this code slightly to pass softcs around instead of device_t,
  solving a possible panic when snd_ai2s is loaded at boot time. Also change
  the device setup to indicate to the pcm layer that the device is MPSAFE.
  
  Submitted by:	Marco Trillo
  Suggestions by: Ariff Abdullah

Modified:
  head/sys/dev/sound/macio/aoa.c
  head/sys/dev/sound/macio/aoa.h
  head/sys/dev/sound/macio/davbus.c
  head/sys/dev/sound/macio/i2s.c
  head/sys/dev/sound/macio/snapper.c
  head/sys/dev/sound/macio/tumbler.c

Modified: head/sys/dev/sound/macio/aoa.c
==============================================================================
--- head/sys/dev/sound/macio/aoa.c	Sat Feb  7 01:12:51 2009	(r188258)
+++ head/sys/dev/sound/macio/aoa.c	Sat Feb  7 01:15:13 2009	(r188259)
@@ -104,13 +104,14 @@ aoa_dma_set_program(struct aoa_dma *dma)
 #define AOA_BUFFER_SIZE		65536
 
 static struct aoa_dma * 
-aoa_dma_create(device_t self)
+aoa_dma_create(struct aoa_softc *sc)
 {
-	struct aoa_softc *sc = pcm_getdevinfo(self);
 	struct aoa_dma *dma;
 	bus_dma_tag_t 	tag;
 	int 		err;
+	device_t	self;
 
+	self = sc->sc_dev;
 	err = bus_dma_tag_create(bus_get_dma_tag(self), 
 	    4, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, 
 	    AOA_BUFFER_SIZE, 1, AOA_BUFFER_SIZE, 0, NULL, NULL, &tag);
@@ -214,14 +215,13 @@ static void *
 aoa_chan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, 
 	struct pcm_channel *c, int dir)
 {
-	device_t 		 self = devinfo;
-	struct aoa_softc 	*sc = pcm_getdevinfo(self);
+	struct aoa_softc 	*sc = devinfo;
 	struct aoa_dma		*dma;
 	int 	 		 max_slots, err;
 
 	KASSERT(dir == PCMDIR_PLAY, ("bad dir"));
 
-	dma = aoa_dma_create(self);
+	dma = aoa_dma_create(sc);
 	if (!dma)
 		return (NULL);
 	dma->pcm = c;
@@ -230,7 +230,7 @@ aoa_chan_init(kobj_t obj, void *devinfo,
 
 	/* One slot per block, plus branch to 0 plus STOP. */
 	max_slots = 2 + dma->bufsz / dma->blksz;
-	err = dbdma_allocate_channel(dma->reg, 0, bus_get_dma_tag(self),
+	err = dbdma_allocate_channel(dma->reg, 0, bus_get_dma_tag(sc->sc_dev),
 	    max_slots, &dma->channel );
 	if (err != 0) {
 		aoa_dma_delete(dma);
@@ -308,9 +308,9 @@ aoa_chan_free(kobj_t obj, void *data)
 }
 
 void 
-aoa_interrupt(void *arg)
+aoa_interrupt(void *xsc)
 {
-	struct aoa_softc	*sc = arg;
+	struct aoa_softc	*sc = xsc;
 	struct aoa_dma		*dma;
 
 	if (!(dma = sc->sc_intrp) || !dma->running)
@@ -357,11 +357,16 @@ static kobj_method_t aoa_chan_methods[] 
 CHANNEL_DECLARE(aoa_chan);
 
 int
-aoa_attach(device_t self, void *sc)
+aoa_attach(void *xsc)
 {
 	char status[SND_STATUSLEN];
+	struct aoa_softc *sc;
+	device_t self;
 	int err;
 
+	sc = xsc;
+	self = sc->sc_dev;
+
 	if (pcm_register(self, sc, 1, 0))
 		return (ENXIO);
 
@@ -369,7 +374,7 @@ aoa_attach(device_t self, void *sc)
 	    AOA_BUFFER_SIZE);
 	DPRINTF(("pcm_getbuffersize returned %d\n", err));
 
-	pcm_addchan(self, PCMDIR_PLAY, &aoa_chan_class, self);
+	pcm_addchan(self, PCMDIR_PLAY, &aoa_chan_class, sc);
 
 	snprintf(status, sizeof(status), "at %s", ofw_bus_get_name(self)); 
 	pcm_setstatus(self, status);

Modified: head/sys/dev/sound/macio/aoa.h
==============================================================================
--- head/sys/dev/sound/macio/aoa.h	Sat Feb  7 01:12:51 2009	(r188258)
+++ head/sys/dev/sound/macio/aoa.h	Sat Feb  7 01:15:13 2009	(r188259)
@@ -35,12 +35,13 @@
 #endif
 
 struct aoa_softc {
-	void		 *sc_intrp;
-	struct resource	 *sc_odma;
+	device_t	 sc_dev;	 
+	void		*sc_intrp;
+	struct resource	*sc_odma;
 };
 
 void	aoa_interrupt(void *);
-int	aoa_attach(device_t, void *sc);
+int	aoa_attach(void *xsc);
 
 #endif /* SOUND_AOA_H */
 

Modified: head/sys/dev/sound/macio/davbus.c
==============================================================================
--- head/sys/dev/sound/macio/davbus.c	Sat Feb  7 01:12:51 2009	(r188258)
+++ head/sys/dev/sound/macio/davbus.c	Sat Feb  7 01:15:13 2009	(r188259)
@@ -52,7 +52,6 @@
 
 struct davbus_softc {
 	struct aoa_softc 	 aoa;
-	device_t 		 dev;
 	phandle_t 		 node;
 	phandle_t 		 soundnode;
 	struct resource 	*reg;
@@ -497,7 +496,7 @@ davbus_attach(device_t self)
 
 	sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
 
-	sc->dev = self;
+	sc->aoa.sc_dev = self;
 	sc->node = ofw_bus_get_node(self);
 	sc->soundnode = OF_child(sc->node);
 
@@ -529,8 +528,8 @@ davbus_attach(device_t self)
 	if (err != 0)
 		return (err);
 		
-	bus_setup_intr(self, dbdma_irq, INTR_TYPE_AV | INTR_MPSAFE,
-	    NULL, aoa_interrupt, sc, &cookie);
+	snd_setup_intr(self, dbdma_irq, INTR_MPSAFE, aoa_interrupt,
+	    sc, &cookie);
 
 	/* Now initialize the controller. */
 
@@ -555,7 +554,7 @@ davbus_attach(device_t self)
 	    DAVBUS_OUTPUT_SUBFRAME0 | DAVBUS_RATE_44100 | DAVBUS_INTR_PORTCHG);
 
 	/* Attach DBDMA engine and PCM layer */
-	err = aoa_attach(self,sc);
+	err = aoa_attach(sc);
 	if (err)
 		return (err);
 

Modified: head/sys/dev/sound/macio/i2s.c
==============================================================================
--- head/sys/dev/sound/macio/i2s.c	Sat Feb  7 01:12:51 2009	(r188258)
+++ head/sys/dev/sound/macio/i2s.c	Sat Feb  7 01:15:13 2009	(r188259)
@@ -78,7 +78,6 @@
 
 struct i2s_softc {
 	struct aoa_softc 	 aoa;
-	device_t		 dev;
 	phandle_t 		 node;
 	phandle_t		 soundnode;
 	struct resource 	*reg;
@@ -179,7 +178,7 @@ i2s_attach(device_t self)
 	
 	sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
 
-	sc->dev = self;
+	sc->aoa.sc_dev = self;
 	sc->node = ofw_bus_get_node(self);
 
 	port = of_find_firstchild_byname(sc->node, "i2s-a");
@@ -216,8 +215,8 @@ i2s_attach(device_t self)
 	if (err != 0)
 		return (err);
 
-	bus_setup_intr(self, dbdma_irq, INTR_TYPE_AV | INTR_MPSAFE, NULL,
-	    aoa_interrupt, sc, &dbdma_ih);
+	snd_setup_intr(self, dbdma_irq, INTR_MPSAFE, aoa_interrupt,
+	    sc, &dbdma_ih);
 
 	oirq = rman_get_start(dbdma_irq);
 	err = powerpc_config_intr(oirq, INTR_TRIGGER_EDGE, INTR_POLARITY_LOW);
@@ -233,12 +232,12 @@ i2s_attach(device_t self)
 		return (ENOMEM);
 
 	i2s_delayed_attach->ich_func = i2s_postattach;
-	i2s_delayed_attach->ich_arg = self;
+	i2s_delayed_attach->ich_arg = sc;
 
 	if (config_intrhook_establish(i2s_delayed_attach) != 0)
 		return (ENOMEM);
 
-	return (aoa_attach(self,sc));
+	return (aoa_attach(sc));
 }
 
 /*****************************************************************************
@@ -717,16 +716,13 @@ i2s_set_outputs(void *ptr, u_int mask)
 }
 
 static void
-i2s_postattach(void *arg)
+i2s_postattach(void *xsc)
 {
-	device_t 		 self = arg;
-	struct i2s_softc 	*sc;
+	struct i2s_softc 	*sc = xsc;
+	device_t 		 self;
 	int 			 i;
 
-	KASSERT(self != NULL, ("bad arg"));
-	KASSERT(i2s_delayed_attach != NULL, ("bogus call"));
-
-	sc = pcm_getdevinfo(self);
+	self = sc->aoa.sc_dev;
 
 	/* Reset the codec. */
 	i2s_audio_hw_reset(sc);

Modified: head/sys/dev/sound/macio/snapper.c
==============================================================================
--- head/sys/dev/sound/macio/snapper.c	Sat Feb  7 01:12:51 2009	(r188258)
+++ head/sys/dev/sound/macio/snapper.c	Sat Feb  7 01:15:13 2009	(r188259)
@@ -433,10 +433,14 @@ static int
 snapper_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right)
 {
 	struct snapper_softc *sc;
+	struct mtx *mixer_lock;
+	int locked;
 	u_int l, r;
 	u_char reg[6];
 
 	sc = device_get_softc(mix_getdevinfo(m));
+	mixer_lock = mixer_get_lock(m);
+	locked = mtx_owned(mixer_lock);
 
 	if (left > 100 || right > 100)
 		return (0);
@@ -452,8 +456,22 @@ snapper_set(struct snd_mixer *m, unsigne
 		reg[3] = (r & 0xff0000) >> 16;
 		reg[4] = (r & 0x00ff00) >> 8;
 		reg[5] = r & 0x0000ff;
+
+		/*
+		 * We need to unlock the mixer lock because iicbus_transfer()
+		 * may sleep. The mixer lock itself is unnecessary here
+		 * because it is meant to serialize hardware access, which
+		 * is taken care of by the I2C layer, so this is safe.
+		 */
+
+		if (locked)
+			mtx_unlock(mixer_lock);
+
 		snapper_write(sc, SNAPPER_VOLUME, reg);
 
+		if (locked)
+			mtx_lock(mixer_lock);
+
 		return (left | (right << 8));
 	}
 

Modified: head/sys/dev/sound/macio/tumbler.c
==============================================================================
--- head/sys/dev/sound/macio/tumbler.c	Sat Feb  7 01:12:51 2009	(r188258)
+++ head/sys/dev/sound/macio/tumbler.c	Sat Feb  7 01:15:13 2009	(r188259)
@@ -95,8 +95,6 @@ static int	tumbler_reinit(struct snd_mix
 static int	tumbler_set(struct snd_mixer *m, unsigned dev, unsigned left,
 		    unsigned right);
 static int	tumbler_setrecsrc(struct snd_mixer *m, u_int32_t src);
-static int	tumbler_set_volume(struct tumbler_softc *sc, int left,
-		    int right);
 
 static device_method_t tumbler_methods[] = {
 	/* Device interface. */
@@ -381,12 +379,46 @@ static int
 tumbler_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right)
 {
 	struct tumbler_softc *sc;
+	struct mtx *mixer_lock;
+	int locked;
+	u_int l, r;
+	u_char reg[6];
 
 	sc = device_get_softc(mix_getdevinfo(m));
+	mixer_lock = mixer_get_lock(m);
+	locked = mtx_owned(mixer_lock);
 
 	switch (dev) {
 	case SOUND_MIXER_VOLUME:
-		return (tumbler_set_volume(sc, left, right));
+		if (left > 100 || right > 100)
+			return (0);
+
+		l = (left == 0 ? 0 : tumbler_volume_table[left - 1]);
+		r = (right == 0 ? 0 : tumbler_volume_table[right - 1]);
+		
+		reg[0] = (l & 0xff0000) >> 16;
+		reg[1] = (l & 0x00ff00) >> 8;
+		reg[2] = l & 0x0000ff;
+		reg[3] = (r & 0xff0000) >> 16;
+		reg[4] = (r & 0x00ff00) >> 8;
+		reg[5] = r & 0x0000ff;
+
+		/*
+		 * We need to unlock the mixer lock because iicbus_transfer()
+		 * may sleep. The mixer lock itself is unnecessary here
+		 * because it is meant to serialize hardware access, which
+		 * is taken care of by the I2C layer, so this is safe.
+		 */
+
+		if (locked)
+			mtx_unlock(mixer_lock);
+
+		tumbler_write(sc, TUMBLER_VOLUME, reg);
+
+		if (locked)
+			mtx_lock(mixer_lock);
+
+		return (left | (right << 8));
 	}
 
 	return (0);
@@ -398,26 +430,3 @@ tumbler_setrecsrc(struct snd_mixer *m, u
 	return (0);
 }
 
-static int
-tumbler_set_volume(struct tumbler_softc *sc, int left, int right)
-{
-	u_int l, r;
-	u_char reg[6];
-
-	if (left > 100 || right > 100)
-		return (0);
-
-	l = (left == 0 ? 0 : tumbler_volume_table[left - 1]);
-	r = (right == 0 ? 0 : tumbler_volume_table[right - 1]);
-	
-	reg[0] = (l & 0xff0000) >> 16;
-	reg[1] = (l & 0x00ff00) >> 8;
-	reg[2] = l & 0x0000ff;
-	reg[3] = (r & 0xff0000) >> 16;
-	reg[4] = (r & 0x00ff00) >> 8;
-	reg[5] = r & 0x0000ff;
-	tumbler_write(sc, TUMBLER_VOLUME, reg);
-
-	return (left | (right << 8));
-}
-

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 01:53:44 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6DF29106566B;
	Sat,  7 Feb 2009 01:53:44 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5C6A18FC14;
	Sat,  7 Feb 2009 01:53:44 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n171rihf077518;
	Sat, 7 Feb 2009 01:53:44 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n171riGu077517;
	Sat, 7 Feb 2009 01:53:44 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902070153.n171riGu077517@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Sat, 7 Feb 2009 01:53:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188263 - head/sys/dev/ath/ath_hal
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 01:53:44 -0000

Author: sam
Date: Sat Feb  7 01:53:44 2009
New Revision: 188263
URL: http://svn.freebsd.org/changeset/base/188263

Log:
  add macro for future regulatory mods

Modified:
  head/sys/dev/ath/ath_hal/ah_regdomain.c

Modified: head/sys/dev/ath/ath_hal/ah_regdomain.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_regdomain.c	Sat Feb  7 01:51:22 2009	(r188262)
+++ head/sys/dev/ath/ath_hal/ah_regdomain.c	Sat Feb  7 01:53:44 2009	(r188263)
@@ -74,6 +74,11 @@ typedef uint64_t chanbmask_t[BMLEN];
 	  W0(_fg) | W0(_fh) ,	\
 	  W1(_fa) | W1(_fb) | W1(_fc) | W1(_fd) | W1(_fe) | W1(_ff) |	\
 	  W1(_fg) | W1(_fh) }
+#define BM9(_fa, _fb, _fc, _fd, _fe, _ff, _fg, _fh, _fi)	\
+	{ W0(_fa) | W0(_fb) | W0(_fc) | W0(_fd) | W0(_fe) | W0(_ff) |	\
+	  W0(_fg) | W0(_fh) | W0(_fi) ,	\
+	  W1(_fa) | W1(_fb) | W1(_fc) | W1(_fd) | W1(_fe) | W1(_ff) |	\
+	  W1(_fg) | W1(_fh) | W1(_fi) }
 
 /*
  * Mask to check whether a domain is a multidomain or a single domain

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 01:54:57 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DB76C1065670;
	Sat,  7 Feb 2009 01:54:57 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CA0448FC1F;
	Sat,  7 Feb 2009 01:54:57 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n171sv6m077605;
	Sat, 7 Feb 2009 01:54:57 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n171svoE077604;
	Sat, 7 Feb 2009 01:54:57 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902070154.n171svoE077604@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Sat, 7 Feb 2009 01:54:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188264 - head/sys/dev/ath/ath_hal
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 01:54:58 -0000

Author: sam
Date: Sat Feb  7 01:54:57 2009
New Revision: 188264
URL: http://svn.freebsd.org/changeset/base/188264

Log:
  fix 11n channel construction

Modified:
  head/sys/dev/ath/ath_hal/ah_regdomain.c

Modified: head/sys/dev/ath/ath_hal/ah_regdomain.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_regdomain.c	Sat Feb  7 01:53:44 2009	(r188263)
+++ head/sys/dev/ath/ath_hal/ah_regdomain.c	Sat Feb  7 01:54:57 2009	(r188264)
@@ -1706,16 +1706,16 @@ static const struct cmode modes[] = {
 	  IEEE80211_CHAN_G | IEEE80211_CHAN_QUARTER },
 	{ HAL_MODE_11G_HALF_RATE,
 	  IEEE80211_CHAN_G | IEEE80211_CHAN_HALF },
-	{ HAL_MODE_11NG_HT20,	IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_HT20 },
+	{ HAL_MODE_11NG_HT20,	IEEE80211_CHAN_G | IEEE80211_CHAN_HT20 },
 	{ HAL_MODE_11NG_HT40PLUS,
-	  IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_HT40U },
+	  IEEE80211_CHAN_G | IEEE80211_CHAN_HT40U },
 	{ HAL_MODE_11NG_HT40MINUS,
-	  IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_HT40D },
-	{ HAL_MODE_11NA_HT20,	IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HT20 },
+	  IEEE80211_CHAN_G | IEEE80211_CHAN_HT40D },
+	{ HAL_MODE_11NA_HT20,	IEEE80211_CHAN_A | IEEE80211_CHAN_HT20 },
 	{ HAL_MODE_11NA_HT40PLUS,
-	  IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HT40U },
+	  IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U },
 	{ HAL_MODE_11NA_HT40MINUS,
-	  IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HT40D },
+	  IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D },
 };
 
 static OS_INLINE uint16_t

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 02:14:28 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 73010106566C;
	Sat,  7 Feb 2009 02:14:28 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 60FEA8FC1E;
	Sat,  7 Feb 2009 02:14:28 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n172ESHK078225;
	Sat, 7 Feb 2009 02:14:28 GMT (envelope-from wkoszek@svn.freebsd.org)
Received: (from wkoszek@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n172ESMM078224;
	Sat, 7 Feb 2009 02:14:28 GMT (envelope-from wkoszek@svn.freebsd.org)
Message-Id: <200902070214.n172ESMM078224@svn.freebsd.org>
From: "Wojciech A. Koszek" <wkoszek@FreeBSD.org>
Date: Sat, 7 Feb 2009 02:14:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188266 - head/sys/dev/si
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 02:14:28 -0000

Author: wkoszek
Date: Sat Feb  7 02:14:27 2009
New Revision: 188266
URL: http://svn.freebsd.org/changeset/base/188266

Log:
  si_cmdname() is defined only when SI_DEBUG is enabled, thus
  using this function in simple printf() causes compile-time
  problems. Use conditionally enabled DPRINT() macro instead.

Modified:
  head/sys/dev/si/si.c

Modified: head/sys/dev/si/si.c
==============================================================================
--- head/sys/dev/si/si.c	Sat Feb  7 01:59:34 2009	(r188265)
+++ head/sys/dev/si/si.c	Sat Feb  7 02:14:27 2009	(r188266)
@@ -1549,7 +1549,7 @@ si_command(struct si_port *pp, int cmd, 
 			/* This is very very bad.  The card has crashed. */
 			/* XXX the driver breaks at this point */
 			if (err == ETIMEDOUT)
-				printf("%s: tsleep1 timeout. hi_stat %s, sp_pend %s\n", pp->sp_name, si_cmdname(ccbp->hi_stat), si_cmdname(pp->sp_pend));
+				DPRINT(("%s: tsleep1 timeout. hi_stat %s, sp_pend %s\n", pp->sp_name, si_cmdname(ccbp->hi_stat), si_cmdname(pp->sp_pend)));
 			splx(oldspl);
 			return;
 		}
@@ -1586,7 +1586,7 @@ si_command(struct si_port *pp, int cmd, 
 			if (err) {
 				DPRINT((pp, DBG_PARAM, "sicmd2 tsleep error: hi_stat (%s) sp_pend (%s)\n", si_cmdname(ccbp->hi_stat), si_cmdname(pp->sp_pend)));
 				if (err == ETIMEDOUT) {
-					printf("%s: tsleep2 timeout. hi_stat %s, sp_pend %s\n", pp->sp_name, si_cmdname(ccbp->hi_stat), si_cmdname(pp->sp_pend));
+					DPRINT(("%s: tsleep2 timeout. hi_stat %s, sp_pend %s\n", pp->sp_name, si_cmdname(ccbp->hi_stat), si_cmdname(pp->sp_pend)));
 				}
 				break;
 			}

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 05:03:25 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 809F5106566C;
	Sat,  7 Feb 2009 05:03:25 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 552BB8FC08;
	Sat,  7 Feb 2009 05:03:25 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1753PmO081571;
	Sat, 7 Feb 2009 05:03:25 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1753Pdg081570;
	Sat, 7 Feb 2009 05:03:25 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902070503.n1753Pdg081570@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Sat, 7 Feb 2009 05:03:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188267 - head/sys/dev/cfi
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 05:03:25 -0000

Author: sam
Date: Sat Feb  7 05:03:25 2009
New Revision: 188267
URL: http://svn.freebsd.org/changeset/base/188267

Log:
  expand CFI_ARMEDANDDANGEROUS to include writing the user segment
  of the PR; this register is actually write-once so deserves the
  safety-belt as much as the PLR

Modified:
  head/sys/dev/cfi/cfi_core.c

Modified: head/sys/dev/cfi/cfi_core.c
==============================================================================
--- head/sys/dev/cfi/cfi_core.c	Sat Feb  7 02:14:27 2009	(r188266)
+++ head/sys/dev/cfi/cfi_core.c	Sat Feb  7 05:03:25 2009	(r188267)
@@ -438,9 +438,9 @@ cfi_write_block(struct cfi_softc *sc)
  * used for security.  There are two 64-bit segments; one is programmed
  * at the factory with a unique 64-bit number which is immutable.
  * The other segment is left blank for User (OEM) programming.
- * Once the User/OEM segment is programmed it can be locked
- * to prevent future programming by writing bit 0 of the Protection
- * Lock Register (PLR).  The PLR can written only once.
+ * The User/OEM segment is One Time Programmable (OTP).  It can also
+ * be locked to prevent any firther writes by setting bit 0 of the
+ * Protection Lock Register (PLR).  The PLR can written only once.
  */
 
 static uint16_t
@@ -496,17 +496,21 @@ cfi_intel_get_oem_pr(struct cfi_softc *s
 
 /*
  * Write the User/OEM 64-bit segment of the PR.
+ * XXX should allow writing individual words/bytes
  */
 int
 cfi_intel_set_oem_pr(struct cfi_softc *sc, uint64_t id)
 {
+#ifdef CFI_ARMEDANDDANGEROUS
 	register_t intr;
 	int i, error;
+#endif
 
 	if (sc->sc_cmdset != CFI_VEND_INTEL_ECS)
 		return EOPNOTSUPP;
 	KASSERT(sc->sc_width == 2, ("sc_width %d", sc->sc_width));
 
+#ifdef CFI_ARMEDANDDANGEROUS
 	for (i = 7; i >= 4; i--, id >>= 16) {
 		intr = intr_disable();
 		cfi_write(sc, 0, CFI_INTEL_PP_SETUP);
@@ -519,6 +523,11 @@ cfi_intel_set_oem_pr(struct cfi_softc *s
 	}
 	cfi_write(sc, 0, CFI_BCS_READ_ARRAY);
 	return error;
+#else
+	device_printf(sc->sc_dev, "%s: OEM PR not set, "
+	    "CFI_ARMEDANDDANGEROUS not configured\n", __func__);
+	return ENXIO;
+#endif
 }
 
 /*

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 05:32:19 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 56AAF1065670;
	Sat,  7 Feb 2009 05:32:19 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 45A438FC14;
	Sat,  7 Feb 2009 05:32:19 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n175WJJ5082068;
	Sat, 7 Feb 2009 05:32:19 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n175WJrp082067;
	Sat, 7 Feb 2009 05:32:19 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902070532.n175WJrp082067@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Sat, 7 Feb 2009 05:32:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188268 - head/sys/dev/cfi
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 05:32:19 -0000

Author: sam
Date: Sat Feb  7 05:32:19 2009
New Revision: 188268
URL: http://svn.freebsd.org/changeset/base/188268

Log:
  fix building w/o CFI_ARMEDANDDANGEROUS

Modified:
  head/sys/dev/cfi/cfi_core.c

Modified: head/sys/dev/cfi/cfi_core.c
==============================================================================
--- head/sys/dev/cfi/cfi_core.c	Sat Feb  7 05:03:25 2009	(r188267)
+++ head/sys/dev/cfi/cfi_core.c	Sat Feb  7 05:32:19 2009	(r188268)
@@ -450,11 +450,13 @@ cfi_get16(struct cfi_softc *sc, int off)
 	return v;
 }
 
+#ifdef CFI_ARMEDANDDANGEROUS
 static void
 cfi_put16(struct cfi_softc *sc, int off, uint16_t v)
 {
 	bus_space_write_2(sc->sc_tag, sc->sc_handle, off<<1, v);
 }
+#endif
 
 /*
  * Read the factory-defined 64-bit segment of the PR.
@@ -556,9 +558,8 @@ cfi_intel_set_plr(struct cfi_softc *sc)
 {
 #ifdef CFI_ARMEDANDDANGEROUS
 	register_t intr;
-#endif
 	int error;
-
+#endif
 	if (sc->sc_cmdset != CFI_VEND_INTEL_ECS)
 		return EOPNOTSUPP;
 	KASSERT(sc->sc_width == 2, ("sc_width %d", sc->sc_width));
@@ -572,11 +573,11 @@ cfi_intel_set_plr(struct cfi_softc *sc)
 	intr_restore(intr);
 	error = cfi_wait_ready(sc, CFI_BCS_READ_STATUS, sc->sc_write_timeout);
 	cfi_write(sc, 0, CFI_BCS_READ_ARRAY);
+	return error;
 #else
 	device_printf(sc->sc_dev, "%s: PLR not set, "
 	    "CFI_ARMEDANDDANGEROUS not configured\n", __func__);
-	error = ENXIO;
+	return ENXIO;
 #endif
-	return error;
 }
 #endif /* CFI_SUPPORT_STRATAFLASH */

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 05:34:41 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D2D6C106566B;
	Sat,  7 Feb 2009 05:34:41 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A7D868FC13;
	Sat,  7 Feb 2009 05:34:41 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n175YfoS082156;
	Sat, 7 Feb 2009 05:34:41 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n175Yfcs082154;
	Sat, 7 Feb 2009 05:34:41 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200902070534.n175Yfcs082154@svn.freebsd.org>
From: Sam Leffler <sam@FreeBSD.org>
Date: Sat, 7 Feb 2009 05:34:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188269 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 05:34:42 -0000

Author: sam
Date: Sat Feb  7 05:34:41 2009
New Revision: 188269
URL: http://svn.freebsd.org/changeset/base/188269

Log:
  count stuck beacon events

Modified:
  head/sys/dev/ath/if_ath.c

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Sat Feb  7 05:32:19 2009	(r188268)
+++ head/sys/dev/ath/if_ath.c	Sat Feb  7 05:34:41 2009	(r188269)
@@ -3343,6 +3343,7 @@ ath_bstuck_proc(void *arg, int pending)
 
 	if_printf(ifp, "stuck beacon; resetting (bmiss count %u)\n",
 		sc->sc_bmisscount);
+	sc->sc_stats.ast_bstuck++;
 	ath_reset(ifp);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 05:41:24 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 86F08106566C;
	Sat,  7 Feb 2009 05:41:24 +0000 (UTC) (envelope-from das@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 73F308FC0A;
	Sat,  7 Feb 2009 05:41:24 +0000 (UTC) (envelope-from das@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n175fOfd082421;
	Sat, 7 Feb 2009 05:41:24 GMT (envelope-from das@svn.freebsd.org)
Received: (from das@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n175fOQh082420;
	Sat, 7 Feb 2009 05:41:24 GMT (envelope-from das@svn.freebsd.org)
Message-Id: <200902070541.n175fOQh082420@svn.freebsd.org>
From: David Schultz <das@FreeBSD.org>
Date: Sat, 7 Feb 2009 05:41:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188272 - head/lib/msun/src
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 05:41:25 -0000

Author: das
Date: Sat Feb  7 05:41:24 2009
New Revision: 188272
URL: http://svn.freebsd.org/changeset/base/188272

Log:
  C99 TC2 now wants FP_FAST_FMA* to be defined to 1, if the macros are
  defined at all. See also: defect report #223.

Modified:
  head/lib/msun/src/math.h

Modified: head/lib/msun/src/math.h
==============================================================================
--- head/lib/msun/src/math.h	Sat Feb  7 05:39:05 2009	(r188271)
+++ head/lib/msun/src/math.h	Sat Feb  7 05:41:24 2009	(r188272)
@@ -70,12 +70,12 @@ extern const union __nan_un {
 
 /* XXX We need a <machine/math.h>. */
 #if defined(__ia64__) || defined(__sparc64__)
-#define	FP_FAST_FMA
+#define	FP_FAST_FMA	1
 #endif
 #ifdef __ia64__
-#define	FP_FAST_FMAL
+#define	FP_FAST_FMAL	1
 #endif
-#define	FP_FAST_FMAF
+#define	FP_FAST_FMAF	1
 
 /* Symbolic constants to classify floating point numbers. */
 #define	FP_INFINITE	0x01

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 06:27:17 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 539D6106567E;
	Sat,  7 Feb 2009 06:27:17 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 412288FC18;
	Sat,  7 Feb 2009 06:27:17 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n176RGal083279;
	Sat, 7 Feb 2009 06:27:16 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n176RGEa083276;
	Sat, 7 Feb 2009 06:27:16 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200902070627.n176RGEa083276@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Sat, 7 Feb 2009 06:27:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188273 - head/sys/dev/usb2/controller
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 06:27:18 -0000

Author: thompsa
Date: Sat Feb  7 06:27:16 2009
New Revision: 188273
URL: http://svn.freebsd.org/changeset/base/188273

Log:
  Dont hold the lock over the controller init, we are still attaching.

Modified:
  head/sys/dev/usb2/controller/ehci2.c
  head/sys/dev/usb2/controller/ohci2.c
  head/sys/dev/usb2/controller/uhci2.c

Modified: head/sys/dev/usb2/controller/ehci2.c
==============================================================================
--- head/sys/dev/usb2/controller/ehci2.c	Sat Feb  7 05:41:24 2009	(r188272)
+++ head/sys/dev/usb2/controller/ehci2.c	Sat Feb  7 06:27:16 2009	(r188273)
@@ -223,8 +223,6 @@ ehci_init(ehci_softc_t *sc)
 	uint16_t bit;
 	usb2_error_t err = 0;
 
-	USB_BUS_LOCK(&sc->sc_bus);
-
 	DPRINTF("start\n");
 
 	usb2_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.bus_mtx, 0);
@@ -259,10 +257,12 @@ ehci_init(ehci_softc_t *sc)
 	/* Reset the controller */
 	DPRINTF("%s: resetting\n", device_get_nameunit(sc->sc_bus.bdev));
 
+	USB_BUS_LOCK(&sc->sc_bus);
 	err = ehci_hc_reset(sc);
+	USB_BUS_UNLOCK(&sc->sc_bus);
 	if (err) {
 		device_printf(sc->sc_bus.bdev, "reset timeout\n");
-		goto done;
+		return (error);
 	}
 	/*
 	 * use current frame-list-size selection 0: 1024*4 bytes 1:  512*4
@@ -270,8 +270,7 @@ ehci_init(ehci_softc_t *sc)
 	 */
 	if (EHCI_CMD_FLS(EOREAD4(sc, EHCI_USBCMD)) == 3) {
 		device_printf(sc->sc_bus.bdev, "invalid frame-list-size\n");
-		err = USB_ERR_IOERROR;
-		goto done;
+		return (USB_ERR_IOERROR);
 	}
 	/* set up the bus struct */
 	sc->sc_bus.methods = &ehci_bus_methods;
@@ -479,7 +478,7 @@ ehci_init(ehci_softc_t *sc)
 	EOWRITE4(sc, EHCI_CONFIGFLAG, EHCI_CONF_CF);
 
 	for (i = 0; i < 100; i++) {
-		usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1);
+		usb2_pause_mtx(NULL, 1);
 		hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH;
 		if (!hcr) {
 			break;
@@ -487,11 +486,8 @@ ehci_init(ehci_softc_t *sc)
 	}
 	if (hcr) {
 		device_printf(sc->sc_bus.bdev, "run timeout\n");
-		err = USB_ERR_IOERROR;
-		goto done;
+		return (USB_ERR_IOERROR);
 	}
-done:
-	USB_BUS_UNLOCK(&sc->sc_bus);
 
 	if (!err) {
 		/* catch any lost interrupts */

Modified: head/sys/dev/usb2/controller/ohci2.c
==============================================================================
--- head/sys/dev/usb2/controller/ohci2.c	Sat Feb  7 05:41:24 2009	(r188272)
+++ head/sys/dev/usb2/controller/ohci2.c	Sat Feb  7 06:27:16 2009	(r188273)
@@ -168,7 +168,7 @@ ohci_controller_init(ohci_softc_t *sc)
 		DPRINTF("SMM active, request owner change\n");
 		OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_OCR);
 		for (i = 0; (i < 100) && (ctl & OHCI_IR); i++) {
-			usb2_pause_mtx(&sc->sc_bus.bus_mtx, 1);
+			usb2_pause_mtx(NULL, 1);
 			ctl = OREAD4(sc, OHCI_CONTROL);
 		}
 		if (ctl & OHCI_IR) {
@@ -181,8 +181,7 @@ ohci_controller_init(ohci_softc_t *sc)
 		DPRINTF("cold started\n");
 reset:
 		/* controller was cold started */
-		usb2_pause_mtx(&sc->sc_bus.bus_mtx,
-		    USB_BUS_RESET_DELAY);
+		usb2_pause_mtx(NULL, USB_BUS_RESET_DELAY);
 	}
 
 	/*
@@ -192,8 +191,7 @@ reset:
 	DPRINTF("%s: resetting\n", device_get_nameunit(sc->sc_bus.bdev));
 	OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);
 
-	usb2_pause_mtx(&sc->sc_bus.bus_mtx,
-	    USB_BUS_RESET_DELAY);
+	usb2_pause_mtx(NULL, USB_BUS_RESET_DELAY);
 
 	/* we now own the host controller and the bus has been reset */
 	ival = OHCI_GET_IVAL(OREAD4(sc, OHCI_FM_INTERVAL));
@@ -255,8 +253,7 @@ reset:
 	desca = OREAD4(sc, OHCI_RH_DESCRIPTOR_A);
 	OWRITE4(sc, OHCI_RH_DESCRIPTOR_A, desca | OHCI_NOCP);
 	OWRITE4(sc, OHCI_RH_STATUS, OHCI_LPSC);	/* Enable port power */
-	usb2_pause_mtx(&sc->sc_bus.bus_mtx,
-	    OHCI_ENABLE_POWER_DELAY);
+	usb2_pause_mtx(NULL, OHCI_ENABLE_POWER_DELAY);
 	OWRITE4(sc, OHCI_RH_DESCRIPTOR_A, desca);
 
 	/*
@@ -265,8 +262,7 @@ reset:
 	 */
 	sc->sc_noport = 0;
 	for (i = 0; (i < 10) && (sc->sc_noport == 0); i++) {
-		usb2_pause_mtx(&sc->sc_bus.bus_mtx,
-		    OHCI_READ_DESC_DELAY);
+		usb2_pause_mtx(NULL, OHCI_READ_DESC_DELAY);
 		sc->sc_noport = OHCI_GET_NDP(OREAD4(sc, OHCI_RH_DESCRIPTOR_A));
 	}
 
@@ -304,8 +300,6 @@ ohci_init(ohci_softc_t *sc)
 	uint16_t x;
 	uint16_t y;
 
-	USB_BUS_LOCK(&sc->sc_bus);
-
 	DPRINTF("start\n");
 
 	sc->sc_eintrs = OHCI_NORMAL_INTRS;
@@ -402,10 +396,8 @@ ohci_init(ohci_softc_t *sc)
 	sc->sc_bus.usbrev = USB_REV_1_0;
 
 	if (ohci_controller_init(sc)) {
-		USB_BUS_UNLOCK(&sc->sc_bus);
 		return (USB_ERR_INVAL);
 	} else {
-		USB_BUS_UNLOCK(&sc->sc_bus);
 		/* catch any lost interrupts */
 		ohci_do_poll(&sc->sc_bus);
 		return (USB_ERR_NORMAL_COMPLETION);
@@ -473,8 +465,6 @@ ohci_resume(ohci_softc_t *sc)
 {
 	uint32_t ctl;
 
-	USB_BUS_LOCK(&sc->sc_bus);
-
 #if USB_DEBUG
 	DPRINTF("\n");
 	if (ohcidebug > 2) {
@@ -484,6 +474,7 @@ ohci_resume(ohci_softc_t *sc)
 	/* some broken BIOSes never initialize the Controller chip */
 	ohci_controller_init(sc);
 
+	USB_BUS_LOCK(&sc->sc_bus);
 	if (sc->sc_intre) {
 		OWRITE4(sc, OHCI_INTERRUPT_ENABLE,
 		    sc->sc_intre & (OHCI_ALL_INTRS | OHCI_MIE));

Modified: head/sys/dev/usb2/controller/uhci2.c
==============================================================================
--- head/sys/dev/usb2/controller/uhci2.c	Sat Feb  7 05:41:24 2009	(r188272)
+++ head/sys/dev/usb2/controller/uhci2.c	Sat Feb  7 06:27:16 2009	(r188273)
@@ -406,8 +406,6 @@ uhci_init(uhci_softc_t *sc)
 	uint16_t x;
 	uint16_t y;
 
-	USB_BUS_LOCK(&sc->sc_bus);
-
 	DPRINTF("start\n");
 
 #if USB_DEBUG
@@ -597,12 +595,12 @@ uhci_init(uhci_softc_t *sc)
 	/* set up the bus struct */
 	sc->sc_bus.methods = &uhci_bus_methods;
 
+	USB_BUS_LOCK(&sc->sc_bus);
 	/* reset the controller */
 	uhci_reset(sc);
 
 	/* start the controller */
 	uhci_start(sc);
-
 	USB_BUS_UNLOCK(&sc->sc_bus);
 
 	/* catch lost interrupts */

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 09:57:14 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CEFCD106566B;
	Sat,  7 Feb 2009 09:57:14 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BCD758FC1C;
	Sat,  7 Feb 2009 09:57:14 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n179vEKh087183;
	Sat, 7 Feb 2009 09:57:14 GMT (envelope-from wkoszek@svn.freebsd.org)
Received: (from wkoszek@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n179vEGd087181;
	Sat, 7 Feb 2009 09:57:14 GMT (envelope-from wkoszek@svn.freebsd.org)
Message-Id: <200902070957.n179vEGd087181@svn.freebsd.org>
From: "Wojciech A. Koszek" <wkoszek@FreeBSD.org>
Date: Sat, 7 Feb 2009 09:57:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188274 - in head/sys: conf ia64/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 09:57:15 -0000

Author: wkoszek
Date: Sat Feb  7 09:57:14 2009
New Revision: 188274
URL: http://svn.freebsd.org/changeset/base/188274

Log:
  Don't forget to create opt_agp.h on ia64, which also uses agp(4).

Modified:
  head/sys/conf/options.ia64
  head/sys/ia64/conf/NOTES

Modified: head/sys/conf/options.ia64
==============================================================================
--- head/sys/conf/options.ia64	Sat Feb  7 06:27:16 2009	(r188273)
+++ head/sys/conf/options.ia64	Sat Feb  7 09:57:14 2009	(r188274)
@@ -20,6 +20,9 @@ VGA_NO_MODE_CHANGE	opt_vga.h
 VGA_SLOW_IOACCESS	opt_vga.h
 VGA_WIDTH90		opt_vga.h
 
+# AGP debugging.
+AGP_DEBUG		opt_agp.h
+
 PSM_HOOKRESUME		opt_psm.h
 PSM_RESETAFTERSUSPEND	opt_psm.h
 PSM_DEBUG		opt_psm.h

Modified: head/sys/ia64/conf/NOTES
==============================================================================
--- head/sys/ia64/conf/NOTES	Sat Feb  7 06:27:16 2009	(r188273)
+++ head/sys/ia64/conf/NOTES	Sat Feb  7 09:57:14 2009	(r188274)
@@ -101,6 +101,9 @@ options 	VGA_WIDTH90		# support 90 colum
 # Debugging.
 options 	VGA_DEBUG
 
+# AGP debugging.
+options		AGP_DEBUG
+
 # The following devices are not supported.
 nodevice	fdc
 nooption	FDC_DEBUG

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 10:59:35 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DD57D106566C;
	Sat,  7 Feb 2009 10:59:35 +0000 (UTC)
	(envelope-from niclas.zeising@gmail.com)
Received: from mxf1.bahnhof.se (mxf1.bahnhof.se [213.80.101.25])
	by mx1.freebsd.org (Postfix) with ESMTP id 8DC588FC22;
	Sat,  7 Feb 2009 10:59:35 +0000 (UTC)
	(envelope-from niclas.zeising@gmail.com)
Received: from localhost (mxf1.local [127.0.0.1])
	by mxf1-reinject (Postfix) with ESMTP id 7D2005DC0;
	Sat,  7 Feb 2009 11:59:33 +0100 (CET)
X-Virus-Scanned: by amavisd-new using ClamAV at bahnhof.se (MXF1)
X-Spam-Score: 2.777
X-Spam-Level: **
X-Spam-Status: No, score=2.777 tagged_above=-99 required=5
	tests=[DNS_FROM_RFC_POST=1.708, SPF_NEUTRAL=1.069]
Received: from mxf1.bahnhof.se ([127.0.0.1])
	by localhost (mxf1.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id VZYn3HbEzpIQ; Sat,  7 Feb 2009 11:59:32 +0100 (CET)
Received: from [10.0.0.3] (h-85-24-219-30.NA.cust.bahnhof.se [85.24.219.30])
	by mxf1.bahnhof.se (Postfix) with ESMTP id 225FC5DBE;
	Sat,  7 Feb 2009 11:59:32 +0100 (CET)
Received: from 127.0.0.1 (AVG SMTP 8.0.233 [270.10.18/1935]);
	Sat, 07 Feb 2009 11:59:23 +0100
Message-ID: <498D698B.5000101@gmail.com>
Date: Sat, 07 Feb 2009 11:59:23 +0100
From: Niclas Zeising <niclas.zeising@gmail.com>
User-Agent: Thunderbird 2.0.0.19 (Windows/20081209)
MIME-Version: 1.0
To: Andrew Thompson <thompsa@FreeBSD.org>
References: <200902070627.n176RGEa083276@svn.freebsd.org>
In-Reply-To: <200902070627.n176RGEa083276@svn.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r188273 - head/sys/dev/usb2/controller
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 10:59:36 -0000

Andrew Thompson wrote:
> Author: thompsa
> Date: Sat Feb  7 06:27:16 2009
> New Revision: 188273
> URL: http://svn.freebsd.org/changeset/base/188273
> 
> Log:
>   Dont hold the lock over the controller init, we are still attaching.
> 
> Modified:
>   head/sys/dev/usb2/controller/ehci2.c
>   head/sys/dev/usb2/controller/ohci2.c
>   head/sys/dev/usb2/controller/uhci2.c
> 
> Modified: head/sys/dev/usb2/controller/ehci2.c
> ==============================================================================
> --- head/sys/dev/usb2/controller/ehci2.c	Sat Feb  7 05:41:24 2009	(r188272)
> +++ head/sys/dev/usb2/controller/ehci2.c	Sat Feb  7 06:27:16 2009	(r188273)
> @@ -223,8 +223,6 @@ ehci_init(ehci_softc_t *sc)
>  	uint16_t bit;
>  	usb2_error_t err = 0;
>  
> -	USB_BUS_LOCK(&sc->sc_bus);
> -
>  	DPRINTF("start\n");
>  
>  	usb2_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.bus_mtx, 0);
> @@ -259,10 +257,12 @@ ehci_init(ehci_softc_t *sc)
>  	/* Reset the controller */
>  	DPRINTF("%s: resetting\n", device_get_nameunit(sc->sc_bus.bdev));
>  
> +	USB_BUS_LOCK(&sc->sc_bus);
>  	err = ehci_hc_reset(sc);
> +	USB_BUS_UNLOCK(&sc->sc_bus);
>  	if (err) {
>  		device_printf(sc->sc_bus.bdev, "reset timeout\n");
> -		goto done;
> +		return (error);
                 ^^^^^^^^^^^^^^^

This broke the build. I'm not familiar with the code, but might it be 
err you want to return since you set it a bit earlier, and it is of the 
correct type.
[SNIP the rest of the diff]

Regards!
//Niclas
--


From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 11:12:31 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4DE44106566B;
	Sat,  7 Feb 2009 11:12:31 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3BB6E8FC16;
	Sat,  7 Feb 2009 11:12:31 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17BCVNe090161;
	Sat, 7 Feb 2009 11:12:31 GMT (envelope-from wkoszek@svn.freebsd.org)
Received: (from wkoszek@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17BCVOi090160;
	Sat, 7 Feb 2009 11:12:31 GMT (envelope-from wkoszek@svn.freebsd.org)
Message-Id: <200902071112.n17BCVOi090160@svn.freebsd.org>
From: "Wojciech A. Koszek" <wkoszek@FreeBSD.org>
Date: Sat, 7 Feb 2009 11:12:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188277 - head/usr.sbin/config
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 11:12:31 -0000

Author: wkoszek
Date: Sat Feb  7 11:12:30 2009
New Revision: 188277
URL: http://svn.freebsd.org/changeset/base/188277

Log:
  Remove leftover of alpha support for config(8)--we have MAP_FAILED
  globally defined.

Modified:
  head/usr.sbin/config/main.c

Modified: head/usr.sbin/config/main.c
==============================================================================
--- head/usr.sbin/config/main.c	Sat Feb  7 10:29:07 2009	(r188276)
+++ head/usr.sbin/config/main.c	Sat Feb  7 11:12:30 2009	(r188277)
@@ -565,9 +565,6 @@ moveifchanged(const char *from_name, con
 
 	if (!changed) {
 		p = mmap(NULL, tsize, PROT_READ, MAP_SHARED, from_fd, (off_t)0);
-#ifndef MAP_FAILED
-#define MAP_FAILED ((caddr_t) -1)
-#endif
 		if (p == MAP_FAILED)
 			err(EX_OSERR, "mmap %s", from_name);
 		q = mmap(NULL, tsize, PROT_READ, MAP_SHARED, to_fd, (off_t)0);

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 11:40:48 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0DDE8106564A;
	Sat,  7 Feb 2009 11:40:48 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EFEED8FC19;
	Sat,  7 Feb 2009 11:40:47 +0000 (UTC)
	(envelope-from wkoszek@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17BelPG091009;
	Sat, 7 Feb 2009 11:40:47 GMT (envelope-from wkoszek@svn.freebsd.org)
Received: (from wkoszek@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17Belhp091008;
	Sat, 7 Feb 2009 11:40:47 GMT (envelope-from wkoszek@svn.freebsd.org)
Message-Id: <200902071140.n17Belhp091008@svn.freebsd.org>
From: "Wojciech A. Koszek" <wkoszek@FreeBSD.org>
Date: Sat, 7 Feb 2009 11:40:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188280 - head/usr.sbin/config
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 11:40:49 -0000

Author: wkoszek
Date: Sat Feb  7 11:40:47 2009
New Revision: 188280
URL: http://svn.freebsd.org/changeset/base/188280

Log:
  Move the comment to it's correct place.

Modified:
  head/usr.sbin/config/main.c

Modified: head/usr.sbin/config/main.c
==============================================================================
--- head/usr.sbin/config/main.c	Sat Feb  7 11:27:35 2009	(r188279)
+++ head/usr.sbin/config/main.c	Sat Feb  7 11:40:47 2009	(r188280)
@@ -466,6 +466,11 @@ configfile_filebased(struct sbuf *sb)
 	struct cfgfile *cf;
 	int i;
 
+	/*
+	 * Try to read all configuration files. Since those will be present as
+	 * C string in the macro, we have to slash their ends then the line
+	 * wraps.
+	 */
 	STAILQ_FOREACH(cf, &cfgfiles, cfg_next) {
 		cff = fopen(cf->cfg_path, "r");
 		if (cff == NULL) {
@@ -500,11 +505,6 @@ configfile(void)
 	sb = sbuf_new(NULL, NULL, 2048, SBUF_AUTOEXTEND);
 	assert(sb != NULL);
 	sbuf_clear(sb);
-	/*
-	 * Try to read all configuration files. Since those will be present as
-	 * C string in the macro, we have to slash their ends then the line
-	 * wraps.
-	 */
 	if (filebased) {
 		/* Is needed, can be used for backward compatibility. */
 		configfile_filebased(sb);

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 15:51:32 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8540A106566C;
	Sat,  7 Feb 2009 15:51:32 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 741118FC14;
	Sat,  7 Feb 2009 15:51:32 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17FpWis097481;
	Sat, 7 Feb 2009 15:51:32 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17FpWM4097480;
	Sat, 7 Feb 2009 15:51:32 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200902071551.n17FpWM4097480@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Sat, 7 Feb 2009 15:51:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188292 - head/sys/dev/usb2/controller
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 15:51:33 -0000

Author: thompsa
Date: Sat Feb  7 15:51:32 2009
New Revision: 188292
URL: http://svn.freebsd.org/changeset/base/188292

Log:
  Fix build, sigh.

Modified:
  head/sys/dev/usb2/controller/ehci2.c

Modified: head/sys/dev/usb2/controller/ehci2.c
==============================================================================
--- head/sys/dev/usb2/controller/ehci2.c	Sat Feb  7 15:51:21 2009	(r188291)
+++ head/sys/dev/usb2/controller/ehci2.c	Sat Feb  7 15:51:32 2009	(r188292)
@@ -262,7 +262,7 @@ ehci_init(ehci_softc_t *sc)
 	USB_BUS_UNLOCK(&sc->sc_bus);
 	if (err) {
 		device_printf(sc->sc_bus.bdev, "reset timeout\n");
-		return (error);
+		return (err);
 	}
 	/*
 	 * use current frame-list-size selection 0: 1024*4 bytes 1:  512*4

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 16:37:03 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4C693106564A;
	Sat,  7 Feb 2009 16:37:03 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 214E98FC0C;
	Sat,  7 Feb 2009 16:37:03 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17Gb2HB098378;
	Sat, 7 Feb 2009 16:37:02 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17Gb25u098377;
	Sat, 7 Feb 2009 16:37:02 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200902071637.n17Gb25u098377@svn.freebsd.org>
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Date: Sat, 7 Feb 2009 16:37:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188293 - head/etc/rc.d
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 16:37:03 -0000

Author: bz
Date: Sat Feb  7 16:37:02 2009
New Revision: 188293
URL: http://svn.freebsd.org/changeset/base/188293

Log:
  Named normally cannot be started chrooted inside a jail. Thus treat
  the jail case specifically. In case we find a proper pre-seeded
  devfs in the chroot path (mounted from the base system) permit
  starting chrooted else give proper warn/error messages.
  
  PR:		conf/103489
  Reviewed by:	dougb
  MFC after:	5 days

Modified:
  head/etc/rc.d/named

Modified: head/etc/rc.d/named
==============================================================================
--- head/etc/rc.d/named	Sat Feb  7 15:51:32 2009	(r188292)
+++ head/etc/rc.d/named	Sat Feb  7 16:37:02 2009	(r188293)
@@ -61,10 +61,23 @@ chroot_autoupdate()
 
 	# Mount a devfs in the chroot directory if needed
 	#
-	umount ${named_chrootdir}/dev 2>/dev/null
-	devfs_domount ${named_chrootdir}/dev devfsrules_hide_all
-	devfs -m ${named_chrootdir}/dev rule apply path null unhide
-	devfs -m ${named_chrootdir}/dev rule apply path random unhide
+	if [ `${SYSCTL_N} security.jail.jailed` -eq 0 ]; then
+		umount ${named_chrootdir}/dev 2>/dev/null
+		devfs_domount ${named_chrootdir}/dev devfsrules_hide_all
+		devfs -m ${named_chrootdir}/dev rule apply path null unhide
+		devfs -m ${named_chrootdir}/dev rule apply path random unhide
+	else
+		if [ -c ${named_chrootdir}/dev/null -a \
+		    -c ${named_chrootdir}/dev/random ]; then
+			info "named chroot: using pre-mounted devfs."
+		else
+			err 1 "named chroot: devfs cannot be mounted from" \
+			    "within a jail. Thus a chrooted named cannot" \
+			    "be run from within a jail." \
+			    "To run named without chrooting it, set" \
+			    "named_chrootdir=\"\" in /etc/rc.conf."
+		fi
+	fi
 
 	# Copy and/or update key files to the chroot /etc 
 	#
@@ -113,7 +126,12 @@ named_stop()
 named_poststop()
 {
 	if [ -n "${named_chrootdir}" -a -c ${named_chrootdir}/dev/null ]; then
-		umount ${named_chrootdir}/dev 2>/dev/null || true
+		if [ `${SYSCTL_N} security.jail.jailed` -eq 0 ]; then
+			umount ${named_chrootdir}/dev 2>/dev/null || true
+		else
+			warn "named chroot:" \
+			    "cannot unmount devfs from inside jail!"
+		fi
 	fi
 }
 

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 18:49:42 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AC523106566C;
	Sat,  7 Feb 2009 18:49:42 +0000 (UTC)
	(envelope-from piso@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 97CB58FC16;
	Sat,  7 Feb 2009 18:49:42 +0000 (UTC)
	(envelope-from piso@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17Ingwa000959;
	Sat, 7 Feb 2009 18:49:42 GMT (envelope-from piso@svn.freebsd.org)
Received: (from piso@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17IngZN000950;
	Sat, 7 Feb 2009 18:49:42 GMT (envelope-from piso@svn.freebsd.org)
Message-Id: <200902071849.n17IngZN000950@svn.freebsd.org>
From: Paolo Pisati <piso@FreeBSD.org>
Date: Sat, 7 Feb 2009 18:49:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188294 - in head: sbin sbin/ipfw sys
	sys/modules/libalias/libalias sys/netinet sys/netinet/libalias
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 18:49:43 -0000

Author: piso
Date: Sat Feb  7 18:49:42 2009
New Revision: 188294
URL: http://svn.freebsd.org/changeset/base/188294

Log:
  Add SCTP NAT support.
  
  Submitted by: CAIA (http://caia.swin.edu.au)

Added:
  head/sys/netinet/libalias/alias_sctp.c
     - copied, changed from r186543, user/piso/sys/netinet/libalias/alias_sctp.c
  head/sys/netinet/libalias/alias_sctp.h
     - copied, changed from r186543, user/piso/sys/netinet/libalias/alias_sctp.h
Modified:
  head/sbin/   (props changed)
  head/sbin/ipfw/ipfw.8
  head/sbin/ipfw/nat.c
  head/sys/   (props changed)
  head/sys/modules/libalias/libalias/Makefile
  head/sys/netinet/ip_fw_nat.c
  head/sys/netinet/libalias/alias.c
  head/sys/netinet/libalias/alias_db.c
  head/sys/netinet/libalias/alias_local.h
  head/sys/netinet/sctp_crc32.c
  head/sys/netinet/sctp_crc32.h

Modified: head/sbin/ipfw/ipfw.8
==============================================================================
--- head/sbin/ipfw/ipfw.8	Sat Feb  7 16:37:02 2009	(r188293)
+++ head/sbin/ipfw/ipfw.8	Sat Feb  7 18:49:42 2009	(r188294)
@@ -2183,17 +2183,173 @@ Redirect and LSNAT support follow closel
 See Section
 .Sx EXAMPLES
 for some examples on how to do redirect and lsnat.
+.Sh SCTP NAT SUPPORT
+Sctp nat can be configured in a simillar manner to TCP through the
+ipfw command line tool
+.Xr ipfw 8
+, the main difference is that 
+.Nm sctp nat 
+does not do port
+translation. Since the local and global side ports will be the same,
+there is no need to specify both. Ports are redirected as follows:
+.Bd -ragged -offset indent
+.Bk -words
+.Cm nat 
+.Ar nat_number 
+.Cm config if
+.Ar nic
+.Cm redirect_port sctp
+.Ar ip_address [,addr_list] {[port | port-port] [,ports]}
+.Ek
+.Ed
+.Pp
+.
+Most
+.B sctp nat
+configuration can be done in real-time through the
+.B sysctl(8)
+interface. All may be changed dynamically, though the hash_table size will only
+change for new 
+.Nm nat 
+instances. See 
+.Sx SYSCTL VARIABLES 
+for more info.
 .Sh SYSCTL VARIABLES
 A set of
 .Xr sysctl 8
 variables controls the behaviour of the firewall and
 associated modules
-.Pq Nm dummynet , bridge .
+.Pq Nm dummynet , bridge , sctp nat .
 These are shown below together with their default value
 (but always check with the
 .Xr sysctl 8
 command what value is actually in use) and meaning:
 .Bl -tag -width indent
+.It Va net.inet.ip.alias.sctp.accept_global_ootb_addip: No 0
+Defines how the 
+.Nm nat 
+responds to receipt of global OOTB ASCONF-AddIP:
+.Bl -tag -width indent
+.It Cm 0
+No response (unless a partially matching association exists -
+ports and vtags match but global address does not)
+.It Cm 1
+.Nm nat 
+will accept and process all OOTB global AddIP messages.
+.El
+.Pp
+Option 1 should never be selected as this forms a security risk. An attacker can
+establish multiple fake associations by sending AddIP messages.
+.It Va net.inet.ip.alias.sctp.chunk_proc_limit: No 5
+Defines the maximum number of chunks in an SCTP packet that will be parsed for a
+packet that matches an existing association. This value is enforced to be greater or equal
+than 
+.Cm net.inet.ip.alias.sctp.initialising_chunk_proc_limit . 
+A high value is
+a DoS risk yet setting too low a value may result in important control chunks in
+the packet not being located and parsed.
+.It Va net.inet.ip.alias.sctp.error_on_ootb: No 1
+Defines when the 
+.Nm nat 
+responds to any Out-of-the-Blue (OOTB) packets with ErrorM
+packets. An OOTB packet is a packet that arrives with no existing association
+registered in the 
+.Nm nat 
+and is not an INIT or ASCONF-AddIP packet:
+.Bl -tag -width indent
+.It Cm 0
+ErrorM is never sent in response to OOTB packets.
+.It Cm 1
+ErrorM is only sent to OOTB packets received on the local side.
+.It Cm 2
+ErrorM is sent to the local side and on the global side ONLY if there is a
+partial match (ports and vtags match but the source global IP does not). This
+value is only useful if the 
+.Nm nat 
+is tracking global IP addresses.
+.It Cm 3
+ErrorM is sent in response to all OOTB packets on both the local and global side
+(DoS risk).
+.El
+.Pp
+At the moment the default is 0, since the ErrorM packet is not yet
+supported by most SCTP stacks. When it is supported, and if not tracking
+global addresses, we recommend setting this value to 1 to allow
+multi-homed local hosts to function with the 
+.Nm nat .
+To track global addresses, we recommend setting this value to 2 to
+allow global hosts to be informed when they need to (re)send an
+ASCONF-AddIP. Value 3 should never be chosen (except for debugging) as
+the
+.Nm nat 
+will respond to all OOTB global packets (a DoS risk).
+.It Va net.inet.ip.alias.sctp.hashtable_size: No 2003
+Size of hash tables used for 
+.Nm nat 
+lookups (100 < prime_number > 1000001)
+This value sets the 
+.Nm hash table 
+size for any future created 
+.Nm nat
+instance and therefore must be set prior to creating a 
+.Nm nat 
+instance.
+The table sizes my be changed to suit specific needs. If there will be few
+concurrent associations, and memory is scarce, you may make these smaller.  If
+there will be many thousands (or millions) of concurrent associations, you
+should make these larger. A prime number is best for the table size. The sysctl
+update function will adjust your input value to the next highest prime number.
+.It Va net.inet.ip.alias.sctp.holddown_time:  No 0
+Hold association in table for this many seconds after receiving a
+SHUTDOWN-COMPLETE.  This allows endpoints to correct shutdown gracefully if a
+shutdown_complete is lost and retransmissions are required.
+.It Va net.inet.ip.alias.sctp.init_timer: No 15
+Timeout value while waiting for (INIT-ACK|AddIP-ACK).
+This value cannot be 0.
+.It Va net.inet.ip.alias.sctp.initialising_chunk_proc_limit: No 2
+Defines the maximum number of chunks in an SCTP packet that will be parsed when
+no existing association exists that matches that packet. Ideally this packet
+will only be an INIT or ASCONF-AddIP packet. A higher value may become a DoS
+risk as malformed packets can consume processing resources.
+.It Va net.inet.ip.alias.sctp.param_proc_limit: No 25
+Defines the maximum number of parameters within a chunk that will be parsed in a
+packet. As for other similar sysctl variables, larger values pose a DoS risk.
+.It Va net.inet.ip.alias.sctp.log_level: No 0 
+Level of detail in the system log messages (0 \- minimal, 1 \- event,
+2 \- info, 3 \- detail, 4 \- debug, 5 \- max debug). May be a good
+option in high loss environments.
+.It Va net.inet.ip.alias.sctp.shutdown_time: No 15
+Timeout value while waiting for SHUTDOWN-COMPLETE.
+This value cannot be 0.
+.It Va net.inet.ip.alias.sctp.track_global_addresses: No 0
+Enables/disables global IP address tracking within the 
+.Nm nat 
+and places an
+upper limit on the number of addresses tracked for each association:
+.Bl -tag -width indent
+.It Cm 0
+Global tracking is disabled
+.It Cm >1
+Enables tracking, the maximum number of addresses tracked for each
+association is limited to this value
+.El
+.Pp
+This variable is fully dynamic, the new value will be adopted for all newly
+arriving associations, existing association are treated as they were previously.
+Global tracking will decrease the number of collisions within the 
+.Nm nat 
+at a cost
+of increased processing load, memory usage, complexity, and possible 
+.Nm nat 
+state
+problems in complex networks with multiple 
+.Nm nats . 
+We recommend not tracking
+global IP addresses, this will still result in a fully functional 
+.Nm nat .
+.It Va net.inet.ip.alias.sctp.up_timer: No 300
+Timeout value to keep an association up with no traffic.
+This value cannot be 0.
 .It Va net.inet.ip.dummynet.expire : No 1
 Lazily delete dynamic pipes/queue once they have no pending traffic.
 You can disable this by setting the variable to 0, in which case
@@ -2718,6 +2874,15 @@ as part of a Summer of Code 2005 project
 Work on
 .Nm dummynet
 traffic shaper supported by Akamba Corp.
+.Pp
+Sctp
+.Nm nat
+support has been developed by
+.An The Centre for Advanced Internet Architectures (CAIA) Aq http://www.caia.swin.edu.au .
+The primary developers and maintainers are David Hayes and Jason But.
+For further information visit:
+.Aq http://www.caia.swin.edu.au/urp/SONATA
+.
 .Sh BUGS
 The syntax has grown over the years and sometimes it might be confusing.
 Unfortunately, backward compatibility prevents cleaning up mistakes

Modified: head/sbin/ipfw/nat.c
==============================================================================
--- head/sbin/ipfw/nat.c	Sat Feb  7 16:37:02 2009	(r188293)
+++ head/sbin/ipfw/nat.c	Sat Feb  7 18:49:42 2009	(r188294)
@@ -257,7 +257,9 @@ StrToProto (const char* str)
 	if (!strcmp (str, "udp"))
 		return IPPROTO_UDP;
 
-	errx (EX_DATAERR, "unknown protocol %s. Expected tcp or udp", str);
+	if (!strcmp (str, "sctp"))
+		return IPPROTO_SCTP;
+	errx (EX_DATAERR, "unknown protocol %s. Expected sctp, tcp or udp", str);
 }
 
 static int 
@@ -433,13 +435,27 @@ setup_redir_port(char *spool_buf, int le
 		strncpy(tmp_spool_buf, *av, strlen(*av)+1);
 		lsnat = 1;
 	} else {
-		if (StrToAddrAndPortRange (*av, &r->laddr, protoName, 
-		    &portRange) != 0)
-			errx(EX_DATAERR, "redirect_port:"
-			    "invalid local port range");
+		/*
+		 * The sctp nat does not allow the port numbers to be mapped to 
+		 * new port numbers. Therefore, no ports are to be specified 
+		 * in the target port field.
+		 */
+		if (r->proto == IPPROTO_SCTP) {
+			if (strchr (*av, ':'))
+				errx(EX_DATAERR, "redirect_port:"
+				    "port numbers do not change in sctp, so do not "
+				    "specify them as part of the target");
+			else
+				StrToAddr(*av, &r->laddr);
+		} else {
+			if (StrToAddrAndPortRange (*av, &r->laddr, protoName, 
+				&portRange) != 0)
+				errx(EX_DATAERR, "redirect_port:"
+				    "invalid local port range");
 
-		r->lport = GETLOPORT(portRange);
-		numLocalPorts = GETNUMPORTS(portRange);
+			r->lport = GETLOPORT(portRange);
+			numLocalPorts = GETNUMPORTS(portRange);
+		}
 	}
 	INC_ARGCV();	
 
@@ -463,6 +479,10 @@ setup_redir_port(char *spool_buf, int le
 	}
 
 	r->pport = GETLOPORT(portRange);
+	if (r->proto == IPPROTO_SCTP) { /* so the logic below still works */
+		numLocalPorts = GETNUMPORTS(portRange);
+		r->lport = r->pport;
+	}
 	r->pport_cnt = GETNUMPORTS(portRange);
 	INC_ARGCV();
 
@@ -518,14 +538,31 @@ setup_redir_port(char *spool_buf, int le
 				goto nospace;
 			len -= SOF_SPOOL;
 			space += SOF_SPOOL;
-			if (StrToAddrAndPortRange(sep, &tmp->addr, protoName, 
-			    &portRange) != 0)
-				errx(EX_DATAERR, "redirect_port:"
-				    "invalid local port range");
-			if (GETNUMPORTS(portRange) != 1)
-				errx(EX_DATAERR, "redirect_port: local port"
-				    "must be single in this context");
-			tmp->port = GETLOPORT(portRange);
+			/*
+			 * The sctp nat does not allow the port numbers to be mapped to new port numbers
+			 * Therefore, no ports are to be specified in the target port field
+			 */
+			if (r->proto == IPPROTO_SCTP) {
+				if (strchr (sep, ':')) {
+					errx(EX_DATAERR, "redirect_port:"
+					    "port numbers do not change in "
+					    "sctp, so do not specify them as "
+					    "part of the target");
+				} else {
+					StrToAddr(sep, &tmp->addr);
+					tmp->port = r->pport;
+				}
+			} else {
+				if (StrToAddrAndPortRange(sep, &tmp->addr, 
+					protoName, &portRange) != 0)
+					errx(EX_DATAERR, "redirect_port:"
+					    "invalid local port range");
+				if (GETNUMPORTS(portRange) != 1)
+					errx(EX_DATAERR, "redirect_port: "
+					    "local port must be single in "
+					    "this context");
+				tmp->port = GETLOPORT(portRange);
+			}
 			r->spool_cnt++;	
 			/* Point to the next possible cfg_spool. */
 			spool_buf = &spool_buf[SOF_SPOOL];

Modified: head/sys/modules/libalias/libalias/Makefile
==============================================================================
--- head/sys/modules/libalias/libalias/Makefile	Sat Feb  7 16:37:02 2009	(r188293)
+++ head/sys/modules/libalias/libalias/Makefile	Sat Feb  7 18:49:42 2009	(r188294)
@@ -3,6 +3,6 @@
 .PATH: ${.CURDIR}/../../../netinet/libalias
 
 KMOD=	libalias
-SRCS=	alias.c alias_db.c alias_proxy.c alias_util.c alias_mod.c
+SRCS=	alias.c alias_db.c alias_proxy.c alias_util.c alias_mod.c alias_sctp.c
 
 .include <bsd.kmod.mk>

Modified: head/sys/netinet/ip_fw_nat.c
==============================================================================
--- head/sys/netinet/ip_fw_nat.c	Sat Feb  7 16:37:02 2009	(r188293)
+++ head/sys/netinet/ip_fw_nat.c	Sat Feb  7 18:49:42 2009	(r188294)
@@ -326,6 +326,10 @@ ipfw_nat(struct ip_fw_args *args, struct
 	else
 		retval = LibAliasOut(t->lib, c, 
 			mcl->m_len + M_TRAILINGSPACE(mcl));
+	if (retval == PKT_ALIAS_RESPOND) {
+	  m->m_flags |= M_SKIP_FIREWALL;
+	  retval = PKT_ALIAS_OK;
+	}
 	if (retval != PKT_ALIAS_OK &&
 	    retval != PKT_ALIAS_FOUND_HEADER_FRAGMENT) {
 		/* XXX - should i add some logging? */

Modified: head/sys/netinet/libalias/alias.c
==============================================================================
--- head/sys/netinet/libalias/alias.c	Sat Feb  7 16:37:02 2009	(r188293)
+++ head/sys/netinet/libalias/alias.c	Sat Feb  7 18:49:42 2009	(r188294)
@@ -115,6 +115,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/mbuf.h>
+#include <sys/sysctl.h>
 #else
 #include <sys/types.h>
 #include <stdlib.h>
@@ -143,6 +144,17 @@ __FBSDID("$FreeBSD$");
 #include "alias_mod.h"
 #endif
 
+/* 
+ * Define libalias SYSCTL Node
+ */
+#ifdef SYSCTL_NODE
+
+SYSCTL_DECL(_net_inet);
+SYSCTL_DECL(_net_inet_ip);
+SYSCTL_NODE(_net_inet_ip, OID_AUTO, alias, CTLFLAG_RW, NULL, "Libalias sysctl API");
+
+#endif
+
 static __inline int
 twowords(void *p)
 {
@@ -1335,6 +1347,11 @@ LibAliasInLocked(struct libalias *la, ch
 		case IPPROTO_TCP:
 			iresult = TcpAliasIn(la, pip);
 			break;
+#ifdef _KERNEL
+		case IPPROTO_SCTP:
+		  iresult = SctpAlias(la, pip, SN_TO_LOCAL);
+			break;
+#endif
  		case IPPROTO_GRE: {
 			int error;
 			struct alias_data ad = {
@@ -1477,10 +1494,15 @@ LibAliasOutLocked(struct libalias *la, c
 		case IPPROTO_UDP:
 			iresult = UdpAliasOut(la, pip, maxpacketsize, create);
 			break;
-			case IPPROTO_TCP:
+		case IPPROTO_TCP:
 			iresult = TcpAliasOut(la, pip, maxpacketsize, create);
 			break;
- 		case IPPROTO_GRE: {
+#ifdef _KERNEL
+		case IPPROTO_SCTP:
+		  iresult = SctpAlias(la, pip, SN_TO_GLOBAL);
+			break;
+#endif
+		case IPPROTO_GRE: {
 			int error;
 			struct alias_data ad = {
 				.lnk = NULL, 

Modified: head/sys/netinet/libalias/alias_db.c
==============================================================================
--- head/sys/netinet/libalias/alias_db.c	Sat Feb  7 16:37:02 2009	(r188293)
+++ head/sys/netinet/libalias/alias_db.c	Sat Feb  7 18:49:42 2009	(r188294)
@@ -411,6 +411,8 @@ static void	ShowAliasStats(struct libali
 static int	InitPacketAliasLog(struct libalias *);
 static void	UninitPacketAliasLog(struct libalias *);
 
+void SctpShowAliasStats(struct libalias *la);
+
 static		u_int
 StartPointIn(struct in_addr alias_addr,
     u_short alias_port,
@@ -489,15 +491,17 @@ ShowAliasStats(struct libalias *la)
 /* Used for debugging */
 	if (la->logDesc) {
 		int tot  = la->icmpLinkCount + la->udpLinkCount + 
+		  (la->sctpLinkCount>>1) + /* sctp counts half associations */
 			la->tcpLinkCount + la->pptpLinkCount +
 			la->protoLinkCount + la->fragmentIdLinkCount +
 			la->fragmentPtrLinkCount;
 		
 		AliasLog(la->logDesc,
-			 "icmp=%u, udp=%u, tcp=%u, pptp=%u, proto=%u, frag_id=%u frag_ptr=%u / tot=%u",
+			 "icmp=%u, udp=%u, tcp=%u, sctp=%u, pptp=%u, proto=%u, frag_id=%u frag_ptr=%u / tot=%u",
 			 la->icmpLinkCount,
 			 la->udpLinkCount,
 			 la->tcpLinkCount,
+			 la->sctpLinkCount>>1, /* sctp counts half associations */
 			 la->pptpLinkCount,
 			 la->protoLinkCount,
 			 la->fragmentIdLinkCount,
@@ -508,6 +512,13 @@ ShowAliasStats(struct libalias *la)
 	}
 }
 
+void SctpShowAliasStats(struct libalias *la)
+{
+
+	ShowAliasStats(la);
+}
+
+
 /* Internal routines for finding, deleting and adding links
 
 Port Allocation:
@@ -1278,6 +1289,11 @@ _FindLinkIn(struct libalias *la, struct 
 			src_port = lnk->src_port;
 		}
 
+		if (link_type == LINK_SCTP) {
+		  lnk->src_addr = src_addr;
+		  lnk->src_port = src_port;
+		  return(lnk);
+		}
 		lnk = ReLink(lnk,
 		    src_addr, dst_addr, alias_addr,
 		    src_port, dst_port, alias_port,
@@ -2277,10 +2293,13 @@ LibAliasRedirectPort(struct libalias *la
 	case IPPROTO_TCP:
 		link_type = LINK_TCP;
 		break;
+	case IPPROTO_SCTP:
+		link_type = LINK_SCTP;
+		break;
 	default:
 #ifdef LIBALIAS_DEBUG
 		fprintf(stderr, "PacketAliasRedirectPort(): ");
-		fprintf(stderr, "only TCP and UDP protocols allowed\n");
+		fprintf(stderr, "only SCTP, TCP and UDP protocols allowed\n");
 #endif
 		lnk = NULL;
 		goto getout;
@@ -2496,6 +2515,9 @@ LibAliasInit(struct libalias *la)
 			LIST_INIT(&la->linkTableOut[i]);
 		for (i = 0; i < LINK_TABLE_IN_SIZE; i++)
 			LIST_INIT(&la->linkTableIn[i]);
+#ifdef _KERNEL
+		AliasSctpInit(la);
+#endif
 		LIBALIAS_LOCK_INIT(la);
 		LIBALIAS_LOCK(la);
 	} else {
@@ -2503,6 +2525,10 @@ LibAliasInit(struct libalias *la)
 		la->deleteAllLinks = 1;
 		CleanupAliasData(la);
 		la->deleteAllLinks = 0;
+#ifdef _KERNEL
+		AliasSctpTerm(la);
+		AliasSctpInit(la);
+#endif
 	}
 
 	la->aliasAddress.s_addr = INADDR_ANY;
@@ -2511,6 +2537,7 @@ LibAliasInit(struct libalias *la)
 	la->icmpLinkCount = 0;
 	la->udpLinkCount = 0;
 	la->tcpLinkCount = 0;
+	la->sctpLinkCount = 0;
 	la->pptpLinkCount = 0;
 	la->protoLinkCount = 0;
 	la->fragmentIdLinkCount = 0;
@@ -2539,6 +2566,9 @@ LibAliasUninit(struct libalias *la)
 {
 
 	LIBALIAS_LOCK(la);
+#ifdef _KERNEL
+	AliasSctpTerm(la);
+#endif
 	la->deleteAllLinks = 1;
 	CleanupAliasData(la);
 	la->deleteAllLinks = 0;
@@ -2879,3 +2909,30 @@ LibAliasSetSkinnyPort(struct libalias *l
 	la->skinnyPort = port;
 	LIBALIAS_UNLOCK(la);
 }
+
+/*
+ * Find the address to redirect incoming packets
+ */
+struct in_addr
+FindSctpRedirectAddress(struct libalias *la,  struct sctp_nat_msg *sm)
+{
+	struct alias_link *lnk;
+	struct in_addr redir;
+
+	LIBALIAS_LOCK_ASSERT(la);
+	lnk = FindLinkIn(la, sm->ip_hdr->ip_src, sm->ip_hdr->ip_dst,
+	    sm->sctp_hdr->dest_port,sm->sctp_hdr->dest_port, LINK_SCTP, 1);
+	if (lnk != NULL) {
+		return(lnk->src_addr); /* port redirect */
+	} else {
+		redir = FindOriginalAddress(la,sm->ip_hdr->ip_dst);
+		if (redir.s_addr == la->aliasAddress.s_addr ||
+		    redir.s_addr == la->targetAddress.s_addr) { /* No address found */
+			lnk = FindLinkIn(la, sm->ip_hdr->ip_src, sm->ip_hdr->ip_dst,
+			    NO_DEST_PORT, 0, LINK_SCTP, 1);
+			if (lnk != NULL)
+				return(lnk->src_addr); /* redirect proto */
+		}
+		return(redir); /* address redirect */
+	}
+}

Modified: head/sys/netinet/libalias/alias_local.h
==============================================================================
--- head/sys/netinet/libalias/alias_local.h	Sat Feb  7 16:37:02 2009	(r188293)
+++ head/sys/netinet/libalias/alias_local.h	Sat Feb  7 18:49:42 2009	(r188294)
@@ -57,6 +57,10 @@
 
 /* XXX: LibAliasSetTarget() uses this constant. */
 #define	INADDR_NONE	0xffffffff
+
+#include <netinet/libalias/alias_sctp.h>
+#else
+#include "alias_sctp.h"
 #endif
 
 /* Sizes of input and output link tables */
@@ -147,7 +151,29 @@ struct libalias {
 
 	struct in_addr	true_addr;	/* in network byte order. */
 	u_short		true_port;	/* in host byte order. */
+
+	/*
+	 * sctp code support
+	 */
+
+	/* counts associations that have progressed to UP and not yet removed */
+	int		sctpLinkCount;
 #ifdef  _KERNEL
+	/* timing queue for keeping track of association timeouts */
+	struct sctp_nat_timer sctpNatTimer;
+	
+	/* size of hash table used in this instance */
+	u_int sctpNatTableSize;
+	
+/* 
+ * local look up table sorted by l_vtag/l_port 
+ */
+	LIST_HEAD(sctpNatTableL, sctp_nat_assoc) *sctpTableLocal;
+/* 
+ * global look up table sorted by g_vtag/g_port 
+ */
+	LIST_HEAD(sctpNatTableG, sctp_nat_assoc) *sctpTableGlobal;
+	
 	/* 
 	 * avoid races in libalias: every public function has to use it.
 	 */
@@ -199,6 +225,14 @@ struct libalias {
 /* Prototypes */
 
 /*
+ * SctpFunction prototypes
+ * 
+ */
+void AliasSctpInit(struct libalias *la);
+void AliasSctpTerm(struct libalias *la);
+int SctpAlias(struct libalias *la, struct ip *ip, int direction);
+
+/*
  * We do not calculate TCP checksums when libalias is a kernel
  * module, since it has no idea about checksum offloading.
  * If TCP data has changed, then we just set checksum to zero,
@@ -264,6 +298,8 @@ struct in_addr
 		FindOriginalAddress(struct libalias *la, struct in_addr _alias_addr);
 struct in_addr
 		FindAliasAddress(struct libalias *la, struct in_addr _original_addr);
+struct in_addr 
+FindSctpRedirectAddress(struct libalias *la,  struct sctp_nat_msg *sm);
 
 /* External data access/modification */
 int

Copied and modified: head/sys/netinet/libalias/alias_sctp.c (from r186543, user/piso/sys/netinet/libalias/alias_sctp.c)
==============================================================================
--- user/piso/sys/netinet/libalias/alias_sctp.c	Sun Dec 28 17:16:32 2008	(r186543, copy source)
+++ head/sys/netinet/libalias/alias_sctp.c	Sat Feb  7 18:49:42 2009	(r188294)
@@ -1,34 +1,9 @@
-//* 	$Id$	 */
-//#ifndef lint
-//static char vcid[] = "$Id$";
-//#endif /* lint */
 /**
  * @file alias_sctp.c
  * Copyright (c) 2008, Centre for Advanced Internet Architectures
  * Swinburne University of Technology, Melbourne, Australia
  * (CRICOS number 00111D).
  * 
- * Alias_sctp forms part of the libalias kernel module to handle 
- * Network Address Translation (NAT) for the SCTP protocol.
- *
- *  This software was developed by David A. Hayes and Jason But
- *
- * The design is outlined in CAIA technical report number  080618A
- * (D. Hayes and J. But, "Alias_sctp Version 0.1: SCTP NAT implementation in IPFW")
- *
- * Development is part of the CAIA SONATA project,
- * proposed by Jason But and Grenville Armitage:
- * http://caia.swin.edu.au/urp/sonata/
- *
- * 
- * This project has been made possible in part by a grant from
- * the Cisco University Research Program Fund at Community
- * Foundation Silicon Valley.
- *
- *
- *
- *  All rights reserved.
- * 
  *  Redistribution and use in source and binary forms, with or without
  *  modification, are permitted provided that the following conditions
  *  are met:
@@ -54,6 +29,23 @@
  *  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  *  SUCH DAMAGE.
  *
+ * Alias_sctp forms part of the libalias kernel module to handle 
+ * Network Address Translation (NAT) for the SCTP protocol.
+ *
+ *  This software was developed by David A. Hayes and Jason But
+ *
+ * The design is outlined in CAIA technical report number  080618A
+ * (D. Hayes and J. But, "Alias_sctp Version 0.1: SCTP NAT implementation in IPFW")
+ *
+ * Development is part of the CAIA SONATA project,
+ * proposed by Jason But and Grenville Armitage:
+ * http://caia.swin.edu.au/urp/sonata/
+ *
+ * 
+ * This project has been made possible in part by a grant from
+ * the Cisco University Research Program Fund at Community
+ * Foundation Silicon Valley.
+ *
  */
 /** @mainpage 
  * Alias_sctp is part of the SONATA (http://caia.swin.edu.au/urp/sonata) project
@@ -80,6 +72,8 @@
  * - Dynamic control of hash-table size
  */
 
+/* $FreeBSD$ */
+
 #ifdef _KERNEL
 #include <machine/stdarg.h>
 #include <sys/param.h>
@@ -107,9 +101,9 @@
  */
 /* Packet Parsing Functions */
 static int sctp_PktParser(struct libalias *la, int direction, struct ip *pip,
-                          struct sctp_nat_msg *sm, struct sctp_nat_assoc **passoc);
+    struct sctp_nat_msg *sm, struct sctp_nat_assoc **passoc);
 static int GetAsconfVtags(struct libalias *la, struct sctp_nat_msg *sm,
-			  uint32_t *l_vtag, uint32_t *g_vtag, int direction);
+    uint32_t *l_vtag, uint32_t *g_vtag, int direction);
 static int IsASCONFack(struct libalias *la, struct sctp_nat_msg *sm, int direction);
 
 static void AddGlobalIPAddresses(struct sctp_nat_msg *sm, struct sctp_nat_assoc *assoc, int direction);
@@ -119,20 +113,20 @@ static int IsADDorDEL(struct libalias *l
 
 /* State Machine Functions */
 static int ProcessSctpMsg(struct libalias *la, int direction, \
-			  struct sctp_nat_msg *sm, struct sctp_nat_assoc *assoc);
+    struct sctp_nat_msg *sm, struct sctp_nat_assoc *assoc);
 
 static int ID_process(struct libalias *la, int direction,\
-		      struct sctp_nat_assoc *assoc, struct sctp_nat_msg *sm);
+    struct sctp_nat_assoc *assoc, struct sctp_nat_msg *sm);
 static int INi_process(struct libalias *la, int direction,\
-		       struct sctp_nat_assoc *assoc, struct sctp_nat_msg *sm);
+    struct sctp_nat_assoc *assoc, struct sctp_nat_msg *sm);
 static int INa_process(struct libalias *la, int direction,\
-		       struct sctp_nat_assoc *assoc, struct sctp_nat_msg *sm);
+    struct sctp_nat_assoc *assoc, struct sctp_nat_msg *sm);
 static int UP_process(struct libalias *la, int direction,\
-		      struct sctp_nat_assoc *assoc, struct sctp_nat_msg *sm);
+    struct sctp_nat_assoc *assoc, struct sctp_nat_msg *sm);
 static int CL_process(struct libalias *la, int direction,\
-		      struct sctp_nat_assoc *assoc, struct sctp_nat_msg *sm);
+    struct sctp_nat_assoc *assoc, struct sctp_nat_msg *sm);
 static void TxAbortErrorM(struct libalias *la,  struct sctp_nat_msg *sm,\
-		     struct sctp_nat_assoc *assoc, int sndrply, int direction);
+    struct sctp_nat_assoc *assoc, int sndrply, int direction);
 
 /* Hash Table Functions */
 static struct sctp_nat_assoc*
@@ -189,22 +183,6 @@ static void SctpAliasLog(const char *for
  */
 void SctpShowAliasStats(struct libalias *la);
 
-/** @ingroup external
- * @brief Find the address to redirect incoming packets
- *
- * This function is defined in alias_db.c, since it calls static functions in
- * this file
- *
- * Given a destination port for incoming packets to the NAT, discover what 
- * (if any) internal IP address this packet should be re-directed to
- * 
- * @param la Pointer to the libalias instance
- * @param sm Pointer to the incoming message
- * 
- * @return Address to redirect an incoming INIT to
- */
-struct in_addr FindSctpRedirectAddress(struct libalias *la,  struct sctp_nat_msg *sm);
-
 #ifdef	_KERNEL
 
 MALLOC_DEFINE(M_SCTPNAT, "sctpnat", "sctp nat dbs");
@@ -364,9 +342,9 @@ static u_int sysctl_holddown_timer = 0; 
 static u_int sysctl_hashtable_size = SN_DEFAULT_HASH_SIZE; /**< Sets the hash table size for any NEW NAT instances (existing instances retain their existing Hash Table */
 /** @brief net.inet.ip.alias.sctp.error_on_ootb */
 static u_int sysctl_error_on_ootb = 1; /**< NAT response  to receipt of OOTB packet
-   (0 - No response, 1 - NAT will send ErrorM only to local side,
-   2 -  NAT will send local ErrorM and global ErrorM if there was a partial association match
-   3 - NAT will send ErrorM to both local and global) */
+					  (0 - No response, 1 - NAT will send ErrorM only to local side,
+					  2 -  NAT will send local ErrorM and global ErrorM if there was a partial association match
+					  3 - NAT will send ErrorM to both local and global) */
 /** @brief net.inet.ip.alias.sctp.accept_global_ootb_addip */
 static u_int sysctl_accept_global_ootb_addip = 0; /**<NAT responset to receipt of global OOTB AddIP (0 - No response, 1 - NAT will accept OOTB global AddIP messages for processing (Security risk)) */
 /** @brief net.inet.ip.alias.sctp.initialising_chunk_proc_limit */
@@ -377,7 +355,7 @@ static u_int sysctl_chunk_proc_limit = 5
 static u_int sysctl_param_proc_limit = 25; /**< A limit on the number of parameters (in chunks) that should be searched (DoS prevention) */
 /** @brief net.inet.ip.alias.sctp.track_global_addresses */
 static u_int sysctl_track_global_addresses = 0; /**< Configures the global address tracking option within the NAT (0 - Global tracking is disabled, > 0 - enables tracking but limits the number of global IP addresses to this value)
- If set to >=1 the NAT will track that many global IP addresses. This may reduce look up table conflicts, but increases processing */
+						   If set to >=1 the NAT will track that many global IP addresses. This may reduce look up table conflicts, but increases processing */
 
 #define SN_NO_ERROR_ON_OOTB              0 /**< Send no errorM on out of the blue packets */
 #define SN_LOCAL_ERROR_ON_OOTB           1 /**< Send only local errorM on out of the blue packets */
@@ -393,41 +371,41 @@ SYSCTL_DECL(_net_inet_ip_alias);
 SYSCTL_NODE(_net_inet_ip_alias, OID_AUTO, sctp, CTLFLAG_RW, NULL, "SCTP NAT");
 
 SYSCTL_PROC(_net_inet_ip_alias_sctp, OID_AUTO, log_level, CTLTYPE_UINT | CTLFLAG_RW,
-            &sysctl_log_level, 0, sysctl_chg_loglevel, "IU",
-            "Level of detail (0 - default, 1 - event, 2 - info, 3 - detail, 4 - debug, 5 - max debug)");
+    &sysctl_log_level, 0, sysctl_chg_loglevel, "IU",
+    "Level of detail (0 - default, 1 - event, 2 - info, 3 - detail, 4 - debug, 5 - max debug)");
 SYSCTL_PROC(_net_inet_ip_alias_sctp, OID_AUTO, init_timer, CTLTYPE_UINT | CTLFLAG_RW,
-            &sysctl_init_timer, 0, sysctl_chg_timer, "IU",
-            "Timeout value (s) while waiting for (INIT-ACK|AddIP-ACK)");
+    &sysctl_init_timer, 0, sysctl_chg_timer, "IU",
+    "Timeout value (s) while waiting for (INIT-ACK|AddIP-ACK)");
 SYSCTL_PROC(_net_inet_ip_alias_sctp, OID_AUTO, up_timer, CTLTYPE_UINT | CTLFLAG_RW,
-            &sysctl_up_timer, 0, sysctl_chg_timer, "IU",
-            "Timeout value (s) to keep an association up with no traffic");
+    &sysctl_up_timer, 0, sysctl_chg_timer, "IU",
+    "Timeout value (s) to keep an association up with no traffic");
 SYSCTL_PROC(_net_inet_ip_alias_sctp, OID_AUTO, shutdown_timer, CTLTYPE_UINT | CTLFLAG_RW,
-            &sysctl_shutdown_timer, 0, sysctl_chg_timer, "IU",
-            "Timeout value (s) while waiting for SHUTDOWN-COMPLETE");
+    &sysctl_shutdown_timer, 0, sysctl_chg_timer, "IU",
+    "Timeout value (s) while waiting for SHUTDOWN-COMPLETE");
 SYSCTL_PROC(_net_inet_ip_alias_sctp, OID_AUTO, holddown_timer, CTLTYPE_UINT | CTLFLAG_RW,
-            &sysctl_holddown_timer, 0, sysctl_chg_timer, "IU",
-            "Hold association in table for this many seconds after receiving a SHUTDOWN-COMPLETE");
+    &sysctl_holddown_timer, 0, sysctl_chg_timer, "IU",
+    "Hold association in table for this many seconds after receiving a SHUTDOWN-COMPLETE");
 SYSCTL_PROC(_net_inet_ip_alias_sctp, OID_AUTO, hashtable_size, CTLTYPE_UINT | CTLFLAG_RW,
-            &sysctl_hashtable_size, 0, sysctl_chg_hashtable_size, "IU",
-            "Size of hash tables used for NAT lookups (100 < prime_number > 1000001)");
+    &sysctl_hashtable_size, 0, sysctl_chg_hashtable_size, "IU",
+    "Size of hash tables used for NAT lookups (100 < prime_number > 1000001)");
 SYSCTL_PROC(_net_inet_ip_alias_sctp, OID_AUTO, error_on_ootb, CTLTYPE_UINT | CTLFLAG_RW,
-            &sysctl_error_on_ootb, 0, sysctl_chg_error_on_ootb, "IU",
-            "ErrorM sent on receipt of ootb packet:\n\t0 - none,\n\t1 - to local only,\n\t2 - to local and global if a partial association match,\n\t3 - to local and global (DoS risk)");
+    &sysctl_error_on_ootb, 0, sysctl_chg_error_on_ootb, "IU",
+    "ErrorM sent on receipt of ootb packet:\n\t0 - none,\n\t1 - to local only,\n\t2 - to local and global if a partial association match,\n\t3 - to local and global (DoS risk)");
 SYSCTL_PROC(_net_inet_ip_alias_sctp, OID_AUTO, accept_global_ootb_addip, CTLTYPE_UINT | CTLFLAG_RW,
-            &sysctl_accept_global_ootb_addip, 0, sysctl_chg_accept_global_ootb_addip, "IU",
-            "NAT response to receipt of global OOTB AddIP:\n\t0 - No response,\n\t1 - NAT will accept OOTB global AddIP messages for processing (Security risk)");
+    &sysctl_accept_global_ootb_addip, 0, sysctl_chg_accept_global_ootb_addip, "IU",
+    "NAT response to receipt of global OOTB AddIP:\n\t0 - No response,\n\t1 - NAT will accept OOTB global AddIP messages for processing (Security risk)");
 SYSCTL_PROC(_net_inet_ip_alias_sctp, OID_AUTO, initialising_chunk_proc_limit, CTLTYPE_UINT | CTLFLAG_RW,
-            &sysctl_initialising_chunk_proc_limit, 0, sysctl_chg_initialising_chunk_proc_limit, "IU",
-            "Number of chunks that should be processed if there is no current association found:\n\t > 0 (A high value is a DoS risk)");
+    &sysctl_initialising_chunk_proc_limit, 0, sysctl_chg_initialising_chunk_proc_limit, "IU",
+    "Number of chunks that should be processed if there is no current association found:\n\t > 0 (A high value is a DoS risk)");
 SYSCTL_PROC(_net_inet_ip_alias_sctp, OID_AUTO, chunk_proc_limit, CTLTYPE_UINT | CTLFLAG_RW,
-            &sysctl_chunk_proc_limit, 0, sysctl_chg_chunk_proc_limit, "IU",
-            "Number of chunks that should be processed to find key chunk:\n\t>= initialising_chunk_proc_limit (A high value is a DoS risk)");
+    &sysctl_chunk_proc_limit, 0, sysctl_chg_chunk_proc_limit, "IU",
+    "Number of chunks that should be processed to find key chunk:\n\t>= initialising_chunk_proc_limit (A high value is a DoS risk)");
 SYSCTL_PROC(_net_inet_ip_alias_sctp, OID_AUTO, param_proc_limit, CTLTYPE_UINT | CTLFLAG_RW,
-            &sysctl_param_proc_limit, 0, sysctl_chg_param_proc_limit, "IU",
-            "Number of parameters (in a chunk) that should be processed to find key parameters:\n\t> 1 (A high value is a DoS risk)");
+    &sysctl_param_proc_limit, 0, sysctl_chg_param_proc_limit, "IU",
+    "Number of parameters (in a chunk) that should be processed to find key parameters:\n\t> 1 (A high value is a DoS risk)");
 SYSCTL_PROC(_net_inet_ip_alias_sctp, OID_AUTO, track_global_addresses, CTLTYPE_UINT | CTLFLAG_RW,
-            &sysctl_track_global_addresses, 0, sysctl_chg_track_global_addresses, "IU",
-            "Configures the global address tracking option within the NAT:\n\t0 - Global tracking is disabled,\n\t> 0 - enables tracking but limits the number of global IP addresses to this value");
+    &sysctl_track_global_addresses, 0, sysctl_chg_track_global_addresses, "IU",
+    "Configures the global address tracking option within the NAT:\n\t0 - Global tracking is disabled,\n\t> 0 - enables tracking but limits the number of global IP addresses to this value");
 
 #endif /* SYSCTL_NODE */
 
@@ -440,16 +418,16 @@ SYSCTL_PROC(_net_inet_ip_alias_sctp, OID
  */
 int sysctl_chg_loglevel(SYSCTL_HANDLER_ARGS)
 {
-  u_int level = *(u_int *)arg1;
-  int error;
+	u_int level = *(u_int *)arg1;
+	int error;
 
-  error = sysctl_handle_int(oidp, &level, 0, req);
-  if (error) return (error);
+	error = sysctl_handle_int(oidp, &level, 0, req);
+	if (error) return (error);
 
-  sysctl_log_level = (level > SN_LOG_DEBUG_MAX)?(SN_LOG_DEBUG_MAX):(level);
-  sysctl_log_level = (level < SN_LOG_LOW)?(SN_LOG_LOW):(level);
+	sysctl_log_level = (level > SN_LOG_DEBUG_MAX)?(SN_LOG_DEBUG_MAX):(level);
+	sysctl_log_level = (level < SN_LOG_LOW)?(SN_LOG_LOW):(level);
 
-  return (0);
+	return (0);
 }
 
 /** @ingroup sysctl
@@ -461,22 +439,22 @@ int sysctl_chg_loglevel(SYSCTL_HANDLER_A
  */
 int sysctl_chg_timer(SYSCTL_HANDLER_ARGS)
 {
-  u_int timer = *(u_int *)arg1;
-  int error;
+	u_int timer = *(u_int *)arg1;
+	int error;
 
-  error = sysctl_handle_int(oidp, &timer, 0, req);
-  if (error) return (error);
+	error = sysctl_handle_int(oidp, &timer, 0, req);
+	if (error) return (error);
 
-  timer = (timer > SN_MAX_TIMER)?(SN_MAX_TIMER):(timer);
+	timer = (timer > SN_MAX_TIMER)?(SN_MAX_TIMER):(timer);
 
-  if (((u_int *)arg1) != &sysctl_holddown_timer)
-  {
-    timer = (timer < SN_MIN_TIMER)?(SN_MIN_TIMER):(timer);
-  }
+	if (((u_int *)arg1) != &sysctl_holddown_timer)
+	    {
+		    timer = (timer < SN_MIN_TIMER)?(SN_MIN_TIMER):(timer);
+	    }
 
-  *(u_int *)arg1 = timer;
+	*(u_int *)arg1 = timer;
 
-  return (0);
+	return (0);
 }
 
 /** @ingroup sysctl
@@ -490,20 +468,20 @@ int sysctl_chg_timer(SYSCTL_HANDLER_ARGS
  */
 int sysctl_chg_hashtable_size(SYSCTL_HANDLER_ARGS)
 {
-  u_int size = *(u_int *)arg1;
-  int error;
+	u_int size = *(u_int *)arg1;
+	int error;
 
-  error = sysctl_handle_int(oidp, &size, 0, req);
-  if (error) return (error);
+	error = sysctl_handle_int(oidp, &size, 0, req);
+	if (error) return (error);
 
-  size = (size < SN_MIN_HASH_SIZE)?(SN_MIN_HASH_SIZE):((size > SN_MAX_HASH_SIZE)?(SN_MAX_HASH_SIZE):(size));
+	size = (size < SN_MIN_HASH_SIZE)?(SN_MIN_HASH_SIZE):((size > SN_MAX_HASH_SIZE)?(SN_MAX_HASH_SIZE):(size));
 
-  size |= 0x00000001; /* make odd */
+	size |= 0x00000001; /* make odd */
 
-  for(;(((size % 3) == 0) || ((size % 5) == 0) || ((size % 7) == 0) || ((size % 11) == 0)); size+=2);
-  sysctl_hashtable_size = size;
+	for(;(((size % 3) == 0) || ((size % 5) == 0) || ((size % 7) == 0) || ((size % 11) == 0)); size+=2);
+	sysctl_hashtable_size = size;
 
-  return (0);
+	return (0);
 }
 
 /** @ingroup sysctl
@@ -518,15 +496,15 @@ int sysctl_chg_hashtable_size(SYSCTL_HAN
  */
 int sysctl_chg_error_on_ootb(SYSCTL_HANDLER_ARGS)
 {
-  u_int flag = *(u_int *)arg1;
-  int error;
+	u_int flag = *(u_int *)arg1;
+	int error;
 
-  error = sysctl_handle_int(oidp, &flag, 0, req);
-  if (error) return (error);
+	error = sysctl_handle_int(oidp, &flag, 0, req);
+	if (error) return (error);
 
-  sysctl_error_on_ootb = (flag > SN_ERROR_ON_OOTB) ? SN_ERROR_ON_OOTB: flag;
+	sysctl_error_on_ootb = (flag > SN_ERROR_ON_OOTB) ? SN_ERROR_ON_OOTB: flag;
 
-  return (0);
+	return (0);
 }
 
 /** @ingroup sysctl
@@ -537,15 +515,15 @@ int sysctl_chg_error_on_ootb(SYSCTL_HAND
  */
 int sysctl_chg_accept_global_ootb_addip(SYSCTL_HANDLER_ARGS)
 {
-  u_int flag = *(u_int *)arg1;
-  int error;
+	u_int flag = *(u_int *)arg1;
+	int error;
 
-  error = sysctl_handle_int(oidp, &flag, 0, req);
-  if (error) return (error);
+	error = sysctl_handle_int(oidp, &flag, 0, req);
+	if (error) return (error);
 
-  sysctl_accept_global_ootb_addip = (flag == 1) ? 1: 0;
+	sysctl_accept_global_ootb_addip = (flag == 1) ? 1: 0;
 
-  return (0);
+	return (0);
 }
 
 /** @ingroup sysctl
@@ -557,17 +535,17 @@ int sysctl_chg_accept_global_ootb_addip(
  */
 int sysctl_chg_initialising_chunk_proc_limit(SYSCTL_HANDLER_ARGS)
 {
-  u_int proclimit = *(u_int *)arg1;
-  int error;
+	u_int proclimit = *(u_int *)arg1;
+	int error;
 
-  error = sysctl_handle_int(oidp, &proclimit, 0, req);
-  if (error) return (error);
+	error = sysctl_handle_int(oidp, &proclimit, 0, req);
+	if (error) return (error);
 
-  sysctl_initialising_chunk_proc_limit = (proclimit < 1) ? 1: proclimit;
-  sysctl_chunk_proc_limit = 
-    (sysctl_chunk_proc_limit < sysctl_initialising_chunk_proc_limit) ? sysctl_initialising_chunk_proc_limit : sysctl_chunk_proc_limit;
+	sysctl_initialising_chunk_proc_limit = (proclimit < 1) ? 1: proclimit;
+	sysctl_chunk_proc_limit = 
+		(sysctl_chunk_proc_limit < sysctl_initialising_chunk_proc_limit) ? sysctl_initialising_chunk_proc_limit : sysctl_chunk_proc_limit;
  
-  return (0);
+	return (0);
 }
 
 /** @ingroup sysctl
@@ -579,16 +557,16 @@ int sysctl_chg_initialising_chunk_proc_l
  */
 int sysctl_chg_chunk_proc_limit(SYSCTL_HANDLER_ARGS)
 {
-  u_int proclimit = *(u_int *)arg1;
-  int error;
+	u_int proclimit = *(u_int *)arg1;
+	int error;
 
-  error = sysctl_handle_int(oidp, &proclimit, 0, req);
-  if (error) return (error);
+	error = sysctl_handle_int(oidp, &proclimit, 0, req);
+	if (error) return (error);
 
-  sysctl_chunk_proc_limit = 
-    (proclimit < sysctl_initialising_chunk_proc_limit) ? sysctl_initialising_chunk_proc_limit : proclimit;
+	sysctl_chunk_proc_limit = 
+		(proclimit < sysctl_initialising_chunk_proc_limit) ? sysctl_initialising_chunk_proc_limit : proclimit;
 
-  return (0);
+	return (0);
 }
 
 
@@ -601,16 +579,16 @@ int sysctl_chg_chunk_proc_limit(SYSCTL_H
  */
 int sysctl_chg_param_proc_limit(SYSCTL_HANDLER_ARGS)
 {
-  u_int proclimit = *(u_int *)arg1;
-  int error;
+	u_int proclimit = *(u_int *)arg1;
+	int error;
 
-  error = sysctl_handle_int(oidp, &proclimit, 0, req);
-  if (error) return (error);
+	error = sysctl_handle_int(oidp, &proclimit, 0, req);
+	if (error) return (error);
 
-  sysctl_param_proc_limit = 
-    (proclimit < 2) ? 2 : proclimit;
+	sysctl_param_proc_limit = 

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 19:17:10 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BB2B71065670;
	Sat,  7 Feb 2009 19:17:10 +0000 (UTC)
	(envelope-from ache@nagual.pp.ru)
Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69])
	by mx1.freebsd.org (Postfix) with ESMTP id 1C82F8FC1A;
	Sat,  7 Feb 2009 19:17:09 +0000 (UTC)
	(envelope-from ache@nagual.pp.ru)
Received: from nagual.pp.ru (ache@localhost [127.0.0.1])
	by nagual.pp.ru (8.14.3/8.14.3) with ESMTP id n17J4Ini001816;
	Sat, 7 Feb 2009 22:04:18 +0300 (MSK)
	(envelope-from ache@nagual.pp.ru)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nagual.pp.ru;
	s=default; t=1234033459; bh=C+pWsuZf9xQKUO7FlMSGFhUdOBFN3QIgeY9wN6B
	QN/A=; l=806; h=Date:From:To:Cc:Subject:Message-ID:References:
	MIME-Version:Content-Type:In-Reply-To; b=ncVrQR/FPbM2uiU9nrm1UIXLO
	1Qs08R7uey/dKKF6Xg+04PYJHlBfzE2C2QeeAceLi5rBH+A3U0rq/gneK0UBuADnIxm
	ugfxa3BPx6qm4UZqCnKhJY8eZw4nL0hftfQLWKEVI9CSlZmCB1+5C9n6Nm33Y+NMxVA
	uanauXEXwPCM=
Received: (from ache@localhost)
	by nagual.pp.ru (8.14.3/8.14.3/Submit) id n17J4ItI001814;
	Sat, 7 Feb 2009 22:04:18 +0300 (MSK) (envelope-from ache)
Date: Sat, 7 Feb 2009 22:04:18 +0300
From: Andrey Chernov <ache@nagual.pp.ru>
To: Warner Losh <imp@FreeBSD.org>
Message-ID: <20090207190418.GA336@nagual.pp.ru>
Mail-Followup-To: Andrey Chernov <ache@nagual.pp.ru>,
	Warner Losh <imp@FreeBSD.org>, src-committers@FreeBSD.org,
	svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org
References: <200902032025.n13KPaCV041012@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <200902032025.n13KPaCV041012@svn.freebsd.org>
User-Agent: Mutt/1.5.18 (2008-05-17)
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r188098 - head/lib/libc/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 19:17:11 -0000

On Tue, Feb 03, 2009 at 08:25:36PM +0000, Warner Losh wrote:
> ==============================================================================
> --- head/lib/libc/string/memchr.c	Tue Feb  3 20:01:51 2009	(r188097)
> +++ head/lib/libc/string/memchr.c	Tue Feb  3 20:25:36 2009	(r188098)
> @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
>  #include <string.h>
>  
>  void *
> -memchr(const void *s, unsigned char c, size_t n)
> +memchr(const void *s, int c, size_t n)
>  {
>  	if (n != 0) {
>  		const unsigned char *p = s;

You just broke comparison with negative chars, as memchr(3) says:
"The memchr() function locates the first occurrence of c (converted to an
 unsigned char)"

Please change 
	if (*p++ == c)
to
	if (*p++ == (unsigned char)c)
(as in memrchr.c)

-- 
http://ache.pp.ru/

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 19:33:13 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8E970106564A;
	Sat,  7 Feb 2009 19:33:13 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 499818FC21;
	Sat,  7 Feb 2009 19:33:13 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n17JWqs2083483;
	Sat, 7 Feb 2009 12:32:52 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Sat, 07 Feb 2009 12:32:53 -0700 (MST)
Message-Id: <20090207.123253.-1775864766.imp@bsdimp.com>
To: ache@nagual.pp.ru
From: "M. Warner Losh" <imp@bsdimp.com>
In-Reply-To: <20090207190418.GA336@nagual.pp.ru>
References: <200902032025.n13KPaCV041012@svn.freebsd.org>
	<20090207190418.GA336@nagual.pp.ru>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r188098 - head/lib/libc/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 19:33:14 -0000

In message: <20090207190418.GA336@nagual.pp.ru>
            Andrey Chernov <ache@nagual.pp.ru> writes:
: On Tue, Feb 03, 2009 at 08:25:36PM +0000, Warner Losh wrote:
: > ==============================================================================
: > --- head/lib/libc/string/memchr.c	Tue Feb  3 20:01:51 2009	(r188097)
: > +++ head/lib/libc/string/memchr.c	Tue Feb  3 20:25:36 2009	(r188098)
: > @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
: >  #include <string.h>
: >  
: >  void *
: > -memchr(const void *s, unsigned char c, size_t n)
: > +memchr(const void *s, int c, size_t n)
: >  {
: >  	if (n != 0) {
: >  		const unsigned char *p = s;
: 
: You just broke comparison with negative chars, as memchr(3) says:
: "The memchr() function locates the first occurrence of c (converted to an
:  unsigned char)"
: 
: Please change 
: 	if (*p++ == c)
: to
: 	if (*p++ == (unsigned char)c)
: (as in memrchr.c)

Yes.  Thanks.

Warner

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 19:34:44 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7B66B1065672;
	Sat,  7 Feb 2009 19:34:44 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 69B888FC17;
	Sat,  7 Feb 2009 19:34:44 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n17JYiqU001770;
	Sat, 7 Feb 2009 19:34:44 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n17JYiji001769;
	Sat, 7 Feb 2009 19:34:44 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200902071934.n17JYiji001769@svn.freebsd.org>
From: Warner Losh <imp@FreeBSD.org>
Date: Sat, 7 Feb 2009 19:34:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r188295 - head/lib/libc/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 19:34:45 -0000

Author: imp
Date: Sat Feb  7 19:34:44 2009
New Revision: 188295
URL: http://svn.freebsd.org/changeset/base/188295

Log:
  Make sure the comparison is done with an unsigned char.

Modified:
  head/lib/libc/string/memchr.c

Modified: head/lib/libc/string/memchr.c
==============================================================================
--- head/lib/libc/string/memchr.c	Sat Feb  7 18:49:42 2009	(r188294)
+++ head/lib/libc/string/memchr.c	Sat Feb  7 19:34:44 2009	(r188295)
@@ -45,7 +45,7 @@ memchr(const void *s, int c, size_t n)
 		const unsigned char *p = s;
 
 		do {
-			if (*p++ == c)
+			if (*p++ == (unsigned char)c)
 				return ((void *)(p - 1));
 		} while (--n != 0);
 	}

From owner-svn-src-head@FreeBSD.ORG  Sat Feb  7 21:23:04 2009
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0A4C81065670
	for <svn-src-head@freebsd.org>; Sat,  7 Feb 2009 21:23:04 +0000 (UTC)
	(envelope-from christoph.mallon@gmx.de)
Received: from mail.gmx.net (mail.gmx.net [213.165.64.20])
	by mx1.freebsd.org (Postfix) with SMTP id 4DCF48FC1D
	for <svn-src-head@freebsd.org>; Sat,  7 Feb 2009 21:23:03 +0000 (UTC)
	(envelope-from christoph.mallon@gmx.de)
Received: (qmail invoked by alias); 07 Feb 2009 21:23:01 -0000
Received: from p54A3E1E8.dip.t-dialin.net (EHLO tron.homeunix.org)
	[84.163.225.232]
	by mail.gmx.net (mp038) with SMTP; 07 Feb 2009 22:23:01 +0100
X-Authenticated: #1673122
X-Provags-ID: V01U2FsdGVkX1+hNDxy2AqhVKl+P6HHZjmJGUCud4heba86m4gBoM
	TYYq3/HnvSK17g
Message-ID: <498DFBB5.9080309@gmx.de>
Date: Sat, 07 Feb 2009 22:23:01 +0100
From: Christoph Mallon <christoph.mallon@gmx.de>
User-Agent: Thunderbird 2.0.0.19 (X11/20090103)
MIME-Version: 1.0
To: John Baldwin <jhb@FreeBSD.org>
References: <200902062224.n16MO3gm072994@svn.freebsd.org>
In-Reply-To: <200902062224.n16MO3gm072994@svn.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Y-GMX-Trusted: 0
X-FuHaFi: 0.53
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r188251 - head/sys/fs/udf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Feb 2009 21:23:04 -0000

John Baldwin schrieb:
> Modified: head/sys/fs/udf/ecma167-udf.h
> ==============================================================================
> --- head/sys/fs/udf/ecma167-udf.h	Fri Feb  6 22:22:08 2009	(r188250)
> +++ head/sys/fs/udf/ecma167-udf.h	Fri Feb  6 22:24:03 2009	(r188251)
> @@ -354,6 +354,18 @@ struct file_entry {
>  #define	UDF_FENTRY_PERM_GRP_MASK	0xE0
>  #define	UDF_FENTRY_PERM_OWNER_MASK	0x1C00
>  
> +/* Path Component [4/14.16.1] */
> +struct path_component {
> +	uint8_t			type;
> +	uint8_t			length;
> +	uint16_t		version;
> +	uint8_t			identifier[0];
> +} __packed;

[0] is a GCCism. The standard way to declare a flexible array member is 
[] (cf. ISO/IEC 9899:1999 (E) §6.7.2.1:16).