CVS commit: [pgoyette-localcount] src/sys/dev/pci

2017-04-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Apr 26 05:52:57 UTC 2017

Modified Files:
src/sys/dev/pci [pgoyette-localcount]: pcidevs.h pcidevs_data.h

Log Message:
Regen


To generate a diff of this commit:
cvs rdiff -u -r1.1246.2.5 -r1.1246.2.6 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1245.2.5 -r1.1245.2.6 src/sys/dev/pci/pcidevs_data.h

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

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1246.2.5 src/sys/dev/pci/pcidevs.h:1.1246.2.6
--- src/sys/dev/pci/pcidevs.h:1.1246.2.5	Wed Apr 26 02:53:13 2017
+++ src/sys/dev/pci/pcidevs.h	Wed Apr 26 05:52:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcidevs.h,v 1.1246.2.5 2017/04/26 02:53:13 pgoyette Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1246.2.6 2017/04/26 05:52:48 pgoyette Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -701,6 +701,7 @@
 #define	PCI_PRODUCT_3COM_3C339	0x3390		/* 3c339 TokenLink Velocity */
 #define	PCI_PRODUCT_3COM_3C359	0x3590		/* 3c359 TokenLink Velocity XL */
 #define	PCI_PRODUCT_3COM_3C450TX	0x4500		/* 3c450-TX 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C555	0x5055		/* 3c555 10/100 Mini-PCI Ethernet */
 #define	PCI_PRODUCT_3COM_3C575TX	0x5057		/* 3c575-TX 10/100 Ethernet */
 #define	PCI_PRODUCT_3COM_3C575BTX	0x5157		/* 3CCFE575BT 10/100 Ethernet */
 #define	PCI_PRODUCT_3COM_3C575CTX	0x5257		/* 3CCFE575CT 10/100 Ethernet */
@@ -708,7 +709,6 @@
 #define	PCI_PRODUCT_3COM_3C595TX	0x5950		/* 3c595-TX 10/100 Ethernet */
 #define	PCI_PRODUCT_3COM_3C595T4	0x5951		/* 3c595-T4 10/100 Ethernet */
 #define	PCI_PRODUCT_3COM_3C595MII	0x5952		/* 3c595-MII 10/100 Ethernet */
-#define	PCI_PRODUCT_3COM_3C555	0x5055		/* 3c555 10/100 Mini-PCI Ethernet */
 #define	PCI_PRODUCT_3COM_3C154G72	0x6001		/* 3CRWE154G72 Wireless LAN Adapter */
 #define	PCI_PRODUCT_3COM_3C556	0x6055		/* 3c556 10/100 Mini-PCI Ethernet */
 #define	PCI_PRODUCT_3COM_3C556B	0x6056		/* 3c556B 10/100 Mini-PCI Ethernet */
@@ -724,11 +724,11 @@
 #define	PCI_PRODUCT_3COM_TOKEN	0x8811		/* Token Ring */
 #define	PCI_PRODUCT_3COM_3C900TPO	0x9000		/* 3c900-TPO Ethernet */
 #define	PCI_PRODUCT_3COM_3C900COMBO	0x9001		/* 3c900-COMBO Ethernet */
-#define	PCI_PRODUCT_3COM_3C905TX	0x9050		/* 3c905-TX 10/100 Ethernet */
-#define	PCI_PRODUCT_3COM_3C905T4	0x9051		/* 3c905-T4 10/100 Ethernet */
 #define	PCI_PRODUCT_3COM_3C900BTPO	0x9004		/* 3c900B-TPO Ethernet */
 #define	PCI_PRODUCT_3COM_3C900BCOMBO	0x9005		/* 3c900B-COMBO Ethernet */
 #define	PCI_PRODUCT_3COM_3C900BTPC	0x9006		/* 3c900B-TPC Ethernet */
+#define	PCI_PRODUCT_3COM_3C905TX	0x9050		/* 3c905-TX 10/100 Ethernet */
+#define	PCI_PRODUCT_3COM_3C905T4	0x9051		/* 3c905-T4 10/100 Ethernet */
 #define	PCI_PRODUCT_3COM_3C905BTX	0x9055		/* 3c905B-TX 10/100 Ethernet */
 #define	PCI_PRODUCT_3COM_3C905BT4	0x9056		/* 3c905B-T4 10/100 Ethernet */
 #define	PCI_PRODUCT_3COM_3C905BCOMBO	0x9058		/* 3c905B-COMBO 10/100 Ethernet */
@@ -829,13 +829,13 @@
 #define	PCI_PRODUCT_ALI_M1689	0x1689		/* M1689 Host-PCI Bridge */
 #define	PCI_PRODUCT_ALI_M3309	0x3309		/* M3309 MPEG Decoder */
 #define	PCI_PRODUCT_ALI_M4803	0x5215		/* M4803 */
-#define	PCI_PRODUCT_ALI_M5257	0x5257		/* M5257 PCI Software Modem */
 #define	PCI_PRODUCT_ALI_M5229	0x5229		/* M5229 UDMA IDE Controller */
 #define	PCI_PRODUCT_ALI_M5237	0x5237		/* M5237 USB 1.1 Host Controller */
 #define	PCI_PRODUCT_ALI_M5239	0x5239		/* M5239 USB 2.0 Host Controller */
 #define	PCI_PRODUCT_ALI_M5243	0x5243		/* M5243 PCI-AGP Bridge */
 #define	PCI_PRODUCT_ALI_M5247	0x5247		/* M5247 PCI-AGP Bridge */
 #define	PCI_PRODUCT_ALI_M5249	0x5249		/* M5249 Hypertransport to PCI Bridge */
+#define	PCI_PRODUCT_ALI_M5257	0x5257		/* M5257 PCI Software Modem */
 #define	PCI_PRODUCT_ALI_M5261	0x5261		/* M5261 Tulip Ethernet Controller */
 #define	PCI_PRODUCT_ALI_M5288	0x5288		/* M5288 SATA/Raid Controller */
 #define	PCI_PRODUCT_ALI_M5451	0x5451		/* M5451 AC-Link Controller Audio Device */
@@ -849,10 +849,10 @@
 #define	PCI_PRODUCT_ADP_AIC7855	0x5578		/* AIC-7855 */
 #define	PCI_PRODUCT_ADP_AIC5900	0x5900		/* AIC-5900 ATM */
 #define	PCI_PRODUCT_ADP_AIC5905	0x5905		/* AIC-5905 ATM */
-#define	PCI_PRODUCT_ADP_AIC6915	0x6915		/* AIC-6915 10/100 Ethernet */
-#define	PCI_PRODUCT_ADP_AIC7860	0x6078		/* AIC-7860 */
 #define	PCI_PRODUCT_ADP_APA1480	0x6075		/* APA-1480 Ultra */
+#define	PCI_PRODUCT_ADP_AIC7860	0x6078		/* AIC-7860 */
 #define	PCI_PRODUCT_ADP_2940AU	0x6178		/* AHA-2940A Ultra */
+#define	PCI_PRODUCT_ADP_AIC6915	0x6915		/* AIC-6915 10/100 Ethernet */
 #define	PCI_PRODUCT_ADP_AIC7870	0x7078		/* AIC-7870 */
 #define	PCI_PRODUCT_ADP_2940	0x7178		/* AHA-2940 */
 #define	PCI_PRODUCT_ADP_3940	0x7278		/* AHA-3940 */
@@ -883,6 +883,7 @@
 #define	PCI_PRODUCT_ADP2_AIC7899P	0x00cf		/* AIC-7899P U160 */
 #define	PCI_PRODUCT_ADP2_1420SA	0x0241		/* RAID 1420SA */
 #define	PCI_PRODUCT_ADP2_1430SA	0x0243		/* RAID 1430SA */
+#define	PCI_PRODUCT_ADP2_SERVERAID	

CVS commit: [pgoyette-localcount] src/sys/dev/pci

2017-04-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Apr 26 05:35:36 UTC 2017

Modified Files:
src/sys/dev/pci [pgoyette-localcount]: pcidevs

Log Message:
Somehow this got out of sync on the branch.


To generate a diff of this commit:
cvs rdiff -u -r1.1253.2.5 -r1.1253.2.6 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1253.2.5 src/sys/dev/pci/pcidevs:1.1253.2.6
--- src/sys/dev/pci/pcidevs:1.1253.2.5	Wed Apr 26 02:53:13 2017
+++ src/sys/dev/pci/pcidevs	Wed Apr 26 05:35:36 2017
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1253.2.5 2017/04/26 02:53:13 pgoyette Exp $
+$NetBSD: pcidevs,v 1.1253.2.6 2017/04/26 05:35:36 pgoyette Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -694,6 +694,7 @@ product 3COM 3C940	0x1700	3c940 Gigabit 
 product 3COM 3C339	0x3390	3c339 TokenLink Velocity
 product 3COM 3C359	0x3590	3c359 TokenLink Velocity XL
 product 3COM 3C450TX	0x4500	3c450-TX 10/100 Ethernet
+product 3COM 3C555	0x5055	3c555 10/100 Mini-PCI Ethernet
 product 3COM 3C575TX	0x5057	3c575-TX 10/100 Ethernet
 product 3COM 3C575BTX	0x5157	3CCFE575BT 10/100 Ethernet
 product 3COM 3C575CTX	0x5257	3CCFE575CT 10/100 Ethernet
@@ -701,7 +702,6 @@ product 3COM 3C590	0x5900	3c590 Ethernet
 product 3COM 3C595TX	0x5950	3c595-TX 10/100 Ethernet
 product 3COM 3C595T4	0x5951	3c595-T4 10/100 Ethernet
 product 3COM 3C595MII	0x5952	3c595-MII 10/100 Ethernet
-product 3COM 3C555	0x5055	3c555 10/100 Mini-PCI Ethernet
 product 3COM 3C154G72	0x6001	3CRWE154G72 Wireless LAN Adapter
 product 3COM 3C556	0x6055	3c556 10/100 Mini-PCI Ethernet
 product 3COM 3C556B	0x6056	3c556B 10/100 Mini-PCI Ethernet
@@ -717,11 +717,11 @@ product 3COM 3C804	0x7980	3c804 FDDILink
 product 3COM TOKEN	0x8811	Token Ring
 product 3COM 3C900TPO	0x9000	3c900-TPO Ethernet
 product 3COM 3C900COMBO	0x9001	3c900-COMBO Ethernet
-product 3COM 3C905TX	0x9050	3c905-TX 10/100 Ethernet
-product 3COM 3C905T4	0x9051	3c905-T4 10/100 Ethernet
 product 3COM 3C900BTPO	0x9004	3c900B-TPO Ethernet
 product 3COM 3C900BCOMBO 0x9005	3c900B-COMBO Ethernet
 product 3COM 3C900BTPC	0x9006	3c900B-TPC Ethernet
+product 3COM 3C905TX	0x9050	3c905-TX 10/100 Ethernet
+product 3COM 3C905T4	0x9051	3c905-T4 10/100 Ethernet
 product 3COM 3C905BTX	0x9055	3c905B-TX 10/100 Ethernet
 product 3COM 3C905BT4	0x9056	3c905B-T4 10/100 Ethernet
 product 3COM 3C905BCOMBO 0x9058	3c905B-COMBO 10/100 Ethernet
@@ -822,13 +822,13 @@ product ALI M1647	0x1647	M1647 Host-PCI 
 product ALI M1689	0x1689	M1689 Host-PCI Bridge
 product ALI M3309	0x3309	M3309 MPEG Decoder
 product ALI M4803	0x5215	M4803
-product ALI M5257	0x5257	M5257 PCI Software Modem
 product ALI M5229	0x5229	M5229 UDMA IDE Controller
 product ALI M5237	0x5237	M5237 USB 1.1 Host Controller
 product ALI M5239	0x5239	M5239 USB 2.0 Host Controller
 product ALI M5243	0x5243	M5243 PCI-AGP Bridge
 product ALI M5247	0x5247	M5247 PCI-AGP Bridge
 product ALI M5249	0x5249	M5249 Hypertransport to PCI Bridge
+product ALI M5257	0x5257	M5257 PCI Software Modem
 product ALI M5261	0x5261	M5261 Tulip Ethernet Controller
 product ALI M5288	0x5288	M5288 SATA/Raid Controller
 product ALI M5451	0x5451	M5451 AC-Link Controller Audio Device
@@ -842,10 +842,10 @@ product ADP AIC7850	0x5078	AIC-7850
 product ADP AIC7855	0x5578	AIC-7855
 product ADP AIC5900	0x5900	AIC-5900 ATM
 product ADP AIC5905	0x5905	AIC-5905 ATM
-product ADP AIC6915	0x6915	AIC-6915 10/100 Ethernet
-product ADP AIC7860	0x6078	AIC-7860
 product ADP APA1480	0x6075	APA-1480 Ultra
+product ADP AIC7860	0x6078	AIC-7860
 product ADP 2940AU	0x6178	AHA-2940A Ultra
+product ADP AIC6915	0x6915	AIC-6915 10/100 Ethernet
 product ADP AIC7870	0x7078	AIC-7870
 product ADP 2940	0x7178	AHA-2940
 product ADP 3940	0x7278	AHA-3940
@@ -876,6 +876,7 @@ product ADP2 AIC7899F		0x00c5	AIC-7899F 
 product ADP2 AIC7899P		0x00cf	AIC-7899P U160
 product ADP2 1420SA		0x0241	RAID 1420SA
 product ADP2 1430SA		0x0243	RAID 1430SA
+product ADP2 SERVERAID		0x0250	ServeRAID 6/7 (marco)
 product ADP2 AAC2622		0x0282	AAC-2622
 product ADP2 ASR2200S		0x0285	ASR-2200S
 product ADP2 ASR2120S		0x0286	ASR-2120S
@@ -891,11 +892,10 @@ product ADP2 PERC_2QC		0x1364	Dell PERC 
 /* XXX guess */
 product ADP2 PERC_3QC		0x1365	Dell PERC 3/QC
 product ADP2 HP_M110_G2		0x3227	HP M110 G2 / ASR-2610SA
-product ADP2 SERVERAID		0x0250	ServeRAID 6/7 (marco)
 
 /* Addtron Products */
-product ADDTRON 8139	0x1360	8139 Ethernet
 product ADDTRON RHINEII	0x1320	Rhine II 10/100 Ethernet
+product ADDTRON 8139	0x1360	8139 Ethernet
 
 /* ADMtek products */
 product ADMTEK AL981	0x0981	AL981 (Comet) 10/100 Ethernet
@@ -920,9 +920,9 @@ product AGILENT TACHYON_DX2	0x0100	Tachy
 /* Aironet Wireless Communicasions products */
 product AIRONET PC4xxx		0x0001	PC4500/PC4800 Wireless LAN Adapter
 product AIRONET PCI350		0x0350	PCI350 Wireless LAN Adapter
-product AIRONET MPI350		

CVS commit: [pgoyette-localcount] src/sys/dev/pci

2017-04-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Apr 26 05:35:36 UTC 2017

Modified Files:
src/sys/dev/pci [pgoyette-localcount]: pcidevs

Log Message:
Somehow this got out of sync on the branch.


To generate a diff of this commit:
cvs rdiff -u -r1.1253.2.5 -r1.1253.2.6 src/sys/dev/pci/pcidevs

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



CVS commit: [pgoyette-localcount] src/sys

2017-04-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Apr 26 02:57:17 UTC 2017

Modified Files:
src/sys/arch/sh3/include [pgoyette-localcount]: ieeefp.h
src/sys/dev/pci [pgoyette-localcount]: piixpm.c

Log Message:
Resolve a couple of conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.4.62.1 -r1.4.62.2 src/sys/arch/sh3/include/ieeefp.h
cvs rdiff -u -r1.49.2.3 -r1.49.2.4 src/sys/dev/pci/piixpm.c

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



CVS commit: [pgoyette-localcount] src/sys

2017-04-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Apr 26 02:57:17 UTC 2017

Modified Files:
src/sys/arch/sh3/include [pgoyette-localcount]: ieeefp.h
src/sys/dev/pci [pgoyette-localcount]: piixpm.c

Log Message:
Resolve a couple of conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.4.62.1 -r1.4.62.2 src/sys/arch/sh3/include/ieeefp.h
cvs rdiff -u -r1.49.2.3 -r1.49.2.4 src/sys/dev/pci/piixpm.c

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

Modified files:

Index: src/sys/arch/sh3/include/ieeefp.h
diff -u src/sys/arch/sh3/include/ieeefp.h:1.4.62.1 src/sys/arch/sh3/include/ieeefp.h:1.4.62.2
--- src/sys/arch/sh3/include/ieeefp.h:1.4.62.1	Wed Apr 26 02:53:07 2017
+++ src/sys/arch/sh3/include/ieeefp.h	Wed Apr 26 02:57:17 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ieeefp.h,v 1.4.62.1 2017/04/26 02:53:07 pgoyette Exp $ */
+/* $NetBSD: ieeefp.h,v 1.4.62.2 2017/04/26 02:57:17 pgoyette Exp $ */
 
 /*
  * Written by J.T. Conklin, Apr 6, 1995
@@ -32,14 +32,11 @@ typedef int fexcept_t;
 #if defined(_NETBSD_SOURCE)
 
 typedef int fp_except;
-<<< ieeefp.h
-===
 
 #ifdef	__SH_FPU_ANY__
 
 /* hardfloat */
 
->>> 1.7
 #define	FP_X_INV	FE_INVALID	/* invalid operation exception */
 #define	FP_X_DNML	FE_DENORMAL	/* denormalization exception */
 #define	FP_X_DZ		FE_DIVBYZERO	/* divide-by-zero exception */

Index: src/sys/dev/pci/piixpm.c
diff -u src/sys/dev/pci/piixpm.c:1.49.2.3 src/sys/dev/pci/piixpm.c:1.49.2.4
--- src/sys/dev/pci/piixpm.c:1.49.2.3	Wed Apr 26 02:53:22 2017
+++ src/sys/dev/pci/piixpm.c	Wed Apr 26 02:57:17 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpm.c,v 1.49.2.3 2017/04/26 02:53:22 pgoyette Exp $ */
+/* $NetBSD: piixpm.c,v 1.49.2.4 2017/04/26 02:57:17 pgoyette Exp $ */
 /*	$OpenBSD: piixpm.c,v 1.20 2006/02/27 08:25:02 grange Exp $	*/
 
 /*
@@ -22,11 +22,7 @@
  */
 
 #include 
-<<< piixpm.c
-__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.49.2.3 2017/04/26 02:53:22 pgoyette Exp $");
-===
-__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.49.2.3 2017/04/26 02:53:22 pgoyette Exp $");
->>> 1.52
+__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.49.2.4 2017/04/26 02:57:17 pgoyette Exp $");
 
 #include 
 #include 



CVS commit: [pgoyette-localcount] src/sys/kern

2017-04-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 25 21:53:06 UTC 2017

Modified Files:
src/sys/kern [pgoyette-localcount]: subr_devsw.c

Log Message:
Use {b,c}devsw_acquire() and {b,c}devsw_release() in the various device
acccess methods.


To generate a diff of this commit:
cvs rdiff -u -r1.34.2.16 -r1.34.2.17 src/sys/kern/subr_devsw.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/subr_devsw.c
diff -u src/sys/kern/subr_devsw.c:1.34.2.16 src/sys/kern/subr_devsw.c:1.34.2.17
--- src/sys/kern/subr_devsw.c:1.34.2.16	Tue Apr 25 21:36:41 2017
+++ src/sys/kern/subr_devsw.c	Tue Apr 25 21:53:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_devsw.c,v 1.34.2.16 2017/04/25 21:36:41 pgoyette Exp $	*/
+/*	$NetBSD: subr_devsw.c,v 1.34.2.17 2017/04/25 21:53:06 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.34.2.16 2017/04/25 21:36:41 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.34.2.17 2017/04/25 21:53:06 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dtrace.h"
@@ -877,7 +877,7 @@ bdev_open(dev_t dev, int flag, int devty
 	 * with attach/detach.
 	 */
 	mutex_enter(_lock);
-	d = bdevsw_lookup(dev);
+	d = bdevsw_lookup_acquire(dev);
 	mutex_exit(_lock);
 	if (d == NULL)
 		return ENXIO;
@@ -885,6 +885,7 @@ bdev_open(dev_t dev, int flag, int devty
 	DEV_LOCK(d);
 	rv = (*d->d_open)(dev, flag, devtype, l);
 	DEV_UNLOCK(d);
+	bdevsw_release(dev);
 
 	return rv;
 }
@@ -895,12 +896,13 @@ bdev_close(dev_t dev, int flag, int devt
 	const struct bdevsw *d;
 	int rv, mpflag;
 
-	if ((d = bdevsw_lookup(dev)) == NULL)
+	if ((d = bdevsw_lookup_acquire(dev)) == NULL)
 		return ENXIO;
 
 	DEV_LOCK(d);
 	rv = (*d->d_close)(dev, flag, devtype, l);
 	DEV_UNLOCK(d);
+	bdevsw_release(dev);
 
 	return rv;
 }
@@ -916,7 +918,7 @@ bdev_strategy(struct buf *bp)
 
 	SDT_PROBE1(io, kernel, , start, bp);
 
-	if ((d = bdevsw_lookup(bp->b_dev)) == NULL) {
+	if ((d = bdevsw_lookup_acquire(bp->b_dev)) == NULL) {
 		bp->b_error = ENXIO;
 		bp->b_resid = bp->b_bcount;
 		biodone_vfs(bp); /* biodone() iff vfs present */
@@ -926,6 +928,7 @@ bdev_strategy(struct buf *bp)
 	DEV_LOCK(d);
 	(*d->d_strategy)(bp);
 	DEV_UNLOCK(d);
+	bdevsw_release(bp->b_dev);
 }
 
 int
@@ -934,12 +937,13 @@ bdev_ioctl(dev_t dev, u_long cmd, void *
 	const struct bdevsw *d;
 	int rv, mpflag;
 
-	if ((d = bdevsw_lookup(dev)) == NULL)
+	if ((d = bdevsw_lookup_acquire(dev)) == NULL)
 		return ENXIO;
 
 	DEV_LOCK(d);
 	rv = (*d->d_ioctl)(dev, cmd, data, flag, l);
 	DEV_UNLOCK(d);
+	bdevsw_release(dev);
 
 	return rv;
 }
@@ -969,20 +973,28 @@ int
 bdev_flags(dev_t dev)
 {
 	const struct bdevsw *d;
+	int rv;
 
-	if ((d = bdevsw_lookup(dev)) == NULL)
+	if ((d = bdevsw_lookup_acquire(dev)) == NULL)
 		return 0;
-	return d->d_flag & ~D_TYPEMASK;
+	rv = d->d_flag & ~D_TYPEMASK;
+	bdevsw_release();
+
+	return rv;
 }
 
 int
 bdev_type(dev_t dev)
 {
 	const struct bdevsw *d;
+	int rv;
 
-	if ((d = bdevsw_lookup(dev)) == NULL)
+	if ((d = bdevsw_lookup_acquire(dev)) == NULL)
 		return D_OTHER;
-	return d->d_flag & D_TYPEMASK;
+	rv = d->d_flag & D_TYPEMASK;
+	bdevsw_release(dev);
+
+	return rv;
 }
 
 int
@@ -991,7 +1003,7 @@ bdev_size(dev_t dev)
 	const struct bdevsw *d;
 	int rv, mpflag = 0;
 
-	if ((d = bdevsw_lookup(dev)) == NULL ||
+	if ((d = bdevsw_lookup_acquire(dev)) == NULL ||
 	d->d_psize == NULL)
 		return -1;
 
@@ -1004,7 +1016,7 @@ bdev_size(dev_t dev)
 	rv = (*d->d_psize)(dev);
 	if ((boothowto & RB_DUMP) == 0)
 		DEV_UNLOCK(d);
-
+	bdevsw_release(dev);
 	return rv;
 }
 
@@ -1014,12 +1026,13 @@ bdev_discard(dev_t dev, off_t pos, off_t
 	const struct bdevsw *d;
 	int rv, mpflag;
 
-	if ((d = bdevsw_lookup(dev)) == NULL)
+	if ((d = bdevsw_lookup_acquire(dev)) == NULL)
 		return ENXIO;
 
 	DEV_LOCK(d);
 	rv = (*d->d_discard)(dev, pos, len);
 	DEV_UNLOCK(d);
+	bdevsw_release(dev);
 
 	return rv;
 }
@@ -1035,7 +1048,7 @@ cdev_open(dev_t dev, int flag, int devty
 	 * with attach/detach.
 	 */
 	mutex_enter(_lock);
-	d = cdevsw_lookup(dev);
+	d = cdevsw_lookup_acquire(dev);
 	mutex_exit(_lock);
 	if (d == NULL)
 		return ENXIO;
@@ -1043,6 +1056,7 @@ cdev_open(dev_t dev, int flag, int devty
 	DEV_LOCK(d);
 	rv = (*d->d_open)(dev, flag, devtype, l);
 	DEV_UNLOCK(d);
+	cdevsw_release(dev);
 
 	return rv;
 }
@@ -1053,12 +1067,13 @@ cdev_close(dev_t dev, int flag, int devt
 	const struct cdevsw *d;
 	int rv, mpflag;
 
-	if ((d = cdevsw_lookup(dev)) == NULL)
+	if ((d = cdevsw_lookup_acquire(dev)) == NULL)
 		return ENXIO;
 
 	DEV_LOCK(d);
 	rv = (*d->d_close)(dev, flag, devtype, l);
 	DEV_UNLOCK(d);
+	cdevsw_release(dev);
 
 	return rv;
 }
@@ -1069,12 +1084,13 @@ cdev_read(dev_t dev, struct uio *uio, in
 	const struct cdevsw *d;
 	int rv, mpflag;
 
-	if ((d = cdevsw_lookup(dev)) == NULL)
+	if ((d = 

CVS commit: [pgoyette-localcount] src/sys/kern

2017-04-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 25 21:53:06 UTC 2017

Modified Files:
src/sys/kern [pgoyette-localcount]: subr_devsw.c

Log Message:
Use {b,c}devsw_acquire() and {b,c}devsw_release() in the various device
acccess methods.


To generate a diff of this commit:
cvs rdiff -u -r1.34.2.16 -r1.34.2.17 src/sys/kern/subr_devsw.c

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



CVS commit: [pgoyette-localcount] src/sys/kern

2017-04-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 25 21:36:41 UTC 2017

Modified Files:
src/sys/kern [pgoyette-localcount]: subr_devsw.c

Log Message:
Add membar_datadep_consumer() to {b,c}devsw_lookup() to ensure that
the devsw content is visible.

Again, thanks riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.34.2.15 -r1.34.2.16 src/sys/kern/subr_devsw.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/subr_devsw.c
diff -u src/sys/kern/subr_devsw.c:1.34.2.15 src/sys/kern/subr_devsw.c:1.34.2.16
--- src/sys/kern/subr_devsw.c:1.34.2.15	Tue Apr 25 21:31:33 2017
+++ src/sys/kern/subr_devsw.c	Tue Apr 25 21:36:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_devsw.c,v 1.34.2.15 2017/04/25 21:31:33 pgoyette Exp $	*/
+/*	$NetBSD: subr_devsw.c,v 1.34.2.16 2017/04/25 21:36:41 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.34.2.15 2017/04/25 21:31:33 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.34.2.16 2017/04/25 21:36:41 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dtrace.h"
@@ -452,6 +452,9 @@ bdevsw_lookup(dev_t dev)
 	if (bmajor < 0 || bmajor >= max_bdevsws)
 		return (NULL);
 
+	/* Wait for the content of the struct bdevsw to become visible */
+	membar_datadep_consumer();
+
 	return (bdevsw[bmajor]);
 }
 
@@ -513,6 +516,9 @@ cdevsw_lookup(dev_t dev)
 	if (cmajor < 0 || cmajor >= max_cdevsws)
 		return (NULL);
 
+	/* Wait for the content of the struct bdevsw to become visible */
+	membar_datadep_consumer();
+
 	return (cdevsw[cmajor]);
 }
 



CVS commit: [pgoyette-localcount] src/sys/kern

2017-04-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 25 21:36:41 UTC 2017

Modified Files:
src/sys/kern [pgoyette-localcount]: subr_devsw.c

Log Message:
Add membar_datadep_consumer() to {b,c}devsw_lookup() to ensure that
the devsw content is visible.

Again, thanks riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.34.2.15 -r1.34.2.16 src/sys/kern/subr_devsw.c

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



CVS commit: [pgoyette-localcount] src/sys/kern

2017-04-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 25 21:31:33 UTC 2017

Modified Files:
src/sys/kern [pgoyette-localcount]: subr_devsw.c

Log Message:
Call localcount_init() before publishing the new {b,c}devsw.

Thanks to riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.34.2.14 -r1.34.2.15 src/sys/kern/subr_devsw.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/subr_devsw.c
diff -u src/sys/kern/subr_devsw.c:1.34.2.14 src/sys/kern/subr_devsw.c:1.34.2.15
--- src/sys/kern/subr_devsw.c:1.34.2.14	Sat Jan  7 08:56:49 2017
+++ src/sys/kern/subr_devsw.c	Tue Apr 25 21:31:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_devsw.c,v 1.34.2.14 2017/01/07 08:56:49 pgoyette Exp $	*/
+/*	$NetBSD: subr_devsw.c,v 1.34.2.15 2017/04/25 21:31:33 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.34.2.14 2017/01/07 08:56:49 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.34.2.15 2017/04/25 21:31:33 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dtrace.h"
@@ -300,13 +300,14 @@ bdevsw_attach(const struct bdevsw *devsw
 	if (bdevsw[*devmajor] != NULL)
 		return (EEXIST);
 
+	KASSERTMSG(devsw->d_localcount != NULL, "%s: bdev for major %d has "
+	"no localcount", __func__, *devmajor);
+	localcount_init(devsw->d_localcount);
+
 	/* ensure visibility of the bdevsw */
 	membar_producer();
 
 	bdevsw[*devmajor] = devsw;
-	KASSERTMSG(devsw->d_localcount != NULL, "%s: bdev for major %d has "
-	"no localcount", __func__, *devmajor);
-	localcount_init(devsw->d_localcount);
 
 	return (0);
 }
@@ -353,13 +354,14 @@ cdevsw_attach(const struct cdevsw *devsw
 	if (cdevsw[*devmajor] != NULL)
 		return (EEXIST);
 
+	KASSERTMSG(devsw->d_localcount != NULL, "%s: cdev for major %d has "
+	"no localcount", __func__, *devmajor);
+	localcount_init(devsw->d_localcount);
+
 	/* ensure visibility of the cdevsw */
 	membar_producer();
 
 	cdevsw[*devmajor] = devsw;
-	KASSERTMSG(devsw->d_localcount != NULL, "%s: cdev for major %d has "
-	"no localcount", __func__, *devmajor);
-	localcount_init(devsw->d_localcount);
 
 	return (0);
 }



CVS commit: [pgoyette-localcount] src/sys/kern

2017-04-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 25 21:31:33 UTC 2017

Modified Files:
src/sys/kern [pgoyette-localcount]: subr_devsw.c

Log Message:
Call localcount_init() before publishing the new {b,c}devsw.

Thanks to riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.34.2.14 -r1.34.2.15 src/sys/kern/subr_devsw.c

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



CVS commit: [pgoyette-localcount] src/sys/kern

2017-04-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 25 09:03:03 UTC 2017

Modified Files:
src/sys/kern [pgoyette-localcount]: subr_autoconf.c

Log Message:
Use KASSERTMSG() to ensure that the device has a localcount.


To generate a diff of this commit:
cvs rdiff -u -r1.246.2.8 -r1.246.2.9 src/sys/kern/subr_autoconf.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/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.246.2.8 src/sys/kern/subr_autoconf.c:1.246.2.9
--- src/sys/kern/subr_autoconf.c:1.246.2.8	Mon Mar 20 06:57:47 2017
+++ src/sys/kern/subr_autoconf.c	Tue Apr 25 09:03:03 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.246.2.8 2017/03/20 06:57:47 pgoyette Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.246.2.9 2017/04/25 09:03:03 pgoyette Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.246.2.8 2017/03/20 06:57:47 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.246.2.9 2017/04/25 09:03:03 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -2252,8 +2252,9 @@ void
 device_acquire(device_t dv)
 {
 
-	if (dv->dv_localcnt != NULL)
-		localcount_acquire(dv->dv_localcnt);
+	KASSERTMSG(dv->dv_localcnt != NULL, "%s: device %s has no localcnt!",
+	__func__, dv->dv_cfdriver->cd_name)
+	localcount_acquire(dv->dv_localcnt);
 }
 
 /*



CVS commit: [pgoyette-localcount] src/sys/kern

2017-04-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 25 09:03:03 UTC 2017

Modified Files:
src/sys/kern [pgoyette-localcount]: subr_autoconf.c

Log Message:
Use KASSERTMSG() to ensure that the device has a localcount.


To generate a diff of this commit:
cvs rdiff -u -r1.246.2.8 -r1.246.2.9 src/sys/kern/subr_autoconf.c

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



CVS commit: [pgoyette-localcount] src/share/man/man9

2016-12-07 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Dec  8 06:56:21 UTC 2016

Modified Files:
src/share/man/man9 [pgoyette-localcount]: localcount.9

Log Message:
Minor tweaks.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/share/man/man9/localcount.9

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



CVS commit: [pgoyette-localcount] src/share/man/man9

2016-12-07 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Dec  8 06:56:21 UTC 2016

Modified Files:
src/share/man/man9 [pgoyette-localcount]: localcount.9

Log Message:
Minor tweaks.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/share/man/man9/localcount.9

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/man9/localcount.9
diff -u src/share/man/man9/localcount.9:1.1.2.6 src/share/man/man9/localcount.9:1.1.2.7
--- src/share/man/man9/localcount.9:1.1.2.6	Wed Aug  3 13:11:36 2016
+++ src/share/man/man9/localcount.9	Thu Dec  8 06:56:21 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: localcount.9,v 1.1.2.6 2016/08/03 13:11:36 pgoyette Exp $
+.\"	$NetBSD: localcount.9,v 1.1.2.7 2016/12/08 06:56:21 pgoyette Exp $
 .\"
 .\" Copyright (c) 2016
 .\" 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 August 2, 2016
+.Dd December 8, 2016
 .Dt LOCALCOUNT 9
 .Os
 .Sh NAME
@@ -77,11 +77,13 @@ and almost always more than
 .Pp
 As a rough heuristic,
 .Nm
-should be used for classes of objects of which there are maybe a few dozen
-instances but not a few thousand instances (e.g. autoconf devices, but not
+should be used for classes of objects of which there are perhaps a few dozen
+instances (such as
+.Xr autoconf 9
+devices) but not thousands of instances (such as
 network flows) and on which there may be a mixture of long-term I/O waits,
 such as xyzread for a device xyz(4), and short-term fast operations, such as
-xyzioctl(IOC_READ_A_CPU_REG).
+.Dv xyzioctl(IOC_READ_A_CPU_REG) .
 .Sh FUNCTIONS
 .Bl -tag -width abcd
 .It Fn localcount_init "lc"



CVS commit: [pgoyette-localcount] src

2016-09-13 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Sep 14 03:04:19 UTC 2016

Modified Files:
src/distrib/sets/lists/comp [pgoyette-localcount]: mi
Added Files:
src/distrib/sets/lists/debug [pgoyette-localcount]: md.ia64
src/external/bsd/llvm/dist/clang/test/CodeGen [pgoyette-localcount]:
builtins-sparc.c sparc-vaarg.c
src/external/bsd/llvm/dist/llvm/test/Analysis/DivergenceAnalysis/AMDGPU 
[pgoyette-localcount]:
interp-intrinsics.ll
src/external/bsd/llvm/dist/llvm/test/CodeGen/AMDGPU 
[pgoyette-localcount]:
bug-vopc-commute.ll hsa-default-device.ll multilevel-break.ll
promote-alloca-array-allocation.ll
promote-alloca-invariant-markers.ll
promote-alloca-mem-intrinsics.ll
promote-alloca-unhandled-intrinsic.ll promote-alloca-volatile.ll
ret_jump.ll si-annotate-cfg-loop-assert.ll si-spill-sgpr-stack.ll
split-smrd.ll
src/external/bsd/llvm/dist/llvm/test/CodeGen/ARM/Windows 
[pgoyette-localcount]:
builtin_longjmp.ll dbzchk.ll
src/external/bsd/llvm/dist/llvm/test/CodeGen/Mips/cconv 
[pgoyette-localcount]:
roundl-call.ll
src/external/bsd/llvm/dist/llvm/test/CodeGen/PowerPC 
[pgoyette-localcount]:
aggressive-anti-dep-breaker-subreg.ll pr27350.ll
src/external/bsd/llvm/dist/llvm/test/CodeGen/X86 [pgoyette-localcount]:
base-pointer-and-cmpxchg.ll i686-win-shrink-wrapping.ll

src/external/bsd/llvm/dist/llvm/test/Instrumentation/MemorySanitizer/Mips 
[pgoyette-localcount]:
vararg-mips64.ll vararg-mips64el.ll
src/external/bsd/llvm/dist/llvm/test/LTO/X86 [pgoyette-localcount]:
pr25919.ll
src/external/bsd/tmux/dist [pgoyette-localcount]: cmd-set-hook.c
example_tmux.conf hooks.c proc.c xmalloc.h
src/external/bsd/tmux/dist/compat [pgoyette-localcount]: reallocarray.c
src/external/bsd/unbound [pgoyette-localcount]: Makefile Makefile.inc
TODO
src/external/bsd/unbound/bin [pgoyette-localcount]: Makefile
Makefile.inc
src/external/bsd/unbound/bin/unbound-host [pgoyette-localcount]:
Makefile
src/external/bsd/unbound/dist [pgoyette-localcount]: .gitignore LICENSE
Makefile.in README ac_pkg_swig.m4 aclocal.m4 acx_nlnetlabs.m4
acx_python.m4 ax_pthread.m4 config.guess config.h.in config.sub
configure configure.ac install-sh ltmain.sh
src/external/bsd/unbound/dist/cachedb [pgoyette-localcount]: cachedb.c
cachedb.h
src/external/bsd/unbound/dist/compat [pgoyette-localcount]: arc4_lock.c
arc4random.c arc4random_uniform.c chacha_private.h ctime_r.c
explicit_bzero.c fake-rfc2553.c fake-rfc2553.h getentropy_linux.c
getentropy_osx.c getentropy_solaris.c getentropy_win.c gmtime_r.c
inet_aton.c inet_ntop.c inet_pton.c isblank.c malloc.c memcmp.c
memcmp.h memmove.c reallocarray.c sha512.c snprintf.c strlcat.c
strlcpy.c strptime.c strsep.c
src/external/bsd/unbound/dist/contrib [pgoyette-localcount]: README
-filter-iterator.patch build-unbound-localzone-from-hosts.pl
create_unbound_ad_servers.cmd create_unbound_ad_servers.sh
parseunbound.pl patch_rsamd5_enable.diff rc_d_unbound
unbound-host.nagios.patch unbound.init unbound.init_fedora
unbound.plist unbound.spec unbound.spec_fedora unbound_cache.cmd
unbound_cache.sh unbound_cacti.tar.gz unbound_munin_
unbound_smf22.tar.gz update-anchor.sh validation-reporter.sh
warmup.cmd warmup.sh
src/external/bsd/unbound/dist/contrib/selinux [pgoyette-localcount]:
unbound.fc unbound.te
src/external/bsd/unbound/dist/daemon [pgoyette-localcount]: acl_list.c
acl_list.h cachedump.c cachedump.h daemon.c daemon.h remote.c
remote.h stats.c stats.h unbound.c worker.c worker.h
src/external/bsd/unbound/dist/dns64 [pgoyette-localcount]: dns64.c
dns64.h
src/external/bsd/unbound/dist/dnstap [pgoyette-localcount]: dnstap.c
dnstap.h dnstap.m4 dnstap.proto dnstap_config.h.in
src/external/bsd/unbound/dist/doc [pgoyette-localcount]: CREDITS
Changelog FEATURES LICENSE README README.DNS64 README.svn
README.tests TODO control_proto_spec.txt example.conf.in
ietf67-design-02.odp ietf67-design-02.pdf libunbound.3.in
requirements.txt unbound-anchor.8.in unbound-checkconf.8.in
unbound-control.8.in unbound-host.1.in unbound.8.in
unbound.conf.5.in unbound.doxygen
src/external/bsd/unbound/dist/iterator [pgoyette-localcount]:
iter_delegpt.c iter_delegpt.h iter_donotq.c iter_donotq.h
iter_fwd.c iter_fwd.h iter_hints.c iter_hints.h 

CVS commit: [pgoyette-localcount] src

2016-09-13 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Sep 14 03:04:19 UTC 2016

Modified Files:
src/distrib/sets/lists/comp [pgoyette-localcount]: mi
Added Files:
src/distrib/sets/lists/debug [pgoyette-localcount]: md.ia64
src/external/bsd/llvm/dist/clang/test/CodeGen [pgoyette-localcount]:
builtins-sparc.c sparc-vaarg.c
src/external/bsd/llvm/dist/llvm/test/Analysis/DivergenceAnalysis/AMDGPU 
[pgoyette-localcount]:
interp-intrinsics.ll
src/external/bsd/llvm/dist/llvm/test/CodeGen/AMDGPU 
[pgoyette-localcount]:
bug-vopc-commute.ll hsa-default-device.ll multilevel-break.ll
promote-alloca-array-allocation.ll
promote-alloca-invariant-markers.ll
promote-alloca-mem-intrinsics.ll
promote-alloca-unhandled-intrinsic.ll promote-alloca-volatile.ll
ret_jump.ll si-annotate-cfg-loop-assert.ll si-spill-sgpr-stack.ll
split-smrd.ll
src/external/bsd/llvm/dist/llvm/test/CodeGen/ARM/Windows 
[pgoyette-localcount]:
builtin_longjmp.ll dbzchk.ll
src/external/bsd/llvm/dist/llvm/test/CodeGen/Mips/cconv 
[pgoyette-localcount]:
roundl-call.ll
src/external/bsd/llvm/dist/llvm/test/CodeGen/PowerPC 
[pgoyette-localcount]:
aggressive-anti-dep-breaker-subreg.ll pr27350.ll
src/external/bsd/llvm/dist/llvm/test/CodeGen/X86 [pgoyette-localcount]:
base-pointer-and-cmpxchg.ll i686-win-shrink-wrapping.ll

src/external/bsd/llvm/dist/llvm/test/Instrumentation/MemorySanitizer/Mips 
[pgoyette-localcount]:
vararg-mips64.ll vararg-mips64el.ll
src/external/bsd/llvm/dist/llvm/test/LTO/X86 [pgoyette-localcount]:
pr25919.ll
src/external/bsd/tmux/dist [pgoyette-localcount]: cmd-set-hook.c
example_tmux.conf hooks.c proc.c xmalloc.h
src/external/bsd/tmux/dist/compat [pgoyette-localcount]: reallocarray.c
src/external/bsd/unbound [pgoyette-localcount]: Makefile Makefile.inc
TODO
src/external/bsd/unbound/bin [pgoyette-localcount]: Makefile
Makefile.inc
src/external/bsd/unbound/bin/unbound-host [pgoyette-localcount]:
Makefile
src/external/bsd/unbound/dist [pgoyette-localcount]: .gitignore LICENSE
Makefile.in README ac_pkg_swig.m4 aclocal.m4 acx_nlnetlabs.m4
acx_python.m4 ax_pthread.m4 config.guess config.h.in config.sub
configure configure.ac install-sh ltmain.sh
src/external/bsd/unbound/dist/cachedb [pgoyette-localcount]: cachedb.c
cachedb.h
src/external/bsd/unbound/dist/compat [pgoyette-localcount]: arc4_lock.c
arc4random.c arc4random_uniform.c chacha_private.h ctime_r.c
explicit_bzero.c fake-rfc2553.c fake-rfc2553.h getentropy_linux.c
getentropy_osx.c getentropy_solaris.c getentropy_win.c gmtime_r.c
inet_aton.c inet_ntop.c inet_pton.c isblank.c malloc.c memcmp.c
memcmp.h memmove.c reallocarray.c sha512.c snprintf.c strlcat.c
strlcpy.c strptime.c strsep.c
src/external/bsd/unbound/dist/contrib [pgoyette-localcount]: README
-filter-iterator.patch build-unbound-localzone-from-hosts.pl
create_unbound_ad_servers.cmd create_unbound_ad_servers.sh
parseunbound.pl patch_rsamd5_enable.diff rc_d_unbound
unbound-host.nagios.patch unbound.init unbound.init_fedora
unbound.plist unbound.spec unbound.spec_fedora unbound_cache.cmd
unbound_cache.sh unbound_cacti.tar.gz unbound_munin_
unbound_smf22.tar.gz update-anchor.sh validation-reporter.sh
warmup.cmd warmup.sh
src/external/bsd/unbound/dist/contrib/selinux [pgoyette-localcount]:
unbound.fc unbound.te
src/external/bsd/unbound/dist/daemon [pgoyette-localcount]: acl_list.c
acl_list.h cachedump.c cachedump.h daemon.c daemon.h remote.c
remote.h stats.c stats.h unbound.c worker.c worker.h
src/external/bsd/unbound/dist/dns64 [pgoyette-localcount]: dns64.c
dns64.h
src/external/bsd/unbound/dist/dnstap [pgoyette-localcount]: dnstap.c
dnstap.h dnstap.m4 dnstap.proto dnstap_config.h.in
src/external/bsd/unbound/dist/doc [pgoyette-localcount]: CREDITS
Changelog FEATURES LICENSE README README.DNS64 README.svn
README.tests TODO control_proto_spec.txt example.conf.in
ietf67-design-02.odp ietf67-design-02.pdf libunbound.3.in
requirements.txt unbound-anchor.8.in unbound-checkconf.8.in
unbound-control.8.in unbound-host.1.in unbound.8.in
unbound.conf.5.in unbound.doxygen
src/external/bsd/unbound/dist/iterator [pgoyette-localcount]:
iter_delegpt.c iter_delegpt.h iter_donotq.c iter_donotq.h
iter_fwd.c iter_fwd.h iter_hints.c iter_hints.h 

CVS commit: [pgoyette-localcount] src/sys/arch/x86/x86

2016-08-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Aug  6 10:45:22 UTC 2016

Modified Files:
src/sys/arch/x86/x86 [pgoyette-localcount]: pmap.c

Log Message:
Resolve $NetBSD$ conflict


To generate a diff of this commit:
cvs rdiff -u -r1.211.2.2 -r1.211.2.3 src/sys/arch/x86/x86/pmap.c

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



CVS commit: [pgoyette-localcount] src/sys/arch/x86/x86

2016-08-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Aug  6 10:45:22 UTC 2016

Modified Files:
src/sys/arch/x86/x86 [pgoyette-localcount]: pmap.c

Log Message:
Resolve $NetBSD$ conflict


To generate a diff of this commit:
cvs rdiff -u -r1.211.2.2 -r1.211.2.3 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.211.2.2 src/sys/arch/x86/x86/pmap.c:1.211.2.3
--- src/sys/arch/x86/x86/pmap.c:1.211.2.2	Sat Aug  6 00:19:06 2016
+++ src/sys/arch/x86/x86/pmap.c	Sat Aug  6 10:45:22 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.211.2.2 2016/08/06 00:19:06 pgoyette Exp $	*/
+/*	$NetBSD: pmap.c,v 1.211.2.3 2016/08/06 10:45:22 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010, 2016 The NetBSD Foundation, Inc.
@@ -171,11 +171,7 @@
  */
 
 #include 
-<<< pmap.c
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.211.2.2 2016/08/06 00:19:06 pgoyette Exp $");
-===
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.211.2.2 2016/08/06 00:19:06 pgoyette Exp $");
->>> 1.218
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.211.2.3 2016/08/06 10:45:22 pgoyette Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"



CVS commit: [pgoyette-localcount] src

2016-08-05 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Aug  6 00:19:12 UTC 2016

Modified Files:
src/crypto/external/bsd/openssh/bin/ssh [pgoyette-localcount]: Makefile
src/crypto/external/bsd/openssh/dist [pgoyette-localcount]: PROTOCOL
PROTOCOL.agent PROTOCOL.certkeys PROTOCOL.chacha20poly1305
auth-krb5.c auth-options.c auth-pam.c auth-passwd.c auth-rh-rsa.c
auth-rhosts.c auth.c auth.h auth2-chall.c auth2-hostbased.c auth2.c
authfile.c bufbn.c canohost.c canohost.h channels.c clientloop.c
compat.c dh.c dh.h kex.c kex.h kexc25519.c kexc25519c.c
kexc25519s.c kexdh.c kexdhc.c kexdhs.c kexgexs.c key.c log.c log.h
mac.c mac.h misc.c misc.h monitor.c monitor_fdpass.c monitor_wrap.c
monitor_wrap.h mux.c myproposal.h opacket.h packet.c packet.h
pathnames.h progressmeter.c readconf.c readconf.h scp.1 scp.c
servconf.c serverloop.c session.c session.h sftp-client.c sftp.1
sftp.c ssh-agent.c ssh-dss.c ssh-ecdsa.c ssh-ed25519.c ssh-keygen.1
ssh-keygen.c ssh-keyscan.c ssh-rsa.c ssh.1 ssh.c ssh1.h ssh2.h
ssh_api.c ssh_config.5 sshbuf-getput-basic.c sshbuf-getput-crypto.c
sshbuf-misc.c sshbuf.h sshconnect1.c sshconnect2.c sshd.c
sshd_config sshd_config.5 sshkey.c sshkey.h ttymodes.c ttymodes.h
version.h
src/crypto/external/bsd/openssh/dist/moduli-gen [pgoyette-localcount]:
moduli.2048 moduli.3072 moduli.4096 moduli.6144 moduli.7680
moduli.8192
src/crypto/external/bsd/openssh/lib [pgoyette-localcount]: Makefile
shlib_version
src/distrib/notes/common [pgoyette-localcount]: main
src/distrib/sets/lists/base [pgoyette-localcount]: mi rescue.mi shl.mi
src/distrib/sets/lists/comp [pgoyette-localcount]: mi
src/distrib/sets/lists/debug [pgoyette-localcount]: mi shl.mi
src/distrib/sets/lists/modules [pgoyette-localcount]: md.ia64 mi
src/distrib/sets/lists/tests [pgoyette-localcount]: mi
src/doc [pgoyette-localcount]: 3RDPARTY CHANGES
src/etc/mtree [pgoyette-localcount]: NetBSD.dist.tests
src/external/bsd/blacklist/bin [pgoyette-localcount]: blacklistd.8
src/external/bsd/blacklist/lib [pgoyette-localcount]: bl.c
src/external/bsd/dhcpcd/dist [pgoyette-localcount]: arp.c defs.h
dhcp-common.c dhcp.c dhcp6.c dhcp6.h dhcpcd-run-hooks.8.in
dhcpcd.8.in dhcpcd.c dhcpcd.conf.5.in dhcpcd.h duid.c if-bsd.c
if-options.c if-options.h if.c if.h ipv4.c ipv4.h ipv4ll.c ipv6.c
ipv6.h ipv6nd.c ipv6nd.h
src/external/bsd/dhcpcd/dist/dhcpcd-hooks [pgoyette-localcount]:
20-resolv.conf
src/external/cddl/osnet/dist/lib/libdtrace/common [pgoyette-localcount]:
dt_module.c
src/external/cddl/osnet/lib [pgoyette-localcount]: Makefile.inc
src/external/cddl/osnet/lib/drti [pgoyette-localcount]: Makefile
src/external/cddl/osnet/lib/libavl [pgoyette-localcount]: Makefile
src/external/cddl/osnet/lib/libctf [pgoyette-localcount]: Makefile
src/external/cddl/osnet/lib/libdtrace [pgoyette-localcount]: Makefile
src/external/cddl/osnet/lib/libnvpair [pgoyette-localcount]: Makefile
src/external/cddl/osnet/lib/libumem [pgoyette-localcount]: Makefile
src/external/cddl/osnet/lib/libuutil [pgoyette-localcount]: Makefile
src/external/cddl/osnet/lib/libzfs [pgoyette-localcount]: Makefile
src/external/cddl/osnet/lib/libzpool [pgoyette-localcount]: Makefile
src/external/gpl3/binutils/dist [pgoyette-localcount]: md5.sum
src/external/gpl3/binutils/dist/bfd [pgoyette-localcount]: ChangeLog
archive.c coff-alpha.c coff-i386.c coff-x86_64.c coffcode.h
cofflink.c configure development.sh dwarf2.c elf-bfd.h elf-strtab.c
elf32-arm.c elf32-avr.c elf32-hppa.c elf32-i386.c elf32-ppc.c
elf64-hppa.c elf64-ppc.c elf64-x86-64.c elflink.c elfnn-aarch64.c
version.h version.m4
src/external/gpl3/binutils/dist/binutils [pgoyette-localcount]:
ChangeLog Makefile.am Makefile.in configure objcopy.c objdump.c
src/external/gpl3/binutils/dist/binutils/doc [pgoyette-localcount]:
addr2line.1 ar.1 binutils.info binutils.texi cxxfilt.man dlltool.1
elfedit.1 nlmconv.1 nm.1 objcopy.1 objdump.1 ranlib.1 readelf.1
size.1 strings.1 strip.1 windmc.1 windres.1
src/external/gpl3/binutils/dist/binutils/po [pgoyette-localcount]:
sv.po
src/external/gpl3/binutils/dist/binutils/testsuite 
[pgoyette-localcount]:
ChangeLog
src/external/gpl3/binutils/dist/binutils/testsuite/binutils-all 
[pgoyette-localcount]:
ar.exp compress.exp
src/external/gpl3/binutils/dist/elfcpp [pgoyette-localcount]: ChangeLog
 

CVS commit: [pgoyette-localcount] src

2016-08-05 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Aug  6 00:19:12 UTC 2016

Modified Files:
src/crypto/external/bsd/openssh/bin/ssh [pgoyette-localcount]: Makefile
src/crypto/external/bsd/openssh/dist [pgoyette-localcount]: PROTOCOL
PROTOCOL.agent PROTOCOL.certkeys PROTOCOL.chacha20poly1305
auth-krb5.c auth-options.c auth-pam.c auth-passwd.c auth-rh-rsa.c
auth-rhosts.c auth.c auth.h auth2-chall.c auth2-hostbased.c auth2.c
authfile.c bufbn.c canohost.c canohost.h channels.c clientloop.c
compat.c dh.c dh.h kex.c kex.h kexc25519.c kexc25519c.c
kexc25519s.c kexdh.c kexdhc.c kexdhs.c kexgexs.c key.c log.c log.h
mac.c mac.h misc.c misc.h monitor.c monitor_fdpass.c monitor_wrap.c
monitor_wrap.h mux.c myproposal.h opacket.h packet.c packet.h
pathnames.h progressmeter.c readconf.c readconf.h scp.1 scp.c
servconf.c serverloop.c session.c session.h sftp-client.c sftp.1
sftp.c ssh-agent.c ssh-dss.c ssh-ecdsa.c ssh-ed25519.c ssh-keygen.1
ssh-keygen.c ssh-keyscan.c ssh-rsa.c ssh.1 ssh.c ssh1.h ssh2.h
ssh_api.c ssh_config.5 sshbuf-getput-basic.c sshbuf-getput-crypto.c
sshbuf-misc.c sshbuf.h sshconnect1.c sshconnect2.c sshd.c
sshd_config sshd_config.5 sshkey.c sshkey.h ttymodes.c ttymodes.h
version.h
src/crypto/external/bsd/openssh/dist/moduli-gen [pgoyette-localcount]:
moduli.2048 moduli.3072 moduli.4096 moduli.6144 moduli.7680
moduli.8192
src/crypto/external/bsd/openssh/lib [pgoyette-localcount]: Makefile
shlib_version
src/distrib/notes/common [pgoyette-localcount]: main
src/distrib/sets/lists/base [pgoyette-localcount]: mi rescue.mi shl.mi
src/distrib/sets/lists/comp [pgoyette-localcount]: mi
src/distrib/sets/lists/debug [pgoyette-localcount]: mi shl.mi
src/distrib/sets/lists/modules [pgoyette-localcount]: md.ia64 mi
src/distrib/sets/lists/tests [pgoyette-localcount]: mi
src/doc [pgoyette-localcount]: 3RDPARTY CHANGES
src/etc/mtree [pgoyette-localcount]: NetBSD.dist.tests
src/external/bsd/blacklist/bin [pgoyette-localcount]: blacklistd.8
src/external/bsd/blacklist/lib [pgoyette-localcount]: bl.c
src/external/bsd/dhcpcd/dist [pgoyette-localcount]: arp.c defs.h
dhcp-common.c dhcp.c dhcp6.c dhcp6.h dhcpcd-run-hooks.8.in
dhcpcd.8.in dhcpcd.c dhcpcd.conf.5.in dhcpcd.h duid.c if-bsd.c
if-options.c if-options.h if.c if.h ipv4.c ipv4.h ipv4ll.c ipv6.c
ipv6.h ipv6nd.c ipv6nd.h
src/external/bsd/dhcpcd/dist/dhcpcd-hooks [pgoyette-localcount]:
20-resolv.conf
src/external/cddl/osnet/dist/lib/libdtrace/common [pgoyette-localcount]:
dt_module.c
src/external/cddl/osnet/lib [pgoyette-localcount]: Makefile.inc
src/external/cddl/osnet/lib/drti [pgoyette-localcount]: Makefile
src/external/cddl/osnet/lib/libavl [pgoyette-localcount]: Makefile
src/external/cddl/osnet/lib/libctf [pgoyette-localcount]: Makefile
src/external/cddl/osnet/lib/libdtrace [pgoyette-localcount]: Makefile
src/external/cddl/osnet/lib/libnvpair [pgoyette-localcount]: Makefile
src/external/cddl/osnet/lib/libumem [pgoyette-localcount]: Makefile
src/external/cddl/osnet/lib/libuutil [pgoyette-localcount]: Makefile
src/external/cddl/osnet/lib/libzfs [pgoyette-localcount]: Makefile
src/external/cddl/osnet/lib/libzpool [pgoyette-localcount]: Makefile
src/external/gpl3/binutils/dist [pgoyette-localcount]: md5.sum
src/external/gpl3/binutils/dist/bfd [pgoyette-localcount]: ChangeLog
archive.c coff-alpha.c coff-i386.c coff-x86_64.c coffcode.h
cofflink.c configure development.sh dwarf2.c elf-bfd.h elf-strtab.c
elf32-arm.c elf32-avr.c elf32-hppa.c elf32-i386.c elf32-ppc.c
elf64-hppa.c elf64-ppc.c elf64-x86-64.c elflink.c elfnn-aarch64.c
version.h version.m4
src/external/gpl3/binutils/dist/binutils [pgoyette-localcount]:
ChangeLog Makefile.am Makefile.in configure objcopy.c objdump.c
src/external/gpl3/binutils/dist/binutils/doc [pgoyette-localcount]:
addr2line.1 ar.1 binutils.info binutils.texi cxxfilt.man dlltool.1
elfedit.1 nlmconv.1 nm.1 objcopy.1 objdump.1 ranlib.1 readelf.1
size.1 strings.1 strip.1 windmc.1 windres.1
src/external/gpl3/binutils/dist/binutils/po [pgoyette-localcount]:
sv.po
src/external/gpl3/binutils/dist/binutils/testsuite 
[pgoyette-localcount]:
ChangeLog
src/external/gpl3/binutils/dist/binutils/testsuite/binutils-all 
[pgoyette-localcount]:
ar.exp compress.exp
src/external/gpl3/binutils/dist/elfcpp [pgoyette-localcount]: ChangeLog
 

CVS commit: [pgoyette-localcount] src/share/man/man9

2016-08-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Aug  3 13:11:37 UTC 2016

Modified Files:
src/share/man/man9 [pgoyette-localcount]: localcount.9

Log Message:
As suggested in private Email, rename BUGS section to CAVEATS.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/share/man/man9/localcount.9

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



CVS commit: [pgoyette-localcount] src/share/man/man9

2016-08-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Aug  3 13:11:37 UTC 2016

Modified Files:
src/share/man/man9 [pgoyette-localcount]: localcount.9

Log Message:
As suggested in private Email, rename BUGS section to CAVEATS.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/share/man/man9/localcount.9

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/man9/localcount.9
diff -u src/share/man/man9/localcount.9:1.1.2.5 src/share/man/man9/localcount.9:1.1.2.6
--- src/share/man/man9/localcount.9:1.1.2.5	Mon Aug  1 12:02:00 2016
+++ src/share/man/man9/localcount.9	Wed Aug  3 13:11:36 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: localcount.9,v 1.1.2.5 2016/08/01 12:02:00 pgoyette Exp $
+.\"	$NetBSD: localcount.9,v 1.1.2.6 2016/08/03 13:11:36 pgoyette Exp $
 .\"
 .\" Copyright (c) 2016
 .\" All rights reserved.
@@ -173,7 +173,7 @@ was written by
 .An Taylor R. Campbell .
 This manual page was compiled by
 .An Paul Goyette .
-.Sh BUGS
+.Sh CAVEATS
 The
 .Nm
 facility does not provide any way to examine the reference count without



CVS commit: [pgoyette-localcount] src/share/man/man9

2016-08-01 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Aug  1 12:02:00 UTC 2016

Modified Files:
src/share/man/man9 [pgoyette-localcount]: localcount.9

Log Message:
Add a BUGS section, which is really a RESTRICTIONS section (but mdoclint
doesn't like RESTRICTIONS!)


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/share/man/man9/localcount.9

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/man9/localcount.9
diff -u src/share/man/man9/localcount.9:1.1.2.4 src/share/man/man9/localcount.9:1.1.2.5
--- src/share/man/man9/localcount.9:1.1.2.4	Sat Jul 16 23:42:35 2016
+++ src/share/man/man9/localcount.9	Mon Aug  1 12:02:00 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: localcount.9,v 1.1.2.4 2016/07/16 23:42:35 pgoyette Exp $
+.\"	$NetBSD: localcount.9,v 1.1.2.5 2016/08/01 12:02:00 pgoyette Exp $
 .\"
 .\" Copyright (c) 2016
 .\" 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 July xx, 2016
+.Dd August 2, 2016
 .Dt LOCALCOUNT 9
 .Os
 .Sh NAME
@@ -173,3 +173,17 @@ was written by
 .An Taylor R. Campbell .
 This manual page was compiled by
 .An Paul Goyette .
+.Sh BUGS
+The
+.Nm
+facility does not provide any way to examine the reference count without
+actually waiting for the count to reach zero.
+.Pp
+Waiting for a
+.Nm
+reference count to reach zero is a one-shot operation.
+Once the
+.Nm
+has been waited for, no further operations are allowed until the
+.Nm
+has been re-initialized.



CVS commit: [pgoyette-localcount] src/share/man/man9

2016-08-01 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Aug  1 12:02:00 UTC 2016

Modified Files:
src/share/man/man9 [pgoyette-localcount]: localcount.9

Log Message:
Add a BUGS section, which is really a RESTRICTIONS section (but mdoclint
doesn't like RESTRICTIONS!)


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/share/man/man9/localcount.9

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



CVS commit: [pgoyette-localcount] src/tests/lib/libpthread

2016-08-01 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Aug  1 07:39:23 UTC 2016

Modified Files:
src/tests/lib/libpthread [pgoyette-localcount]: t_mutex.c

Log Message:
Import test fix from HEAD.

With this, a complete test run on HEAD vs the localcount branch yields
identical lists of "Failed test cases" and "Expected failures"


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.2.1 src/tests/lib/libpthread/t_mutex.c

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



CVS commit: [pgoyette-localcount] src/tests/lib/libpthread

2016-08-01 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Aug  1 07:39:23 UTC 2016

Modified Files:
src/tests/lib/libpthread [pgoyette-localcount]: t_mutex.c

Log Message:
Import test fix from HEAD.

With this, a complete test run on HEAD vs the localcount branch yields
identical lists of "Failed test cases" and "Expected failures"


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.2.1 src/tests/lib/libpthread/t_mutex.c

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

Modified files:

Index: src/tests/lib/libpthread/t_mutex.c
diff -u src/tests/lib/libpthread/t_mutex.c:1.9 src/tests/lib/libpthread/t_mutex.c:1.9.2.1
--- src/tests/lib/libpthread/t_mutex.c:1.9	Wed Jul  6 14:42:53 2016
+++ src/tests/lib/libpthread/t_mutex.c	Mon Aug  1 07:39:23 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mutex.c,v 1.9 2016/07/06 14:42:53 christos Exp $ */
+/* $NetBSD: t_mutex.c,v 1.9.2.1 2016/08/01 07:39:23 pgoyette Exp $ */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_mutex.c,v 1.9 2016/07/06 14:42:53 christos Exp $");
+__RCSID("$NetBSD: t_mutex.c,v 1.9.2.1 2016/08/01 07:39:23 pgoyette Exp $");
 
 #include 
 #include 
@@ -318,7 +318,7 @@ child_func(void* arg)
 
 	printf("child is waiting\n");
 	res = _sched_protect(-2);
-	ATF_REQUIRE_EQ(res, -1);
+	ATF_REQUIRE_EQ_MSG(res, -1, "sched_protect returned %d", res);
 	ATF_REQUIRE_EQ(errno, ENOENT);
 	PTHREAD_REQUIRE(pthread_mutex_lock());
 	printf("child is owning resource\n");
@@ -334,6 +334,7 @@ ATF_TC(mutex5);
 ATF_TC_HEAD(mutex5, tc)
 {
 	atf_tc_set_md_var(tc, "descr", "Checks mutexes for priority setting");
+	atf_tc_set_md_var(tc, "require.user", "root");
 }
 
 ATF_TC_BODY(mutex5, tc)
@@ -352,7 +353,8 @@ ATF_TC_BODY(mutex5, tc)
 	printf("previous policy used = %d\n", res);
 
 	res = sched_getscheduler(getpid());
-	ATF_REQUIRE_EQ(res, 1);
+	ATF_REQUIRE_EQ_MSG(res, SCHED_FIFO, "sched %d != FIFO %d", res, 
+	SCHED_FIFO);
 
 	PTHREAD_REQUIRE(pthread_mutexattr_init());
 	PTHREAD_REQUIRE(pthread_mutexattr_setprotocol(,
@@ -444,6 +446,7 @@ ATF_TC_HEAD(mutex6, tc)
 {
 	atf_tc_set_md_var(tc, "descr",
 	"Checks scheduling for priority ceiling");
+	atf_tc_set_md_var(tc, "require.user", "root");
 }
 
 /*



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-31 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 31 13:12:59 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: fss.c

Log Message:
mport rev 1.95 from HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.93.2.6 -r1.93.2.7 src/sys/dev/fss.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/fss.c
diff -u src/sys/dev/fss.c:1.93.2.6 src/sys/dev/fss.c:1.93.2.7
--- src/sys/dev/fss.c:1.93.2.6	Sun Jul 31 01:36:49 2016
+++ src/sys/dev/fss.c	Sun Jul 31 13:12:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fss.c,v 1.93.2.6 2016/07/31 01:36:49 pgoyette Exp $	*/
+/*	$NetBSD: fss.c,v 1.93.2.7 2016/07/31 13:12:59 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.93.2.6 2016/07/31 01:36:49 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.93.2.7 2016/07/31 13:12:59 pgoyette Exp $");
 
 #include 
 #include 
@@ -472,17 +472,20 @@ fss_dump(dev_t dev, daddr_t blkno, void 
 
 /*
  * An error occurred reading or writing the snapshot or backing store.
- * If it is the first error log to console.
+ * If it is the first error log to console and disestablish cow handler.
  * The caller holds the mutex.
  */
 static inline void
 fss_error(struct fss_softc *sc, const char *msg)
 {
 
-	if ((sc->sc_flags & (FSS_ACTIVE|FSS_ERROR)) == FSS_ACTIVE)
-		aprint_error_dev(sc->sc_dev, "snapshot invalid: %s\n", msg);
-	if ((sc->sc_flags & FSS_ACTIVE) == FSS_ACTIVE)
-		sc->sc_flags |= FSS_ERROR;
+	if ((sc->sc_flags & (FSS_ACTIVE | FSS_ERROR)) != FSS_ACTIVE)
+		return;
+
+	aprint_error_dev(sc->sc_dev, "snapshot invalid: %s\n", msg);
+	if ((sc->sc_flags & FSS_PERSISTENT) == 0)
+		fscow_disestablish(sc->sc_mount, fss_copy_on_write, sc);
+	sc->sc_flags |= FSS_ERROR;
 }
 
 /*
@@ -605,9 +608,8 @@ fss_unmount_hook(struct mount *mp)
 			continue;
 		sc = device_private(self);
 		mutex_enter(>sc_slock);
-		if ((sc->sc_flags & FSS_ACTIVE) != 0 &&
-		sc->sc_mount == mp)
-			fss_error(sc, "forced unmount");
+		if ((sc->sc_flags & FSS_ACTIVE) != 0 && sc->sc_mount == mp)
+			fss_error(sc, "forced by unmount");
 		mutex_exit(>sc_slock);
 		device_release(self);
 	}
@@ -917,7 +919,7 @@ static int
 fss_delete_snapshot(struct fss_softc *sc, struct lwp *l)
 {
 
-	if ((sc->sc_flags & FSS_PERSISTENT) == 0)
+	if ((sc->sc_flags & (FSS_PERSISTENT | FSS_ERROR)) == 0)
 		fscow_disestablish(sc->sc_mount, fss_copy_on_write, sc);
 
 	mutex_enter(>sc_slock);



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-31 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 31 13:12:59 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: fss.c

Log Message:
mport rev 1.95 from HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.93.2.6 -r1.93.2.7 src/sys/dev/fss.c

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



CVS commit: [pgoyette-localcount] src/tests/dev/fss

2016-07-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 31 03:56:57 UTC 2016

Modified Files:
src/tests/dev/fss [pgoyette-localcount]: t_fss.sh

Log Message:
Import changes from HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/tests/dev/fss/t_fss.sh

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

Modified files:

Index: src/tests/dev/fss/t_fss.sh
diff -u src/tests/dev/fss/t_fss.sh:1.1.2.2 src/tests/dev/fss/t_fss.sh:1.1.2.3
--- src/tests/dev/fss/t_fss.sh:1.1.2.2	Fri Jul 29 10:57:32 2016
+++ src/tests/dev/fss/t_fss.sh	Sun Jul 31 03:56:57 2016
@@ -1,4 +1,4 @@
-# $NetBSD: t_fss.sh,v 1.1.2.2 2016/07/29 10:57:32 pgoyette Exp $
+# $NetBSD: t_fss.sh,v 1.1.2.3 2016/07/31 03:56:57 pgoyette Exp $
 #
 # Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -52,7 +52,7 @@ basic_body() {
 # configure and mount a snapshot of the file system
 
 	fssconfig -c fss0 ./m1 ./backup
-	mount /dev/fss0 ./m2
+	mount -o rdonly /dev/fss0 ./m2
 
 # Modify the data on the underlying file system
 
@@ -65,15 +65,17 @@ basic_body() {
 
 # Unmount our temporary stuff
 
-	umount /dev/vnd0a	|| true
 	umount /dev/fss0	|| true
+	fssconfig -u fss0	|| true
+	umount /dev/vnd0a	|| true
+	vndconfig -u vnd0	|| true
 }
 
 basic_cleanup() {
 	umount /dev/vnd0a	|| true
+	fssconfig -u fss0	|| true
 	umount /dev/fss0	|| true
 	vndconfig -u vnd0	|| true
-	fssconfig -u fss0	|| true
 }
 
 atf_init_test_cases()



CVS commit: [pgoyette-localcount] src/tests/dev/fss

2016-07-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 31 03:56:57 UTC 2016

Modified Files:
src/tests/dev/fss [pgoyette-localcount]: t_fss.sh

Log Message:
Import changes from HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/tests/dev/fss/t_fss.sh

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



CVS commit: [pgoyette-localcount] src/distrib/sets/lists

2016-07-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 31 02:11:42 UTC 2016

Modified Files:
src/distrib/sets/lists/base [pgoyette-localcount]: mi
src/distrib/sets/lists/debug [pgoyette-localcount]: mi

Log Message:
Add rump.fssconfig to sets lists


To generate a diff of this commit:
cvs rdiff -u -r1.1131 -r1.1131.2.1 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.160 -r1.160.2.1 src/distrib/sets/lists/debug/mi

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1131 src/distrib/sets/lists/base/mi:1.1131.2.1
--- src/distrib/sets/lists/base/mi:1.1131	Fri Jul  1 22:52:06 2016
+++ src/distrib/sets/lists/base/mi	Sun Jul 31 02:11:41 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1131 2016/07/01 22:52:06 christos Exp $
+# $NetBSD: mi,v 1.1131.2.1 2016/07/31 02:11:41 pgoyette Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -1838,6 +1838,7 @@
 ./usr/sbin/rtsoldbase-obsolete		obsolete
 ./usr/sbin/rump.arpbase-netutil-bin	rump
 ./usr/sbin/rump.envstatbase-sysutil-bin	rump
+./usr/sbin/rump.fssconfig			base-sysutil-root	rump
 ./usr/sbin/rump.ndpbase-netutil-bin	inet6,rump
 ./usr/sbin/rump.powerdbase-sysutil-bin	rump
 ./usr/sbin/rump.rtadvdbase-router-bin		use_inet6,rump

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.160 src/distrib/sets/lists/debug/mi:1.160.2.1
--- src/distrib/sets/lists/debug/mi:1.160	Sat Jul  2 15:40:51 2016
+++ src/distrib/sets/lists/debug/mi	Sun Jul 31 02:11:42 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.160 2016/07/02 15:40:51 christos Exp $
+# $NetBSD: mi,v 1.160.2.1 2016/07/31 02:11:42 pgoyette Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -1214,6 +1214,7 @@
 ./usr/libdata/debug/usr/sbin/rtsold.debug	comp-obsolete		obsolete
 ./usr/libdata/debug/usr/sbin/rump.arp.debug	comp-netutil-debug	debug,rump
 ./usr/libdata/debug/usr/sbin/rump.envstat.debug	comp-sysutil-debug	debug,rump
+./usr/libdata/debug/usr/sbin/rump.fssconfig.debug comp-sysutil-debug	debug,rump
 ./usr/libdata/debug/usr/sbin/rump.ndp.debug	comp-netutil-debug	inet6,debug,rump
 ./usr/libdata/debug/usr/sbin/rump.powerd.debug	comp-sysutil-debug	debug,rump
 ./usr/libdata/debug/usr/sbin/rump.traceroute.debug	comp-netutil-debug	debug,rump



CVS commit: [pgoyette-localcount] src/distrib/sets/lists

2016-07-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 31 02:11:42 UTC 2016

Modified Files:
src/distrib/sets/lists/base [pgoyette-localcount]: mi
src/distrib/sets/lists/debug [pgoyette-localcount]: mi

Log Message:
Add rump.fssconfig to sets lists


To generate a diff of this commit:
cvs rdiff -u -r1.1131 -r1.1131.2.1 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.160 -r1.160.2.1 src/distrib/sets/lists/debug/mi

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



CVS commit: [pgoyette-localcount] src/usr.sbin/fssconfig

2016-07-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 31 02:02:20 UTC 2016

Modified Files:
src/usr.sbin/fssconfig [pgoyette-localcount]: Makefile
Added Files:
src/usr.sbin/fssconfig [pgoyette-localcount]: fssconfig_hostops.c
fssconfig_rumpops.c prog_ops.h

Log Message:
Add a rump version of fssconfig


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.78.1 src/usr.sbin/fssconfig/Makefile
cvs rdiff -u -r0 -r1.1.2.1 src/usr.sbin/fssconfig/fssconfig_hostops.c \
src/usr.sbin/fssconfig/fssconfig_rumpops.c \
src/usr.sbin/fssconfig/prog_ops.h

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

Modified files:

Index: src/usr.sbin/fssconfig/Makefile
diff -u src/usr.sbin/fssconfig/Makefile:1.1 src/usr.sbin/fssconfig/Makefile:1.1.78.1
--- src/usr.sbin/fssconfig/Makefile:1.1	Wed Dec 10 11:40:12 2003
+++ src/usr.sbin/fssconfig/Makefile	Sun Jul 31 02:02:20 2016
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.1 2003/12/10 11:40:12 hannken Exp $
+#	$NetBSD: Makefile,v 1.1.78.1 2016/07/31 02:02:20 pgoyette Exp $
 
-PROG=		fssconfig
+RUMPPRG=	fssconfig
 MAN=		fssconfig.8
 DPADD+=		${LIBUTIL}
 LDADD+=		-lutil

Added files:

Index: src/usr.sbin/fssconfig/fssconfig_hostops.c
diff -u /dev/null src/usr.sbin/fssconfig/fssconfig_hostops.c:1.1.2.1
--- /dev/null	Sun Jul 31 02:02:20 2016
+++ src/usr.sbin/fssconfig/fssconfig_hostops.c	Sun Jul 31 02:02:20 2016
@@ -0,0 +1,52 @@
+/*	$NetBSD: fssconfig_hostops.c,v 1.1.2.1 2016/07/31 02:02:20 pgoyette Exp $	*/
+
+/*
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#include 
+#ifndef lint
+__RCSID("$NetBSD: fssconfig_hostops.c,v 1.1.2.1 2016/07/31 02:02:20 pgoyette Exp $");
+#endif /* !lint */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "prog_ops.h"
+
+const struct prog_ops prog_ops = {
+	.op_open = open,
+	.op_ioctl = ioctl,
+	.op_pread = pread,
+	.op_close = close,
+	.op_stat = stat,
+	.op_fstat = fstat,
+	.op_statvfs1 = statvfs1,
+};
Index: src/usr.sbin/fssconfig/fssconfig_rumpops.c
diff -u /dev/null src/usr.sbin/fssconfig/fssconfig_rumpops.c:1.1.2.1
--- /dev/null	Sun Jul 31 02:02:20 2016
+++ src/usr.sbin/fssconfig/fssconfig_rumpops.c	Sun Jul 31 02:02:20 2016
@@ -0,0 +1,54 @@
+/*	$NetBSD: fssconfig_rumpops.c,v 1.1.2.1 2016/07/31 02:02:20 pgoyette Exp $	*/
+
+/*
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 

CVS commit: [pgoyette-localcount] src/usr.sbin/fssconfig

2016-07-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 31 02:02:20 UTC 2016

Modified Files:
src/usr.sbin/fssconfig [pgoyette-localcount]: Makefile
Added Files:
src/usr.sbin/fssconfig [pgoyette-localcount]: fssconfig_hostops.c
fssconfig_rumpops.c prog_ops.h

Log Message:
Add a rump version of fssconfig


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.78.1 src/usr.sbin/fssconfig/Makefile
cvs rdiff -u -r0 -r1.1.2.1 src/usr.sbin/fssconfig/fssconfig_hostops.c \
src/usr.sbin/fssconfig/fssconfig_rumpops.c \
src/usr.sbin/fssconfig/prog_ops.h

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



CVS commit: [pgoyette-localcount] src/sys

2016-07-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 31 01:36:49 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: fss.c
src/sys/rump/dev/lib/libfss [pgoyette-localcount]: fss_component.c

Log Message:
When initializing the rump component, detach the [bc]devsw after
using the devmajors to create the device nodes.  Normal module
initialization will reattach them.

XXX This code sequence is fairly common, and probably should be
XXX extracted into a separate routine and/or macro.  But there's
XXX a lot of variables/parameters involved...


To generate a diff of this commit:
cvs rdiff -u -r1.93.2.5 -r1.93.2.6 src/sys/dev/fss.c
cvs rdiff -u -r1.2 -r1.2.2.1 src/sys/rump/dev/lib/libfss/fss_component.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/fss.c
diff -u src/sys/dev/fss.c:1.93.2.5 src/sys/dev/fss.c:1.93.2.6
--- src/sys/dev/fss.c:1.93.2.5	Wed Jul 27 03:25:00 2016
+++ src/sys/dev/fss.c	Sun Jul 31 01:36:49 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fss.c,v 1.93.2.5 2016/07/27 03:25:00 pgoyette Exp $	*/
+/*	$NetBSD: fss.c,v 1.93.2.6 2016/07/31 01:36:49 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.93.2.5 2016/07/27 03:25:00 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.93.2.6 2016/07/31 01:36:49 pgoyette Exp $");
 
 #include 
 #include 
@@ -1321,10 +1321,11 @@ fss_bs_thread(void *arg)
 MODULE(MODULE_CLASS_DRIVER, fss, NULL);
 CFDRIVER_DECL(fss, DV_DISK, NULL);
 
+devmajor_t fss_bmajor = -1, fss_cmajor = -1;
+
 static int
 fss_modcmd(modcmd_t cmd, void *arg)
 {
-	devmajor_t bmajor = -1, cmajor = -1;
 	int error = 0;
 
 	switch (cmd) {
@@ -1342,9 +1343,8 @@ fss_modcmd(modcmd_t cmd, void *arg)
 			break;
 		}
 		error = devsw_attach(fss_cd.cd_name,
-		_bdevsw, , _cdevsw, );
-		if (error == EEXIST)
-			error = 0;
+		_bdevsw, _bmajor, _cdevsw, _cmajor);
+
 		if (error) {
 			config_cfattach_detach(fss_cd.cd_name, _ca);
 			config_cfdriver_detach(_cd);
@@ -1354,11 +1354,14 @@ fss_modcmd(modcmd_t cmd, void *arg)
 		break;
 
 	case MODULE_CMD_FINI:
+		devsw_detach(_bdevsw, _cdevsw);
 		error = config_cfattach_detach(fss_cd.cd_name, _ca);
-		if (error)
+		if (error) {
+			devsw_attach(fss_cd.cd_name, _bdevsw, _bmajor,
+			_cdevsw, _cmajor);
 			break;
+		}
 		config_cfdriver_detach(_cd);
-		devsw_detach(_bdevsw, _cdevsw);
 		mutex_destroy(_device_lock);
 		break;
 

Index: src/sys/rump/dev/lib/libfss/fss_component.c
diff -u src/sys/rump/dev/lib/libfss/fss_component.c:1.2 src/sys/rump/dev/lib/libfss/fss_component.c:1.2.2.1
--- src/sys/rump/dev/lib/libfss/fss_component.c:1.2	Tue Jan 26 23:12:15 2016
+++ src/sys/rump/dev/lib/libfss/fss_component.c	Sun Jul 31 01:36:49 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fss_component.c,v 1.2 2016/01/26 23:12:15 pooka Exp $	*/
+/*	$NetBSD: fss_component.c,v 1.2.2.1 2016/07/31 01:36:49 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fss_component.c,v 1.2 2016/01/26 23:12:15 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss_component.c,v 1.2.2.1 2016/07/31 01:36:49 pgoyette Exp $");
 
 #include 
 #include 
@@ -40,20 +40,22 @@ RUMP_COMPONENT(RUMP_COMPONENT_DEV)
 {
 	extern const struct bdevsw fss_bdevsw;
 	extern const struct cdevsw fss_cdevsw;
-	devmajor_t bmaj, cmaj;
+	extern devmajor_t fss_bmajor, fss_cmajor;
 	int error;
 
-	bmaj = bdevsw_lookup_major(_bdevsw);
-	cmaj = cdevsw_lookup_major(_cdevsw);
+	fss_bmajor = bdevsw_lookup_major(_bdevsw);
+	fss_cmajor = cdevsw_lookup_major(_cdevsw);
 
-	if ((error = devsw_attach("fss", _bdevsw, ,
-	_cdevsw, )) != 0)
+	if ((error = devsw_attach("fss", _bdevsw, _bmajor,
+	_cdevsw, _cmajor)) != 0)
 		panic("cannot attach fss: %d", error);
 
 	if ((error = rump_vfs_makedevnodes(S_IFBLK, "/dev/fss", '0',
-	bmaj, 0, 4)) != 0)
+	fss_bmajor, 0, 4)) != 0)
 		panic("cannot create cooked fss dev nodes: %d", error);
 	if ((error = rump_vfs_makedevnodes(S_IFCHR, "/dev/rfss", '0',
-	cmaj, 0, 4)) != 0)
+	fss_cmajor, 0, 4)) != 0)
 		panic("cannot create raw fss dev nodes: %d", error);
+
+	devsw_detach(_bdevsw, _cdevsw);
 }



CVS commit: [pgoyette-localcount] src/sys

2016-07-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 31 01:36:49 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: fss.c
src/sys/rump/dev/lib/libfss [pgoyette-localcount]: fss_component.c

Log Message:
When initializing the rump component, detach the [bc]devsw after
using the devmajors to create the device nodes.  Normal module
initialization will reattach them.

XXX This code sequence is fairly common, and probably should be
XXX extracted into a separate routine and/or macro.  But there's
XXX a lot of variables/parameters involved...


To generate a diff of this commit:
cvs rdiff -u -r1.93.2.5 -r1.93.2.6 src/sys/dev/fss.c
cvs rdiff -u -r1.2 -r1.2.2.1 src/sys/rump/dev/lib/libfss/fss_component.c

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



CVS commit: [pgoyette-localcount] src/tests/dev

2016-07-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 31 01:33:21 UTC 2016

Modified Files:
src/tests/dev [pgoyette-localcount]: Makefile

Log Message:
Descend into fss subdirectory


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.2.1 src/tests/dev/Makefile

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

Modified files:

Index: src/tests/dev/Makefile
diff -u src/tests/dev/Makefile:1.10 src/tests/dev/Makefile:1.10.2.1
--- src/tests/dev/Makefile:1.10	Tue Jan  5 17:22:38 2016
+++ src/tests/dev/Makefile	Sun Jul 31 01:33:21 2016
@@ -1,11 +1,11 @@
-#	$NetBSD: Makefile,v 1.10 2016/01/05 17:22:38 jakllsch Exp $
+#	$NetBSD: Makefile,v 1.10.2.1 2016/07/31 01:33:21 pgoyette Exp $
 #
 
 .include 
 
 TESTSDIR=	${TESTSBASE}/dev
 
-TESTS_SUBDIRS+=	cgd raidframe
+TESTS_SUBDIRS+=	cgd fss raidframe
 .if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE) 
 TESTS_SUBDIRS+=	audio md scsipi sysmon usb
 .endif



CVS commit: [pgoyette-localcount] src/tests/dev

2016-07-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 31 01:33:21 UTC 2016

Modified Files:
src/tests/dev [pgoyette-localcount]: Makefile

Log Message:
Descend into fss subdirectory


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.2.1 src/tests/dev/Makefile

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 31 01:32:00 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: ld.c

Log Message:
Use after initialization, not before


To generate a diff of this commit:
cvs rdiff -u -r1.94.2.4 -r1.94.2.5 src/sys/dev/ld.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/ld.c
diff -u src/sys/dev/ld.c:1.94.2.4 src/sys/dev/ld.c:1.94.2.5
--- src/sys/dev/ld.c:1.94.2.4	Wed Jul 27 01:13:50 2016
+++ src/sys/dev/ld.c	Sun Jul 31 01:32:00 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld.c,v 1.94.2.4 2016/07/27 01:13:50 pgoyette Exp $	*/
+/*	$NetBSD: ld.c,v 1.94.2.5 2016/07/31 01:32:00 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.94.2.4 2016/07/27 01:13:50 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.94.2.5 2016/07/31 01:32:00 pgoyette Exp $");
 
 #include 
 #include 
@@ -627,10 +627,11 @@ static void
 ld_config_interrupts(device_t d)
 {
 	struct ld_softc *sc;
-	struct dk_softc *dksc = >sc_dksc;
+	struct dk_softc *dksc;
 
 	device_acquire(d);
 	sc = device_private(d);
+	dksc = >sc_dksc;
 	dkwedge_discover(>sc_dkdev);
 	device_release(d);
 }
@@ -654,6 +655,7 @@ ld_discard(device_t dev, off_t pos, off_
 static int
 lddiscard(dev_t dev, off_t pos, off_t len)
 {
+	device_t self;
 	struct ld_softc *sc;
 	struct dk_softc *dksc;
 	int unit;



CVS commit: [pgoyette-localcount] src/etc/mtree

2016-07-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 31 01:28:52 UTC 2016

Modified Files:
src/etc/mtree [pgoyette-localcount]: NetBSD.dist.tests

Log Message:
Add directories for the fss(4) test


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.127.2.1 src/etc/mtree/NetBSD.dist.tests

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

Modified files:

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.127 src/etc/mtree/NetBSD.dist.tests:1.127.2.1
--- src/etc/mtree/NetBSD.dist.tests:1.127	Fri Apr 15 01:38:17 2016
+++ src/etc/mtree/NetBSD.dist.tests	Sun Jul 31 01:28:52 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.127 2016/04/15 01:38:17 ozaki-r Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.127.2.1 2016/07/31 01:28:52 pgoyette Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -17,6 +17,7 @@
 ./usr/libdata/debug/usr/tests/dev
 ./usr/libdata/debug/usr/tests/dev/audio
 ./usr/libdata/debug/usr/tests/dev/cgd
+./usr/libdata/debug/usr/tests/dev/fss
 ./usr/libdata/debug/usr/tests/dev/md
 ./usr/libdata/debug/usr/tests/dev/scsipi
 ./usr/libdata/debug/usr/tests/dev/sysmon
@@ -186,6 +187,7 @@
 ./usr/tests/dev
 ./usr/tests/dev/audio
 ./usr/tests/dev/cgd
+./usr/tests/dev/fss
 ./usr/tests/dev/md
 ./usr/tests/dev/raidframe
 ./usr/tests/dev/scsipi



CVS commit: [pgoyette-localcount] src/etc/mtree

2016-07-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 31 01:28:52 UTC 2016

Modified Files:
src/etc/mtree [pgoyette-localcount]: NetBSD.dist.tests

Log Message:
Add directories for the fss(4) test


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.127.2.1 src/etc/mtree/NetBSD.dist.tests

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



CVS commit: [pgoyette-localcount] src/distrib/sets/lists/tests

2016-07-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 31 01:28:02 UTC 2016

Modified Files:
src/distrib/sets/lists/tests [pgoyette-localcount]: mi

Log Message:
Add the fss(4) test


To generate a diff of this commit:
cvs rdiff -u -r1.678 -r1.678.2.1 src/distrib/sets/lists/tests/mi

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



CVS commit: [pgoyette-localcount] src/distrib/sets/lists/tests

2016-07-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 31 01:28:02 UTC 2016

Modified Files:
src/distrib/sets/lists/tests [pgoyette-localcount]: mi

Log Message:
Add the fss(4) test


To generate a diff of this commit:
cvs rdiff -u -r1.678 -r1.678.2.1 src/distrib/sets/lists/tests/mi

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.678 src/distrib/sets/lists/tests/mi:1.678.2.1
--- src/distrib/sets/lists/tests/mi:1.678	Wed Jul 13 15:58:37 2016
+++ src/distrib/sets/lists/tests/mi	Sun Jul 31 01:28:02 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.678 2016/07/13 15:58:37 matt Exp $
+# $NetBSD: mi,v 1.678.2.1 2016/07/31 01:28:02 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -25,6 +25,7 @@
 ./usr/libdata/debug/usr/tests/dev	tests-fs-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/dev/audio	tests-fs-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/dev/cgd	tests-fs-debug		compattestfile,atf
+./usr/libdata/debug/usr/tests/dev/fss	tests-fs-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/dev/cgd/h_img2cgdtests-obsolete		obsolete
 ./usr/libdata/debug/usr/tests/dev/md	tests-fs-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/dev/scsipitests-fs-debug		compattestfile,atf
@@ -1364,6 +1365,10 @@
 ./usr/tests/dev/cgd/h_img2cgd/h_img2cgd		tests-obsolete		obsolete
 ./usr/tests/dev/cgd/paramsfile			tests-fs-tests		compattestfile,atf
 ./usr/tests/dev/cgd/t_cgd			tests-fs-tests		compattestfile,atf
+./usr/tests/dev/fsstests-fs-tests		compattestfile,atf
+./usr/tests/dev/fss/Atffile			tests-fs-tests		compattestfile,atf
+./usr/tests/dev/fss/Kyuafile			tests-fs-tests		compattestfile,atf,kyua
+./usr/tests/dev/fss/t_fss			tests-fs-tests		compattestfile,atf
 ./usr/tests/dev/mdtests-fs-tests		compattestfile,atf
 ./usr/tests/dev/md/Atffile			tests-fs-tests		atf,rump
 ./usr/tests/dev/md/Kyuafile			tests-fs-tests		atf,rump,kyua



CVS commit: [pgoyette-localcount] src/tests/dev/fss

2016-07-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Jul 29 10:57:32 UTC 2016

Added Files:
src/tests/dev/fss [pgoyette-localcount]: Makefile t_fss.sh

Log Message:
Import the new fss(4) test here, too


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.2 src/tests/dev/fss/Makefile \
src/tests/dev/fss/t_fss.sh

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

Added files:

Index: src/tests/dev/fss/Makefile
diff -u /dev/null src/tests/dev/fss/Makefile:1.1.2.2
--- /dev/null	Fri Jul 29 10:57:32 2016
+++ src/tests/dev/fss/Makefile	Fri Jul 29 10:57:32 2016
@@ -0,0 +1,10 @@
+#	$NetBSD: Makefile,v 1.1.2.2 2016/07/29 10:57:32 pgoyette Exp $
+#
+
+.include 
+
+TESTSDIR=	${TESTSBASE}/dev/fss
+
+TESTS_SH=	t_fss
+
+.include 
Index: src/tests/dev/fss/t_fss.sh
diff -u /dev/null src/tests/dev/fss/t_fss.sh:1.1.2.2
--- /dev/null	Fri Jul 29 10:57:32 2016
+++ src/tests/dev/fss/t_fss.sh	Fri Jul 29 10:57:32 2016
@@ -0,0 +1,82 @@
+# $NetBSD: t_fss.sh,v 1.1.2.2 2016/07/29 10:57:32 pgoyette Exp $
+#
+# Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
+# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+#
+
+#
+# Verify basic operation of fss(4) file system snapshot device
+#
+
+orig_data="Original data"
+repl_data="Replacement data"
+
+atf_test_case basic cleanup
+basic_body() {
+
+# create of mount-points for the file system and snapshot
+
+	mkdir ./m1
+	mkdir ./m2
+
+# create a small 4MB file, treat it as a disk, init a file-system on it,
+# and mount it
+
+	dd if=/dev/zero of=./image bs=32k count=64
+	vndconfig -c vnd0 ./image
+	newfs /dev/vnd0a
+	mount /dev/vnd0a ./m1
+
+	echo "${orig_data}" > ./m1/text
+
+# configure and mount a snapshot of the file system
+
+	fssconfig -c fss0 ./m1 ./backup
+	mount /dev/fss0 ./m2
+
+# Modify the data on the underlying file system
+
+	echo "${repl_data}" > ./m1/text || abort
+
+# Verify that original data is still visible in the snapshot
+
+	read test_data < ./m2/text
+	atf_check_equal "${orig_data}" "${test_data}"
+
+# Unmount our temporary stuff
+
+	umount /dev/vnd0a	|| true
+	umount /dev/fss0	|| true
+}
+
+basic_cleanup() {
+	umount /dev/vnd0a	|| true
+	umount /dev/fss0	|| true
+	vndconfig -u vnd0	|| true
+	fssconfig -u fss0	|| true
+}
+
+atf_init_test_cases()
+{
+atf_add_test_case basic
+}



CVS commit: [pgoyette-localcount] src/tests/dev/fss

2016-07-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Jul 29 10:57:32 UTC 2016

Added Files:
src/tests/dev/fss [pgoyette-localcount]: Makefile t_fss.sh

Log Message:
Import the new fss(4) test here, too


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.2 src/tests/dev/fss/Makefile \
src/tests/dev/fss/t_fss.sh

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



CVS commit: [pgoyette-localcount] src/sys/kern

2016-07-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Jul 29 02:28:38 UTC 2016

Modified Files:
src/sys/kern [pgoyette-localcount]: tty_pty.c

Log Message:
Add module initializers in the pmax-specific copies of the [bc]devsw's


To generate a diff of this commit:
cvs rdiff -u -r1.142.2.6 -r1.142.2.7 src/sys/kern/tty_pty.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/tty_pty.c
diff -u src/sys/kern/tty_pty.c:1.142.2.6 src/sys/kern/tty_pty.c:1.142.2.7
--- src/sys/kern/tty_pty.c:1.142.2.6	Fri Jul 29 02:19:52 2016
+++ src/sys/kern/tty_pty.c	Fri Jul 29 02:28:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_pty.c,v 1.142.2.6 2016/07/29 02:19:52 pgoyette Exp $	*/
+/*	$NetBSD: tty_pty.c,v 1.142.2.7 2016/07/29 02:28:38 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.142.2.6 2016/07/29 02:19:52 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.142.2.7 2016/07/29 02:28:38 pgoyette Exp $");
 
 #include "opt_ptm.h"
 
@@ -151,6 +151,7 @@ const struct cdevsw pts_cdevsw = {
  */
 
 const struct cdevsw ptc_ultrix_cdevsw = {
+	DEVSW_MODULE_INIT
 	.d_open = ptcopen,
 	.d_close = ptcclose,
 	.d_read = ptcread,
@@ -166,6 +167,7 @@ const struct cdevsw ptc_ultrix_cdevsw = 
 };
 
 const struct cdevsw pts_ultrix_cdevsw = {
+	DEVSW_MODULE_INIT
 	.d_open = ptsopen,
 	.d_close = ptsclose,
 	.d_read = ptsread,



CVS commit: [pgoyette-localcount] src/sys/kern

2016-07-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Jul 29 02:28:38 UTC 2016

Modified Files:
src/sys/kern [pgoyette-localcount]: tty_pty.c

Log Message:
Add module initializers in the pmax-specific copies of the [bc]devsw's


To generate a diff of this commit:
cvs rdiff -u -r1.142.2.6 -r1.142.2.7 src/sys/kern/tty_pty.c

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



CVS commit: [pgoyette-localcount] src/sys/kern

2016-07-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Jul 29 02:19:52 UTC 2016

Modified Files:
src/sys/kern [pgoyette-localcount]: tty_pty.c

Log Message:
Add a note to revisit the locking for this device.


To generate a diff of this commit:
cvs rdiff -u -r1.142.2.5 -r1.142.2.6 src/sys/kern/tty_pty.c

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



CVS commit: [pgoyette-localcount] src/sys/kern

2016-07-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Jul 29 02:19:52 UTC 2016

Modified Files:
src/sys/kern [pgoyette-localcount]: tty_pty.c

Log Message:
Add a note to revisit the locking for this device.


To generate a diff of this commit:
cvs rdiff -u -r1.142.2.5 -r1.142.2.6 src/sys/kern/tty_pty.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/tty_pty.c
diff -u src/sys/kern/tty_pty.c:1.142.2.5 src/sys/kern/tty_pty.c:1.142.2.6
--- src/sys/kern/tty_pty.c:1.142.2.5	Fri Jul 29 01:49:39 2016
+++ src/sys/kern/tty_pty.c	Fri Jul 29 02:19:52 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_pty.c,v 1.142.2.5 2016/07/29 01:49:39 pgoyette Exp $	*/
+/*	$NetBSD: tty_pty.c,v 1.142.2.6 2016/07/29 02:19:52 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.142.2.5 2016/07/29 01:49:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.142.2.6 2016/07/29 02:19:52 pgoyette Exp $");
 
 #include "opt_ptm.h"
 
@@ -1046,6 +1046,12 @@ ptytty(dev_t dev)
 int
 ptyioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
 {
+/*
+ * XXX	We really should use device_lookup_acquire(...) to lock the
+ * XXX	device before fetching its softc pointer. Acquiring the
+ * XXX	cdevsw prevents the driver from being detached, but doesn't
+ * XXX	prevent the specific instance/unit from disappearing.
+ */
 	struct pt_softc *pti = pt_softc[minor(dev)];
 	struct tty *tp = pti->pt_tty;
 	const struct cdevsw *cdev;



CVS commit: [pgoyette-localcount] src/sys/kern

2016-07-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Jul 29 01:49:39 UTC 2016

Modified Files:
src/sys/kern [pgoyette-localcount]: tty_pty.c

Log Message:
Redo previous, restoring "return xxx;" in each case of the select.  This
gets the exit conditions back the way they were, and allows the atf test
kernel/t_pty to pass.


To generate a diff of this commit:
cvs rdiff -u -r1.142.2.4 -r1.142.2.5 src/sys/kern/tty_pty.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/tty_pty.c
diff -u src/sys/kern/tty_pty.c:1.142.2.4 src/sys/kern/tty_pty.c:1.142.2.5
--- src/sys/kern/tty_pty.c:1.142.2.4	Tue Jul 26 05:54:40 2016
+++ src/sys/kern/tty_pty.c	Fri Jul 29 01:49:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_pty.c,v 1.142.2.4 2016/07/26 05:54:40 pgoyette Exp $	*/
+/*	$NetBSD: tty_pty.c,v 1.142.2.5 2016/07/29 01:49:39 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.142.2.4 2016/07/26 05:54:40 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.142.2.5 2016/07/29 01:49:39 pgoyette Exp $");
 
 #include "opt_ptm.h"
 
@@ -1093,13 +1093,13 @@ ptyioctl(dev_t dev, u_long cmd, void *da
 
 	cdev = cdevsw_lookup_acquire(dev);
 	if (cdev != NULL && cdev->d_open == ptcopen) {
-		error = 0;
 		switch (cmd) {
 #ifndef NO_DEV_PTM
 		case TIOCGRANTPT:
 			if ((error = pty_getmp(l, )) == 0)
 error = pty_grant_slave(l, dev, mp);
-			break;
+			cdevsw_release(cdev);
+			return error;
 #endif
 
 		case TIOCGPGRP:
@@ -1108,7 +1108,8 @@ ptyioctl(dev_t dev, u_long cmd, void *da
 			 * in that case, tp must be the controlling terminal.
 			 */
 			*(int *)data = tp->t_pgrp ? tp->t_pgrp->pg_id : 0;
-			break;
+			cdevsw_release(cdev);
+			return 0;
 
 		case TIOCPKT:
 			if (*(int *)data) {
@@ -1117,7 +1118,8 @@ ptyioctl(dev_t dev, u_long cmd, void *da
 pti->pt_flags |= PF_PKT;
 			} else
 pti->pt_flags &= ~PF_PKT;
-			break;
+			cdevsw_release(cdev);
+			return 0;
 
 		case TIOCUCNTL:
 			if (*(int *)data) {
@@ -1126,7 +1128,8 @@ ptyioctl(dev_t dev, u_long cmd, void *da
 pti->pt_flags |= PF_UCNTL;
 			} else
 pti->pt_flags &= ~PF_UCNTL;
-			break;
+			cdevsw_release(cdev);
+			return 0;
 
 		case TIOCREMOTE:
 			if (*(int *)data)
@@ -1136,7 +1139,8 @@ ptyioctl(dev_t dev, u_long cmd, void *da
 			mutex_spin_enter(_lock);
 			ttyflush(tp, FREAD|FWRITE);
 			mutex_spin_exit(_lock);
-			break;
+			cdevsw_release(cdev);
+			return 0;
 
 		case TIOCSETP:
 		case TIOCSETN:
@@ -1147,7 +1151,6 @@ ptyioctl(dev_t dev, u_long cmd, void *da
 			mutex_spin_enter(_lock);
 			ndflush(>t_outq, tp->t_outq.c_cc);
 			mutex_spin_exit(_lock);
-			error = -1;
 			break;
 
 		case TIOCSIG:
@@ -1160,17 +1163,16 @@ ptyioctl(dev_t dev, u_long cmd, void *da
 			tp->t_state |= TS_SIGINFO;
 			ttysig(tp, TTYSIG_PG1, sig);
 			mutex_spin_exit(_lock);
-			break;
+			error = 0;
+			cdevsw_release(cdev);
+			return 0;
 
 		case FIONREAD:
 			mutex_spin_enter(_lock);
 			*(int *)data = tp->t_outq.c_cc;
 			mutex_spin_exit(_lock);
-			break;
-		}
-		if (error >= 0 ) {
 			cdevsw_release(cdev);
-			return error;
+			return 0;
 		}
 	}
 	error = (*tp->t_linesw->l_ioctl)(tp, cmd, data, flag, l);



CVS commit: [pgoyette-localcount] src/sys/kern

2016-07-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Jul 29 01:49:39 UTC 2016

Modified Files:
src/sys/kern [pgoyette-localcount]: tty_pty.c

Log Message:
Redo previous, restoring "return xxx;" in each case of the select.  This
gets the exit conditions back the way they were, and allows the atf test
kernel/t_pty to pass.


To generate a diff of this commit:
cvs rdiff -u -r1.142.2.4 -r1.142.2.5 src/sys/kern/tty_pty.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Jul 28 23:59:15 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: md.c

Log Message:
Since md(4) has a pointer from the softc back to the device_t, it is
OK for us to use device_lookup_private_acquire() rather than calling
device_lookup_acquire() followed by device_private().

So, redo earlier changes, which reduces diff to the original code at
the branch-point.


To generate a diff of this commit:
cvs rdiff -u -r1.76.2.5 -r1.76.2.6 src/sys/dev/md.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/md.c
diff -u src/sys/dev/md.c:1.76.2.5 src/sys/dev/md.c:1.76.2.6
--- src/sys/dev/md.c:1.76.2.5	Wed Jul 27 03:25:00 2016
+++ src/sys/dev/md.c	Thu Jul 28 23:59:15 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.76.2.5 2016/07/27 03:25:00 pgoyette Exp $	*/
+/*	$NetBSD: md.c,v 1.76.2.6 2016/07/28 23:59:15 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon W. Ross, Leo Weppelman.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.76.2.5 2016/07/27 03:25:00 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.76.2.6 2016/07/28 23:59:15 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_md.h"
@@ -243,14 +243,12 @@ static int	md_ioctl_kalloc(struct md_sof
 static int
 mdsize(dev_t dev)
 {
-	device_t self;
 	struct md_softc *sc;
 	int res;
 
-	self = device_lookup_acquire(_cd, MD_UNIT(dev));
-	if (self == NULL)
+	sc = device_lookup_private_acquire(_cd, MD_UNIT(dev));
+	if (sc == NULL)
 		return 0;
-	sc = device_private(self);
 
 	mutex_enter(>sc_lock);
 	if (sc->sc_type == MD_UNCONFIGURED)
@@ -259,14 +257,14 @@ mdsize(dev_t dev)
 		res = sc->sc_size >> DEV_BSHIFT;
 	mutex_exit(>sc_lock);
 
-	device_release(self);
+	device_release(sc->sc_dev);
 	return res;
 }
 
 static int
 mdopen(dev_t dev, int flag, int fmt, struct lwp *l)
 {
-	device_t self;
+	device_t self, new_self;
 	int unit;
 	int part = DISKPART(dev);
 	int pmask = 1 << part;
@@ -279,9 +277,8 @@ mdopen(dev_t dev, int flag, int fmt, str
 
 	mutex_enter(_device_lock);
 	unit = MD_UNIT(dev);
-	sc = NULL;
-	self = device_lookup_acquire(_cd, unit);
-	if (self == NULL) {
+	sc = device_lookup_private_acquire(_cd, unit);
+	if (sc == NULL) {
 		if (part != RAW_PART) {
 			mutex_exit(_device_lock);
 			return ENXIO;
@@ -291,19 +288,16 @@ mdopen(dev_t dev, int flag, int fmt, str
 		cf->cf_atname = md_cd.cd_name;
 		cf->cf_unit = unit;
 		cf->cf_fstate = FSTATE_STAR;
-		self = config_attach_pseudo(cf);
-		if (self != NULL) {
-			device_acquire(self);
-			sc = device_private(self);
-		}
+		new_self = config_attach_pseudo(cf);
+		self = device_lookup_acquire(_cd, unit);
+		KASSERT(self == new_self);
+		sc = device_private(self);
 		if (sc == NULL) {
 			mutex_exit(_device_lock);
-			device_release(self);
+			device_release(sc->sc_dev);
 			return ENOMEM;
 		}
 	}
-	else
-		sc = device_private(self);
 
 	dk = >sc_dkdev;
 
@@ -328,11 +322,11 @@ mdopen(dev_t dev, int flag, int fmt, str
 	 */
 	if (sc->sc_type == MD_UNCONFIGURED) {
 		mutex_exit(_device_lock);
-		device_release(self);
+		device_release(sc->sc_dev);
 		return ENXIO;
 	}
 
-ok:
+ ok:
 	/* XXX duplicates code in dk_open().  Call dk_open(), instead? */
 	mutex_enter(>dk_openlock);
 	/* Mark our unit as open. */
@@ -349,14 +343,13 @@ ok:
 
 	mutex_exit(>dk_openlock);
 	mutex_exit(_device_lock);
-	device_release(self);
+	device_release(sc->sc_dev);
 	return 0;
 }
 
 static int
 mdclose(dev_t dev, int flag, int fmt, struct lwp *l)
 {
-	device_t self;
 	int part = DISKPART(dev);
 	int pmask = 1 << part;
 	int error;
@@ -364,10 +357,9 @@ mdclose(dev_t dev, int flag, int fmt, st
 	struct md_softc *sc;
 	struct disk *dk;
 
-	self = device_lookup_acquire(_cd, MD_UNIT(dev));
-	if (self == NULL)
+	sc = device_lookup_private_acquire(_cd, MD_UNIT(dev));
+	if (sc == NULL)
 		return ENXIO;
-	sc = device_private(self);
 
 	dk = >sc_dkdev;
 
@@ -384,7 +376,7 @@ mdclose(dev_t dev, int flag, int fmt, st
 	dk->dk_openmask = dk->dk_copenmask | dk->dk_bopenmask;
 	if (dk->dk_openmask != 0) {
 		mutex_exit(>dk_openlock);
-		device_release(self);
+		device_release(sc->sc_dev);
 		return 0;
 	}
 
@@ -396,52 +388,48 @@ mdclose(dev_t dev, int flag, int fmt, st
 	if (! error)
 		free(cf, M_DEVBUF);
 	mutex_exit(_device_lock);
-	device_release(self);
+	if (error)
+		device_release(sc->sc_dev);
 	return error;
 }
 
 static int
 mdread(dev_t dev, struct uio *uio, int flags)
 {
-	device_t self;
 	struct md_softc *sc;
 	int error;
 
-	self = device_lookup_acquire(_cd, MD_UNIT(dev));
-	if (self == NULL)
-		return ENXIO;
+	sc = device_lookup_private_acquire(_cd, MD_UNIT(dev));
 
-	sc = device_private(self);
 	if (sc == NULL || sc->sc_type == MD_UNCONFIGURED) {
-		device_release(self);
+		if (sc != NULL)
+			device_release(sc->sc_dev);
 		return ENXIO;
 	}
 
 	error = (physio(mdstrategy, NULL, dev, B_READ, minphys, uio));
-	

CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Jul 28 23:59:15 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: md.c

Log Message:
Since md(4) has a pointer from the softc back to the device_t, it is
OK for us to use device_lookup_private_acquire() rather than calling
device_lookup_acquire() followed by device_private().

So, redo earlier changes, which reduces diff to the original code at
the branch-point.


To generate a diff of this commit:
cvs rdiff -u -r1.76.2.5 -r1.76.2.6 src/sys/dev/md.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Jul 28 06:45:32 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: cgd.c

Log Message:
Remove duplicated code (cut-and-paste error)


To generate a diff of this commit:
cvs rdiff -u -r1.108.2.16 -r1.108.2.17 src/sys/dev/cgd.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/cgd.c
diff -u src/sys/dev/cgd.c:1.108.2.16 src/sys/dev/cgd.c:1.108.2.17
--- src/sys/dev/cgd.c:1.108.2.16	Tue Jul 26 05:54:39 2016
+++ src/sys/dev/cgd.c	Thu Jul 28 06:45:32 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.108.2.16 2016/07/26 05:54:39 pgoyette Exp $ */
+/* $NetBSD: cgd.c,v 1.108.2.17 2016/07/28 06:45:32 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.108.2.16 2016/07/26 05:54:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.108.2.17 2016/07/28 06:45:32 pgoyette Exp $");
 
 #include 
 #include 
@@ -1157,12 +1157,6 @@ cgd_modcmd(modcmd_t cmd, void *arg)
 		_cdevsw, _cmajor);
 
 		/*
-		 * Attach the {b,c}devsw's
-		 */
-		error = devsw_attach("cgd", _bdevsw, _bmajor,
-		_cdevsw, _cmajor);
-
-		/*
 		 * If devsw_attach fails, remove from autoconf database
 		 */
 		if (error) {



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Jul 28 06:45:32 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: cgd.c

Log Message:
Remove duplicated code (cut-and-paste error)


To generate a diff of this commit:
cvs rdiff -u -r1.108.2.16 -r1.108.2.17 src/sys/dev/cgd.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Jul 28 01:44:56 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: vnd.c

Log Message:
Don't try to call device_release() if we succesfully called vnd_destroy()


To generate a diff of this commit:
cvs rdiff -u -r1.256.2.11 -r1.256.2.12 src/sys/dev/vnd.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/vnd.c
diff -u src/sys/dev/vnd.c:1.256.2.11 src/sys/dev/vnd.c:1.256.2.12
--- src/sys/dev/vnd.c:1.256.2.11	Thu Jul 28 01:07:20 2016
+++ src/sys/dev/vnd.c	Thu Jul 28 01:44:55 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.256.2.11 2016/07/28 01:07:20 pgoyette Exp $	*/
+/*	$NetBSD: vnd.c,v 1.256.2.12 2016/07/28 01:44:55 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.11 2016/07/28 01:07:20 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.12 2016/07/28 01:44:55 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -500,8 +500,8 @@ vndclose(dev_t dev, int flags, int mode,
 			aprint_error_dev(sc->sc_dev,
 			"unable to detach instance\n");
 			device_release(self);
-			return error;
 		}
+		return error;
 	}
 
 	device_release(self);



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Jul 28 01:44:56 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: vnd.c

Log Message:
Don't try to call device_release() if we succesfully called vnd_destroy()


To generate a diff of this commit:
cvs rdiff -u -r1.256.2.11 -r1.256.2.12 src/sys/dev/vnd.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Jul 28 01:07:20 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: vnd.c

Log Message:
Clean up the vnd_spawn() routine so it actually works.  In particular,
it needs to return the new unit's sc _after_ acquiring a reference to
the unit.


To generate a diff of this commit:
cvs rdiff -u -r1.256.2.10 -r1.256.2.11 src/sys/dev/vnd.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/vnd.c
diff -u src/sys/dev/vnd.c:1.256.2.10 src/sys/dev/vnd.c:1.256.2.11
--- src/sys/dev/vnd.c:1.256.2.10	Wed Jul 27 23:17:31 2016
+++ src/sys/dev/vnd.c	Thu Jul 28 01:07:20 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.256.2.10 2016/07/27 23:17:31 pgoyette Exp $	*/
+/*	$NetBSD: vnd.c,v 1.256.2.11 2016/07/28 01:07:20 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.10 2016/07/27 23:17:31 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.11 2016/07/28 01:07:20 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -311,12 +311,10 @@ vnd_spawn(int unit)
 	cf->cf_unit = unit;
 	cf->cf_fstate = FSTATE_STAR;
 
+	/* Attach a new unit */
 	self = config_attach_pseudo(cf);
-	return device_private(config_attach_pseudo(cf));
-
-	if (config_attach_pseudo(cf) == NULL)
-		return NULL;
 
+	/* And acquire a reference to it */
 	self = device_lookup_acquire(_cd, unit);
 	if (self == NULL)
 		return NULL;



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Jul 28 01:07:20 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: vnd.c

Log Message:
Clean up the vnd_spawn() routine so it actually works.  In particular,
it needs to return the new unit's sc _after_ acquiring a reference to
the unit.


To generate a diff of this commit:
cvs rdiff -u -r1.256.2.10 -r1.256.2.11 src/sys/dev/vnd.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Jul 27 23:17:31 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: vnd.c

Log Message:
Return ENXIO if the device is NOT found, not when the device IS found!


To generate a diff of this commit:
cvs rdiff -u -r1.256.2.9 -r1.256.2.10 src/sys/dev/vnd.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Jul 27 23:17:31 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: vnd.c

Log Message:
Return ENXIO if the device is NOT found, not when the device IS found!


To generate a diff of this commit:
cvs rdiff -u -r1.256.2.9 -r1.256.2.10 src/sys/dev/vnd.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/vnd.c
diff -u src/sys/dev/vnd.c:1.256.2.9 src/sys/dev/vnd.c:1.256.2.10
--- src/sys/dev/vnd.c:1.256.2.9	Wed Jul 27 11:51:57 2016
+++ src/sys/dev/vnd.c	Wed Jul 27 23:17:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.256.2.9 2016/07/27 11:51:57 pgoyette Exp $	*/
+/*	$NetBSD: vnd.c,v 1.256.2.10 2016/07/27 23:17:31 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.9 2016/07/27 11:51:57 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.10 2016/07/27 23:17:31 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -1241,7 +1241,7 @@ vndioctl(dev_t dev, u_long cmd, void *da
 	}
 
 	self = device_lookup_acquire(_cd, unit);
-	if (self != NULL)
+	if (self == NULL)
 		return ENXIO;
 	vnd = device_private(self);
 



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Jul 27 11:51:57 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: vnd.c

Log Message:
When detaching, call device_release() to allow the detach to complete.


To generate a diff of this commit:
cvs rdiff -u -r1.256.2.8 -r1.256.2.9 src/sys/dev/vnd.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/vnd.c
diff -u src/sys/dev/vnd.c:1.256.2.8 src/sys/dev/vnd.c:1.256.2.9
--- src/sys/dev/vnd.c:1.256.2.8	Wed Jul 27 11:23:32 2016
+++ src/sys/dev/vnd.c	Wed Jul 27 11:51:57 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.256.2.8 2016/07/27 11:23:32 pgoyette Exp $	*/
+/*	$NetBSD: vnd.c,v 1.256.2.9 2016/07/27 11:51:57 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.8 2016/07/27 11:23:32 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.9 2016/07/27 11:51:57 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -275,6 +275,10 @@ vnd_attach(device_t parent, device_t sel
 		aprint_error_dev(self, "couldn't establish power handler\n");
 }
 
+/*
+ * The caller must hold a reference to the device's localcount.  the
+ * reference is released if the device is available for detach.
+ */
 static int
 vnd_detach(device_t self, int flags)
 {
@@ -291,6 +295,7 @@ vnd_detach(device_t self, int flags)
 	bufq_free(sc->sc_tab);
 	disk_destroy(>sc_dkdev);
 
+	device_release(self);
 	return 0;
 }
 



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Jul 27 11:51:57 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: vnd.c

Log Message:
When detaching, call device_release() to allow the detach to complete.


To generate a diff of this commit:
cvs rdiff -u -r1.256.2.8 -r1.256.2.9 src/sys/dev/vnd.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Jul 27 11:23:32 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: vnd.c

Log Message:
When we spawn a new unit, make sure we get a pointer to its device_t so
we have something to give device_release() when we're finished!

Also, add a call to device_release() in an error path.


To generate a diff of this commit:
cvs rdiff -u -r1.256.2.7 -r1.256.2.8 src/sys/dev/vnd.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Jul 27 11:23:32 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: vnd.c

Log Message:
When we spawn a new unit, make sure we get a pointer to its device_t so
we have something to give device_release() when we're finished!

Also, add a call to device_release() in an error path.


To generate a diff of this commit:
cvs rdiff -u -r1.256.2.7 -r1.256.2.8 src/sys/dev/vnd.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/vnd.c
diff -u src/sys/dev/vnd.c:1.256.2.7 src/sys/dev/vnd.c:1.256.2.8
--- src/sys/dev/vnd.c:1.256.2.7	Tue Jul 26 05:54:39 2016
+++ src/sys/dev/vnd.c	Wed Jul 27 11:23:32 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.256.2.7 2016/07/26 05:54:39 pgoyette Exp $	*/
+/*	$NetBSD: vnd.c,v 1.256.2.8 2016/07/27 11:23:32 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.7 2016/07/26 05:54:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.8 2016/07/27 11:23:32 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -359,12 +359,21 @@ vndopen(dev_t dev, int flags, int mode, 
 		if (sc == NULL)
 			return ENOMEM;
 
+		/*
+		 * get a pointer to the new device_t;  we don't need
+		 * need to _acquire() it, since vnd_spawn() will
+		 * already have taken a reference.
+		 */
+		self = device_lookup(_cd, unit);
+
 		/* compatibility, keep disklabel after close */
 		sc->sc_flags = VNF_KLABEL;
 	}
 
-	if ((error = vndlock(sc)) != 0)
+	if ((error = vndlock(sc)) != 0) {
+		device_release(self);
 		return error;
+	}
 
 	mutex_enter(>sc_dkdev.dk_openlock);
 



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Jul 27 03:25:00 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: fss.c md.c

Log Message:
Repair the inevitable tyops in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.93.2.4 -r1.93.2.5 src/sys/dev/fss.c
cvs rdiff -u -r1.76.2.4 -r1.76.2.5 src/sys/dev/md.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/fss.c
diff -u src/sys/dev/fss.c:1.93.2.4 src/sys/dev/fss.c:1.93.2.5
--- src/sys/dev/fss.c:1.93.2.4	Wed Jul 27 01:13:50 2016
+++ src/sys/dev/fss.c	Wed Jul 27 03:25:00 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fss.c,v 1.93.2.4 2016/07/27 01:13:50 pgoyette Exp $	*/
+/*	$NetBSD: fss.c,v 1.93.2.5 2016/07/27 03:25:00 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.93.2.4 2016/07/27 01:13:50 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.93.2.5 2016/07/27 03:25:00 pgoyette Exp $");
 
 #include 
 #include 
@@ -225,7 +225,7 @@ fss_open(dev_t dev, int flags, int mode,
 		cf->cf_atname = fss_cd.cd_name;
 		cf->cf_unit = minor(dev);
 		cf->cf_fstate = FSTATE_STAR;
-		self = config_attach_pseudo(cf));
+		self = config_attach_pseudo(cf);
 		device_acquire(self);
 		sc = device_private(self);
 		if (sc == NULL) {
@@ -242,7 +242,7 @@ fss_open(dev_t dev, int flags, int mode,
 	mutex_exit(>sc_slock);
 	mutex_exit(_device_lock);
 
-	device_release(sc);
+	device_release(self);
 	return 0;
 }
 

Index: src/sys/dev/md.c
diff -u src/sys/dev/md.c:1.76.2.4 src/sys/dev/md.c:1.76.2.5
--- src/sys/dev/md.c:1.76.2.4	Wed Jul 27 01:13:50 2016
+++ src/sys/dev/md.c	Wed Jul 27 03:25:00 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.76.2.4 2016/07/27 01:13:50 pgoyette Exp $	*/
+/*	$NetBSD: md.c,v 1.76.2.5 2016/07/27 03:25:00 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon W. Ross, Leo Weppelman.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.76.2.4 2016/07/27 01:13:50 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.76.2.5 2016/07/27 03:25:00 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_md.h"
@@ -291,7 +291,7 @@ mdopen(dev_t dev, int flag, int fmt, str
 		cf->cf_atname = md_cd.cd_name;
 		cf->cf_unit = unit;
 		cf->cf_fstate = FSTATE_STAR;
-		self = config_attach_pseudo(cf));
+		self = config_attach_pseudo(cf);
 		if (self != NULL) {
 			device_acquire(self);
 			sc = device_private(self);
@@ -465,7 +465,7 @@ mdstrategy(struct buf *bp)
 	}
 
 	sc = device_private(self);
-	if (sc == NULL || sc->sc_type == MD_UNCONFIGURED) {
+	if (sc->sc_type == MD_UNCONFIGURED) {
 		bp->b_error = ENXIO;
 		goto done;
 	}
@@ -515,11 +515,11 @@ mdstrategy(struct buf *bp)
 		break;
 	}
 
- done:
 	mutex_exit(>sc_lock);
-
+ done:
 	biodone(bp);
-	device_release(self);
+	if (self != NULL)
+		device_release(self);
 }
 
 static int



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Jul 27 03:25:00 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: fss.c md.c

Log Message:
Repair the inevitable tyops in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.93.2.4 -r1.93.2.5 src/sys/dev/fss.c
cvs rdiff -u -r1.76.2.4 -r1.76.2.5 src/sys/dev/md.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Jul 27 01:13:50 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: fss.c ld.c md.c

Log Message:
Update a few more drivers for localcount(9)


To generate a diff of this commit:
cvs rdiff -u -r1.93.2.3 -r1.93.2.4 src/sys/dev/fss.c
cvs rdiff -u -r1.94.2.3 -r1.94.2.4 src/sys/dev/ld.c
cvs rdiff -u -r1.76.2.3 -r1.76.2.4 src/sys/dev/md.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/fss.c
diff -u src/sys/dev/fss.c:1.93.2.3 src/sys/dev/fss.c:1.93.2.4
--- src/sys/dev/fss.c:1.93.2.3	Tue Jul 26 05:54:39 2016
+++ src/sys/dev/fss.c	Wed Jul 27 01:13:50 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fss.c,v 1.93.2.3 2016/07/26 05:54:39 pgoyette Exp $	*/
+/*	$NetBSD: fss.c,v 1.93.2.4 2016/07/27 01:13:50 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.93.2.3 2016/07/26 05:54:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.93.2.4 2016/07/27 01:13:50 pgoyette Exp $");
 
 #include 
 #include 
@@ -172,6 +172,10 @@ fss_attach(device_t parent, device_t sel
 		vfs_hooks_attach(_vfs_hooks);
 }
 
+/*
+ * Caller must hold a reference to the device's localcount.  The
+ * reference is released upon successful exit.
+ */
 static int
 fss_detach(device_t self, int flags)
 {
@@ -193,12 +197,14 @@ fss_detach(device_t self, int flags)
 	disk_destroy(sc->sc_dkdev);
 	free(sc->sc_dkdev, M_DEVBUF);
 
+	device_release(self);
 	return 0;
 }
 
 int
 fss_open(dev_t dev, int flags, int mode, struct lwp *l)
 {
+	device_t self;
 	int mflag;
 	cfdata_t cf;
 	struct fss_softc *sc;
@@ -207,15 +213,23 @@ fss_open(dev_t dev, int flags, int mode,
 
 	mutex_enter(_device_lock);
 
-	sc = device_lookup_private(_cd, minor(dev));
+	self = device_lookup_acquire(_cd, minor(dev));
+	if (self == NULL)
+		sc = NULL;
+	else
+		sc = device_private(self);
+
 	if (sc == NULL) {
 		cf = malloc(sizeof(*cf), M_DEVBUF, M_WAITOK);
 		cf->cf_name = fss_cd.cd_name;
 		cf->cf_atname = fss_cd.cd_name;
 		cf->cf_unit = minor(dev);
 		cf->cf_fstate = FSTATE_STAR;
-		sc = device_private(config_attach_pseudo(cf));
+		self = config_attach_pseudo(cf));
+		device_acquire(self);
+		sc = device_private(self);
 		if (sc == NULL) {
+			device_release(self);
 			mutex_exit(_device_lock);
 			return ENOMEM;
 		}
@@ -228,15 +242,17 @@ fss_open(dev_t dev, int flags, int mode,
 	mutex_exit(>sc_slock);
 	mutex_exit(_device_lock);
 
+	device_release(sc);
 	return 0;
 }
 
 int
 fss_close(dev_t dev, int flags, int mode, struct lwp *l)
 {
+	device_t self = device_lookup_acquire(_cd, minor(dev));
 	int mflag, error;
 	cfdata_t cf;
-	struct fss_softc *sc = device_lookup_private(_cd, minor(dev));
+	struct fss_softc *sc = device_private(self);
 
 	mflag = (mode == S_IFCHR ? FSS_CDEV_OPEN : FSS_BDEV_OPEN);
 	error = 0;
@@ -248,6 +264,7 @@ restart:
 		sc->sc_flags &= ~mflag;
 		mutex_exit(>sc_slock);
 		mutex_exit(_device_lock);
+		device_release(self);
 		return 0;
 	}
 	if ((sc->sc_flags & FSS_ACTIVE) != 0 &&
@@ -260,6 +277,7 @@ restart:
 	if ((sc->sc_flags & FSS_ACTIVE) != 0) {
 		mutex_exit(>sc_slock);
 		mutex_exit(_device_lock);
+		device_release(self);
 		return error;
 	}
 
@@ -272,14 +290,16 @@ restart:
 		free(cf, M_DEVBUF);
 	mutex_exit(_device_lock);
 
+	/* device_release() was called by fss_detach() from config_detach() */
 	return error;
 }
 
 void
 fss_strategy(struct buf *bp)
 {
+	device_t self = device_lookup_acquire(_cd, minor(bp->b_dev));;
 	const bool write = ((bp->b_flags & B_READ) != B_READ);
-	struct fss_softc *sc = device_lookup_private(_cd, minor(bp->b_dev));
+	struct fss_softc *sc = device_private(self);
 
 	mutex_enter(>sc_slock);
 
@@ -290,6 +310,7 @@ fss_strategy(struct buf *bp)
 		bp->b_error = (write ? EROFS : ENXIO);
 		bp->b_resid = bp->b_bcount;
 		biodone(bp);
+		device_release(self);
 		return;
 	}
 
@@ -298,6 +319,7 @@ fss_strategy(struct buf *bp)
 	cv_signal(>sc_work_cv);
 
 	mutex_exit(>sc_slock);
+	device_release(self);
 }
 
 int
@@ -315,8 +337,9 @@ fss_write(dev_t dev, struct uio *uio, in
 int
 fss_ioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
 {
+	device_t self = device_lookup_acquire(_cd, minor(dev));
 	int error;
-	struct fss_softc *sc = device_lookup_private(_cd, minor(dev));
+	struct fss_softc *sc = device_private(self);
 	struct fss_set _fss;
 	struct fss_set *fss = (struct fss_set *)data;
 	struct fss_set50 *fss50 = (struct fss_set50 *)data;
@@ -430,6 +453,7 @@ fss_ioctl(dev_t dev, u_long cmd, void *d
 		break;
 	}
 
+	device_release(self);
 	return error;
 }
 
@@ -570,18 +594,22 @@ fss_softc_free(struct fss_softc *sc)
 static void
 fss_unmount_hook(struct mount *mp)
 {
+	device_t self;
 	int i;
 	struct fss_softc *sc;
 
 	mutex_enter(_device_lock);
 	for (i = 0; i < fss_cd.cd_ndevs; i++) {
-		if ((sc = device_lookup_private(_cd, i)) == NULL)
+		self = 

CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Jul 27 01:13:50 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: fss.c ld.c md.c

Log Message:
Update a few more drivers for localcount(9)


To generate a diff of this commit:
cvs rdiff -u -r1.93.2.3 -r1.93.2.4 src/sys/dev/fss.c
cvs rdiff -u -r1.94.2.3 -r1.94.2.4 src/sys/dev/ld.c
cvs rdiff -u -r1.76.2.3 -r1.76.2.4 src/sys/dev/md.c

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



CVS commit: [pgoyette-localcount] src/sys/dev/acpi

2016-07-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 07:44:21 UTC 2016

Modified Files:
src/sys/dev/acpi [pgoyette-localcount]: pckbc_acpi.c

Log Message:
Fix conversion to device_lookup_acquire()


To generate a diff of this commit:
cvs rdiff -u -r1.34.10.1 -r1.34.10.2 src/sys/dev/acpi/pckbc_acpi.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/acpi/pckbc_acpi.c
diff -u src/sys/dev/acpi/pckbc_acpi.c:1.34.10.1 src/sys/dev/acpi/pckbc_acpi.c:1.34.10.2
--- src/sys/dev/acpi/pckbc_acpi.c:1.34.10.1	Tue Jul 26 03:24:20 2016
+++ src/sys/dev/acpi/pckbc_acpi.c	Tue Jul 26 07:44:21 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pckbc_acpi.c,v 1.34.10.1 2016/07/26 03:24:20 pgoyette Exp $	*/
+/*	$NetBSD: pckbc_acpi.c,v 1.34.10.2 2016/07/26 07:44:21 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pckbc_acpi.c,v 1.34.10.1 2016/07/26 03:24:20 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbc_acpi.c,v 1.34.10.2 2016/07/26 07:44:21 pgoyette Exp $");
 
 #include 
 #include 
@@ -234,7 +234,7 @@ out:
 static void
 pckbc_acpi_intr_establish(struct pckbc_softc *sc, pckbc_slot_t slot)
 {
-	device_t self;
+	device_t self = NULL;
 	struct pckbc_acpi_softc *psc;
 	isa_chipset_tag_t ic = NULL;
 	void *rv = NULL;
@@ -245,7 +245,11 @@ pckbc_acpi_intr_establish(struct pckbc_s
 	 * Note we're always called with sc == first.
 	 */
 	for (i = 0; i < pckbc_cd.cd_ndevs; i++) {
-		psc = device_lookup_private_acquire(_cd, i, );
+		self = device_lookup_acquire(_cd, i);
+		if (self == NULL)
+			psc = NULL;
+		else
+			psc = device_private(self);
 		if (psc && psc->sc_slot == slot) {
 			irq = psc->sc_irq;
 			ist = psc->sc_ist;
@@ -263,7 +267,8 @@ pckbc_acpi_intr_establish(struct pckbc_s
 		aprint_normal_dev(sc->sc_dv, "using irq %d for %s slot\n",
 		irq, pckbc_slot_names[slot]);
 	}
-	device_release(self);
+	if (self != NULL)
+		device_release(self);
 }
 
 static void



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 07:44:44 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: video.c

Log Message:
Typo


To generate a diff of this commit:
cvs rdiff -u -r1.32.8.1 -r1.32.8.2 src/sys/dev/video.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 07:44:44 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: video.c

Log Message:
Typo


To generate a diff of this commit:
cvs rdiff -u -r1.32.8.1 -r1.32.8.2 src/sys/dev/video.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/video.c
diff -u src/sys/dev/video.c:1.32.8.1 src/sys/dev/video.c:1.32.8.2
--- src/sys/dev/video.c:1.32.8.1	Tue Jul 26 03:24:20 2016
+++ src/sys/dev/video.c	Tue Jul 26 07:44:44 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: video.c,v 1.32.8.1 2016/07/26 03:24:20 pgoyette Exp $ */
+/* $NetBSD: video.c,v 1.32.8.2 2016/07/26 07:44:44 pgoyette Exp $ */
 
 /*
  * Copyright (c) 2008 Patrick Mahoney 
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: video.c,v 1.32.8.1 2016/07/26 03:24:20 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: video.c,v 1.32.8.2 2016/07/26 07:44:44 pgoyette Exp $");
 
 #include "video.h"
 #if NVIDEO > 0
@@ -1630,7 +1630,7 @@ videoopen(dev_t dev, int flags, int ifmt
 		 flags, sc, sc->hw_dev));
 
 	hw = sc->hw_if;
-	if (hw == NULL) [
+	if (hw == NULL) {
 		device_release(sc->sc_dev);
 		return ENXIO;
 	}



CVS commit: [pgoyette-localcount] src/sys/dev/acpi

2016-07-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 07:44:21 UTC 2016

Modified Files:
src/sys/dev/acpi [pgoyette-localcount]: pckbc_acpi.c

Log Message:
Fix conversion to device_lookup_acquire()


To generate a diff of this commit:
cvs rdiff -u -r1.34.10.1 -r1.34.10.2 src/sys/dev/acpi/pckbc_acpi.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 07:42:40 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: midi.c

Log Message:
Fix botched edit.


To generate a diff of this commit:
cvs rdiff -u -r1.85.2.1 -r1.85.2.2 src/sys/dev/midi.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/midi.c
diff -u src/sys/dev/midi.c:1.85.2.1 src/sys/dev/midi.c:1.85.2.2
--- src/sys/dev/midi.c:1.85.2.1	Tue Jul 26 03:24:20 2016
+++ src/sys/dev/midi.c	Tue Jul 26 07:42:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: midi.c,v 1.85.2.1 2016/07/26 03:24:20 pgoyette Exp $	*/
+/*	$NetBSD: midi.c,v 1.85.2.2 2016/07/26 07:42:39 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: midi.c,v 1.85.2.1 2016/07/26 03:24:20 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: midi.c,v 1.85.2.2 2016/07/26 07:42:39 pgoyette Exp $");
 
 #include "midi.h"
 #include "sequencer.h"
@@ -1598,9 +1598,8 @@ out:
 int
 midi_writebytes(int unit, u_char *bf, int cc)
 {
-	device_t self = device_lookup_acquire(_cd, MIDIUNIT(dev));
+	device_t self = device_lookup_acquire(_cd, unit);
 	struct midi_softc *sc;
-	device_lookup_private_acquire(_cd, unit, );
 	int error;
 
 	if (self == NULL)



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 07:42:40 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: midi.c

Log Message:
Fix botched edit.


To generate a diff of this commit:
cvs rdiff -u -r1.85.2.1 -r1.85.2.2 src/sys/dev/midi.c

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



CVS commit: [pgoyette-localcount] src/external/cddl/osnet

2016-07-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 06:17:26 UTC 2016

Modified Files:
src/external/cddl/osnet/dev/fbt [pgoyette-localcount]: fbt.c
src/external/cddl/osnet/dev/sdt [pgoyette-localcount]: sdt.c
src/external/cddl/osnet/dist/uts/common/dtrace [pgoyette-localcount]:
dtrace.c
src/external/cddl/osnet/dist/uts/common/fs/zfs [pgoyette-localcount]:
zfs_ioctl.c

Log Message:
More renaming of LOCALCOUNT_INITIALIZER --> DEVSW_MODULE_INIT


To generate a diff of this commit:
cvs rdiff -u -r1.18.2.4 -r1.18.2.5 src/external/cddl/osnet/dev/fbt/fbt.c
cvs rdiff -u -r1.16.2.4 -r1.16.2.5 src/external/cddl/osnet/dev/sdt/sdt.c
cvs rdiff -u -r1.32.2.4 -r1.32.2.5 \
src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c
cvs rdiff -u -r1.10.2.2 -r1.10.2.3 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c

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



CVS commit: [pgoyette-localcount] src/external/cddl/osnet

2016-07-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 06:17:26 UTC 2016

Modified Files:
src/external/cddl/osnet/dev/fbt [pgoyette-localcount]: fbt.c
src/external/cddl/osnet/dev/sdt [pgoyette-localcount]: sdt.c
src/external/cddl/osnet/dist/uts/common/dtrace [pgoyette-localcount]:
dtrace.c
src/external/cddl/osnet/dist/uts/common/fs/zfs [pgoyette-localcount]:
zfs_ioctl.c

Log Message:
More renaming of LOCALCOUNT_INITIALIZER --> DEVSW_MODULE_INIT


To generate a diff of this commit:
cvs rdiff -u -r1.18.2.4 -r1.18.2.5 src/external/cddl/osnet/dev/fbt/fbt.c
cvs rdiff -u -r1.16.2.4 -r1.16.2.5 src/external/cddl/osnet/dev/sdt/sdt.c
cvs rdiff -u -r1.32.2.4 -r1.32.2.5 \
src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c
cvs rdiff -u -r1.10.2.2 -r1.10.2.3 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.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/dev/fbt/fbt.c
diff -u src/external/cddl/osnet/dev/fbt/fbt.c:1.18.2.4 src/external/cddl/osnet/dev/fbt/fbt.c:1.18.2.5
--- src/external/cddl/osnet/dev/fbt/fbt.c:1.18.2.4	Tue Jul 19 06:27:00 2016
+++ src/external/cddl/osnet/dev/fbt/fbt.c	Tue Jul 26 06:17:26 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fbt.c,v 1.18.2.4 2016/07/19 06:27:00 pgoyette Exp $	*/
+/*	$NetBSD: fbt.c,v 1.18.2.5 2016/07/26 06:17:26 pgoyette Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -153,7 +153,7 @@ static void	fbt_resume(void *, dtrace_id
 #define	FBT_PROBETAB_SIZE	0x8000		/* 32k entries -- 128K total */
 
 static const struct cdevsw fbt_cdevsw = {
-	LOCALCOUNT_INITIALIZER
+	DEVSW_MODULE_INIT
 	.d_open		= fbt_open,
 	.d_close	= noclose,
 	.d_read		= noread,

Index: src/external/cddl/osnet/dev/sdt/sdt.c
diff -u src/external/cddl/osnet/dev/sdt/sdt.c:1.16.2.4 src/external/cddl/osnet/dev/sdt/sdt.c:1.16.2.5
--- src/external/cddl/osnet/dev/sdt/sdt.c:1.16.2.4	Tue Jul 19 06:27:00 2016
+++ src/external/cddl/osnet/dev/sdt/sdt.c	Tue Jul 26 06:17:26 2016
@@ -39,7 +39,7 @@
  * unloaded; in particular, probes may not span multiple kernel modules.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.16.2.4 2016/07/19 06:27:00 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.16.2.5 2016/07/26 06:17:26 pgoyette Exp $");
 
 #include 
 #include 
@@ -120,7 +120,7 @@ sdt_open(dev_t dev, int flags, int mode,
 }
 
 static const struct cdevsw sdt_cdevsw = {
-	LOCALCOUNT_INITIALIZER
+	DEVSW_MODULE_INIT
 	.d_open		= sdt_open,
 	.d_close	= noclose,
 	.d_read		= noread,

Index: src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c
diff -u src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.32.2.4 src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.32.2.5
--- src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.32.2.4	Tue Jul 19 06:27:01 2016
+++ src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c	Tue Jul 26 06:17:26 2016
@@ -15340,7 +15340,7 @@ static dev_type_open(dtrace_open);
 /* Just opens, clones to the fileops below */
 
 const struct cdevsw dtrace_cdevsw = {
-	LOCALCOUNT_INITIALIZER
+	DEVSW_MODULE_INIT
 	.d_open		= dtrace_open,
 	.d_close	= noclose,
 	.d_read		= noread,

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.10.2.2 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.10.2.3
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.10.2.2	Tue Jul 19 06:27:01 2016
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c	Tue Jul 26 06:17:26 2016
@@ -4564,7 +4564,7 @@ nb_zfsdev_ioctl(dev_t dev, u_long cmd, v
 }
 
 const struct bdevsw zfs_bdevsw = {
-	LOCALCOUNT_INITIALIZER
+	DEVSW_MODULE_INIT
 	.d_open = nb_zvol_bopen,
 	.d_close = nb_zvol_bclose,
 	.d_strategy = zvol_strategy,
@@ -4575,7 +4575,7 @@ const struct bdevsw zfs_bdevsw = {
 };
 
 const struct cdevsw zfs_cdevsw = {
-	LOCALCOUNT_INITIALIZER
+	DEVSW_MODULE_INIT
 	.d_open = nb_zvol_copen,
 	.d_close = nb_zvol_cclose,
 	.d_read = nb_zvol_read,



CVS commit: [pgoyette-localcount] src/sys

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 05:54:40 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: audio.c cgd.c fss.c ld.c md.c
rndpseudo.c vnd.c
src/sys/dev/dm [pgoyette-localcount]: device-mapper.c
src/sys/dev/pad [pgoyette-localcount]: pad.c
src/sys/dev/pci [pgoyette-localcount]: pci_usrreq.c
src/sys/dev/pud [pgoyette-localcount]: pud_dev.c
src/sys/dev/putter [pgoyette-localcount]: putter.c
src/sys/dev/raidframe [pgoyette-localcount]: rf_netbsdkintf.c
src/sys/dev/scsipi [pgoyette-localcount]: cd.c sd.c
src/sys/dev/sysmon [pgoyette-localcount]: sysmon.c
src/sys/dev/usb [pgoyette-localcount]: ucom.c ulpt.c
src/sys/dev/wscons [pgoyette-localcount]: wskbd.c wsmouse.c
src/sys/external/bsd/ipf/netinet [pgoyette-localcount]: ip_fil_netbsd.c
src/sys/kern [pgoyette-localcount]: kern_drvctl.c tty_ptm.c tty_pty.c
tty_tty.c
src/sys/net [pgoyette-localcount]: bpf.c if_tap.c
src/sys/net/npf [pgoyette-localcount]: npf.c
src/sys/netsmb [pgoyette-localcount]: smb_dev.c
src/sys/opencrypto [pgoyette-localcount]: cryptodev.c
src/sys/rump/librump/rumpvfs [pgoyette-localcount]: devnull.c rumpblk.c
src/sys/sys [pgoyette-localcount]: localcount.h

Log Message:
Rename LOCALCOUNT_INITIALIZER to DEVSW_MODULE_INIT.  This better describes
what we're doing, and why.


To generate a diff of this commit:
cvs rdiff -u -r1.268.2.4 -r1.268.2.5 src/sys/dev/audio.c
cvs rdiff -u -r1.108.2.15 -r1.108.2.16 src/sys/dev/cgd.c
cvs rdiff -u -r1.93.2.2 -r1.93.2.3 src/sys/dev/fss.c
cvs rdiff -u -r1.94.2.2 -r1.94.2.3 src/sys/dev/ld.c
cvs rdiff -u -r1.76.2.2 -r1.76.2.3 src/sys/dev/md.c
cvs rdiff -u -r1.35.2.2 -r1.35.2.3 src/sys/dev/rndpseudo.c
cvs rdiff -u -r1.256.2.6 -r1.256.2.7 src/sys/dev/vnd.c
cvs rdiff -u -r1.38.2.2 -r1.38.2.3 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.25.2.3 -r1.25.2.4 src/sys/dev/pad/pad.c
cvs rdiff -u -r1.29.2.2 -r1.29.2.3 src/sys/dev/pci/pci_usrreq.c
cvs rdiff -u -r1.7.2.3 -r1.7.2.4 src/sys/dev/pud/pud_dev.c
cvs rdiff -u -r1.35.8.2 -r1.35.8.3 src/sys/dev/putter/putter.c
cvs rdiff -u -r1.345.2.5 -r1.345.2.6 src/sys/dev/raidframe/rf_netbsdkintf.c
cvs rdiff -u -r1.331.2.2 -r1.331.2.3 src/sys/dev/scsipi/cd.c
cvs rdiff -u -r1.317.2.2 -r1.317.2.3 src/sys/dev/scsipi/sd.c
cvs rdiff -u -r1.28.2.2 -r1.28.2.3 src/sys/dev/sysmon/sysmon.c
cvs rdiff -u -r1.113.2.2 -r1.113.2.3 src/sys/dev/usb/ucom.c
cvs rdiff -u -r1.97.2.2 -r1.97.2.3 src/sys/dev/usb/ulpt.c
cvs rdiff -u -r1.136.2.2 -r1.136.2.3 src/sys/dev/wscons/wskbd.c
cvs rdiff -u -r1.66.8.2 -r1.66.8.3 src/sys/dev/wscons/wsmouse.c
cvs rdiff -u -r1.16.2.3 -r1.16.2.4 \
src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c
cvs rdiff -u -r1.41.2.2 -r1.41.2.3 src/sys/kern/kern_drvctl.c
cvs rdiff -u -r1.37.2.2 -r1.37.2.3 src/sys/kern/tty_ptm.c
cvs rdiff -u -r1.142.2.3 -r1.142.2.4 src/sys/kern/tty_pty.c
cvs rdiff -u -r1.40.8.2 -r1.40.8.3 src/sys/kern/tty_tty.c
cvs rdiff -u -r1.199.2.2 -r1.199.2.3 src/sys/net/bpf.c
cvs rdiff -u -r1.84.2.2 -r1.84.2.3 src/sys/net/if_tap.c
cvs rdiff -u -r1.31.2.2 -r1.31.2.3 src/sys/net/npf/npf.c
cvs rdiff -u -r1.44.2.3 -r1.44.2.4 src/sys/netsmb/smb_dev.c
cvs rdiff -u -r1.85.2.2 -r1.85.2.3 src/sys/opencrypto/cryptodev.c
cvs rdiff -u -r1.7.2.2 -r1.7.2.3 src/sys/rump/librump/rumpvfs/devnull.c
cvs rdiff -u -r1.64.2.2 -r1.64.2.3 src/sys/rump/librump/rumpvfs/rumpblk.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/sys/localcount.h

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



CVS commit: [pgoyette-localcount] src/sys

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 05:54:40 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: audio.c cgd.c fss.c ld.c md.c
rndpseudo.c vnd.c
src/sys/dev/dm [pgoyette-localcount]: device-mapper.c
src/sys/dev/pad [pgoyette-localcount]: pad.c
src/sys/dev/pci [pgoyette-localcount]: pci_usrreq.c
src/sys/dev/pud [pgoyette-localcount]: pud_dev.c
src/sys/dev/putter [pgoyette-localcount]: putter.c
src/sys/dev/raidframe [pgoyette-localcount]: rf_netbsdkintf.c
src/sys/dev/scsipi [pgoyette-localcount]: cd.c sd.c
src/sys/dev/sysmon [pgoyette-localcount]: sysmon.c
src/sys/dev/usb [pgoyette-localcount]: ucom.c ulpt.c
src/sys/dev/wscons [pgoyette-localcount]: wskbd.c wsmouse.c
src/sys/external/bsd/ipf/netinet [pgoyette-localcount]: ip_fil_netbsd.c
src/sys/kern [pgoyette-localcount]: kern_drvctl.c tty_ptm.c tty_pty.c
tty_tty.c
src/sys/net [pgoyette-localcount]: bpf.c if_tap.c
src/sys/net/npf [pgoyette-localcount]: npf.c
src/sys/netsmb [pgoyette-localcount]: smb_dev.c
src/sys/opencrypto [pgoyette-localcount]: cryptodev.c
src/sys/rump/librump/rumpvfs [pgoyette-localcount]: devnull.c rumpblk.c
src/sys/sys [pgoyette-localcount]: localcount.h

Log Message:
Rename LOCALCOUNT_INITIALIZER to DEVSW_MODULE_INIT.  This better describes
what we're doing, and why.


To generate a diff of this commit:
cvs rdiff -u -r1.268.2.4 -r1.268.2.5 src/sys/dev/audio.c
cvs rdiff -u -r1.108.2.15 -r1.108.2.16 src/sys/dev/cgd.c
cvs rdiff -u -r1.93.2.2 -r1.93.2.3 src/sys/dev/fss.c
cvs rdiff -u -r1.94.2.2 -r1.94.2.3 src/sys/dev/ld.c
cvs rdiff -u -r1.76.2.2 -r1.76.2.3 src/sys/dev/md.c
cvs rdiff -u -r1.35.2.2 -r1.35.2.3 src/sys/dev/rndpseudo.c
cvs rdiff -u -r1.256.2.6 -r1.256.2.7 src/sys/dev/vnd.c
cvs rdiff -u -r1.38.2.2 -r1.38.2.3 src/sys/dev/dm/device-mapper.c
cvs rdiff -u -r1.25.2.3 -r1.25.2.4 src/sys/dev/pad/pad.c
cvs rdiff -u -r1.29.2.2 -r1.29.2.3 src/sys/dev/pci/pci_usrreq.c
cvs rdiff -u -r1.7.2.3 -r1.7.2.4 src/sys/dev/pud/pud_dev.c
cvs rdiff -u -r1.35.8.2 -r1.35.8.3 src/sys/dev/putter/putter.c
cvs rdiff -u -r1.345.2.5 -r1.345.2.6 src/sys/dev/raidframe/rf_netbsdkintf.c
cvs rdiff -u -r1.331.2.2 -r1.331.2.3 src/sys/dev/scsipi/cd.c
cvs rdiff -u -r1.317.2.2 -r1.317.2.3 src/sys/dev/scsipi/sd.c
cvs rdiff -u -r1.28.2.2 -r1.28.2.3 src/sys/dev/sysmon/sysmon.c
cvs rdiff -u -r1.113.2.2 -r1.113.2.3 src/sys/dev/usb/ucom.c
cvs rdiff -u -r1.97.2.2 -r1.97.2.3 src/sys/dev/usb/ulpt.c
cvs rdiff -u -r1.136.2.2 -r1.136.2.3 src/sys/dev/wscons/wskbd.c
cvs rdiff -u -r1.66.8.2 -r1.66.8.3 src/sys/dev/wscons/wsmouse.c
cvs rdiff -u -r1.16.2.3 -r1.16.2.4 \
src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c
cvs rdiff -u -r1.41.2.2 -r1.41.2.3 src/sys/kern/kern_drvctl.c
cvs rdiff -u -r1.37.2.2 -r1.37.2.3 src/sys/kern/tty_ptm.c
cvs rdiff -u -r1.142.2.3 -r1.142.2.4 src/sys/kern/tty_pty.c
cvs rdiff -u -r1.40.8.2 -r1.40.8.3 src/sys/kern/tty_tty.c
cvs rdiff -u -r1.199.2.2 -r1.199.2.3 src/sys/net/bpf.c
cvs rdiff -u -r1.84.2.2 -r1.84.2.3 src/sys/net/if_tap.c
cvs rdiff -u -r1.31.2.2 -r1.31.2.3 src/sys/net/npf/npf.c
cvs rdiff -u -r1.44.2.3 -r1.44.2.4 src/sys/netsmb/smb_dev.c
cvs rdiff -u -r1.85.2.2 -r1.85.2.3 src/sys/opencrypto/cryptodev.c
cvs rdiff -u -r1.7.2.2 -r1.7.2.3 src/sys/rump/librump/rumpvfs/devnull.c
cvs rdiff -u -r1.64.2.2 -r1.64.2.3 src/sys/rump/librump/rumpvfs/rumpblk.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/sys/localcount.h

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

Modified files:

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.268.2.4 src/sys/dev/audio.c:1.268.2.5
--- src/sys/dev/audio.c:1.268.2.4	Tue Jul 26 03:52:14 2016
+++ src/sys/dev/audio.c	Tue Jul 26 05:54:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.268.2.4 2016/07/26 03:52:14 pgoyette Exp $	*/
+/*	$NetBSD: audio.c,v 1.268.2.5 2016/07/26 05:54:39 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -155,7 +155,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.268.2.4 2016/07/26 03:52:14 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.268.2.5 2016/07/26 05:54:39 pgoyette Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -348,7 +348,7 @@ dev_type_mmap(audiommap);
 dev_type_kqfilter(audiokqfilter);
 
 const struct cdevsw audio_cdevsw = {
-	LOCALCOUNT_INITIALIZER
+	DEVSW_MODULE_INIT
 	.d_open = audioopen,
 	.d_close = audioclose,
 	.d_read = audioread,

Index: src/sys/dev/cgd.c
diff -u src/sys/dev/cgd.c:1.108.2.15 src/sys/dev/cgd.c:1.108.2.16
--- src/sys/dev/cgd.c:1.108.2.15	Tue Jul 26 03:24:20 2016
+++ src/sys/dev/cgd.c	Tue Jul 26 05:54:39 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.108.2.15 2016/07/26 03:24:20 pgoyette Exp $ */
+/* $NetBSD: cgd.c,v 1.108.2.16 2016/07/26 05:54:39 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ 

CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 04:30:50 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: vnd.c

Log Message:
Fix some sloppy typos


To generate a diff of this commit:
cvs rdiff -u -r1.256.2.5 -r1.256.2.6 src/sys/dev/vnd.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 04:30:50 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: vnd.c

Log Message:
Fix some sloppy typos


To generate a diff of this commit:
cvs rdiff -u -r1.256.2.5 -r1.256.2.6 src/sys/dev/vnd.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/vnd.c
diff -u src/sys/dev/vnd.c:1.256.2.5 src/sys/dev/vnd.c:1.256.2.6
--- src/sys/dev/vnd.c:1.256.2.5	Tue Jul 26 03:24:20 2016
+++ src/sys/dev/vnd.c	Tue Jul 26 04:30:50 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.256.2.5 2016/07/26 03:24:20 pgoyette Exp $	*/
+/*	$NetBSD: vnd.c,v 1.256.2.6 2016/07/26 04:30:50 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.5 2016/07/26 03:24:20 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.6 2016/07/26 04:30:50 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -312,7 +312,7 @@ vnd_spawn(int unit)
 	if (config_attach_pseudo(cf) == NULL)
 		return NULL;
 
-	*self = device_lookup_acquire(_cd, unit);
+	self = device_lookup_acquire(_cd, unit);
 	if (self == NULL)
 		return NULL;
 	else {  
@@ -320,7 +320,7 @@ vnd_spawn(int unit)
 		 * Note that we return while still holding a reference
 		 * to the device!
 		 */
-		return device_private(*self);
+		return device_private(self);
 	}
 }
 
@@ -353,7 +353,7 @@ vndopen(dev_t dev, int flags, int mode, 
 #endif
 	self = device_lookup_acquire(_cd, unit);
 	if (self != NULL)
-		sc = device-private(self);
+		sc = device_private(self);
 	else {
 		sc = vnd_spawn(unit);
 		if (sc == NULL)
@@ -1055,7 +1055,7 @@ vndwrite(dev_t dev, struct uio *uio, int
 	self = device_lookup_acquire(_cd, unit);
 	if (self == NULL)
 		return ENXIO;
-	sc = device_lookup_private_acquire(_cd, unit, );
+	sc = device_private(self);
 
 	if ((sc->sc_flags & VNF_INITED) == 0) {
 		device_release(self);
@@ -1079,7 +1079,7 @@ vnd_cget(struct lwp *l, int unit, int *u
 	if (*un < 0)
 		return EINVAL;
 
-	self - device_lookup_acquire(_cd, unit);
+	self = device_lookup_acquire(_cd, unit);
 	if (self == NULL)
 		return -1;
 	vnd = device_private(self);
@@ -1226,12 +1226,11 @@ vndioctl(dev_t dev, u_long cmd, void *da
 		break;
 	}
 
-	vnd = device_lookup_private(_cd, unit);
-	if (vnd == NULL) {
-		if (self != NULL)
-			device_release(self);
+	self = device_lookup_acquire(_cd, unit);
+	if (self != NULL)
 		return ENXIO;
-	}
+	vnd = device_private(self);
+
 	vio = (struct vnd_ioctl *)data;
 
 	/* Must be open for writes for these commands... */



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 03:52:14 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: audio.c

Log Message:
Fix typo in local copy


To generate a diff of this commit:
cvs rdiff -u -r1.268.2.3 -r1.268.2.4 src/sys/dev/audio.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 03:52:14 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: audio.c

Log Message:
Fix typo in local copy


To generate a diff of this commit:
cvs rdiff -u -r1.268.2.3 -r1.268.2.4 src/sys/dev/audio.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/audio.c
diff -u src/sys/dev/audio.c:1.268.2.3 src/sys/dev/audio.c:1.268.2.4
--- src/sys/dev/audio.c:1.268.2.3	Tue Jul 26 03:24:20 2016
+++ src/sys/dev/audio.c	Tue Jul 26 03:52:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.268.2.3 2016/07/26 03:24:20 pgoyette Exp $	*/
+/*	$NetBSD: audio.c,v 1.268.2.4 2016/07/26 03:52:14 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -155,7 +155,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.268.2.3 2016/07/26 03:24:20 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.268.2.4 2016/07/26 03:52:14 pgoyette Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -1186,7 +1186,7 @@ audio_enter(dev_t dev, krw_t rw, struct 
 	struct audio_softc *sc;
 
 	/* First, find the device and take sc_lock. */
-	self = device_lookup_acquire(_cd, ADUIOUNIT(dev));
+	self = device_lookup_acquire(_cd, AUDIOUNIT(dev));
 	if (self == NULL)
 		return ENXIO;
 	sc = device_private(self);



CVS commit: [pgoyette-localcount] src

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 03:24:25 UTC 2016

Modified Files:
src/crypto/external/cpl/tpm-tools/bin/tpm_sealdata 
[pgoyette-localcount]:
Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_unsealdata 
[pgoyette-localcount]:
Makefile
src/crypto/external/cpl/tpm-tools/lib/libtpm_unseal 
[pgoyette-localcount]:
Makefile
src/crypto/external/cpl/tpm-tools/lib/libtpm_utils 
[pgoyette-localcount]:
Makefile
src/doc [pgoyette-localcount]: 3RDPARTY BRANCHES CHANGES
src/etc [pgoyette-localcount]: MAKEDEV.tmpl
src/etc/rc.d [pgoyette-localcount]: mountcritlocal
src/external/bsd/mdocml/bin/mandoc [pgoyette-localcount]: Makefile
src/external/bsd/mdocml/dist [pgoyette-localcount]: INSTALL LICENSE
Makefile Makefile.depend NEWS TODO apropos.1 att.c cgi.c
cgi.h.example chars.c compat_fts.c compat_fts.h compat_getsubopt.c
compat_ohash.c compat_ohash.h compat_reallocarray.c
compat_sqlite3_errstr.c compat_strcasestr.c compat_strsep.c
compat_strtonum.c configure configure.local.example demandoc.1
demandoc.c eqn.7 eqn.c eqn_html.c eqn_term.c gmdiff html.c html.h
lib.c lib.in libman.h libmandoc.h libmdoc.h libroff.h main.c main.h
makewhatis.8 man.1 man.7 man.c man.cgi.8 man.h man_hash.c
man_html.c man_macro.c man_term.c man_validate.c mandoc.1 mandoc.3
mandoc.c mandoc.db.5 mandoc.h mandoc_aux.c mandoc_aux.h
mandoc_char.7 mandoc_escape.3 mandoc_headers.3 mandoc_html.3
mandoc_malloc.3 mandocdb.c manpage.c manpath.c mansearch.3
mansearch.c mansearch.h mansearch_const.c mchars_alloc.3 mdoc.7
mdoc.c mdoc.h mdoc_argv.c mdoc_hash.c mdoc_html.c mdoc_macro.c
mdoc_man.c mdoc_term.c mdoc_validate.c msec.c msec.in out.c out.h
preconv.c predefs.in read.c roff.7 roff.c st.c st.in tbl.3 tbl.7
tbl.c tbl_data.c tbl_html.c tbl_layout.c tbl_opts.c tbl_term.c
term.c term.h term_ascii.c term_ps.c test-dirent-namlen.c
test-fts.c test-getsubopt.c test-mmap.c test-ohash.c
test-reallocarray.c test-sqlite3.c test-sqlite3_errstr.c
test-strcasestr.c test-strlcat.c test-strlcpy.c test-strptime.c
test-strsep.c test-strtonum.c test-wchar.c tree.c
src/external/bsd/mdocml/include [pgoyette-localcount]: config.h
src/external/bsd/mdocml/lib/libmandoc [pgoyette-localcount]: Makefile
src/external/bsd/mdocml/man [pgoyette-localcount]: Makefile
src/external/gpl3/binutils/dist/bfd [pgoyette-localcount]: elf32-vax.c
src/external/gpl3/binutils/lib/libbfd [pgoyette-localcount]: Makefile
src/games/fortune/datfiles [pgoyette-localcount]: fortunes
src/include [pgoyette-localcount]: limits.h
src/lib/libc/arch/hppa/gen [pgoyette-localcount]: __setjmp14.S
src/lib/libc/gen [pgoyette-localcount]: arc4random.3
src/lib/libc/sys [pgoyette-localcount]: sigaction.2
src/lib/libpthread [pgoyette-localcount]: pthread_mutex.c
pthread_types.h
src/libexec/ftpd [pgoyette-localcount]: ftpd.c
src/libexec/httpd [pgoyette-localcount]: content-bozo.c
src/libexec/mail.local [pgoyette-localcount]: mail.local.c
src/libexec/tftpd [pgoyette-localcount]: tftpd.c
src/sbin/mount_null [pgoyette-localcount]: mount_null.c
src/share/man/man9 [pgoyette-localcount]: driver.9
src/share/misc [pgoyette-localcount]: acronyms
src/sys/arch/amd64/acpi [pgoyette-localcount]: acpi_wakecode.S
acpi_wakeup_low.S
src/sys/arch/amd64/amd64 [pgoyette-localcount]: locore.S machdep.c
mptramp.S
src/sys/arch/amd64/include [pgoyette-localcount]: pmap.h
src/sys/arch/arm/arm32 [pgoyette-localcount]: arm32_machdep.c
src/sys/arch/arm/include [pgoyette-localcount]: cpufunc.h
src/sys/arch/evbarm/conf [pgoyette-localcount]: VTC100
src/sys/arch/i386/acpi [pgoyette-localcount]: acpi_wakecode.S
acpi_wakeup_low.S
src/sys/arch/i386/i386 [pgoyette-localcount]: locore.S machdep.c
src/sys/arch/macppc/dev [pgoyette-localcount]: awacs.c dbdma.c dbdma.h
esp.c if_bm.c if_mc.c kauai.c mesh.c snapper.c wdc_obio.c
src/sys/arch/mips/include [pgoyette-localcount]: cpu.h
src/sys/arch/mips/mips [pgoyette-localcount]: bus_dma.c
bus_space_alignstride_chipdep.c locore_mips1.S mipsX_subr.S
mips_machdep.c spl.S
src/sys/arch/mips/sibyte/dev [pgoyette-localcount]: sbbuswatch.c
sbmac.c sbobio.c sbscn.c sbtimer.c sbwdog.c
src/sys/arch/mips/sibyte/pci [pgoyette-localcount]: sbbrz.c sbbrz_pci.c
src/sys/arch/newsmips/apbus [pgoyette-localcount]: xafb.c
src/sys/arch/newsmips/dev 

CVS commit: [pgoyette-localcount] src

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jul 26 03:24:25 UTC 2016

Modified Files:
src/crypto/external/cpl/tpm-tools/bin/tpm_sealdata 
[pgoyette-localcount]:
Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_unsealdata 
[pgoyette-localcount]:
Makefile
src/crypto/external/cpl/tpm-tools/lib/libtpm_unseal 
[pgoyette-localcount]:
Makefile
src/crypto/external/cpl/tpm-tools/lib/libtpm_utils 
[pgoyette-localcount]:
Makefile
src/doc [pgoyette-localcount]: 3RDPARTY BRANCHES CHANGES
src/etc [pgoyette-localcount]: MAKEDEV.tmpl
src/etc/rc.d [pgoyette-localcount]: mountcritlocal
src/external/bsd/mdocml/bin/mandoc [pgoyette-localcount]: Makefile
src/external/bsd/mdocml/dist [pgoyette-localcount]: INSTALL LICENSE
Makefile Makefile.depend NEWS TODO apropos.1 att.c cgi.c
cgi.h.example chars.c compat_fts.c compat_fts.h compat_getsubopt.c
compat_ohash.c compat_ohash.h compat_reallocarray.c
compat_sqlite3_errstr.c compat_strcasestr.c compat_strsep.c
compat_strtonum.c configure configure.local.example demandoc.1
demandoc.c eqn.7 eqn.c eqn_html.c eqn_term.c gmdiff html.c html.h
lib.c lib.in libman.h libmandoc.h libmdoc.h libroff.h main.c main.h
makewhatis.8 man.1 man.7 man.c man.cgi.8 man.h man_hash.c
man_html.c man_macro.c man_term.c man_validate.c mandoc.1 mandoc.3
mandoc.c mandoc.db.5 mandoc.h mandoc_aux.c mandoc_aux.h
mandoc_char.7 mandoc_escape.3 mandoc_headers.3 mandoc_html.3
mandoc_malloc.3 mandocdb.c manpage.c manpath.c mansearch.3
mansearch.c mansearch.h mansearch_const.c mchars_alloc.3 mdoc.7
mdoc.c mdoc.h mdoc_argv.c mdoc_hash.c mdoc_html.c mdoc_macro.c
mdoc_man.c mdoc_term.c mdoc_validate.c msec.c msec.in out.c out.h
preconv.c predefs.in read.c roff.7 roff.c st.c st.in tbl.3 tbl.7
tbl.c tbl_data.c tbl_html.c tbl_layout.c tbl_opts.c tbl_term.c
term.c term.h term_ascii.c term_ps.c test-dirent-namlen.c
test-fts.c test-getsubopt.c test-mmap.c test-ohash.c
test-reallocarray.c test-sqlite3.c test-sqlite3_errstr.c
test-strcasestr.c test-strlcat.c test-strlcpy.c test-strptime.c
test-strsep.c test-strtonum.c test-wchar.c tree.c
src/external/bsd/mdocml/include [pgoyette-localcount]: config.h
src/external/bsd/mdocml/lib/libmandoc [pgoyette-localcount]: Makefile
src/external/bsd/mdocml/man [pgoyette-localcount]: Makefile
src/external/gpl3/binutils/dist/bfd [pgoyette-localcount]: elf32-vax.c
src/external/gpl3/binutils/lib/libbfd [pgoyette-localcount]: Makefile
src/games/fortune/datfiles [pgoyette-localcount]: fortunes
src/include [pgoyette-localcount]: limits.h
src/lib/libc/arch/hppa/gen [pgoyette-localcount]: __setjmp14.S
src/lib/libc/gen [pgoyette-localcount]: arc4random.3
src/lib/libc/sys [pgoyette-localcount]: sigaction.2
src/lib/libpthread [pgoyette-localcount]: pthread_mutex.c
pthread_types.h
src/libexec/ftpd [pgoyette-localcount]: ftpd.c
src/libexec/httpd [pgoyette-localcount]: content-bozo.c
src/libexec/mail.local [pgoyette-localcount]: mail.local.c
src/libexec/tftpd [pgoyette-localcount]: tftpd.c
src/sbin/mount_null [pgoyette-localcount]: mount_null.c
src/share/man/man9 [pgoyette-localcount]: driver.9
src/share/misc [pgoyette-localcount]: acronyms
src/sys/arch/amd64/acpi [pgoyette-localcount]: acpi_wakecode.S
acpi_wakeup_low.S
src/sys/arch/amd64/amd64 [pgoyette-localcount]: locore.S machdep.c
mptramp.S
src/sys/arch/amd64/include [pgoyette-localcount]: pmap.h
src/sys/arch/arm/arm32 [pgoyette-localcount]: arm32_machdep.c
src/sys/arch/arm/include [pgoyette-localcount]: cpufunc.h
src/sys/arch/evbarm/conf [pgoyette-localcount]: VTC100
src/sys/arch/i386/acpi [pgoyette-localcount]: acpi_wakecode.S
acpi_wakeup_low.S
src/sys/arch/i386/i386 [pgoyette-localcount]: locore.S machdep.c
src/sys/arch/macppc/dev [pgoyette-localcount]: awacs.c dbdma.c dbdma.h
esp.c if_bm.c if_mc.c kauai.c mesh.c snapper.c wdc_obio.c
src/sys/arch/mips/include [pgoyette-localcount]: cpu.h
src/sys/arch/mips/mips [pgoyette-localcount]: bus_dma.c
bus_space_alignstride_chipdep.c locore_mips1.S mipsX_subr.S
mips_machdep.c spl.S
src/sys/arch/mips/sibyte/dev [pgoyette-localcount]: sbbuswatch.c
sbmac.c sbobio.c sbscn.c sbtimer.c sbwdog.c
src/sys/arch/mips/sibyte/pci [pgoyette-localcount]: sbbrz.c sbbrz_pci.c
src/sys/arch/newsmips/apbus [pgoyette-localcount]: xafb.c
src/sys/arch/newsmips/dev 

CVS commit: [pgoyette-localcount] src/sys/dev/isa

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jul 25 23:40:33 UTC 2016

Modified Files:
src/sys/dev/isa [pgoyette-localcount]: fd.c isv.c mcd.c

Log Message:
Redo previous


To generate a diff of this commit:
cvs rdiff -u -r1.110.2.1 -r1.110.2.2 src/sys/dev/isa/fd.c
cvs rdiff -u -r1.7.8.1 -r1.7.8.2 src/sys/dev/isa/isv.c
cvs rdiff -u -r1.116.2.1 -r1.116.2.2 src/sys/dev/isa/mcd.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/isa/fd.c
diff -u src/sys/dev/isa/fd.c:1.110.2.1 src/sys/dev/isa/fd.c:1.110.2.2
--- src/sys/dev/isa/fd.c:1.110.2.1	Mon Jul 25 03:30:51 2016
+++ src/sys/dev/isa/fd.c	Mon Jul 25 23:40:33 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.110.2.1 2016/07/25 03:30:51 pgoyette Exp $	*/
+/*	$NetBSD: fd.c,v 1.110.2.2 2016/07/25 23:40:33 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003, 2008 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.110.2.1 2016/07/25 03:30:51 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.110.2.2 2016/07/25 23:40:33 pgoyette Exp $");
 
 #include "opt_ddb.h"
 
@@ -695,9 +695,8 @@ fd_dev_to_type(struct fd_softc *fd, dev_
 void
 fdstrategy(struct buf *bp)
 {
-	device_t self;
-	struct fd_softc *fd =
-	device_lookup_private_acquire(_cd, FDUNIT(bp->b_dev), );
+	device_t self = device_lookup_acquire(_cd, FDUNIT(bp->b_dev));
+	struct fd_softc *fd = device_private(self);
 	struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev));
 	int sz;
 
@@ -925,12 +924,10 @@ fdopen(dev_t dev, int flags, int mode, s
 	struct fd_softc *fd;
 	const struct fd_type *type;
 
-	fd = device_lookup_private_acquire(_cd, FDUNIT(dev), );
-	if (fd == NULL) {
-		if (self != NULL)
-			device_release(self);
-		return (ENXIO);
-	}
+	self = device_lookup_acquire(_cd, FDUNIT(dev));
+	if (self == NULL)
+		return ENXIO;
+	fd = device_private(self);
 
 	type = fd_dev_to_type(fd, dev);
 	if (type == NULL) {
@@ -958,9 +955,8 @@ fdopen(dev_t dev, int flags, int mode, s
 int
 fdclose(dev_t dev, int flags, int mode, struct lwp *l)
 {
-	device_t self;
-	struct fd_softc *fd =
-	device_lookup_private_acquire(_cd, FDUNIT(dev), );
+	device_t self = device_lookup_acquire(_cd, FDUNIT(dev));
+	struct fd_softc *fd = device_private(self);
 
 	fd->sc_flags &= ~FD_OPEN;
 	fd->sc_opts &= ~(FDOPT_NORETRY|FDOPT_SILENT);
@@ -1411,9 +1407,8 @@ fdcretry(struct fdc_softc *fdc)
 int
 fdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
 {
-	device_t self;
-	struct fd_softc *fd =
-	device_lookup_private_acquire(_cd, FDUNIT(dev), );
+	device_t self = device_lookup_acquire(_cd, FDUNIT(dev));
+	struct fd_softc *fd = device_private(self);
 	struct fdformat_parms *form_parms;
 	struct fdformat_cmd *form_cmd;
 	struct ne7_fd_formb *fd_formb;
@@ -1642,10 +1637,9 @@ fdioctl(dev_t dev, u_long cmd, void *add
 int
 fdformat(dev_t dev, struct ne7_fd_formb *finfo, struct lwp *l)
 {
-	device_t self;
+	device_t self = device_lookup_acquire(_cd, FDUNIT(dev));
 	int rv = 0;
-	struct fd_softc *fd = 
-	device_lookup_private_acquire(_cd, FDUNIT(dev), );
+	struct fd_softc *fd = device_private(self);
 	struct fd_type *type = fd->sc_type;
 	struct buf *bp;
 

Index: src/sys/dev/isa/isv.c
diff -u src/sys/dev/isa/isv.c:1.7.8.1 src/sys/dev/isa/isv.c:1.7.8.2
--- src/sys/dev/isa/isv.c:1.7.8.1	Mon Jul 25 03:30:51 2016
+++ src/sys/dev/isa/isv.c	Mon Jul 25 23:40:33 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: isv.c,v 1.7.8.1 2016/07/25 03:30:51 pgoyette Exp $ */
+/*	$NetBSD: isv.c,v 1.7.8.2 2016/07/25 23:40:33 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isv.c,v 1.7.8.1 2016/07/25 03:30:51 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isv.c,v 1.7.8.2 2016/07/25 23:40:33 pgoyette Exp $");
 
 #include 
 #include 
@@ -259,16 +259,14 @@ isv_attach(device_t parent, device_t sel
 int
 isv_open(dev_t dev, int flag, int devtype, lwp_t *l)
 {
-	device_t self;
+	device_t self = device_lookup_acquire(_cd, minor(dev));
 	vaddr_t va;
-	struct isv_softc *sc =
-	device_lookup_private_acquire(_cd, minor(dev), );
+	struct isv_softc *sc;
 
-	if (sc == NULL) {
-		if (self != NULL)
-			device_release(self);
+	if (self == NULL)
 		return ENXIO;
-	}
+
+	sc = device_private(self);
 	if (sc->sc_frame != NULL) {
 		device_release(self);
 		return 0;
@@ -412,10 +410,9 @@ isv_capture(struct isv_softc *sc)
 int
 isv_ioctl(dev_t dev, u_long cmd, void *data, int flag, lwp_t *l)
 {
-	device_t self;
+	device_t self = device_lookup_acquire(_cd, minor(dev));
 	struct isv_cmd ic;
-	struct isv_softc *sc =
-	device_lookup_private_acquire(_cd, minor(dev), );
+	struct isv_softc *sc;
 	int error;
 
 	if (cmd != ISV_CMD) {
@@ -432,6 +429,11 @@ isv_ioctl(dev_t dev, u_long cmd, void *d
 		return EINVAL;
 	}
 
+	if (self == NULL)
+		return ENXIO;
+
+	sc = device_private(self);
+
 	ic.c_frameno = 

CVS commit: [pgoyette-localcount] src/sys/dev/isa

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jul 25 23:40:33 UTC 2016

Modified Files:
src/sys/dev/isa [pgoyette-localcount]: fd.c isv.c mcd.c

Log Message:
Redo previous


To generate a diff of this commit:
cvs rdiff -u -r1.110.2.1 -r1.110.2.2 src/sys/dev/isa/fd.c
cvs rdiff -u -r1.7.8.1 -r1.7.8.2 src/sys/dev/isa/isv.c
cvs rdiff -u -r1.116.2.1 -r1.116.2.2 src/sys/dev/isa/mcd.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jul 25 22:06:09 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: vnd.c

Log Message:
Update vnd for using localcount(9)


To generate a diff of this commit:
cvs rdiff -u -r1.256.2.3 -r1.256.2.4 src/sys/dev/vnd.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/vnd.c
diff -u src/sys/dev/vnd.c:1.256.2.3 src/sys/dev/vnd.c:1.256.2.4
--- src/sys/dev/vnd.c:1.256.2.3	Tue Jul 19 06:26:58 2016
+++ src/sys/dev/vnd.c	Mon Jul 25 22:06:09 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.256.2.3 2016/07/19 06:26:58 pgoyette Exp $	*/
+/*	$NetBSD: vnd.c,v 1.256.2.4 2016/07/25 22:06:09 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.3 2016/07/19 06:26:58 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.4 2016/07/25 22:06:09 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -324,6 +324,7 @@ vnd_destroy(device_t dev)
 static int
 vndopen(dev_t dev, int flags, int mode, struct lwp *l)
 {
+	device_t self;
 	int unit = vndunit(dev);
 	struct vnd_softc *sc;
 	int error = 0, part, pmask;
@@ -333,7 +334,7 @@ vndopen(dev_t dev, int flags, int mode, 
 	if (vnddebug & VDB_FOLLOW)
 		printf("vndopen(0x%"PRIx64", 0x%x, 0x%x, %p)\n", dev, flags, mode, l);
 #endif
-	sc = device_lookup_private(_cd, unit);
+	sc = device_lookup_private_acquire(_cd, unit, );
 	if (sc == NULL) {
 		sc = vnd_spawn(unit);
 		if (sc == NULL)
@@ -410,12 +411,14 @@ vndopen(dev_t dev, int flags, int mode, 
  done:
 	mutex_exit(>sc_dkdev.dk_openlock);
 	vndunlock(sc);
+	device_release(self);
 	return error;
 }
 
 static int
 vndclose(dev_t dev, int flags, int mode, struct lwp *l)
 {
+	device_t self;
 	int unit = vndunit(dev);
 	struct vnd_softc *sc;
 	int error = 0, part;
@@ -424,12 +427,17 @@ vndclose(dev_t dev, int flags, int mode,
 	if (vnddebug & VDB_FOLLOW)
 		printf("vndclose(0x%"PRIx64", 0x%x, 0x%x, %p)\n", dev, flags, mode, l);
 #endif
-	sc = device_lookup_private(_cd, unit);
-	if (sc == NULL)
+	sc = device_lookup_private_acquire(_cd, unit, );
+	if (sc == NULL) {
+		if (self != NULL)
+			device_release(self);
 		return ENXIO;
+	}
 
-	if ((error = vndlock(sc)) != 0)
+	if ((error = vndlock(sc)) != 0) {
+		device_release(self);
 		return error;
+	}
 
 	mutex_enter(>sc_dkdev.dk_openlock);
 
@@ -462,10 +470,12 @@ vndclose(dev_t dev, int flags, int mode,
 		if ((error = vnd_destroy(sc->sc_dev)) != 0) {
 			aprint_error_dev(sc->sc_dev,
 			"unable to detach instance\n");
+			device_release(self);
 			return error;
 		}
 	}
 
+	device_release(self);
 	return 0;
 }
 
@@ -475,9 +485,10 @@ vndclose(dev_t dev, int flags, int mode,
 static void
 vndstrategy(struct buf *bp)
 {
+	device_t self;
 	int unit = vndunit(bp->b_dev);
 	struct vnd_softc *vnd =
-	device_lookup_private(_cd, unit);
+	device_lookup_private_acquire(_cd, unit, );
 	struct disklabel *lp;
 	daddr_t blkno;
 	int s = splbio();
@@ -561,12 +572,15 @@ vndstrategy(struct buf *bp)
 	bufq_put(vnd->sc_tab, bp);
 	wakeup(>sc_tab);
 	splx(s);
+	device_release(self);
 	return;
 
 done:
 	bp->b_resid = bp->b_bcount;
 	biodone(bp);
 	splx(s);
+	if (self != NULL)
+		device_release(self);
 }
 
 static bool
@@ -981,6 +995,8 @@ vndiodone(struct buf *bp)
 static int
 vndread(dev_t dev, struct uio *uio, int flags)
 {
+	device_t self;
+	int error;
 	int unit = vndunit(dev);
 	struct vnd_softc *sc;
 
@@ -989,20 +1005,29 @@ vndread(dev_t dev, struct uio *uio, int 
 		printf("vndread(0x%"PRIx64", %p)\n", dev, uio);
 #endif
 
-	sc = device_lookup_private(_cd, unit);
-	if (sc == NULL)
+	sc = device_lookup_private_acquire(_cd, unit, );
+	if (sc == NULL) {
+		if (self != NULL)
+			device_release(self);
 		return ENXIO;
+	}
 
-	if ((sc->sc_flags & VNF_INITED) == 0)
+	if ((sc->sc_flags & VNF_INITED) == 0) {
+		device_release(self);
 		return ENXIO;
+	}
 
-	return physio(vndstrategy, NULL, dev, B_READ, minphys, uio);
+	error = physio(vndstrategy, NULL, dev, B_READ, minphys, uio);
+	device_release(self);
+	return error;
 }
 
 /* ARGSUSED */
 static int
 vndwrite(dev_t dev, struct uio *uio, int flags)
 {
+	device_t self;
+	int error;
 	int unit = vndunit(dev);
 	struct vnd_softc *sc;
 
@@ -1011,19 +1036,27 @@ vndwrite(dev_t dev, struct uio *uio, int
 		printf("vndwrite(0x%"PRIx64", %p)\n", dev, uio);
 #endif
 
-	sc = device_lookup_private(_cd, unit);
-	if (sc == NULL)
+	sc = device_lookup_private_acquire(_cd, unit, );
+	if (sc == NULL) {
+		if (self != NULL)
+			device_release(self);
 		return ENXIO;
+	}
 
-	if ((sc->sc_flags & VNF_INITED) == 0)
+	if ((sc->sc_flags & VNF_INITED) == 0) {
+		device_release(self);
 		return ENXIO;
+	}
 
-	return physio(vndstrategy, NULL, dev, B_WRITE, minphys, uio);
+	error = physio(vndstrategy, NULL, dev, B_WRITE, minphys, uio);
+	device_release(self);
+	

CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jul 25 22:06:09 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: vnd.c

Log Message:
Update vnd for using localcount(9)


To generate a diff of this commit:
cvs rdiff -u -r1.256.2.3 -r1.256.2.4 src/sys/dev/vnd.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-24 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jul 25 03:40:52 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: cgd.c

Log Message:
Add a comment to describe why we didn't convert one caller of
device_lokup_private().


To generate a diff of this commit:
cvs rdiff -u -r1.108.2.13 -r1.108.2.14 src/sys/dev/cgd.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-24 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jul 25 03:40:52 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: cgd.c

Log Message:
Add a comment to describe why we didn't convert one caller of
device_lokup_private().


To generate a diff of this commit:
cvs rdiff -u -r1.108.2.13 -r1.108.2.14 src/sys/dev/cgd.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/cgd.c
diff -u src/sys/dev/cgd.c:1.108.2.13 src/sys/dev/cgd.c:1.108.2.14
--- src/sys/dev/cgd.c:1.108.2.13	Sun Jul 24 10:44:57 2016
+++ src/sys/dev/cgd.c	Mon Jul 25 03:40:52 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.108.2.13 2016/07/24 10:44:57 pgoyette Exp $ */
+/* $NetBSD: cgd.c,v 1.108.2.14 2016/07/25 03:40:52 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.108.2.13 2016/07/24 10:44:57 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.108.2.14 2016/07/25 03:40:52 pgoyette Exp $");
 
 #include 
 #include 
@@ -910,6 +910,11 @@ cgd_ioctl_get(dev_t dev, void *data, str
 		return EINVAL;	/* XXX: should this be ENXIO? */
 	}
 
+	/*
+	 * XXX This appears to be redundant, given the initialization
+	 * XXX when it was declared.  Leave it for now, but don't
+	 * XXX take an extra reference to the device!
+	 */
 	cs = device_lookup_private(_cd, unit);
 	if (cs == NULL || !DK_ATTACHED(dksc)) {
 		cgu->cgu_dev = 0;



CVS commit: [pgoyette-localcount] src/sys/dev/isa

2016-07-24 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jul 25 03:30:52 UTC 2016

Modified Files:
src/sys/dev/isa [pgoyette-localcount]: fd.c isv.c mcd.c

Log Message:
Update a few drivers for localcount(9)


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.110.2.1 src/sys/dev/isa/fd.c
cvs rdiff -u -r1.7 -r1.7.8.1 src/sys/dev/isa/isv.c
cvs rdiff -u -r1.116 -r1.116.2.1 src/sys/dev/isa/mcd.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/isa/fd.c
diff -u src/sys/dev/isa/fd.c:1.110 src/sys/dev/isa/fd.c:1.110.2.1
--- src/sys/dev/isa/fd.c:1.110	Tue Dec  8 20:36:15 2015
+++ src/sys/dev/isa/fd.c	Mon Jul 25 03:30:51 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.110 2015/12/08 20:36:15 christos Exp $	*/
+/*	$NetBSD: fd.c,v 1.110.2.1 2016/07/25 03:30:51 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003, 2008 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.110 2015/12/08 20:36:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.110.2.1 2016/07/25 03:30:51 pgoyette Exp $");
 
 #include "opt_ddb.h"
 
@@ -695,7 +695,9 @@ fd_dev_to_type(struct fd_softc *fd, dev_
 void
 fdstrategy(struct buf *bp)
 {
-	struct fd_softc *fd = device_lookup_private(_cd, FDUNIT(bp->b_dev));
+	device_t self;
+	struct fd_softc *fd =
+	device_lookup_private_acquire(_cd, FDUNIT(bp->b_dev), );
 	struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev));
 	int sz;
 
@@ -753,12 +755,14 @@ fdstrategy(struct buf *bp)
 	}
 #endif
 	mutex_exit(>sc_mtx);
+	device_release(self);
 	return;
 
 done:
 	/* Toss transfer; we're done early. */
 	bp->b_resid = bp->b_bcount;
 	biodone(bp);
+	device_release(self);
 }
 
 void
@@ -917,20 +921,28 @@ out_fdc(bus_space_tag_t iot, bus_space_h
 int
 fdopen(dev_t dev, int flags, int mode, struct lwp *l)
 {
+	device_t self;
 	struct fd_softc *fd;
 	const struct fd_type *type;
 
-	fd = device_lookup_private(_cd, FDUNIT(dev));
-	if (fd == NULL)
+	fd = device_lookup_private_acquire(_cd, FDUNIT(dev), );
+	if (fd == NULL) {
+		if (self != NULL)
+			device_release(self);
 		return (ENXIO);
+	}
 
 	type = fd_dev_to_type(fd, dev);
-	if (type == NULL)
+	if (type == NULL) {
+		device_release(self);
 		return ENXIO;
+	}
 
 	if ((fd->sc_flags & FD_OPEN) != 0 &&
-	memcmp(fd->sc_type, type, sizeof(*type)))
+	memcmp(fd->sc_type, type, sizeof(*type))) {
+		device_release(self);
 		return EBUSY;
+	}
 
 	fd->sc_type_copy = *type;
 	fd->sc_type = >sc_type_copy;
@@ -939,17 +951,20 @@ fdopen(dev_t dev, int flags, int mode, s
 
 	fd_set_geometry(fd);
 
+	device_release(self);
 	return 0;
 }
 
 int
 fdclose(dev_t dev, int flags, int mode, struct lwp *l)
 {
+	device_t self;
 	struct fd_softc *fd =
-	device_lookup_private(_cd, FDUNIT(dev));
+	device_lookup_private_acquire(_cd, FDUNIT(dev), );
 
 	fd->sc_flags &= ~FD_OPEN;
 	fd->sc_opts &= ~(FDOPT_NORETRY|FDOPT_SILENT);
+	device_release(self);
 	return 0;
 }
 
@@ -1396,8 +1411,9 @@ fdcretry(struct fdc_softc *fdc)
 int
 fdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
 {
+	device_t self;
 	struct fd_softc *fd =
-	device_lookup_private(_cd, FDUNIT(dev));
+	device_lookup_private_acquire(_cd, FDUNIT(dev), );
 	struct fdformat_parms *form_parms;
 	struct fdformat_cmd *form_cmd;
 	struct ne7_fd_formb *fd_formb;
@@ -1426,20 +1442,25 @@ fdioctl(dev_t dev, u_long cmd, void *add
 		lp->d_secpercyl = fd->sc_type->seccyl;
 		lp->d_secperunit = fd->sc_type->size;
 
-		if (readdisklabel(dev, fdstrategy, lp, NULL) != NULL)
+		if (readdisklabel(dev, fdstrategy, lp, NULL) != NULL) {
+			device_release(self);
 			return EINVAL;
+		}
 		break;
 	}
 
 	error = disk_ioctl(>sc_dk, dev, cmd, addr, flag, l);
-	if (error != EPASSTHROUGH)
+	if (error != EPASSTHROUGH) {
+		device_release(self);
 		return error;
+	}
 
 	switch (cmd) {
 	case DIOCWLABEL:
 		if ((flag & FWRITE) == 0)
 			return EBADF;
 		/* XXX do something */
+		device_release(self);
 		return 0;
 
 	case DIOCWDINFO:
@@ -1447,8 +1468,10 @@ fdioctl(dev_t dev, u_long cmd, void *add
 	case ODIOCWDINFO:
 #endif
 	{
-		if ((flag & FWRITE) == 0)
+		if ((flag & FWRITE) == 0) {
+			device_release(self);
 			return EBADF;
+		}
 #ifdef __HAVE_OLD_DISKLABEL
 		if (cmd == ODIOCWDINFO) {
 			memset(, 0, sizeof newlabel);
@@ -1457,10 +1480,10 @@ fdioctl(dev_t dev, u_long cmd, void *add
 		}
 #endif
 		error = setdisklabel(lp, addr, 0, NULL);
-		if (error)
-			return error;
+		if (error == 0)
+			error = writedisklabel(dev, fdstrategy, lp, NULL);
 
-		error = writedisklabel(dev, fdstrategy, lp, NULL);
+		device_release(self);
 		return error;
 	}
 
@@ -1488,21 +1511,23 @@ fdioctl(dev_t dev, u_long cmd, void *add
 		default:
 			return EINVAL;
 		}
+		device_release(self);
 		return 0;
 
 	case FDIOCSETFORMAT:
 		if((flag & FWRITE) == 0)
 			return EBADF;	/* must be opened for writing */
 		form_parms = (struct fdformat_parms *)addr;

CVS commit: [pgoyette-localcount] src/sys/dev/isa

2016-07-24 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jul 25 03:30:52 UTC 2016

Modified Files:
src/sys/dev/isa [pgoyette-localcount]: fd.c isv.c mcd.c

Log Message:
Update a few drivers for localcount(9)


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.110.2.1 src/sys/dev/isa/fd.c
cvs rdiff -u -r1.7 -r1.7.8.1 src/sys/dev/isa/isv.c
cvs rdiff -u -r1.116 -r1.116.2.1 src/sys/dev/isa/mcd.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-24 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 24 10:44:57 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: cgd.c

Log Message:
Call device_release() in appropriate error paths.

In the module initialization code, make the bmajor/cmajor variables
global so they can be shared with the rump component initialization.


To generate a diff of this commit:
cvs rdiff -u -r1.108.2.12 -r1.108.2.13 src/sys/dev/cgd.c

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



CVS commit: [pgoyette-localcount] src/sys/dev

2016-07-24 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 24 10:44:57 UTC 2016

Modified Files:
src/sys/dev [pgoyette-localcount]: cgd.c

Log Message:
Call device_release() in appropriate error paths.

In the module initialization code, make the bmajor/cmajor variables
global so they can be shared with the rump component initialization.


To generate a diff of this commit:
cvs rdiff -u -r1.108.2.12 -r1.108.2.13 src/sys/dev/cgd.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/cgd.c
diff -u src/sys/dev/cgd.c:1.108.2.12 src/sys/dev/cgd.c:1.108.2.13
--- src/sys/dev/cgd.c:1.108.2.12	Sun Jul 24 00:14:08 2016
+++ src/sys/dev/cgd.c	Sun Jul 24 10:44:57 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.108.2.12 2016/07/24 00:14:08 pgoyette Exp $ */
+/* $NetBSD: cgd.c,v 1.108.2.13 2016/07/24 10:44:57 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.108.2.12 2016/07/24 00:14:08 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.108.2.13 2016/07/24 10:44:57 pgoyette Exp $");
 
 #include 
 #include 
@@ -179,6 +179,13 @@ static void	hexprint(const char *, void 
 
 /* The code */
 
+/*
+ * Lookup the device and return it's softc.  If the device doesn't
+ * exist, spawn it.
+ *
+ * In either case, the device is "acquired", and must be "released"
+ * by the caller after it is finished with the softc.
+ */
 static struct cgd_softc *
 getcgd_softc(dev_t dev, device_t *self)
 {
@@ -208,7 +215,9 @@ cgd_match(device_t self, cfdata_t cfdata
 static void
 cgd_attach(device_t parent, device_t self, void *aux)
 {
-	struct cgd_softc *sc = device_private(self);
+	struct cgd_softc *sc;
+
+	sc = device_private(self);
 
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_BIO);
 	dk_init(>sc_dksc, self, DKTYPE_CGD);
@@ -220,6 +229,10 @@ cgd_attach(device_t parent, device_t sel
 }
 
 
+/*
+ * The caller must hold a reference to the device's localcount.  the
+ * reference is released if the device is available for detach.
+ */
 static int
 cgd_detach(device_t self, int flags)
 {
@@ -238,6 +251,7 @@ cgd_detach(device_t self, int flags)
 	disk_destroy(>sc_dkdev);
 	mutex_destroy(>sc_lock);
 
+	device_release(self);
 	return 0;
 }
 
@@ -256,6 +270,7 @@ static struct cgd_softc *
 cgd_spawn(int unit, device_t *self)
 {
 	cfdata_t cf;
+	struct cgd_softc *sc;
 
 	cf = malloc(sizeof(*cf), M_DEVBUF, M_WAITOK);
 	cf->cf_name = cgd_cd.cd_name;
@@ -269,12 +284,14 @@ cgd_spawn(int unit, device_t *self)
 	*self = device_lookup_acquire(_cd, unit);
 	if (self == NULL)
 		return NULL;
-	else
+	else {
 		/*
 		 * Note that we return while still holding a reference
 		 * to the device!
 		 */
-		return device_private(*self);
+		sc = device_private(*self);
+		return sc;
+	}
 }
 
 static int
@@ -285,10 +302,10 @@ cgd_destroy(device_t dev)
 
 	cf = device_cfdata(dev);
 	error = config_detach(dev, DETACH_QUIET);
-	if (error)
-		return error;
-	free(cf, M_DEVBUF);
-	return 0;
+	if (error == 0)
+		free(cf, M_DEVBUF);
+
+	return error;
 }
 
 static int
@@ -325,11 +342,10 @@ cgdclose(dev_t dev, int flags, int fmt, 
 		if ((error = cgd_destroy(cs->sc_dksc.sc_dev)) != 0) {
 			aprint_error_dev(dksc->sc_dev,
 			"unable to detach instance\n");
-			device_release(self);
 			return error;
 		}
-	}
-	device_release(self);
+	} else
+		device_release(self);
 	return 0;
 }
 
@@ -597,8 +613,10 @@ cgdread(dev_t dev, struct uio *uio, int 
 	(unsigned long long)dev, uio, flags));
 	GETCGD_SOFTC(cs, dev, self);
 	dksc = >sc_dksc;
-	if (!DK_ATTACHED(dksc))
+	if (!DK_ATTACHED(dksc)) {
+		device_release(self);
 		return ENXIO;
+	}
 	error = physio(cgdstrategy, NULL, dev, B_READ, minphys, uio);
 	device_release(self);
 	return error;
@@ -1104,6 +1122,8 @@ MODULE(MODULE_CLASS_DRIVER, cgd, "dk_sub
 
 #ifdef _MODULE
 CFDRIVER_DECL(cgd, DV_DISK, NULL);
+
+devmajor_t cgd_bmajor = -1, cgd_cmajor = -1;
 #endif
 
 static int
@@ -,10 +1131,6 @@ cgd_modcmd(modcmd_t cmd, void *arg)
 {
 	int error = 0;
 
-#ifdef _MODULE
-	devmajor_t bmajor = -1, cmajor = -1;
-#endif
-
 	switch (cmd) {
 	case MODULE_CMD_INIT:
 #ifdef _MODULE
@@ -1133,8 +1149,8 @@ cgd_modcmd(modcmd_t cmd, void *arg)
 		/*
 		 * Attach the {b,c}devsw's
 		 */
-		error = devsw_attach("cgd", _bdevsw, ,
-		_cdevsw, );
+		error = devsw_attach("cgd", _bdevsw, _bmajor,
+		_cdevsw, _cmajor);
 
 		/*
 		 * If devsw_attach fails, remove from autoconf database
@@ -1161,8 +1177,8 @@ cgd_modcmd(modcmd_t cmd, void *arg)
 		 */
 		error = config_cfattach_detach(cgd_cd.cd_name, _ca);
 		if (error) {
-			error = devsw_attach("cgd", _bdevsw, ,
-			_cdevsw, );
+			error = devsw_attach("cgd", _bdevsw, _bmajor,
+			_cdevsw, _cmajor);
 			aprint_error("%s: failed to detach %s cfattach, "
 			"error %d\n", __func__, cgd_cd.cd_name, error);
 			break;
@@ -1170,8 +1186,8 @@ cgd_modcmd(modcmd_t cmd, void *arg)
 		

CVS commit: [pgoyette-localcount] src/sys/rump/dev/lib/libcgd

2016-07-24 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 24 10:37:10 UTC 2016

Modified Files:
src/sys/rump/dev/lib/libcgd [pgoyette-localcount]: cgd_component.c

Log Message:
since we're now attached the [bc]devsw's, grabbing the assigned majors,
and then detaching (in anticipation of the driver module doing its own
attach), we need to make sure that the driver name matches what is
expected in devsw_attach().  In particular, the driver name is "cgd"
and not "/dev/cgd0"  :)

While here, we might as well record the major numbers from the first
call, and just reuse them later.  So make the module's variables global,
and reference them in the rump initialization code.

Yay - cgd now works in the localcount world, both as a kernel module
and as a rump component.


To generate a diff of this commit:
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/rump/dev/lib/libcgd/cgd_component.c

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

Modified files:

Index: src/sys/rump/dev/lib/libcgd/cgd_component.c
diff -u src/sys/rump/dev/lib/libcgd/cgd_component.c:1.2.2.2 src/sys/rump/dev/lib/libcgd/cgd_component.c:1.2.2.3
--- src/sys/rump/dev/lib/libcgd/cgd_component.c:1.2.2.2	Sat Jul 23 07:41:14 2016
+++ src/sys/rump/dev/lib/libcgd/cgd_component.c	Sun Jul 24 10:37:10 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgd_component.c,v 1.2.2.2 2016/07/23 07:41:14 pgoyette Exp $	*/
+/*	$NetBSD: cgd_component.c,v 1.2.2.3 2016/07/24 10:37:10 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd_component.c,v 1.2.2.2 2016/07/23 07:41:14 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd_component.c,v 1.2.2.3 2016/07/24 10:37:10 pgoyette Exp $");
 
 #include 
 #include 
@@ -40,21 +40,21 @@ RUMP_COMPONENT(RUMP_COMPONENT_DEV)
 {
 	extern const struct bdevsw cgd_bdevsw;
 	extern const struct cdevsw cgd_cdevsw;
-	devmajor_t bmaj, cmaj;
+	extern devmajor_t cgd_bmajor, cgd_cmajor;
 	int error;
 
 	/* go, mydevfs */
-	bmaj = cmaj = -1;
 
-	if ((error = devsw_attach("/dev/cgd0", _bdevsw, ,
-	_cdevsw, )) != 0)
+	if ((error = devsw_attach("cgd", _bdevsw, _bmajor,
+	_cdevsw, _cmajor)) != 0)
 		panic("cannot attach cgd: %d", error);
 
 	if ((error = rump_vfs_makedevnodes(S_IFBLK, "/dev/cgd0", 'a',
-	bmaj, 0, 7)) != 0)
+	cgd_bmajor, 0, 7)) != 0)
 		panic("cannot create cooked cgd dev nodes: %d", error);
 	if ((error = rump_vfs_makedevnodes(S_IFCHR, "/dev/rcgd0", 'a',
-	cmaj, 0, 7)) != 0)
+	cgd_cmajor, 0, 7)) != 0)
 		panic("cannot create raw cgd dev nodes: %d", error);
+
 	devsw_detach(_bdevsw, _cdevsw);
 }



CVS commit: [pgoyette-localcount] src/sys/rump/dev/lib/libcgd

2016-07-24 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 24 10:37:10 UTC 2016

Modified Files:
src/sys/rump/dev/lib/libcgd [pgoyette-localcount]: cgd_component.c

Log Message:
since we're now attached the [bc]devsw's, grabbing the assigned majors,
and then detaching (in anticipation of the driver module doing its own
attach), we need to make sure that the driver name matches what is
expected in devsw_attach().  In particular, the driver name is "cgd"
and not "/dev/cgd0"  :)

While here, we might as well record the major numbers from the first
call, and just reuse them later.  So make the module's variables global,
and reference them in the rump initialization code.

Yay - cgd now works in the localcount world, both as a kernel module
and as a rump component.


To generate a diff of this commit:
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/rump/dev/lib/libcgd/cgd_component.c

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



CVS commit: [pgoyette-localcount] src/sys

2016-07-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 24 05:39:29 UTC 2016

Modified Files:
src/sys/kern [pgoyette-localcount]: subr_autoconf.c
src/sys/sys [pgoyette-localcount]: device.h

Log Message:
Add a device_acquire() for when we need to grab a reference and we
already have a pointer to the device.


To generate a diff of this commit:
cvs rdiff -u -r1.246.2.5 -r1.246.2.6 src/sys/kern/subr_autoconf.c
cvs rdiff -u -r1.149.2.2 -r1.149.2.3 src/sys/sys/device.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/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.246.2.5 src/sys/kern/subr_autoconf.c:1.246.2.6
--- src/sys/kern/subr_autoconf.c:1.246.2.5	Fri Jul 22 12:03:15 2016
+++ src/sys/kern/subr_autoconf.c	Sun Jul 24 05:39:29 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.246.2.5 2016/07/22 12:03:15 pgoyette Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.246.2.6 2016/07/24 05:39:29 pgoyette Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.246.2.5 2016/07/22 12:03:15 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.246.2.6 2016/07/24 05:39:29 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -2238,6 +2238,19 @@ config_alldevs_exit(struct alldevs_foray
 }
 
 /*
+ * device_acquire:
+ *
+ *	Acquire a reference to the device.
+ */
+void
+device_acquire(device_t dv)
+{
+
+	if (dv->dv_localcnt != NULL)
+		localcount_acquire(dv->dv_localcnt);
+}
+
+/*
  * device_lookup:
  *
  *	Look up a device instance for a given driver.
@@ -2274,7 +2287,7 @@ device_lookup_acquire(cfdriver_t cd, int
 	else if ((dv = cd->cd_devs[unit]) != NULL && dv->dv_del_gen != 0)
 		dv = NULL;
 	if (dv != NULL)
-		localcount_acquire(dv->dv_localcnt);
+		device_acquire(dv);
 	mutex_exit(_mtx);
 
 	return dv;
@@ -2284,7 +2297,7 @@ device_lookup_acquire(cfdriver_t cd, int
  * device_release:
  *
  *	Release the reference that was created by an earlier call to
- *	device_lookup_acquire().
+ *	device_acquire() or device_lookup_acquire().
  */
 void
 device_release(device_t dv)

Index: src/sys/sys/device.h
diff -u src/sys/sys/device.h:1.149.2.2 src/sys/sys/device.h:1.149.2.3
--- src/sys/sys/device.h:1.149.2.2	Sat Jul 16 22:06:42 2016
+++ src/sys/sys/device.h	Sun Jul 24 05:39:28 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.149.2.2 2016/07/16 22:06:42 pgoyette Exp $ */
+/* $NetBSD: device.h,v 1.149.2.3 2016/07/24 05:39:28 pgoyette Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -491,6 +491,7 @@ void	null_childdetached(device_t, device
 
 device_t	device_lookup(cfdriver_t, int);
 device_t	device_lookup_acquire(cfdriver_t, int);
+void		device_acquire(device_t);
 void		device_release(device_t);
 void		*device_lookup_private(cfdriver_t, int);
 void		*device_lookup_private_acquire(cfdriver_t, int);



CVS commit: [pgoyette-localcount] src/sys

2016-07-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 24 05:39:29 UTC 2016

Modified Files:
src/sys/kern [pgoyette-localcount]: subr_autoconf.c
src/sys/sys [pgoyette-localcount]: device.h

Log Message:
Add a device_acquire() for when we need to grab a reference and we
already have a pointer to the device.


To generate a diff of this commit:
cvs rdiff -u -r1.246.2.5 -r1.246.2.6 src/sys/kern/subr_autoconf.c
cvs rdiff -u -r1.149.2.2 -r1.149.2.3 src/sys/sys/device.h

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



  1   2   3   >