CVS commit: src/sys/dev/mii

2012-10-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct 18 08:22:37 UTC 2012

Modified Files:
src/sys/dev/mii: igphy.c

Log Message:
Style fix. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/mii/igphy.c

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

Modified files:

Index: src/sys/dev/mii/igphy.c
diff -u src/sys/dev/mii/igphy.c:1.21 src/sys/dev/mii/igphy.c:1.22
--- src/sys/dev/mii/igphy.c:1.21	Sun Mar  7 07:53:37 2010
+++ src/sys/dev/mii/igphy.c	Thu Oct 18 08:22:37 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: igphy.c,v 1.21 2010/03/07 07:53:37 msaitoh Exp $	*/
+/*	$NetBSD: igphy.c,v 1.22 2012/10/18 08:22:37 msaitoh Exp $	*/
 
 /*
  * The Intel copyright applies to the analog register setup, and the
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.21 2010/03/07 07:53:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.22 2012/10/18 08:22:37 msaitoh Exp $");
 
 #include "opt_mii.h"
 
@@ -278,7 +278,7 @@ igphy_load_dspcode(struct mii_softc *sc)
 	for (i = 0; !((code[i].reg == 0) && (code[i].val == 0)); i++)
 		IGPHY_WRITE(sc, code[i].reg, code[i].val);
 
-	PHY_WRITE(sc, MII_IGPHY_PAGE_SELECT,0x);
+	PHY_WRITE(sc, MII_IGPHY_PAGE_SELECT, 0x);
 	PHY_WRITE(sc, 0x, 0x3300);
 
 	delay(2);
@@ -492,7 +492,6 @@ igphy_smartspeed_workaround(struct mii_s
 	struct igphy_softc *igsc = (struct igphy_softc *) sc;
 	uint16_t reg, gtsr, gtcr;
 
-
 	/* This workaround is only for 82541 and 82547 */
 	switch (igsc->sc_mactype) {
 	case WM_T_82541:



CVS commit: src/share/zoneinfo

2012-10-18 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Thu Oct 18 08:47:29 UTC 2012

Update of /cvsroot/src/share/zoneinfo
In directory ivanova.netbsd.org:/tmp/cvs-serv8719

Log Message:
Import tzdata2012g from ftp://ftp.iana.org/tz/releases/tzdata2012g.tar.gz

Changes from tzdata2012f to tzdata2012g:

Samoa fall 2012 and later.  (Thanks to Nicholas Pereira
and Robert Elz.)

Palestine fall 2012.  (Thanks to Steffen Thorsen.)

In addition to those changes, the tzdata distribution now includes
a copy of the Makefile from the tzcode distribution.  NetBSD's
src/share/zoneinfo/Makefile is completely different from the Makefile
that is now included in the tzdata distribution.

Status:

Vendor Tag: ADO
Release Tags:   TZDATA2012G

U src/share/zoneinfo/antarctica
C src/share/zoneinfo/Makefile
U src/share/zoneinfo/africa
C src/share/zoneinfo/australasia
U src/share/zoneinfo/asia
U src/share/zoneinfo/northamerica
U src/share/zoneinfo/europe
U src/share/zoneinfo/yearistype.sh
U src/share/zoneinfo/southamerica
U src/share/zoneinfo/pacificnew
U src/share/zoneinfo/etcetera
U src/share/zoneinfo/backward
U src/share/zoneinfo/systemv
U src/share/zoneinfo/factory
U src/share/zoneinfo/solar87
U src/share/zoneinfo/solar88
U src/share/zoneinfo/solar89
U src/share/zoneinfo/iso3166.tab
U src/share/zoneinfo/zone.tab
U src/share/zoneinfo/leapseconds

2 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jADO:yesterday -jADO src/share/zoneinfo



CVS commit: src/share/zoneinfo

2012-10-18 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Thu Oct 18 08:50:32 UTC 2012

Modified Files:
src/share/zoneinfo: australasia

Log Message:
Merge tzdata2012g from ftp://ftp.iana.org/tz/releases/tzdata2012g.tar.gz

Changes from tzdata2012f to tzdata2012g:

Samoa fall 2012 and later.  (Thanks to Nicholas Pereira
and Robert Elz.)

Palestine fall 2012.  (Thanks to Steffen Thorsen.)


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/share/zoneinfo/australasia

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

Modified files:

Index: src/share/zoneinfo/australasia
diff -u src/share/zoneinfo/australasia:1.27 src/share/zoneinfo/australasia:1.28
--- src/share/zoneinfo/australasia:1.27	Thu Sep 27 16:37:44 2012
+++ src/share/zoneinfo/australasia	Thu Oct 18 08:50:32 2012
@@ -628,6 +628,23 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 # Although Samoa has used Daylight Saving Time in the 2010-2011 and 2011-2012
 # seasons, there is not yet any indication that this trend will continue on
 # a regular basis. For now, we have explicitly listed the transitions below.
+#
+# From Nicky (2012-09-10):
+# Daylight Saving Time commences on Sunday 30th September 2012 and
+# ends on Sunday 7th of April 2013.
+#
+# Please find link below for more information.
+# http://www.mcil.gov.ws/mcil_publications.html
+#
+# That publication also includes dates for Summer of 2013/4 as well
+# which give the impression of a pattern in selecting dates for the
+# future, so for now, we will guess this will continue.
+
+# Western Samoa
+# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
+Rule	WS	2012	max	-	Sep	lastSun	3:00	1	D
+Rule	WS	2012	max	-	Apr	Sun>=1	4:00	0	-
+# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time
@@ -635,8 +652,8 @@ Zone Pacific/Apia	 12:33:04 -	LMT	1879 J
 			-11:00	1:00	WSDT	2011 Apr 2 4:00
 			-11:00	-	WST	2011 Sep 24 3:00
 			-11:00	1:00	WSDT	2011 Dec 30
-			 13:00	1:00	WSDT	2012 Apr 1 4:00
-			 13:00	-	WST
+			 13:00	1:00	WSDT	2012 Apr Sun>=1 4:00
+			 13:00	WS	WS%sT
 
 # Solomon Is
 # excludes Bougainville, for which see Papua New Guinea



CVS commit: src/doc

2012-10-18 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Thu Oct 18 08:57:26 UTC 2012

Modified Files:
src/doc: CHANGES

Log Message:
zoneinfo: Import tzdata2012g. [apb 20121018]


To generate a diff of this commit:
cvs rdiff -u -r1.1749 -r1.1750 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1749 src/doc/CHANGES:1.1750
--- src/doc/CHANGES:1.1749	Sun Oct 14 18:42:22 2012
+++ src/doc/CHANGES	Thu Oct 18 08:57:26 2012
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1749 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1750 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -127,3 +127,4 @@ Changes from NetBSD 6.0 to NetBSD 7.0:
 	x68k: Add network bootloader for Neptune-X and Nereid Ethernet.
 		[tsutsui,isaki 20121012]
 	x68k: Add support for formatting floppy. [tsutsui 20121014]
+	zoneinfo: Import tzdata2012g. [apb 20121018]



CVS commit: src/doc

2012-10-18 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Thu Oct 18 08:59:00 UTC 2012

Modified Files:
src/doc: 3RDPARTY

Log Message:
tzcode2012g and tzdata202g have been released.  We have updated
to tzdata2012g.

Also fix the upstream Maintainer; Paul Eggert has been doing this
job for several months.


To generate a diff of this commit:
cvs rdiff -u -r1.974 -r1.975 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.974 src/doc/3RDPARTY:1.975
--- src/doc/3RDPARTY:1.974	Mon Oct 15 08:08:01 2012
+++ src/doc/3RDPARTY	Thu Oct 18 08:59:00 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.974 2012/10/15 08:08:01 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.975 2012/10/18 08:59:00 apb Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1189,10 +1189,9 @@ Notes:
 Added changes from a5 -> a12 manually.
 
 Package:	tz
-Version:	tzcode2012f / tzdata2012f
-Current Vers:	tzcode2012f / tzdata2012f
-Maintainer:	Arthur David Olson 
-Maintainer:	Robert Elz 
+Version:	tzcode2012f / tzdata2012g
+Current Vers:	tzcode2012g / tzdata2012g
+Maintainer:	Paul Eggert 
 Archive Site:	ftp://ftp.iana.org/tz/releases/
 Archive Site:	ftp://munnari.oz.au/pub/oldtz/
 Old Archive Site:	ftp://elsie.nci.nih.gov/pub/



CVS commit: src/share/man/man4

2012-10-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct 18 09:41:24 UTC 2012

Modified Files:
src/share/man/man4: uftdi.4

Log Message:
Add some deivces.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/share/man/man4/uftdi.4

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

Modified files:

Index: src/share/man/man4/uftdi.4
diff -u src/share/man/man4/uftdi.4:1.16 src/share/man/man4/uftdi.4:1.17
--- src/share/man/man4/uftdi.4:1.16	Sun May 24 19:06:45 2009
+++ src/share/man/man4/uftdi.4	Thu Oct 18 09:41:24 2012
@@ -1,4 +1,4 @@
-.\" $NetBSD: uftdi.4,v 1.16 2009/05/24 19:06:45 wiz Exp $
+.\" $NetBSD: uftdi.4,v 1.17 2012/10/18 09:41:24 msaitoh Exp $
 .\"
 .\" Copyright (c) 2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 24, 2009
+.Dd October 18, 2012
 .Dt UFTDI 4
 .Os
 .Sh NAME
@@ -61,6 +61,7 @@ driver supports the following adapters:
 .It Tn Crystalfontz CFA-633 LCD
 .It Tn Crystalfontz CFA-634 LCD
 .It Tn Crystalfontz CFA-635 LCD
+.It Tn CTI USB-485-Mini and  and USB-Nano-485
 .It Tn Falcom Samba 55/56 GSM/GPRS modem
 .It Tn Falcom Twist GSM/GPRS modem
 .It Tn Future Technology Devices DB9
@@ -71,6 +72,7 @@ driver supports the following adapters:
 .It Tn Future Technology Devices Y8
 .It Tn Future Technology Devices Y9
 .It Tn Future Technology Devices YS
+.It Tn GlobalScale Technogogies SheevaPlug and OpenRD
 .It Tn HP USB-Serial adapter shipped with some HP laptops
 .It Tn Inland UAS111
 .It Tn Interpid Control Systems NeoVI Blue
@@ -80,9 +82,11 @@ driver supports the following adapters:
 .It Tn Matrix Orbital MX2/MX3/MX6 Series
 .It Tn Matrix Orbital MX4/MX5 Series LCD
 .It Tn QVS USC-1000
+.It Tn RATOC Systems REX-USB60F
 .It Tn Robot Electronics USB to I2C Communications Module
-.It Tn SIIG US2308 Serial
 .It Tn Sealevel Systems USB-Serial adapter
+.It Tn SIIG US2308 Serial
+.It Tn Telldus Tellstick and Tellstick Duo
 .It Tn VScom USB-COM Mini
 .El
 .Sh SEE ALSO



CVS commit: src/sys/dev/pci

2012-10-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct 18 10:41:45 UTC 2012

Modified Files:
src/sys/dev/pci: pucdata.c

Log Message:
- Indent.
- Fix some product names or device names.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/pci/pucdata.c

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

Modified files:

Index: src/sys/dev/pci/pucdata.c
diff -u src/sys/dev/pci/pucdata.c:1.81 src/sys/dev/pci/pucdata.c:1.82
--- src/sys/dev/pci/pucdata.c:1.81	Tue Sep 25 06:31:44 2012
+++ src/sys/dev/pci/pucdata.c	Thu Oct 18 10:41:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pucdata.c,v 1.81 2012/09/25 06:31:44 gson Exp $	*/
+/*	$NetBSD: pucdata.c,v 1.82 2012/10/18 10:41:44 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 Christopher G. Demetriou.  All rights reserved.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.81 2012/09/25 06:31:44 gson Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.82 2012/10/18 10:41:44 msaitoh Exp $");
 
 #include 
 #include 
@@ -168,7 +168,7 @@ const struct puc_device_description puc_
 	/*
 	 * B&B Electronics MIPort Serial cards.
 	 */
-	{ "BBELEC ISOLATED_2_PORT",
+	{   "BBELEC ISOLATED_2_PORT",
 	{	PCI_VENDOR_BBELEC, PCI_PRODUCT_BBELEC_ISOLATED_2_PORT, 0, 0 },
 	{	0x, 0x, 0,	0	},
 	{
@@ -176,7 +176,7 @@ const struct puc_device_description puc_
 		{ PUC_PORT_TYPE_COM, 0x10, 0x0200, COM_FREQ * 8 },
 	},
 	},
-	{ "BBELEC ISOLATED_4_PORT",
+	{   "BBELEC ISOLATED_4_PORT",
 	{	PCI_VENDOR_BBELEC, PCI_PRODUCT_BBELEC_ISOLATED_4_PORT, 0, 0 },
 	{	0x, 0x, 0,	0	},
 	{
@@ -186,7 +186,7 @@ const struct puc_device_description puc_
 		{ PUC_PORT_TYPE_COM, 0x10, 0x0600, COM_FREQ * 8 },
 	},
 	},
-	{ "BBELEC ISOLATED_8_PORT",
+	{   "BBELEC ISOLATED_8_PORT",
 	{	PCI_VENDOR_BBELEC, PCI_PRODUCT_BBELEC_ISOLATED_8_PORT, 0, 0 },
 	{	0x, 0x, 0,	0	},
 	{
@@ -363,7 +363,7 @@ const struct puc_device_description puc_
 	},
 
 	/* Digi International Digi Neo 4 Serial */
-	{ "Digi International Digi Neo 4 Serial",
+	{   "Digi International Digi Neo 4 Serial",
 	{	PCI_VENDOR_DIGI, PCI_PRODUCT_DIGI_NEO4,		0, 0  },
 	{	0x, 0x,	0, 0  },
 	{
@@ -375,7 +375,7 @@ const struct puc_device_description puc_
 	},
 
 	/* Digi International Digi Neo 8 Serial */
-	{ "Digi International Digi Neo 8 Serial",
+	{   "Digi International Digi Neo 8 Serial",
 	{	PCI_VENDOR_DIGI, PCI_PRODUCT_DIGI_NEO8,		0, 0  },
 	{	0x, 0x,	0, 0  },
 	{
@@ -799,37 +799,37 @@ const struct puc_device_description puc_
 	   { PUC_PORT_TYPE_COM, 0x18, 0x00, COM_FREQ },
 	   { PUC_PORT_TYPE_COM, 0x1c, 0x00, COM_FREQ },
 	   },
-   },
+	},
 
 	/* NetMos 4S1P PCI NM9845 : 4S, 1P */
 	{   "NetMos NM9845 Quad UART and 1284 Printer port",
-	   {   PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9845, 0x1000, 0x0014 },
-	   {   0x, 0x, 0x, 0x  },
-	   {
+	{   PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9845, 0x1000, 0x0014 },
+	{   0x, 0x, 0x, 0x  },
+	{
 	   { PUC_PORT_TYPE_COM, 0x10, 0x00, COM_FREQ },
 	   { PUC_PORT_TYPE_COM, 0x14, 0x00, COM_FREQ },
 	   { PUC_PORT_TYPE_COM, 0x18, 0x00, COM_FREQ },
 	   { PUC_PORT_TYPE_COM, 0x1c, 0x00, COM_FREQ },
 	   { PUC_PORT_TYPE_LPT, 0x20, 0x00, 0x00 },
-	   },
-   },
+	},
+	},
 
-   /* NetMos 6S PCI 16C650 : 6S, 0P */
-   {   "NetMos NM9845 6 UART",
-	   {   PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9845, 0x1000, 0x0006 },
-	   {   0x, 0x, 0x, 0x  },
-	   {
+	/* NetMos 6S PCI 16C650 : 6S, 0P */
+	{   "NetMos NM9845 6 UART",
+	{   PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9845, 0x1000, 0x0006 },
+	{   0x, 0x, 0x, 0x  },
+	{
 	   { PUC_PORT_TYPE_COM, 0x10, 0x00, COM_FREQ },
 	   { PUC_PORT_TYPE_COM, 0x14, 0x00, COM_FREQ },
 	   { PUC_PORT_TYPE_COM, 0x18, 0x00, COM_FREQ },
 	   { PUC_PORT_TYPE_COM, 0x1c, 0x00, COM_FREQ },
 	   { PUC_PORT_TYPE_COM, 0x20, 0x00, COM_FREQ },
 	   { PUC_PORT_TYPE_COM, 0x24, 0x00, COM_FREQ },
-	   },
-   },
+	},
+	},
 
-   /* NetMos 4S1P PCI NM9845 : 4S, 1P */
-   {   "NetMos NM9845 Quad UART and 1284 Printer port (unknown type)",
+	/* NetMos 4S1P PCI NM9845 : 4S, 1P */
+	{   "NetMos NM9845 Quad UART and 1284 Printer port (unknown type)",
 	{	PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9845, 0, 0 },
 	{	0x,	0x,	0,	0	},
 	{
@@ -841,8 +841,8 @@ const struct puc_device_description puc_
 	},
 	},
 
-   /* NetMos 4S1P PCI NM9855 : 4S, 1P */
-   {   "NetMos NM9855 Quad UART and 1284 Printer port (unknown type)",
+	/* NetMos 4S1P PCI NM9855 : 4S, 1P */
+	{   "NetMos NM9855 Quad UART and 1284 Printer port (unknown type)",
 	{	PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9855, 0x1000, 0x0014 },
 	{	0x,	0x,	0x,	0x	},
 	{
@@ -854,8 +854,8 @@ const struc

CVS commit: src/external/cddl/osnet

2012-10-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Oct 18 14:22:58 UTC 2012

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c
src/external/cddl/osnet/sys/kern: policy.c
src/external/cddl/osnet/sys/sys: policy.h

Log Message:
Take a first whack at making zfs permissions work.

zfs_access uses secpolicy_vnode_access, so it makes no sense for the
latter to call VOP_ACCESS!

Everything seems to return EACCES instead of EPERM, probably because
that's what kauth returns.  This should be fixed, but that may
require some nontrivial surgery to zfs's calls to secpolicy_*, which
is where kauth gets involved.

This commit imports some code from illumos to implement the routine
secpolicy_vnode_setattr.  This shouldn't be outside dist/, but for
now it is expedient to do so.  We ought to fix that, along with all
the other CDDL code outside dist/, when we next import a newer
version of zfs.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/sys/kern/policy.c
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/sys/sys/policy.h

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.13 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.14
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.13	Tue Oct 16 00:04:15 2012
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Thu Oct 18 14:22:57 2012
@@ -1422,7 +1422,8 @@ top:
 		 * Create a new file object and update the directory
 		 * to reference it.
 		 */
-		if (error = zfs_zaccess(dzp, ACE_ADD_FILE, 0, B_FALSE, cr)) {
+		error = zfs_zaccess(dzp, ACE_ADD_FILE, 0, B_FALSE, cr);
+		if (error) {
 			goto out;
 		}
 
@@ -4779,22 +4780,34 @@ zfs_netbsd_write(void *v)
 static int
 zfs_netbsd_access(void *v)
 {
-	struct vop_access_args *ap = v;
+	struct vop_access_args /* {
+		struct vnode *a_vp;
+		int a_mode;
+		kauth_cred_t a_cred;
+	} */ *ap = v;
+	struct vnode *vp = ap->a_vp;
+	int mode = ap->a_mode;
+	mode_t zfs_mode = 0;
+	kauth_cred_t cred = ap->a_cred;
+	int error;
 
 	/*
-	 * ZFS itself only knowns about VREAD, VWRITE and VEXEC, the rest
-	 * we have to handle by calling vaccess().
-	 */
-	if ((ap->a_mode & ~(VREAD|VWRITE|VEXEC)) != 0) {
-		vnode_t *vp = ap->a_vp;
-		znode_t *zp = VTOZ(vp);
-		znode_phys_t *zphys = zp->z_phys;
+	 * XXX This is really random, especially the left shift by six,
+	 * and it exists only because of randomness in zfs_unix_to_v4
+	 * and zfs_zaccess_rwx in zfs_acl.c.
+	 */
+	if (mode & VREAD)
+		zfs_mode |= S_IROTH;
+	if (mode & VWRITE)
+		zfs_mode |= S_IWOTH;
+	if (mode & VEXEC)
+		zfs_mode |= S_IXOTH;
+	zfs_mode <<= 6;
 
-		return (vaccess(vp->v_type, zphys->zp_mode, zphys->zp_uid,
-		zphys->zp_gid, ap->a_mode, ap->a_cred));
-	}
+	KASSERT(VOP_ISLOCKED(vp));
+	error = zfs_access(vp, zfs_mode, 0, cred, NULL);
 
-	return (zfs_access(ap->a_vp, ap->a_mode, 0, ap->a_cred, NULL));
+	return (error);
 }
 
 static int
@@ -4849,13 +4862,19 @@ zfs_netbsd_lookup(void *v)
 	NULL, NULL);
 
 	/*
-	 * Translate errors to match our namei insanity.
+	 * Translate errors to match our namei insanity.  Also, if the
+	 * caller wants to create an entry here, it's apparently our
+	 * responsibility as lookup to make sure that's permissible.
+	 * Go figure.
 	 */
 	if (cnp->cn_flags & ISLASTCN) {
 		switch (cnp->cn_nameiop) {
 		case CREATE:
 		case RENAME:
 			if (error == ENOENT) {
+error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred);
+if (error)
+	break;
 error = EJUSTRETURN;
 break;
 			}

Index: src/external/cddl/osnet/sys/kern/policy.c
diff -u src/external/cddl/osnet/sys/kern/policy.c:1.3 src/external/cddl/osnet/sys/kern/policy.c:1.4
--- src/external/cddl/osnet/sys/kern/policy.c:1.3	Mon Oct 15 22:50:25 2012
+++ src/external/cddl/osnet/sys/kern/policy.c	Thu Oct 18 14:22:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: policy.c,v 1.3 2012/10/15 22:50:25 riastradh Exp $	*/
+/*	$NetBSD: policy.c,v 1.4 2012/10/18 14:22:58 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -55,6 +55,31 @@
  * SUCH DAMAGE.
  */
 
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If

CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2012-10-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Oct 18 14:29:44 UTC 2012

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_dir.c

Log Message:
Back out accidental commit of errno kludge for rmdir(".") &c.

Solaris returns EEXIST, whereas we want to return ENOTEMPTY (POSIX
allows both), but this got included in an unrelated commit and should
be separated into a common commit for other related error code fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c:1.8 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c:1.9
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c:1.8	Mon Oct 15 23:51:11 2012
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c	Thu Oct 18 14:29:44 2012
@@ -801,11 +801,7 @@ zfs_link_destroy(zfs_dirlock_t *dl, znod
 		if (zp_is_dir && !zfs_dirempty(zp)) {	/* dir not empty */
 			mutex_exit(&zp->z_lock);
 			vn_vfsunlock(vp);
-#ifdef __NetBSD__		/* XXX Make our dumb tests happier...  */
-			return (ENOTEMPTY);
-#else
 			return (EEXIST);
-#endif
 		}
 		if (zp->z_phys->zp_links <= zp_is_dir) {
 			zfs_panic_recover("zfs: link count on vnode %p is %u, "



CVS commit: src

2012-10-18 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Thu Oct 18 16:15:29 UTC 2012

Modified Files:
src: build.sh

Log Message:
Print the value of MAKECONF.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/build.sh

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

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.256 src/build.sh:1.257
--- src/build.sh:1.256	Sat Sep 29 04:02:42 2012
+++ src/build.sh	Thu Oct 18 16:15:29 2012
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.256 2012/09/29 04:02:42 tsutsui Exp $
+#	$NetBSD: build.sh,v 1.257 2012/10/18 16:15:29 apb Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1413,10 +1413,23 @@ rebuildmake()
 # Perform some late sanity checks, after rebuildmake,
 # but before createmakewrapper or any real work.
 #
-# Also create the top-level obj directory.
+# Creates the top-level obj directory, because that
+# is needed by some of the sanity checks.
+#
+# Prints status messages reporting the values of several variables.
 #
 validatemakeparams()
 {
+	# MAKECONF (which defaults to /etc/mk.conf in share/mk/bsd.own.mk)
+	# can affect many things, so mention it in an early status message.
+	#
+	MAKECONF=$(getmakevar MAKECONF)
+	if [ -e "${MAKECONF}" ]; then
+		statusmsg2 "MAKECONF file:" "${MAKECONF}"
+	else
+		statusmsg2 "MAKECONF file:" "${MAKECONF} (File not found)"
+	fi
+
 	if [ "${runcmd}" = "echo" ]; then
 		TOOLCHAIN_MISSING=no
 		EXTERNAL_TOOLCHAIN=""
@@ -1668,7 +1681,7 @@ createmakewrapper()
 	eval cat <

CVS commit: src/share/man/man4

2012-10-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct 18 17:27:36 UTC 2012

Modified Files:
src/share/man/man4: puc.4

Log Message:
Update device list


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/share/man/man4/puc.4

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

Modified files:

Index: src/share/man/man4/puc.4
diff -u src/share/man/man4/puc.4:1.36 src/share/man/man4/puc.4:1.37
--- src/share/man/man4/puc.4:1.36	Sun Oct  7 17:00:20 2012
+++ src/share/man/man4/puc.4	Thu Oct 18 17:27:36 2012
@@ -1,4 +1,4 @@
-.\" $NetBSD: puc.4,v 1.36 2012/10/07 17:00:20 gson Exp $
+.\" $NetBSD: puc.4,v 1.37 2012/10/18 17:27:36 msaitoh Exp $
 .\"
 .\" Copyright (c) 1998 Christopher G. Demetriou
 .\" All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" <>
 .\"
-.Dd August 9, 2011
+.Dd October 19, 2012
 .Dt PUC 4
 .Os
 .Sh NAME
@@ -67,7 +67,9 @@ The driver currently supports the follow
 .It Tn "Advantech PCI-1610 (4 port serial)"
 .It Tn "Advantech PCI-1612 (4 port serial)"
 .It Tn "Advantech PCI-1620 (8 port serial)"
-.It Tn "Avlab Technology, Inc. Low Profile PCI 4 Serial (4 port serial)"
+.It Tn "Avlab Low Profile PCI 4S Quartet (4 port serial)"
+.It Tn "Avlab Low Profile PCI 4 Serial (4 port serial)"
+.It Tn "Avlab PCI 2S (2 port serial)"
 .It Tn "Boca Research Turbo Serial 654 (4 port serial)"
 .It Tn "Boca Research Turbo Serial 658 (8 port serial)"
 .It Tn "Chase Research / Perle PCI-FAST4 (4 port serial)"
@@ -89,6 +91,7 @@ The driver currently supports the follow
 .It Tn "Exsys EX-41098 (4 port serial)"
 .It Tn "IBM 4810 SurePOS 300 Series SCC (4 port serial)"
 .It Tn "InnoSys Keyspan SX Pro (4 port serial)"
+.It Tn "Intel EG20T Serial over LAN"
 .It Tn "I-O DATA RSA-PCI (2 port serial)"
 .It Tn "I-O DATA RSA-PCI2 (2 port serial)"
 .It Tn "I-O DATA RSA-PCI2/P4 (4 port serial)"
@@ -115,16 +118,14 @@ The driver currently supports the follow
 .It Tn "NetMos 1P PCI (single parallel)"
 .It Tn "NetMos 2S1P PCI 16C650 (dual serial and single parallel)"
 .It Tn "NetMos 4S1P PCI NM9845 (4 port serial and single parallel)"
-.It Tn "NetMos NM9835 (dual parallel and single serial)"
-.It Tn "NetMos NM9835 UART (1 port serial)"
-.It Tn "NetMos NM9865 Single UART and Single LPT"
-.It Tn "NetMos NM9865 Dual UART and Single LPT"
-.It Tn "NetMos NM9865 Dual LPT"
-.It Tn "NetMos NM9865 2 UART (2 port serial)"
-.It Tn "NetMos NM9865 3 UART (3 port serial)"
-.It Tn "NetMos NM9865 4 UART (4 port serial)"
-.It Tn "NetMos NM9865 UART (1 port serial)"
-.It Tn "NetMos NM9901 PCIe (single parallel)"
+.It Tn "NetMos NM9805 1284 (single parallel)"
+.It Tn "NetMos NM9815 Dual 1284 (dual parallel)"
+.It Tn "NetMos NM9835 series (up to dual serial and single parallel)"
+.It Tn "NetMos NM9845 series (up to 6 serial and 1 parallel)"
+.It Tn "NetMos NM9865 series (up to 4 serial and 2 parallel)"
+.It Tn "NetMos NM9901 PCIe (1 serial or 1 parallel)"
+.It Tn "NetMos NM9904 PCIe (4 port serial)"
+.It Tn "NetMos NM9922 PCIe (2 port serial)"
 .It Tn "Oxford Semiconductor OX16PCI952 (dual serial and single parallel)"
 .It Tn "Oxford Semiconductor OX16PCI954 (4 port serial)"
 .It Tn "Oxford Semiconductor OX16PCI958 (8 port serial)"
@@ -134,16 +135,16 @@ The driver currently supports the follow
 .It Tn "Perle Systems PCI-RAS 8 modem ports"
 .It Tn "Perle Systems PCI-RASV92 4 modem ports"
 .It Tn "Perle Systems PCI-RASV92 8 modem ports"
-.It Tn "SIIG Cyber 2P1S PCI (dual parallel and single serial)"
-.It Tn "SIIG Cyber 2S1P PCI (dual serial and single parallel)"
+.It Tn "SIIG Cyber 2P1S PCI series (dual parallel and single serial)"
+.It Tn "SIIG Cyber 2S1P PCI series (dual serial and single parallel)"
 .It Tn "SIIG Cyber 4 PCI 16550 (4 port serial)"
-.It Tn "SIIG Cyber 4S PCI (quad serial)"
-.It Tn "SIIG Cyber 4S PCI 16C650 (20x family) (4 port serial)"
-.It Tn "SIIG Cyber I/O PCI (single serial and single parallel)"
-.It Tn "SIIG Cyber Parallel Dual PCI (dual parallel)"
-.It Tn "SIIG Cyber Parallel PCI (single parallel)"
-.It Tn "SIIG Cyber Serial Dual PCI (dual serial)"
-.It Tn "SIIG Cyber Serial PCI (single serial)"
+.It Tn "SIIG Cyber 4S PCI series (quad serial)"
+.It Tn "SIIG Cyber I/O PCI series (single serial and single parallel)"
+.It Tn "SIIG Cyber Parallel Dual PCI series (dual parallel)"
+.It Tn "SIIG Cyber Parallel PCI series (single parallel)"
+.It Tn "SIIG Cyber Serial Dual PCI series (dual serial)"
+.It Tn "SIIG Cyber Serial PCI series (single serial)"
+.It Tn "SIIG PS8000 PCI 8S series (8 port serial)"
 .It Tn "SUNIX 400x (1 port parallel)"
 .It Tn "SUNIX 401x (2 port parallel)"
 .It Tn "SUNIX 402x (1 port serial)"
@@ -153,10 +154,20 @@ The driver currently supports the follow
 .It Tn "SUNIX 407x (2 port serial and 1 port parallel)"
 .It Tn "SUNIX 408x (2 port serial and 2 port parallel)"
 .It Tn "SUNIX 409x (4 port serial and 2 port parallel)"
+.It Tn "SUNIX 5008 (1 port parallel)"
+.It Tn "SUNIX 5016 (8 port serial)"
+.It Tn "SUNIX 5027 (1 po

CVS commit: src/sys/kern

2012-10-18 Thread Lars Heidieker
Module Name:src
Committed By:   para
Date:   Thu Oct 18 19:33:38 UTC 2012

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

Log Message:
bring comment up to reality

kmem_map => kmem_arena


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/kern/uipc_mbuf.c

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

Modified files:

Index: src/sys/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.146 src/sys/kern/uipc_mbuf.c:1.147
--- src/sys/kern/uipc_mbuf.c:1.146	Sun Apr 29 16:36:53 2012
+++ src/sys/kern/uipc_mbuf.c	Thu Oct 18 19:33:38 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.146 2012/04/29 16:36:53 dsl Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.147 2012/10/18 19:33:38 para Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.146 2012/04/29 16:36:53 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.147 2012/10/18 19:33:38 para Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_nmbclusters.h"
@@ -150,7 +150,7 @@ static int
 nmbclusters_limit(void)
 {
 #if defined(PMAP_MAP_POOLPAGE)
-	/* direct mapping, doesn't use space in kmem_map */
+	/* direct mapping, doesn't use space in kmem_arena */
 	vsize_t max_size = physmem / 4;
 #else
 	vsize_t max_size = MIN(physmem / 4, nkmempages / 4);



CVS commit: src/sys/kern

2012-10-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Oct 19 02:07:23 UTC 2012

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

Log Message:
No, we can't elide the fs-wide rename lock for same-directory rename.

rename("a/b", "a/c") and rename("a/c/x", "a/b/y") will deadlock.

Darn.


To generate a diff of this commit:
cvs rdiff -u -r1.458 -r1.459 src/sys/kern/vfs_syscalls.c

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

Modified files:

Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.458 src/sys/kern/vfs_syscalls.c:1.459
--- src/sys/kern/vfs_syscalls.c:1.458	Fri Oct 12 02:37:20 2012
+++ src/sys/kern/vfs_syscalls.c	Fri Oct 19 02:07:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.458 2012/10/12 02:37:20 riastradh Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.459 2012/10/19 02:07:22 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.458 2012/10/12 02:37:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.459 2012/10/19 02:07:22 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -4041,11 +4041,9 @@ do_sys_rename(const char *from, const ch
 	 * Take the vfs rename lock to avoid cross-directory screw cases.
 	 * Nothing is locked currently, so taking this lock is safe.
 	 */
-	if (fdvp != tdvp) {
-		error = VFS_RENAMELOCK_ENTER(mp);
-		if (error)
-			goto abort1;
-	}
+	error = VFS_RENAMELOCK_ENTER(mp);
+	if (error)
+		goto abort1;
 
 	/*
 	 * Now fdvp, fvp, tdvp, and (if nonnull) tvp are referenced,
@@ -4186,15 +4184,13 @@ do_sys_rename(const char *from, const ch
 	 * So all we have left to do is to drop the rename lock and
 	 * destroy the pathbufs.
 	 */
-	if (fdvp != tdvp)
-		VFS_RENAMELOCK_EXIT(mp);
+	VFS_RENAMELOCK_EXIT(mp);
 	goto out2;
 
 abort3:	if ((tvp != NULL) && (tvp != tdvp))
 		VOP_UNLOCK(tvp);
 abort2:	VOP_UNLOCK(tdvp);
-	if (fdvp != tdvp)
-		VFS_RENAMELOCK_EXIT(mp);
+	VFS_RENAMELOCK_EXIT(mp);
 abort1:	VOP_ABORTOP(tdvp, &tnd.ni_cnd);
 	vrele(tdvp);
 	if (tvp != NULL)



CVS commit: src/usr.bin/fstat

2012-10-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct 19 02:11:25 UTC 2012

Modified Files:
src/usr.bin/fstat: fstat.c

Log Message:
more info for unix sockets. XXX: chroot handling


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/usr.bin/fstat/fstat.c

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

Modified files:

Index: src/usr.bin/fstat/fstat.c
diff -u src/usr.bin/fstat/fstat.c:1.97 src/usr.bin/fstat/fstat.c:1.98
--- src/usr.bin/fstat/fstat.c:1.97	Wed Sep 26 19:01:04 2012
+++ src/usr.bin/fstat/fstat.c	Thu Oct 18 22:11:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstat.c,v 1.97 2012/09/26 23:01:04 christos Exp $	*/
+/*	$NetBSD: fstat.c,v 1.98 2012/10/19 02:11:25 christos Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)fstat.c	8.3 (Berkeley) 5/2/95";
 #else
-__RCSID("$NetBSD: fstat.c,v 1.97 2012/09/26 23:01:04 christos Exp $");
+__RCSID("$NetBSD: fstat.c,v 1.98 2012/10/19 02:11:25 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -1000,12 +1000,10 @@ socktrans(struct socket *sock, int i)
 		/* print address of pcb and connected pcb */
 		if (so.so_pcb) {
 			char shoconn[4], *cp;
+			void *pcb[2];
+			size_t p = 0;
 
-			if (kvm_read(kd, (u_long)so.so_pcb, (char *)&unpcb,
-			sizeof(struct unpcb)) != sizeof(struct unpcb)){
-dprintf("can't read unpcb at %p", so.so_pcb);
-goto bad;
-			}
+			pcb[0] = so.so_pcb;
 
 			cp = shoconn;
 			if (!(so.so_state & SS_CANTRCVMORE))
@@ -1014,6 +1012,13 @@ socktrans(struct socket *sock, int i)
 			if (!(so.so_state & SS_CANTSENDMORE))
 *cp++ = '>';
 			*cp = '\0';
+again:
+			if (kvm_read(kd, (u_long)pcb[p], (char *)&unpcb,
+			sizeof(struct unpcb)) != sizeof(struct unpcb)){
+dprintf("can't read unpcb at %p", so.so_pcb);
+goto bad;
+			}
+
 			if (unpcb.unp_addr) {
 struct sockaddr_un *sun = 
 	malloc(unpcb.unp_addrlen);
@@ -1027,15 +1032,22 @@ socktrans(struct socket *sock, int i)
 	unpcb.unp_addr);
 	free(sun);
 } else {
-	snprintf(fbuf, sizeof(fbuf), " %s %s",
-	shoconn, sun->sun_path);
+	snprintf(fbuf, sizeof(fbuf), " %s %s %s",
+	shoconn, sun->sun_path,
+	p == 0 ? "[creat]" : "[using]");
 	free(sun);
 	break;
 }
 			}
-			if (unpcb.unp_conn)
-snprintf(fbuf, sizeof(fbuf), " %s %lx", shoconn,
-(long)unpcb.unp_conn);
+			if (unpcb.unp_conn) {
+if (p == 0) {
+	pcb[++p] = unpcb.unp_conn;
+	goto again;
+} else
+	snprintf(fbuf, sizeof(fbuf),
+	" %p %s %p", pcb[0], shoconn,
+	pcb[1]);
+			}
 		}
 		break;
 	case AF_APPLETALK:



CVS commit: src/usr.bin/fstat

2012-10-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct 19 02:49:52 UTC 2012

Modified Files:
src/usr.bin/fstat: fstat.c

Log Message:
print major device numbers symbolically from kinfo_drivers


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/usr.bin/fstat/fstat.c

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

Modified files:

Index: src/usr.bin/fstat/fstat.c
diff -u src/usr.bin/fstat/fstat.c:1.98 src/usr.bin/fstat/fstat.c:1.99
--- src/usr.bin/fstat/fstat.c:1.98	Thu Oct 18 22:11:25 2012
+++ src/usr.bin/fstat/fstat.c	Thu Oct 18 22:49:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstat.c,v 1.98 2012/10/19 02:11:25 christos Exp $	*/
+/*	$NetBSD: fstat.c,v 1.99 2012/10/19 02:49:52 christos Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)fstat.c	8.3 (Berkeley) 5/2/95";
 #else
-__RCSID("$NetBSD: fstat.c,v 1.98 2012/10/19 02:11:25 christos Exp $");
+__RCSID("$NetBSD: fstat.c,v 1.99 2012/10/19 02:49:52 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -177,6 +177,7 @@ static const char   *vfilestat(struct vn
 static void	vtrans(struct vnode *, int, int);
 static void	ftrans(fdfile_t *, int);
 static void	ptrans(struct file *, struct pipe *, int);
+static void	kdriver_init(void);
 
 int
 main(int argc, char **argv)
@@ -234,6 +235,8 @@ main(int argc, char **argv)
 			usage();
 		}
 
+	kdriver_init();
+
 	if (*(argv += optind)) {
 		for (; *argv; ++argv) {
 			if (getfname(*argv))
@@ -314,6 +317,89 @@ pid_t	Pid;
 		break; \
 	}
 
+static struct kinfo_drivers *kdriver;
+static size_t kdriverlen;
+
+static int
+kdriver_comp(const void *a, const void *b)
+{
+	const struct kinfo_drivers *ka = a;
+	const struct kinfo_drivers *kb = b;
+	int kac = ka->d_cmajor == -1 ? 0 : ka->d_cmajor;
+	int kbc = kb->d_cmajor == -1 ? 0 : kb->d_cmajor;
+	int kab = ka->d_bmajor == -1 ? 0 : ka->d_bmajor;
+	int kbb = kb->d_bmajor == -1 ? 0 : kb->d_bmajor;
+	int c = kac - kbc;
+	if (c == 0)
+		return kab - kbb;
+	else
+		return c;
+}
+
+static const char *
+kdriver_search(int type, dev_t num)
+{
+	struct kinfo_drivers k, *kp;
+	static char buf[64];
+
+	if (nflg)
+		goto out;
+
+	if (type == VBLK) {
+		k.d_bmajor = num;
+		k.d_cmajor = -1;
+	} else {
+		k.d_bmajor = -1;
+		k.d_cmajor = num;
+	}
+	kp = bsearch(&k, kdriver, kdriverlen, sizeof(*kdriver), kdriver_comp);
+	if (kp)
+		return kp->d_name;
+out:	
+	snprintf(buf, sizeof(buf), "%llu", (unsigned long long)num);
+	return buf;
+}
+
+
+static void
+kdriver_init(void)
+{
+	size_t sz;
+	int error;
+	static const int name[2] = { CTL_KERN, KERN_DRIVERS };
+
+	error = sysctl(name, __arraycount(name), NULL, &sz, NULL, 0);
+	if (error == -1) {
+		warn("sysctl kern.drivers");
+		return;
+	}
+
+	if (sz % sizeof(*kdriver)) {
+		warnx("bad size %zu for kern.drivers", sz);
+		return;
+	}
+
+	kdriver = malloc(sz);
+	if (kdriver == NULL) {
+		warn("malloc");
+		return;
+	}
+
+	error = sysctl(name, __arraycount(name), kdriver, &sz, NULL, 0);
+	if (error == -1) {
+		warn("sysctl kern.drivers");
+		return;
+	}
+
+	kdriverlen = sz / sizeof(*kdriver);
+	qsort(kdriver, kdriverlen, sizeof(*kdriver), kdriver_comp);
+#ifdef DEBUG
+	for (size_t i = 0; i < kdriverlen; i++)
+		printf("%d %d %s\n", kdriver[i].d_cmajor, kdriver[i].d_bmajor,
+		kdriver[i].d_name);
+#endif
+}
+
 /*
  * print open files attributed to this process
  */
@@ -559,8 +645,8 @@ vtrans(struct vnode *vp, int i, int flag
 
 		if (nflg || ((name = devname(fst.rdev, vn.v_type == VCHR ? 
 		S_IFCHR : S_IFBLK)) == NULL))
-			(void)printf("  %2llu,%-2llu",
-			(unsigned long long)major(fst.rdev),
+			(void)printf("  %s,%-2llu",
+			kdriver_search(vn.v_type, major(fst.rdev)),
 			(unsigned long long)minor(fst.rdev));
 		else
 			(void)printf(" %6s", name);



CVS commit: src/sys/arch/arm/marvell

2012-10-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Oct 19 06:14:44 UTC 2012

Modified Files:
src/sys/arch/arm/marvell: mvsoc.c mvsocreg.h

Log Message:
Add CLKGATING_BIT for some devices. This change prevent some boards
that a device's clock is stopped from hangup.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/marvell/mvsoc.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/marvell/mvsocreg.h

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

Modified files:

Index: src/sys/arch/arm/marvell/mvsoc.c
diff -u src/sys/arch/arm/marvell/mvsoc.c:1.9 src/sys/arch/arm/marvell/mvsoc.c:1.10
--- src/sys/arch/arm/marvell/mvsoc.c:1.9	Fri Aug 10 02:18:20 2012
+++ src/sys/arch/arm/marvell/mvsoc.c	Fri Oct 19 06:14:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsoc.c,v 1.9 2012/08/10 02:18:20 matt Exp $	*/
+/*	$NetBSD: mvsoc.c,v 1.10 2012/10/19 06:14:44 msaitoh Exp $	*/
 /*
  * Copyright (c) 2007, 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsoc.c,v 1.9 2012/08/10 02:18:20 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsoc.c,v 1.10 2012/10/19 06:14:44 msaitoh Exp $");
 
 #include "opt_cputypes.h"
 #include "opt_mvsoc.h"
@@ -252,6 +252,7 @@ static const struct mvsoc_periph {
 	int unit;
 	bus_size_t offset;
 	int irq;
+	uint32_t clkpwr_bit;
 } mvsoc_periphs[] = {
 #if defined(ORION)
 { ORION_1(88F1181),	"mvsoctmr",0, MVSOC_TMR_BASE,	IRQ_DEFAULT },
@@ -392,15 +393,23 @@ static const struct mvsoc_periph {
 { KIRKWOOD(88F6281),"mvsocrtc",0, KIRKWOOD_RTC_BASE,IRQ_DEFAULT },
 { KIRKWOOD(88F6281),"com", 0, MVSOC_COM0_BASE,	KIRKWOOD_IRQ_UART0INT },
 { KIRKWOOD(88F6281),"com", 1, MVSOC_COM1_BASE,	KIRKWOOD_IRQ_UART1INT },
-{ KIRKWOOD(88F6281),"ehci",0, KIRKWOOD_USB_BASE,KIRKWOOD_IRQ_USB0CNT },
+{ KIRKWOOD(88F6281),"ehci",0, KIRKWOOD_USB_BASE,KIRKWOOD_IRQ_USB0CNT,
+	MVSOC_MLMB_CLKGATING_BIT(3) },
 { KIRKWOOD(88F6281),"gtidmac", 0, KIRKWOOD_IDMAC_BASE,IRQ_DEFAULT },
 { KIRKWOOD(88F6281),"gttwsi",  0, MVSOC_TWSI_BASE,	KIRKWOOD_IRQ_TWSI },
-{ KIRKWOOD(88F6281),"mvcesa",  0, KIRKWOOD_CESA_BASE,KIRKWOOD_IRQ_SECURITYINT},
-{ KIRKWOOD(88F6281),"mvgbec",  0, KIRKWOOD_GBE0_BASE,IRQ_DEFAULT },
-{ KIRKWOOD(88F6281),"mvgbec",  1, KIRKWOOD_GBE1_BASE,IRQ_DEFAULT },
-{ KIRKWOOD(88F6281),"mvpex",   0, MVSOC_PEX_BASE,	KIRKWOOD_IRQ_PEX0INT },
-{ KIRKWOOD(88F6281),"mvsata",  0, KIRKWOOD_SATAHC_BASE,KIRKWOOD_IRQ_SATA },
-{ KIRKWOOD(88F6281),"mvsdio",  0, KIRKWOOD_SDIO_BASE,KIRKWOOD_IRQ_SDIOINT },
+{ KIRKWOOD(88F6281),"mvcesa",  0, KIRKWOOD_CESA_BASE,KIRKWOOD_IRQ_SECURITYINT,
+	MVSOC_MLMB_CLKGATING_BIT(17) },
+{ KIRKWOOD(88F6281),"mvgbec",  0, KIRKWOOD_GBE0_BASE,IRQ_DEFAULT,
+	MVSOC_MLMB_CLKGATING_BIT(0) },
+{ KIRKWOOD(88F6281),"mvgbec",  1, KIRKWOOD_GBE1_BASE,IRQ_DEFAULT,
+	MVSOC_MLMB_CLKGATING_BIT(19) },
+{ KIRKWOOD(88F6281),"mvpex",   0, MVSOC_PEX_BASE,	KIRKWOOD_IRQ_PEX0INT,
+	MVSOC_MLMB_CLKGATING_BIT(2) },
+{ KIRKWOOD(88F6281),"mvsata",  0, KIRKWOOD_SATAHC_BASE,KIRKWOOD_IRQ_SATA,
+	MVSOC_MLMB_CLKGATING_BIT(14) |
+	MVSOC_MLMB_CLKGATING_BIT(15) },
+{ KIRKWOOD(88F6281),"mvsdio",  0, KIRKWOOD_SDIO_BASE,KIRKWOOD_IRQ_SDIOINT,
+	MVSOC_MLMB_CLKGATING_BIT(4) },
 
 { KIRKWOOD(88F6282),"mvsoctmr",0, MVSOC_TMR_BASE,	IRQ_DEFAULT },
 { KIRKWOOD(88F6282),"mvsocgpp",0, MVSOC_GPP_BASE,	KIRKWOOD_IRQ_GPIOLO7_0},
@@ -458,6 +467,7 @@ mvsoc_attach(device_t parent, device_t s
 	struct marvell_attach_args mva;
 	uint16_t model;
 	uint8_t rev;
+	uint32_t clkpwr, clkpwrbit;
 	int i;
 
 	sc->sc_dev = self;
@@ -497,6 +507,20 @@ mvsoc_attach(device_t parent, device_t s
 		if (mvsoc_periphs[i].model != model)
 			continue;
 
+		/* Skip clock disabled devices */
+		clkpwrbit = mvsoc_periphs[i].clkpwr_bit;
+		if (clkpwrbit != 0) {
+			clkpwr = read_mlmbreg(MVSOC_MLMB_CLKGATING);
+
+			if ((clkpwr & clkpwrbit) == 0) {
+aprint_normal("%s: %s%d clock disabled\n",
+device_xname(self),
+mvsoc_periphs[i].name,
+mvsoc_periphs[i].unit);
+continue;
+			}
+		}
+
 		mva.mva_name = mvsoc_periphs[i].name;
 		mva.mva_model = model;
 		mva.mva_revision = rev;

Index: src/sys/arch/arm/marvell/mvsocreg.h
diff -u src/sys/arch/arm/marvell/mvsocreg.h:1.2 src/sys/arch/arm/marvell/mvsocreg.h:1.3
--- src/sys/arch/arm/marvell/mvsocreg.h:1.2	Tue Feb  1 22:54:24 2011
+++ src/sys/arch/arm/marvell/mvsocreg.h	Fri Oct 19 06:14:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsocreg.h,v 1.2 2011/02/01 22:54:24 jakllsch Exp $	*/
+/*	$NetBSD: mvsocreg.h,v 1.3 2012/10/19 06:14:44 msaitoh Exp $	*/
 /*
  * Copyright (c) 2007, 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -110,6 +110,9 @@
 #define MVSOC_MLMB_MLMBICR		  0x110	/*Mb-L to Mb Bridge Intr Cause*/
 #define MVSOC_MLMB_MLMBIMR		  0x114	/*Mb-L to Mb Bridge Intr Mask */
 
+#define MVSOC_MLMB_CLKGATING		  0x11c	/* Clock Gating Control */
+