[patch] mtx_init() API violations

From: Don Lewis <truckman_at_FreeBSD.org>
Date: Thu, 27 Nov 2003 19:05:51 -0800 (PST)
It's a good thing that the value of MTX_DEF is 0 ;-)

This isn't a critical fix, but it probably should be done soon after the
code freeze is lifted to prevent the spread if infection via cut and
paste programming.

Index: dev/ata/ata-all.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-all.c,v
retrieving revision 1.197
diff -u -r1.197 ata-all.c
--- dev/ata/ata-all.c	11 Nov 2003 14:55:35 -0000	1.197
+++ dev/ata/ata-all.c	28 Nov 2003 01:34:26 -0000
_at__at_ -120,7 +120,7 _at__at_
     ch->dev = dev;
     ch->state = ATA_IDLE;
     bzero(&ch->queue_mtx, sizeof(struct mtx));
-    mtx_init(&ch->queue_mtx, "ATA queue lock", MTX_DEF, 0);
+    mtx_init(&ch->queue_mtx, "ATA queue lock", NULL, MTX_DEF);
     TAILQ_INIT(&ch->ata_queue);
 
     /* initialise device(s) on this channel */
Index: dev/ata/ata-disk.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-disk.c,v
retrieving revision 1.164
diff -u -r1.164 ata-disk.c
--- dev/ata/ata-disk.c	11 Nov 2003 14:55:35 -0000	1.164
+++ dev/ata/ata-disk.c	28 Nov 2003 01:35:05 -0000
_at__at_ -94,7 +94,7 _at__at_
 	adp->sectors = 17;
 	adp->heads = 8;
     }
-    mtx_init(&adp->queue_mtx, "ATA disk bioqueue lock", MTX_DEF, 0);
+    mtx_init(&adp->queue_mtx, "ATA disk bioqueue lock", NULL, MTX_DEF);
     bioq_init(&adp->queue);
 
     lbasize = (u_int32_t)atadev->param->lba_size_1 |
Index: dev/ata/atapi-cd.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/atapi-cd.c,v
retrieving revision 1.156
diff -u -r1.156 atapi-cd.c
--- dev/ata/atapi-cd.c	24 Nov 2003 14:20:19 -0000	1.156
+++ dev/ata/atapi-cd.c	28 Nov 2003 01:35:18 -0000
_at__at_ -222,7 +222,7 _at__at_
     if (!(cdp = malloc(sizeof(struct acd_softc), M_ACD, M_NOWAIT | M_ZERO)))
 	return NULL;
     bioq_init(&cdp->queue);
-    mtx_init(&cdp->queue_mtx, "ATAPI CD bioqueue lock", MTX_DEF, 0);
+    mtx_init(&cdp->queue_mtx, "ATAPI CD bioqueue lock", NULL, MTX_DEF);
     cdp->device = atadev;
     cdp->lun = ata_get_lun(&acd_lun_map);
     cdp->block_size = 2048;
Index: dev/ata/atapi-fd.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/atapi-fd.c,v
retrieving revision 1.89
diff -u -r1.89 atapi-fd.c
--- dev/ata/atapi-fd.c	11 Nov 2003 14:55:35 -0000	1.89
+++ dev/ata/atapi-fd.c	28 Nov 2003 01:35:28 -0000
_at__at_ -80,7 +80,7 _at__at_
     fdp->lun = ata_get_lun(&afd_lun_map);
     ata_set_name(atadev, "afd", fdp->lun);
     bioq_init(&fdp->queue);
-    mtx_init(&fdp->queue_mtx, "ATAPI FD bioqueue lock", MTX_DEF, 0);  
+    mtx_init(&fdp->queue_mtx, "ATAPI FD bioqueue lock", NULL, MTX_DEF);  
 
     if (afd_sense(fdp)) {
 	free(fdp, M_AFD);
Index: dev/ata/atapi-tape.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/atapi-tape.c,v
retrieving revision 1.84
diff -u -r1.84 atapi-tape.c
--- dev/ata/atapi-tape.c	11 Nov 2003 14:55:36 -0000	1.84
+++ dev/ata/atapi-tape.c	28 Nov 2003 01:35:46 -0000
_at__at_ -103,7 +103,7 _at__at_
     stp->lun = ata_get_lun(&ast_lun_map);
     ata_set_name(atadev, "ast", stp->lun);
     bioq_init(&stp->queue);
-    mtx_init(&stp->queue_mtx, "ATAPI TAPE bioqueue lock", MTX_DEF, 0);
+    mtx_init(&stp->queue_mtx, "ATAPI TAPE bioqueue lock", NULL, MTX_DEF);
 
     if (ast_sense(stp)) {
 	free(stp, M_AST);
Index: dev/led/led.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/led/led.c,v
retrieving revision 1.3
diff -u -r1.3 led.c
--- dev/led/led.c	23 Nov 2003 10:22:51 -0000	1.3
+++ dev/led/led.c	28 Nov 2003 01:35:59 -0000
_at__at_ -216,7 +216,7 _at__at_
 	struct sbuf *sb;
 
 	if (next_minor == 0) {
-		mtx_init(&led_mtx, "LED mtx", MTX_DEF, 0);
+		mtx_init(&led_mtx, "LED mtx", NULL, MTX_DEF);
 		timeout(led_timeout, NULL, hz / 10);
 	}
 
Index: dev/pst/pst-pci.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/pst/pst-pci.c,v
retrieving revision 1.5
diff -u -r1.5 pst-pci.c
--- dev/pst/pst-pci.c	24 Aug 2003 17:54:17 -0000	1.5
+++ dev/pst/pst-pci.c	28 Nov 2003 01:36:09 -0000
_at__at_ -96,7 +96,7 _at__at_
     sc->phys_ibase = vtophys(sc->ibase);
     sc->reg = (struct i2o_registers *)sc->ibase;
     sc->dev = dev;
-    mtx_init(&sc->mtx, "pst lock", MTX_DEF, 0);
+    mtx_init(&sc->mtx, "pst lock", NULL, MTX_DEF);
 
     if (!iop_init(sc))
 	return 0;
Index: dev/sound/pcm/sndstat.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/sound/pcm/sndstat.c,v
retrieving revision 1.14
diff -u -r1.14 sndstat.c
--- dev/sound/pcm/sndstat.c	7 Sep 2003 16:28:03 -0000	1.14
+++ dev/sound/pcm/sndstat.c	28 Nov 2003 01:36:21 -0000
_at__at_ -340,7 +340,7 _at__at_
 static int
 sndstat_init(void)
 {
-	mtx_init(&sndstat_lock, "sndstat", NULL, 0);
+	mtx_init(&sndstat_lock, "sndstat", NULL, MTX_DEF);
 	sndstat_dev = make_dev(&sndstat_cdevsw, SND_DEV_STATUS, UID_ROOT, GID_WHEEL, 0444, "sndstat");
 
 	return (sndstat_dev != 0)? 0 : ENXIO;
Index: geom/geom_disk.c
===================================================================
RCS file: /home/ncvs/src/sys/geom/geom_disk.c,v
retrieving revision 1.80
diff -u -r1.80 geom_disk.c
--- geom/geom_disk.c	18 Oct 2003 17:53:34 -0000	1.80
+++ geom/geom_disk.c	28 Nov 2003 01:36:31 -0000
_at__at_ -72,7 +72,7 _at__at_
 g_disk_init(struct g_class *mp __unused)
 {
 
-	mtx_init(&g_disk_done_mtx, "g_disk_done", MTX_DEF, 0);
+	mtx_init(&g_disk_done_mtx, "g_disk_done", NULL, MTX_DEF);
 }
 
 static void
Index: geom/geom_io.c
===================================================================
RCS file: /home/ncvs/src/sys/geom/geom_io.c,v
retrieving revision 1.50
diff -u -r1.50 geom_io.c
--- geom/geom_io.c	22 Oct 2003 06:32:20 -0000	1.50
+++ geom/geom_io.c	28 Nov 2003 01:39:03 -0000
_at__at_ -313,7 +313,7 _at__at_
 	struct mtx mymutex;
  
 	bzero(&mymutex, sizeof mymutex);
-	mtx_init(&mymutex, "g_xdown", MTX_DEF, 0);
+	mtx_init(&mymutex, "g_xdown", NULL, MTX_DEF);
 
 	for(;;) {
 		g_bioq_lock(&g_bio_run_down);
_at__at_ -365,7 +365,7 _at__at_
 	struct mtx mymutex;
  
 	bzero(&mymutex, sizeof mymutex);
-	mtx_init(&mymutex, "g_xup", MTX_DEF, 0);
+	mtx_init(&mymutex, "g_xup", NULL, MTX_DEF);
 	for(;;) {
 		g_bioq_lock(&g_bio_run_up);
 		bp = g_bioq_first(&g_bio_run_up);
Index: kern/subr_mbpool.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/subr_mbpool.c,v
retrieving revision 1.1
diff -u -r1.1 subr_mbpool.c
--- kern/subr_mbpool.c	15 Jul 2003 08:59:37 -0000	1.1
+++ kern/subr_mbpool.c	28 Nov 2003 01:36:53 -0000
_at__at_ -138,7 +138,7 _at__at_
 	(*pp)->nchunks = nchunks;
 
 	SLIST_INIT(&(*pp)->free_list);
-	mtx_init(&(*pp)->free_lock, name, NULL, 0);
+	mtx_init(&(*pp)->free_lock, name, NULL, MTX_DEF);
 
 	return (0);
 }
Index: kern/subr_mbuf.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/subr_mbuf.c,v
retrieving revision 1.56
diff -u -r1.56 subr_mbuf.c
--- kern/subr_mbuf.c	21 Oct 2003 18:28:34 -0000	1.56
+++ kern/subr_mbuf.c	28 Nov 2003 01:39:38 -0000
_at__at_ -426,7 +426,7 _at__at_
 	/*
 	 * Initialize condition variables and general container mutex locks.
 	 */
-	mtx_init(&mbuf_gen, "mbuf subsystem general lists lock", NULL, 0);
+	mtx_init(&mbuf_gen, "mbuf subsystem general lists lock", NULL, MTX_DEF);
 	cv_init(&(mb_list_mbuf.ml_genlist->mgl_mstarved), "mbuf pool starved");
 	cv_init(&(mb_list_clust.ml_genlist->mgl_mstarved),
 	    "mcluster pool starved");
_at__at_ -491,7 +491,7 _at__at_
 		    (mb_list_clust.ml_cntlst[i] == NULL))
 			goto bad;
 
-		mtx_init(&mbuf_pcpu[i], "mbuf PCPU list lock", NULL, 0);
+		mtx_init(&mbuf_pcpu[i], "mbuf PCPU list lock", NULL, MTX_DEF);
 		mb_list_mbuf.ml_cntlst[i]->mb_cont.mc_lock =
 		    mb_list_clust.ml_cntlst[i]->mb_cont.mc_lock = &mbuf_pcpu[i];
 
Index: netgraph/atm/ngatmbase.c
===================================================================
RCS file: /home/ncvs/src/sys/netgraph/atm/ngatmbase.c,v
retrieving revision 1.1
diff -u -r1.1 ngatmbase.c
--- netgraph/atm/ngatmbase.c	24 Oct 2003 07:39:11 -0000	1.1
+++ netgraph/atm/ngatmbase.c	28 Nov 2003 01:37:11 -0000
_at__at_ -75,7 +75,8 _at__at_
 static void
 uni_msg_init(void)
 {
-	mtx_init(&ngatm_unilist_mtx, "netgraph UNI msg header lists", NULL, 0);
+	mtx_init(&ngatm_unilist_mtx, "netgraph UNI msg header lists", NULL,
+	    MTX_DEF);
 }
 
 /*
Index: netgraph/ng_base.c
===================================================================
RCS file: /home/ncvs/src/sys/netgraph/ng_base.c,v
retrieving revision 1.72
diff -u -r1.72 ng_base.c
--- netgraph/ng_base.c	8 Nov 2003 22:28:39 -0000	1.72
+++ netgraph/ng_base.c	28 Nov 2003 01:37:52 -0000
_at__at_ -2981,10 +2981,14 _at__at_
 	case MOD_LOAD:
 		/* Register line discipline */
 		mtx_init(&ng_worklist_mtx, "ng_worklist", NULL, MTX_SPIN);
-		mtx_init(&ng_typelist_mtx, "netgraph types mutex", NULL, 0);
-		mtx_init(&ng_nodelist_mtx, "netgraph nodelist mutex", NULL, 0);
-		mtx_init(&ng_idhash_mtx, "netgraph idhash mutex", NULL, 0);
-		mtx_init(&ngq_mtx, "netgraph free item list mutex", NULL, 0);
+		mtx_init(&ng_typelist_mtx, "netgraph types mutex", NULL,
+		    MTX_DEF);
+		mtx_init(&ng_nodelist_mtx, "netgraph nodelist mutex", NULL,
+		    MTX_DEF);
+		mtx_init(&ng_idhash_mtx, "netgraph idhash mutex", NULL,
+		    MTX_DEF);
+		mtx_init(&ngq_mtx, "netgraph free item list mutex", NULL,
+		    MTX_DEF);
 		s = splimp();
 		/* XXX could use NETISR_MPSAFE but need to verify code */
 		netisr_register(NETISR_NETGRAPH, (netisr_t *)ngintr, NULL, 0);
Received on Thu Nov 27 2003 - 18:06:03 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:31 UTC