summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-12-25 23:02:27 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-12-25 23:02:27 +0000
commitf817c58ea799274eb832d25dc61acb5955f9b2d9 (patch)
treed81a72a842cf99a20e3b22543a17b8e53ad25961 /sys
parentf1b1a2a9897fb5e4903d7922e7d05f99ad07b847 (diff)
Use list and queue macros where applicable to make the code easier to read;
no functional change.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/alpha/autoconf.c7
-rw-r--r--sys/arch/alpha/dev/bus_dma.c8
-rw-r--r--sys/arch/alpha/dev/shared_intr.c11
-rw-r--r--sys/arch/amd64/amd64/autoconf.c4
-rw-r--r--sys/arch/amd64/amd64/dkcsum.c4
-rw-r--r--sys/arch/arm/arm/bus_dma.c8
-rw-r--r--sys/arch/arm/arm/pmap.c4
-rw-r--r--sys/arch/cats/cats/autoconf.c7
-rw-r--r--sys/arch/hp300/dev/dma.c5
-rw-r--r--sys/arch/hp300/dev/fhpib.c8
-rw-r--r--sys/arch/hp300/dev/hpib.c8
-rw-r--r--sys/arch/hp300/dev/mb89352.c4
-rw-r--r--sys/arch/hp300/dev/nhpib.c8
-rw-r--r--sys/arch/hp300/hp300/autoconf.c43
-rw-r--r--sys/arch/hp300/hp300/intr.c16
-rw-r--r--sys/arch/hppa/hppa/autoconf.c7
-rw-r--r--sys/arch/i386/i386/dkcsum.c4
-rw-r--r--sys/arch/i386/i386/pmap.c20
-rw-r--r--sys/arch/i386/isa/ahc_isa.c5
-rw-r--r--sys/arch/luna88k/dev/mb89352.c4
-rw-r--r--sys/arch/luna88k/luna88k/autoconf.c7
-rw-r--r--sys/arch/luna88k/luna88k/isr.c4
-rw-r--r--sys/arch/m68k/m68k/pmap_motorola.c4
-rw-r--r--sys/arch/mac68k/mac68k/autoconf.c9
-rw-r--r--sys/arch/macppc/dev/mesh.c30
-rw-r--r--sys/arch/macppc/dev/snapper.c4
-rw-r--r--sys/arch/macppc/macppc/autoconf.c13
-rw-r--r--sys/arch/mips64/mips64/busdma.c8
-rw-r--r--sys/arch/mvme68k/dev/sbic.c19
-rw-r--r--sys/arch/mvme68k/dev/ssh.c50
-rw-r--r--sys/arch/mvme68k/mvme68k/autoconf.c7
-rw-r--r--sys/arch/mvme88k/mvme88k/autoconf.c7
-rw-r--r--sys/arch/mvme88k/mvme88k/bus_dma.c8
-rw-r--r--sys/arch/mvmeppc/mvmeppc/autoconf.c13
-rw-r--r--sys/arch/mvmeppc/mvmeppc/bus_dma.c8
-rw-r--r--sys/arch/sgi/sgi/autoconf.c11
-rw-r--r--sys/arch/sparc/dev/fd.c18
-rw-r--r--sys/arch/sparc/sparc/autoconf.c14
-rw-r--r--sys/arch/sparc/sparc/pmap.c16
-rw-r--r--sys/arch/sparc64/dev/iommu.c4
-rw-r--r--sys/arch/sparc64/sparc64/autoconf.c11
-rw-r--r--sys/arch/sparc64/sparc64/db_interface.c8
-rw-r--r--sys/arch/vax/if/if_de.c4
-rw-r--r--sys/arch/vax/uba/uba.c4
-rw-r--r--sys/arch/vax/uba/uda.c6
-rw-r--r--sys/arch/vax/vax/bus_dma.c8
-rw-r--r--sys/arch/vax/vax/rootfil.c7
47 files changed, 228 insertions, 259 deletions
diff --git a/sys/arch/alpha/alpha/autoconf.c b/sys/arch/alpha/alpha/autoconf.c
index 8e5ec66fb15..bcc44dcd3f7 100644
--- a/sys/arch/alpha/alpha/autoconf.c
+++ b/sys/arch/alpha/alpha/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.23 2004/07/18 02:29:11 deraadt Exp $ */
+/* $OpenBSD: autoconf.c,v 1.24 2004/12/25 23:02:21 miod Exp $ */
/* $NetBSD: autoconf.c,v 1.16 1996/11/13 21:13:04 cgd Exp $ */
/*
@@ -203,8 +203,7 @@ getdisk(str, len, defpart, devp)
#ifdef RAMDISK_HOOKS
printf(" %s[a-p]", fakerdrootdev.dv_xname);
#endif
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK)
printf(" %s[a-p]", dv->dv_xname);
#ifdef NFSCLIENT
@@ -247,7 +246,7 @@ parsedisk(str, len, defpart, devp)
goto gotdisk;
}
#endif
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
#ifdef RAMDISK_HOOKS
diff --git a/sys/arch/alpha/dev/bus_dma.c b/sys/arch/alpha/dev/bus_dma.c
index f915392f560..e29526e7afb 100644
--- a/sys/arch/alpha/dev/bus_dma.c
+++ b/sys/arch/alpha/dev/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.13 2004/11/09 19:17:00 claudio Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.14 2004/12/25 23:02:23 miod Exp $ */
/* $NetBSD: bus_dma.c,v 1.40 2000/07/17 04:47:56 thorpej Exp $ */
/*-
@@ -501,13 +501,13 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
* Compute the location, size, and number of segments actually
* returned by the VM code.
*/
- m = mlist.tqh_first;
+ m = TAILQ_FIRST(&mlist);
curseg = 0;
lastaddr = segs[curseg].ds_addr = VM_PAGE_TO_PHYS(m);
segs[curseg].ds_len = PAGE_SIZE;
- m = m->pageq.tqe_next;
+ m = TAILQ_NEXT(m, pageq);
- for (; m != NULL; m = m->pageq.tqe_next) {
+ for (; m != TAILQ_END(&mlist); m = TAILQ_NEXT(m, pageq)) {
curaddr = VM_PAGE_TO_PHYS(m);
#ifdef DIAGNOSTIC
if (curaddr < avail_start || curaddr >= high) {
diff --git a/sys/arch/alpha/dev/shared_intr.c b/sys/arch/alpha/dev/shared_intr.c
index 31f78bb877c..626231f45ab 100644
--- a/sys/arch/alpha/dev/shared_intr.c
+++ b/sys/arch/alpha/dev/shared_intr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: shared_intr.c,v 1.12 2004/06/28 02:28:42 aaron Exp $ */
+/* $OpenBSD: shared_intr.c,v 1.13 2004/12/25 23:02:23 miod Exp $ */
/* $NetBSD: shared_intr.c,v 1.13 2000/03/19 01:46:18 thorpej Exp $ */
/*
@@ -95,10 +95,8 @@ alpha_shared_intr_dispatch(intr, num)
struct alpha_shared_intrhand *ih;
int rv, handled;
- ih = intr[num].intr_q.tqh_first;
handled = 0;
- while (ih != NULL) {
-
+ TAILQ_FOREACH(ih, &intr[num].intr_q, ih_q) {
/*
* The handler returns one of three values:
* 0: This interrupt wasn't for me.
@@ -110,7 +108,6 @@ alpha_shared_intr_dispatch(intr, num)
ih->ih_count.ec_count++;
handled = handled || (rv != 0);
- ih = ih->ih_q.tqe_next;
}
return (handled);
@@ -150,7 +147,7 @@ alpha_shared_intr_establish(intr, num, type, level, fn, arg, basename)
break;
case IST_PULSE:
if (type != IST_NONE) {
- if (intr[num].intr_q.tqh_first == NULL) {
+ if (TAILQ_EMPTY(&intr[num].intr_q)) {
printf("alpha_shared_intr_establish: %s %d: warning: using %s on %s\n",
basename, num, intr_typename(type),
intr_typename(intr[num].intr_sharetype));
@@ -215,7 +212,7 @@ alpha_shared_intr_isactive(intr, num)
unsigned int num;
{
- return (intr[num].intr_q.tqh_first != NULL);
+ return (!TAILQ_EMPTY(&intr[num].intr_q));
}
void
diff --git a/sys/arch/amd64/amd64/autoconf.c b/sys/arch/amd64/amd64/autoconf.c
index bb4460b45e9..f8c96978724 100644
--- a/sys/arch/amd64/amd64/autoconf.c
+++ b/sys/arch/amd64/amd64/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.7 2004/10/23 08:21:26 mjc Exp $ */
+/* $OpenBSD: autoconf.c,v 1.8 2004/12/25 23:02:23 miod Exp $ */
/* $NetBSD: autoconf.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */
/*-
@@ -192,7 +192,7 @@ parsedisk(str, len, defpart, devp)
}
#endif
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
#ifdef RAMDISK_HOOKS
diff --git a/sys/arch/amd64/amd64/dkcsum.c b/sys/arch/amd64/amd64/dkcsum.c
index 8757875fb45..ab2d1582076 100644
--- a/sys/arch/amd64/amd64/dkcsum.c
+++ b/sys/arch/amd64/amd64/dkcsum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dkcsum.c,v 1.2 2004/08/11 18:51:04 millert Exp $ */
+/* $OpenBSD: dkcsum.c,v 1.3 2004/12/25 23:02:23 miod Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -76,7 +76,7 @@ dkcsumattach(void)
*/
bp = geteblk(bios_cksumlen * DEV_BSIZE); /* XXX error check? */
- for (dv = alldevs.tqh_first; dv; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class != DV_DISK)
continue;
diff --git a/sys/arch/arm/arm/bus_dma.c b/sys/arch/arm/arm/bus_dma.c
index 4ffea490cad..81e13a54251 100644
--- a/sys/arch/arm/arm/bus_dma.c
+++ b/sys/arch/arm/arm/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.3 2004/11/09 19:17:01 claudio Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.4 2004/12/25 23:02:23 miod Exp $ */
/* $NetBSD: bus_dma.c,v 1.38 2003/10/30 08:44:13 scw Exp $ */
/*-
@@ -995,16 +995,16 @@ _bus_dmamem_alloc_range(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment,
* Compute the location, size, and number of segments actually
* returned by the VM code.
*/
- m = mlist.tqh_first;
+ m = TAILQ_FIRST(&mlist);
curseg = 0;
lastaddr = segs[curseg].ds_addr = VM_PAGE_TO_PHYS(m);
segs[curseg].ds_len = PAGE_SIZE;
#ifdef DEBUG_DMA
printf("alloc: page %lx\n", lastaddr);
#endif /* DEBUG_DMA */
- m = m->pageq.tqe_next;
+ m = TAILQ_NEXT(m, pageq);
- for (; m != NULL; m = m->pageq.tqe_next) {
+ for (; m != TAILQ_END(&mlist); m = TAILQ_NEXT(m, pageq)) {
curaddr = VM_PAGE_TO_PHYS(m);
#ifdef DIAGNOSTIC
if (curaddr < low || curaddr >= high) {
diff --git a/sys/arch/arm/arm/pmap.c b/sys/arch/arm/arm/pmap.c
index 26d5b983d35..002716502d4 100644
--- a/sys/arch/arm/arm/pmap.c
+++ b/sys/arch/arm/arm/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.2 2004/02/01 06:10:33 drahn Exp $ */
+/* $OpenBSD: pmap.c,v 1.3 2004/12/25 23:02:23 miod Exp $ */
/* $NetBSD: pmap.c,v 1.147 2004/01/18 13:03:50 scw Exp $ */
/*
@@ -4230,7 +4230,7 @@ pmap_postinit(void)
cpu_tlb_flushD_SE(va);
va += PAGE_SIZE;
- m = m->pageq.tqe_next;
+ m = TAILQ_NEXT(m, pageq);
}
#ifdef DIAGNOSTIC
diff --git a/sys/arch/cats/cats/autoconf.c b/sys/arch/cats/cats/autoconf.c
index 0209522ec52..dfb7307bca5 100644
--- a/sys/arch/cats/cats/autoconf.c
+++ b/sys/arch/cats/cats/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.3 2004/02/12 02:32:34 drahn Exp $ */
+/* $OpenBSD: autoconf.c,v 1.4 2004/12/25 23:02:23 miod Exp $ */
/* $NetBSD: autoconf.c,v 1.2 2001/09/05 16:17:36 matt Exp $ */
/*
@@ -150,8 +150,7 @@ getdisk(char *str, int len, int defpart, dev_t *devp)
if ((dv = parsedisk(str, len, defpart, devp)) == NULL) {
printf("use one of:");
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK)
printf(" %s[a-p]", dv->dv_xname);
#ifdef NFSCLIENT
@@ -181,7 +180,7 @@ parsedisk(char *str, int len, int defpart, dev_t *devp)
} else
part = defpart;
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
majdev = findblkmajor(dv);
diff --git a/sys/arch/hp300/dev/dma.c b/sys/arch/hp300/dev/dma.c
index ba2a7cbeba4..15c1f722591 100644
--- a/sys/arch/hp300/dev/dma.c
+++ b/sys/arch/hp300/dev/dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dma.c,v 1.15 2004/12/16 16:48:44 miod Exp $ */
+/* $OpenBSD: dma.c,v 1.16 2004/12/25 23:02:23 miod Exp $ */
/* $NetBSD: dma.c,v 1.19 1997/05/05 21:02:39 thorpej Exp $ */
/*
@@ -310,8 +310,7 @@ dmafree(dq)
*/
dc->dm_job = NULL;
chan = 1 << unit;
- for (dn = sc->sc_queue.tqh_first; dn != NULL;
- dn = dn->dq_list.tqe_next) {
+ TAILQ_FOREACH(dn, &sc->sc_queue, dq_list) {
if (dn->dq_chan & chan) {
/* Found one... */
TAILQ_REMOVE(&sc->sc_queue, dn, dq_list);
diff --git a/sys/arch/hp300/dev/fhpib.c b/sys/arch/hp300/dev/fhpib.c
index c3dcfbf8c20..2bf82aea1fe 100644
--- a/sys/arch/hp300/dev/fhpib.c
+++ b/sys/arch/hp300/dev/fhpib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fhpib.c,v 1.13 2004/09/29 07:35:52 miod Exp $ */
+/* $OpenBSD: fhpib.c,v 1.14 2004/12/25 23:02:23 miod Exp $ */
/* $NetBSD: fhpib.c,v 1.18 1997/05/05 21:04:16 thorpej Exp $ */
/*
@@ -466,7 +466,7 @@ fhpibdmadone(arg)
hs->sc_flags &= ~(HPIBF_DONE|HPIBF_IO|HPIBF_READ|HPIBF_TIMO);
dmafree(hs->sc_dq);
- hq = hs->sc_queue.tqh_first;
+ hq = TAILQ_FIRST(&hs->sc_queue);
(hq->hq_intr)(hq->hq_softc);
}
splx(s);
@@ -546,7 +546,7 @@ fhpibintr(arg)
if ((fhpibdebug & FDB_DMA) && fhpibdebugunit == sc->sc_dev.dv_unit)
printf("fhpibintr: flags %x\n", hs->sc_flags);
#endif
- hq = hs->sc_queue.tqh_first;
+ hq = TAILQ_FIRST(&hs->sc_queue);
if (hs->sc_flags & HPIBF_IO) {
if (hs->sc_flags & HPIBF_TIMO)
timeout_del(&sc->sc_dma_to);
@@ -651,7 +651,7 @@ fhpibppwatch(arg)
if ((hs->sc_flags & HPIBF_PPOLL) == 0)
return;
- slave = (0x80 >> hs->sc_queue.tqh_first->hq_slave);
+ slave = (0x80 >> TAILQ_FIRST(&hs->sc_queue)->hq_slave);
#ifdef DEBUG
if (!doppollint) {
if (fhpibppoll(hs) & slave) {
diff --git a/sys/arch/hp300/dev/hpib.c b/sys/arch/hp300/dev/hpib.c
index 3ef5983265f..d972d9d315e 100644
--- a/sys/arch/hp300/dev/hpib.c
+++ b/sys/arch/hp300/dev/hpib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hpib.c,v 1.10 2003/06/02 23:27:44 millert Exp $ */
+/* $OpenBSD: hpib.c,v 1.11 2004/12/25 23:02:24 miod Exp $ */
/* $NetBSD: hpib.c,v 1.16 1997/04/27 20:58:57 thorpej Exp $ */
/*
@@ -262,7 +262,7 @@ hpibreq(pdev, hq)
TAILQ_INSERT_TAIL(&sc->sc_queue, hq, hq_list);
splx(s);
- if (sc->sc_queue.tqh_first == hq)
+ if (TAILQ_FIRST(&sc->sc_queue) == hq)
return (1);
return (0);
@@ -280,7 +280,7 @@ hpibfree(pdev, hq)
TAILQ_REMOVE(&sc->sc_queue, hq, hq_list);
splx(s);
- if ((hq = sc->sc_queue.tqh_first) != NULL)
+ if ((hq = TAILQ_FIRST(&sc->sc_queue)) != NULL)
(*hq->hq_start)(hq->hq_softc);
}
@@ -394,7 +394,7 @@ hpibstart(arg)
struct hpibbus_softc *sc = arg;
struct hpibqueue *hq;
- hq = sc->sc_queue.tqh_first;
+ hq = TAILQ_FIRST(&sc->sc_queue);
(*hq->hq_go)(hq->hq_softc);
}
diff --git a/sys/arch/hp300/dev/mb89352.c b/sys/arch/hp300/dev/mb89352.c
index a80fd43f805..9f0de06a403 100644
--- a/sys/arch/hp300/dev/mb89352.c
+++ b/sys/arch/hp300/dev/mb89352.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mb89352.c,v 1.11 2004/12/22 21:11:12 miod Exp $ */
+/* $OpenBSD: mb89352.c,v 1.12 2004/12/25 23:02:24 miod Exp $ */
/* $NetBSD: mb89352.c,v 1.5 2000/03/23 07:01:31 thorpej Exp $ */
/* NecBSD: mb89352.c,v 1.4 1998/03/14 07:31:20 kmatsuda Exp */
@@ -341,7 +341,7 @@ spc_free_acb(struct spc_softc *sc, struct spc_acb *acb, int flags)
* If there were none, wake anybody waiting for one to come free,
* starting with queued entries.
*/
- if (acb->chain.tqe_next == 0)
+ if (TAILQ_NEXT(acb, chain) == NULL)
wakeup(&sc->free_list);
splx(s);
diff --git a/sys/arch/hp300/dev/nhpib.c b/sys/arch/hp300/dev/nhpib.c
index 9cd0f88c727..3053f999a03 100644
--- a/sys/arch/hp300/dev/nhpib.c
+++ b/sys/arch/hp300/dev/nhpib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nhpib.c,v 1.13 2004/09/29 07:35:52 miod Exp $ */
+/* $OpenBSD: nhpib.c,v 1.14 2004/12/25 23:02:24 miod Exp $ */
/* $NetBSD: nhpib.c,v 1.17 1997/05/05 21:06:41 thorpej Exp $ */
/*
@@ -411,7 +411,7 @@ nhpibreadtimo(arg)
hs->sc_flags &= ~(HPIBF_DONE|HPIBF_IO|HPIBF_READ|HPIBF_TIMO);
dmafree(hs->sc_dq);
- hq = hs->sc_queue.tqh_first;
+ hq = TAILQ_FIRST(&hs->sc_queue);
(hq->hq_intr)(hq->hq_softc);
}
splx(s);
@@ -467,7 +467,7 @@ nhpibintr(arg)
stat0 = hd->hpib_mis;
stat1 = hd->hpib_lis;
- hq = hs->sc_queue.tqh_first;
+ hq = TAILQ_FIRST(&hs->sc_queue);
if (hs->sc_flags & HPIBF_IO) {
hd->hpib_mim = 0;
@@ -545,7 +545,7 @@ nhpibppwatch(arg)
if ((hs->sc_flags & HPIBF_PPOLL) == 0)
return;
again:
- if (nhpibppoll(hs) & (0x80 >> hs->sc_queue.tqh_first->hq_slave))
+ if (nhpibppoll(hs) & (0x80 >> TAILQ_FIRST(&hs->sc_queue)->hq_slave))
sc->sc_regs->hpib_mim = MIS_BO;
else if (cold)
/* timeouts not working yet */
diff --git a/sys/arch/hp300/hp300/autoconf.c b/sys/arch/hp300/hp300/autoconf.c
index 20140db6314..7c57c118bde 100644
--- a/sys/arch/hp300/hp300/autoconf.c
+++ b/sys/arch/hp300/hp300/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.26 2004/08/03 21:46:58 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.27 2004/12/25 23:02:24 miod Exp $ */
/* $NetBSD: autoconf.c,v 1.45 1999/04/10 17:31:02 kleink Exp $ */
/*
@@ -460,8 +460,7 @@ getdisk(str, len, defpart, devp)
if ((dv = parsedisk(str, len, defpart, devp)) == NULL) {
printf("use one of:");
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK)
printf(" %s[a-p]", dv->dv_xname);
#ifdef NFSCLIENT
@@ -498,7 +497,7 @@ parsedisk(str, len, defpart, devp)
} else
part = defpart;
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
majdev = findblkmajor(dv);
@@ -683,8 +682,7 @@ setroot()
* `root on nfs'. Find the first network
* interface.
*/
- for (dd = dev_data_list.lh_first;
- dd != NULL; dd = dd->dd_list.le_next) {
+ LIST_FOREACH(dd, &dev_data_list, dd_list) {
if (dd->dd_dev->dv_class == DV_IFNET) {
/* Got it! */
break;
@@ -707,8 +705,7 @@ setroot()
snprintf(buf, sizeof buf, "%s%d", rootdevname,
DISKUNIT(rootdev));
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (strcmp(buf, dv->dv_xname) == 0) {
root_device = dv;
break;
@@ -842,8 +839,7 @@ findbootdev()
* always starts at scode 0 and works its way up.
*/
if (netboot) {
- for (dd = dev_data_list.lh_first; dd != NULL;
- dd = dd->dd_list.le_next) {
+ LIST_FOREACH(dd, &dev_data_list, dd_list) {
if (dd->dd_dev->dv_class == DV_IFNET) {
/*
* Found it!
@@ -918,8 +914,8 @@ findbootdev_slave(ddlist, ctlr, slave, punit)
/*
* Find the booted controller.
*/
- for (cdd = ddlist->lh_first; ctlr != 0 && cdd != NULL;
- cdd = cdd->dd_clist.le_next)
+ for (cdd = LIST_FIRST(ddlist); ctlr != 0 && cdd != LIST_END(ddlist);
+ cdd = LIST_NEXT(cdd, dd_clist))
ctlr--;
if (cdd == NULL) {
/*
@@ -932,8 +928,7 @@ findbootdev_slave(ddlist, ctlr, slave, punit)
* Now find the device with the right slave/punit
* that's a child of the controller.
*/
- for (dd = dev_data_list.lh_first; dd != NULL;
- dd = dd->dd_list.le_next) {
+ LIST_FOREACH(dd, &dev_data_list, dd_list) {
/*
* "sd" / "st" / "cd" -> "scsibus" -> "spc"
* "hd" -> "hpibbus" -> "fhpib"
@@ -1015,8 +1010,9 @@ setbootdev()
* "hd" -> "hpibbus" -> "fhpib"
* "sd" / "cd" / "st" -> "scsibus" -> "spc"
*/
- for (cdd = dev_data_list_hpib.lh_first, ctlr = 0;
- cdd != NULL; cdd = cdd->dd_clist.le_next, ctlr++) {
+ for (cdd = LIST_FIRST(&dev_data_list_hpib), ctlr = 0;
+ cdd != LIST_END(&dev_data_list_hpib);
+ cdd = LIST_NEXT(cdd, dd_clist), ctlr++) {
if (cdd->dd_dev == root_device->dv_parent->dv_parent) {
/*
* Found it!
@@ -1029,9 +1025,10 @@ setbootdev()
out:
/* Don't need this anymore. */
- for (dd = dev_data_list.lh_first; dd != NULL; ) {
+ for (dd = LIST_FIRST(&dev_data_list);
+ dd != LIST_END(&dev_data_list); ) {
cdd = dd;
- dd = dd->dd_list.le_next;
+ dd = LIST_NEXT(dd, dd_list);
free(cdd, M_DEVBUF);
}
}
@@ -1045,7 +1042,7 @@ dev_data_lookup(dev)
{
struct dev_data *dd;
- for (dd = dev_data_list.lh_first; dd != NULL; dd = dd->dd_list.le_next)
+ LIST_FOREACH(dd, &dev_data_list, dd_list)
if (dd->dd_dev == dev)
return (dd);
@@ -1068,12 +1065,10 @@ dev_data_insert(dd, ddlist)
}
#endif
- de = ddlist->lh_first;
-
/*
* Just insert at head if list is empty.
*/
- if (de == NULL) {
+ if (LIST_EMPTY(ddlist)) {
LIST_INSERT_HEAD(ddlist, dd, dd_clist);
return;
}
@@ -1083,7 +1078,9 @@ dev_data_insert(dd, ddlist)
* is greater than ours. When we find it, insert ourselves
* into the list before it.
*/
- for (; de->dd_clist.le_next != NULL; de = de->dd_clist.le_next) {
+ for (de = LIST_FIRST(ddlist);
+ LIST_NEXT(de, dd_clist) != LIST_END(ddlist);
+ de = LIST_NEXT(de, dd_clist)) {
if (de->dd_scode > dd->dd_scode) {
LIST_INSERT_BEFORE(de, dd, dd_clist);
return;
diff --git a/sys/arch/hp300/hp300/intr.c b/sys/arch/hp300/hp300/intr.c
index d1b3c4d3933..41cc5a693e7 100644
--- a/sys/arch/hp300/hp300/intr.c
+++ b/sys/arch/hp300/hp300/intr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.c,v 1.14 2004/12/24 22:50:29 miod Exp $ */
+/* $OpenBSD: intr.c,v 1.15 2004/12/25 23:02:24 miod Exp $ */
/* $NetBSD: intr.c,v 1.5 1998/02/16 20:58:30 thorpej Exp $ */
/*-
@@ -100,8 +100,7 @@ intr_computeipl()
(PSL_S|PSL_IPL3);
for (ipl = 0; ipl < NISR; ipl++) {
- for (isr = isr_list[ipl].lh_first; isr != NULL;
- isr = isr->isr_link.le_next) {
+ LIST_FOREACH(isr, &isr_list[ipl], isr_link) {
/*
* Bump up the level for a given priority,
* if necessary.
@@ -191,7 +190,7 @@ intr_establish(struct isr *isr, const char *name)
* at the head of the list.
*/
list = &isr_list[isr->isr_ipl];
- if (list->lh_first == NULL) {
+ if (LIST_EMPTY(list)) {
LIST_INSERT_HEAD(list, isr, isr_link);
goto compute;
}
@@ -201,8 +200,9 @@ intr_establish(struct isr *isr, const char *name)
* and place ourselves after any ISRs with our current (or
* higher) priority.
*/
- for (curisr = list->lh_first; curisr->isr_link.le_next != NULL;
- curisr = curisr->isr_link.le_next) {
+ for (curisr = LIST_FIRST(list);
+ LIST_NEXT(curisr, isr_link) != LIST_END(list);
+ curisr = LIST_NEXT(curisr, isr_link)) {
if (isr->isr_priority > curisr->isr_priority) {
LIST_INSERT_BEFORE(curisr, isr, isr_link);
goto compute;
@@ -254,7 +254,7 @@ intr_dispatch(evec)
uvmexp.intrs++;
list = &isr_list[ipl];
- if (list->lh_first == NULL) {
+ if (LIST_EMPTY(list)) {
printf("intr_dispatch: ipl %d unexpected\n", ipl);
if (++unexpected > 10)
panic("intr_dispatch: too many unexpected interrupts");
@@ -263,7 +263,7 @@ intr_dispatch(evec)
handled = 0;
/* Give all the handlers a chance. */
- for (isr = list->lh_first ; isr != NULL; isr = isr->isr_link.le_next) {
+ LIST_FOREACH(isr, list, isr_link) {
rc = (*isr->isr_func)(isr->isr_arg);
if (rc > 0)
isr->isr_count.ec_count++;
diff --git a/sys/arch/hppa/hppa/autoconf.c b/sys/arch/hppa/hppa/autoconf.c
index a3e985144a9..015b7ef5917 100644
--- a/sys/arch/hppa/hppa/autoconf.c
+++ b/sys/arch/hppa/hppa/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.41 2004/09/15 20:11:29 mickey Exp $ */
+/* $OpenBSD: autoconf.c,v 1.42 2004/12/25 23:02:24 miod Exp $ */
/*
* Copyright (c) 1998-2003 Michael Shalayeff
@@ -295,8 +295,7 @@ getdisk(str, len, defpart, devp)
#ifdef RAMDISK_HOOKS
printf(" %s[a-p]", fakerdrootdev.dv_xname);
#endif
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK)
printf(" %s[a-p]", dv->dv_xname);
#ifdef NFSCLIENT
@@ -339,7 +338,7 @@ parsedisk(str, len, defpart, devp)
goto gotdisk;
}
#endif
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
#ifdef RAMDISK_HOOKS
diff --git a/sys/arch/i386/i386/dkcsum.c b/sys/arch/i386/i386/dkcsum.c
index 7071689ad1f..792ced92910 100644
--- a/sys/arch/i386/i386/dkcsum.c
+++ b/sys/arch/i386/i386/dkcsum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dkcsum.c,v 1.12 2004/08/11 18:51:03 millert Exp $ */
+/* $OpenBSD: dkcsum.c,v 1.13 2004/12/25 23:02:24 miod Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -76,7 +76,7 @@ dkcsumattach()
*/
bp = geteblk(bios_cksumlen * DEV_BSIZE); /* XXX error check? */
- for (dv = alldevs.tqh_first; dv; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class != DV_DISK)
continue;
bp->b_dev = dev = dev_rawpart(dv);
diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c
index baa3b4c34b0..76aff1121fc 100644
--- a/sys/arch/i386/i386/pmap.c
+++ b/sys/arch/i386/i386/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.79 2004/07/20 20:18:13 art Exp $ */
+/* $OpenBSD: pmap.c,v 1.80 2004/12/25 23:02:24 miod Exp $ */
/* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */
/*
@@ -1220,8 +1220,8 @@ pmap_alloc_pv(pmap, mode)
simple_lock(&pvalloc_lock);
- if (pv_freepages.tqh_first != NULL) {
- pvpage = pv_freepages.tqh_first;
+ if (!TAILQ_EMPTY(&pv_freepages)) {
+ pvpage = TAILQ_FIRST(&pv_freepages);
pvpage->pvinfo.pvpi_nfree--;
if (pvpage->pvinfo.pvpi_nfree == 0) {
/* nothing left in this one? */
@@ -1281,10 +1281,10 @@ pmap_alloc_pvpage(pmap, mode)
* if we need_entry and we've got unused pv_pages, allocate from there
*/
- if (mode != ALLOCPV_NONEED && pv_unusedpgs.tqh_first != NULL) {
+ if (mode != ALLOCPV_NONEED && !TAILQ_EMPTY(&pv_unusedpgs)) {
/* move it to pv_freepages list */
- pvpage = pv_unusedpgs.tqh_first;
+ pvpage = TAILQ_FIRST(&pv_unusedpgs);
TAILQ_REMOVE(&pv_unusedpgs, pvpage, pvinfo.pvpi_list);
TAILQ_INSERT_HEAD(&pv_freepages, pvpage, pvinfo.pvpi_list);
@@ -1799,8 +1799,7 @@ pmap_steal_ptp(obj, offset)
we_locked = simple_lock_try(&curobj->vmobjlock);
}
if (caller_locked || we_locked) {
- ptp = curobj->memq.tqh_first;
- for (/*null*/; ptp != NULL; ptp = ptp->listq.tqe_next) {
+ TAILQ_FOREACH(ptp, &curobj->memq, listq) {
/*
* might have found a PTP we can steal
@@ -2041,8 +2040,8 @@ pmap_release(pmap)
* free any remaining PTPs
*/
- while (pmap->pm_obj.memq.tqh_first != NULL) {
- pg = pmap->pm_obj.memq.tqh_first;
+ while (!TAILQ_EMPTY(&pmap->pm_obj.memq)) {
+ pg = TAILQ_FIRST(&pmap->pm_obj.memq);
#ifdef DIAGNOSTIC
if (pg->flags & PG_BUSY)
panic("pmap_release: busy page table page");
@@ -3407,8 +3406,7 @@ pmap_growkernel(maxkvaddr)
/* distribute new kernel PTP to all active pmaps */
simple_lock(&pmaps_lock);
- for (pm = pmaps.lh_first; pm != NULL;
- pm = pm->pm_list.le_next) {
+ LIST_FOREACH(pm, &pmaps, pm_list) {
pm->pm_pdir[PDSLOT_KERN + nkpde] =
kpm->pm_pdir[PDSLOT_KERN + nkpde];
}
diff --git a/sys/arch/i386/isa/ahc_isa.c b/sys/arch/i386/isa/ahc_isa.c
index c385c554cf6..c2c0ad8a608 100644
--- a/sys/arch/i386/isa/ahc_isa.c
+++ b/sys/arch/i386/isa/ahc_isa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahc_isa.c,v 1.13 2004/08/01 01:36:23 krw Exp $ */
+/* $OpenBSD: ahc_isa.c,v 1.14 2004/12/25 23:02:24 miod Exp $ */
/* $NetBSD: ahc_isa.c,v 1.5 1996/10/21 22:27:39 thorpej Exp $ */
/*
@@ -309,8 +309,7 @@ ahc_isa_probe(parent, match, aux)
* Find this bus's state. If we don't yet have a slot
* marker, allocate and initialize one.
*/
- for (as = ahc_isa_all_slots.lh_first; as != NULL;
- as = as->link.le_next)
+ LIST_FOREACH(as, &ahc_isa_all_slots, link)
if (as->bus == parent->dv_unit)
goto found_slot_marker;
diff --git a/sys/arch/luna88k/dev/mb89352.c b/sys/arch/luna88k/dev/mb89352.c
index 91cafd276c0..ea6b49ce89d 100644
--- a/sys/arch/luna88k/dev/mb89352.c
+++ b/sys/arch/luna88k/dev/mb89352.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mb89352.c,v 1.4 2004/08/11 06:09:32 miod Exp $ */
+/* $OpenBSD: mb89352.c,v 1.5 2004/12/25 23:02:24 miod Exp $ */
/* $NetBSD: mb89352.c,v 1.5 2000/03/23 07:01:31 thorpej Exp $ */
/* NecBSD: mb89352.c,v 1.4 1998/03/14 07:31:20 kmatsuda Exp */
@@ -369,7 +369,7 @@ spc_free_acb(sc, acb, flags)
* If there were none, wake anybody waiting for one to come free,
* starting with queued entries.
*/
- if (acb->chain.tqe_next == 0)
+ if (TAILQ_NEXT(acb, chain) == NULL)
wakeup(&sc->free_list);
splx(s);
diff --git a/sys/arch/luna88k/luna88k/autoconf.c b/sys/arch/luna88k/luna88k/autoconf.c
index 2b283b38eef..d9273cc0f41 100644
--- a/sys/arch/luna88k/luna88k/autoconf.c
+++ b/sys/arch/luna88k/luna88k/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.3 2004/07/23 15:31:35 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.4 2004/12/25 23:02:24 miod Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -146,8 +146,7 @@ getdisk(str, len, defpart, devp)
if ((dv = parsedisk(str, len, defpart, devp)) == NULL) {
printf("use one of:");
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK)
printf(" %s[a-p]", dv->dv_xname);
#ifdef NFSCLIENT
@@ -180,7 +179,7 @@ parsedisk(str, len, defpart, devp)
} else
part = defpart;
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
majdev = findblkmajor(dv);
diff --git a/sys/arch/luna88k/luna88k/isr.c b/sys/arch/luna88k/luna88k/isr.c
index 0081f93bba5..d619b7b8113 100644
--- a/sys/arch/luna88k/luna88k/isr.c
+++ b/sys/arch/luna88k/luna88k/isr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isr.c,v 1.3 2004/12/24 22:50:30 miod Exp $ */
+/* $OpenBSD: isr.c,v 1.4 2004/12/25 23:02:24 miod Exp $ */
/* $NetBSD: isr.c,v 1.5 2000/07/09 08:08:20 nisimura Exp $ */
/*-
@@ -119,7 +119,7 @@ isrlink_autovec(int (*func)(void *), void *arg, int ipl, int priority,
* at the head of the list.
*/
list = &isr_autovec[ipl];
- if (list->lh_first == NULL) {
+ if (LIST_EMPTY(list)) {
LIST_INSERT_HEAD(list, newisr, isr_link);
return;
}
diff --git a/sys/arch/m68k/m68k/pmap_motorola.c b/sys/arch/m68k/m68k/pmap_motorola.c
index 9a266411cce..09625eae1cc 100644
--- a/sys/arch/m68k/m68k/pmap_motorola.c
+++ b/sys/arch/m68k/m68k/pmap_motorola.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap_motorola.c,v 1.35 2004/11/30 07:41:52 martin Exp $ */
+/* $OpenBSD: pmap_motorola.c,v 1.36 2004/12/25 23:02:24 miod Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -554,7 +554,7 @@ pmap_alloc_pv()
pv = &pvp->pvp_pv[0];
} else {
--pv_nfree;
- pvp = pv_page_freelist.tqh_first;
+ pvp = TAILQ_FIRST(&pv_page_freelist);
if (--pvp->pvp_pgi.pgi_nfree == 0) {
TAILQ_REMOVE(&pv_page_freelist, pvp, pvp_pgi.pgi_list);
}
diff --git a/sys/arch/mac68k/mac68k/autoconf.c b/sys/arch/mac68k/mac68k/autoconf.c
index 065320b51e4..131f7566851 100644
--- a/sys/arch/mac68k/mac68k/autoconf.c
+++ b/sys/arch/mac68k/mac68k/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.19 2003/06/02 23:27:49 millert Exp $ */
+/* $OpenBSD: autoconf.c,v 1.20 2004/12/25 23:02:24 miod Exp $ */
/* $NetBSD: autoconf.c,v 1.38 1996/12/18 05:46:09 scottr Exp $ */
/*
@@ -164,8 +164,7 @@ getdisk(str, len, defpart, devp)
#ifdef RAMDISK_HOOKS
printf(" %s[a-p]", fakerdrootdev.dv_xname);
#endif
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK)
printf(" %s[a-p]", dv->dv_xname);
#ifdef NFSCLIENT
@@ -205,7 +204,7 @@ parsedisk(str, len, defpart, devp)
}
#endif
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
#ifdef RAMDISK_HOOKS
@@ -502,7 +501,7 @@ findbootdev()
if (disk_count <= 0)
return;
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK && major == findblkmajor(dv) &&
unit == dv->dv_unit) {
booted_device = dv;
diff --git a/sys/arch/macppc/dev/mesh.c b/sys/arch/macppc/dev/mesh.c
index 748e13e83ea..9406e926532 100644
--- a/sys/arch/macppc/dev/mesh.c
+++ b/sys/arch/macppc/dev/mesh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mesh.c,v 1.8 2004/01/09 22:57:09 jmc Exp $ */
+/* $OpenBSD: mesh.c,v 1.9 2004/12/25 23:02:24 miod Exp $ */
/* $NetBSD: mesh.c,v 1.1 1999/02/19 13:06:03 tsubai Exp $ */
/*-
@@ -909,7 +909,7 @@ mesh_get_scb(sc)
int s;
s = splbio();
- while ((scb = sc->free_scb.tqh_first) == NULL)
+ while ((scb = TAILQ_FIRST(&sc->free_scb)) == NULL)
tsleep(&sc->free_scb, PRIBIO, "meshscb", 0);
TAILQ_REMOVE(&sc->free_scb, scb, chain);
splx(s);
@@ -926,7 +926,7 @@ mesh_free_scb(sc, scb)
s = splbio();
TAILQ_INSERT_HEAD(&sc->free_scb, scb, chain);
- if (scb->chain.tqe_next == NULL)
+ if (TAILQ_NEXT(&scb->chain) == NULL)
wakeup(&sc->free_scb);
splx(s);
}
@@ -1005,23 +1005,17 @@ mesh_sched(sc)
struct scsi_link *sc_link;
struct mesh_scb *scb;
- scb = sc->ready_scb.tqh_first;
-start:
- if (scb == NULL)
- return;
-
- xs = scb->xs;
- sc_link = xs->sc_link;
+ TAILQ_FOREACH(scb, &sc->ready_scb, chain) {
+ xs = scb->xs;
+ sc_link = xs->sc_link;
- if (sc->sc_nexus == NULL) {
- TAILQ_REMOVE(&sc->ready_scb, scb, chain);
- sc->sc_nexus = scb;
- mesh_select(sc, scb);
- return;
+ if (sc->sc_nexus == NULL) {
+ TAILQ_REMOVE(&sc->ready_scb, scb, chain);
+ sc->sc_nexus = scb;
+ mesh_select(sc, scb);
+ return;
+ }
}
-
- scb = scb->chain.tqe_next;
- goto start;
}
int
diff --git a/sys/arch/macppc/dev/snapper.c b/sys/arch/macppc/dev/snapper.c
index 1753dd1d942..0f0ec11312f 100644
--- a/sys/arch/macppc/dev/snapper.c
+++ b/sys/arch/macppc/dev/snapper.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snapper.c,v 1.6 2004/12/25 19:01:01 miod Exp $ */
+/* $OpenBSD: snapper.c,v 1.7 2004/12/25 23:02:24 miod Exp $ */
/* $NetBSD: snapper.c,v 1.1 2003/12/27 02:19:34 grant Exp $ */
/*-
@@ -383,7 +383,7 @@ snapper_defer(struct device *dev)
struct snapper_softc *sc = (struct snapper_softc *)dev;
struct device *dv;
- for (dv = alldevs.tqh_first; dv; dv=dv->dv_list.tqe_next)
+ TAILQ_FOREACH(dv, &alldevs, dv_list)
if (strncmp(dv->dv_xname, "ki2c", 4) == 0 &&
strncmp(dv->dv_parent->dv_xname, "macobio", 7) == 0)
sc->sc_i2c = dv;
diff --git a/sys/arch/macppc/macppc/autoconf.c b/sys/arch/macppc/macppc/autoconf.c
index d9926bb5128..20159656193 100644
--- a/sys/arch/macppc/macppc/autoconf.c
+++ b/sys/arch/macppc/macppc/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.14 2003/10/21 17:05:55 drahn Exp $ */
+/* $OpenBSD: autoconf.c,v 1.15 2004/12/25 23:02:24 miod Exp $ */
/*
* Copyright (c) 1996, 1997 Per Fogelstrom
* Copyright (c) 1995 Theo de Raadt
@@ -37,7 +37,7 @@
* from: Utah Hdr: autoconf.c 1.31 91/01/21
*
* from: @(#)autoconf.c 8.1 (Berkeley) 6/10/93
- * $Id: autoconf.c,v 1.14 2003/10/21 17:05:55 drahn Exp $
+ * $Id: autoconf.c,v 1.15 2004/12/25 23:02:24 miod Exp $
*/
/*
@@ -241,8 +241,7 @@ getdisk(char *str, int len, int defpart, dev_t *devp)
if ((dv = parsedisk(str, len, defpart, devp)) == NULL) {
printf("use one of:");
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK)
printf(" %s[a-p]", dv->dv_xname);
#ifdef NFSCLIENT
@@ -272,7 +271,7 @@ parsedisk(char *str, int len, int defpart, dev_t *devp)
} else
part = defpart;
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
majdev = findblkmajor(dv);
@@ -517,7 +516,7 @@ gotswap:
struct device *
getdevunit(char *name, int unit)
{
- struct device *dev = alldevs.tqh_first;
+ struct device *dev = TAILQ_FIRST(&alldevs);
char num[10], fullname[16];
int lunit;
@@ -531,7 +530,7 @@ getdevunit(char *name, int unit)
strlcat(fullname, num, sizeof fullname);
while (strcmp(dev->dv_xname, fullname) != 0)
- if ((dev = dev->dv_list.tqe_next) == NULL)
+ if ((dev = TAILQ_NEXT(dev, dv_list)) == NULL)
return NULL;
return dev;
diff --git a/sys/arch/mips64/mips64/busdma.c b/sys/arch/mips64/mips64/busdma.c
index fcec109333b..979a4a0c219 100644
--- a/sys/arch/mips64/mips64/busdma.c
+++ b/sys/arch/mips64/mips64/busdma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: busdma.c,v 1.6 2004/09/27 17:40:24 pefo Exp $ */
+/* $OpenBSD: busdma.c,v 1.7 2004/12/25 23:02:24 miod Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -606,14 +606,14 @@ _dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
* Compute the location, size, and number of segments actually
* returned by the VM code.
*/
- m = mlist.tqh_first;
+ m = TAILQ_FIRST(&mlist);
curseg = 0;
lastaddr = segs[curseg].ds_addr = VM_PAGE_TO_PHYS(m);
segs[curseg].ds_addr += t->dma_offs;
segs[curseg].ds_len = PAGE_SIZE;
- m = m->pageq.tqe_next;
+ m = TAILQ_NEXT(m, pageq);
- for (; m != NULL; m = m->pageq.tqe_next) {
+ for (; m != TAILQ_END(&mlist); m = TAILQ_NEXT(m, pageq)) {
curaddr = VM_PAGE_TO_PHYS(m);
#ifdef DIAGNOSTIC
if (curaddr < low || curaddr >= high) {
diff --git a/sys/arch/mvme68k/dev/sbic.c b/sys/arch/mvme68k/dev/sbic.c
index 7090dd5d764..967b65b9780 100644
--- a/sys/arch/mvme68k/dev/sbic.c
+++ b/sys/arch/mvme68k/dev/sbic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sbic.c,v 1.15 2003/12/20 00:34:28 miod Exp $ */
+/* $OpenBSD: sbic.c,v 1.16 2004/12/25 23:02:24 miod Exp $ */
/* $NetBSD: sbic.c,v 1.2 1996/04/23 16:32:54 chuck Exp $ */
/*
@@ -374,7 +374,7 @@ sbic_scsicmd(xs)
s = splbio();
- if ( (acb = dev->free_list.tqh_first) != NULL )
+ if ( (acb = TAILQ_FIRST(&dev->free_list)) != NULL )
TAILQ_REMOVE(&dev->free_list, acb, chain);
splx(s);
@@ -482,7 +482,7 @@ sbic_sched(dev)
/*
* Loop through the ready list looking for work to do...
*/
- for (acb = dev->ready_list.tqh_first; acb; acb = acb->chain.tqe_next) {
+ TAILQ_FOREACH(acb, &dev->ready_list, chain) {
int i, j;
slp = acb->xs->sc_link;
@@ -641,7 +641,7 @@ sbic_scsidone(acb, stat)
dev->sc_tinfo[slp->target].lubusy &= ~(1 << slp->lun);
- if ( dev->ready_list.tqh_first )
+ if ( !TAILQ_EMPTY(&dev->ready_list) )
dosched = 1; /* start next command */
} else
@@ -653,7 +653,7 @@ sbic_scsidone(acb, stat)
register struct sbic_acb *a;
- for (a = dev->nexus_list.tqh_first; a; a = a->chain.tqe_next) {
+ TAILQ_FOREACH(a, &dev->nexus_list, chain) {
if ( a == acb ) {
TAILQ_REMOVE(&dev->nexus_list, acb, chain);
dev->sc_tinfo[slp->target].lubusy &= ~(1 << slp->lun);
@@ -663,7 +663,7 @@ sbic_scsidone(acb, stat)
if ( a )
;
- else if ( acb->chain.tqe_next ) {
+ else if ( TAILQ_NEXT(acb, chain) != NULL) {
TAILQ_REMOVE(&dev->ready_list, acb, chain);
} else {
printf("%s: can't find matching acb\n", dev->sc_dev.dv_xname);
@@ -1075,7 +1075,7 @@ sbicselectbus(dev)
* XXXSCW This is probably not necessary since we don't use use the
* Select-and-Xfer-with-ATN command to initiate a selection...
*/
- if ( !sbic_enable_reselect && dev->nexus_list.tqh_first == NULL)
+ if ( !sbic_enable_reselect && TAILQ_EMPTY(&dev->nexus_list))
SET_SBIC_rselid (regs, 0);
else
SET_SBIC_rselid (regs, SBIC_RID_ER);
@@ -2492,8 +2492,7 @@ sbicnextstate(dev, csr, asr)
* Loop through the nexus list until we find the saved entry
* for the reselecting target...
*/
- for (acb = dev->nexus_list.tqh_first; acb;
- acb = acb->chain.tqe_next) {
+ TAILQ_FOREACH(acb, &dev->nexus_list, chain) {
if ( acb->xs->sc_link->target == newtarget &&
acb->xs->sc_link->lun == newlun) {
@@ -2516,7 +2515,7 @@ sbicnextstate(dev, csr, asr)
printf("%s: reselect %s targ %d not in nexus_list %p\n",
dev->sc_dev.dv_xname,
csr == SBIC_CSR_RSLT_NI ? "NI" : "IFY", newtarget,
- &dev->nexus_list.tqh_first);
+ &TAILQ_FIRST(&dev->nexus_list));
panic("bad reselect in sbic");
}
diff --git a/sys/arch/mvme68k/dev/ssh.c b/sys/arch/mvme68k/dev/ssh.c
index 13a5d744f70..8582d5a97d6 100644
--- a/sys/arch/mvme68k/dev/ssh.c
+++ b/sys/arch/mvme68k/dev/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.11 2004/07/30 22:29:45 miod Exp $ */
+/* $OpenBSD: ssh.c,v 1.12 2004/12/25 23:02:25 miod Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
@@ -166,7 +166,7 @@ struct scsi_xfer *xs;
panic("ssh_scsicmd: busy");
s = splbio();
- acb = sc->free_list.tqh_first;
+ acb = TAILQ_FIRST(&sc->free_list);
if (acb) {
TAILQ_REMOVE(&sc->free_list, acb, chain);
}
@@ -214,7 +214,7 @@ struct ssh_acb *acb;
s = splbio();
to = xs->timeout / 1000;
- if (sc->nexus_list.tqh_first)
+ if (!TAILQ_EMPTY(&sc->nexus_list))
printf("%s: ssh_poll called with disconnected device\n",
sc->sc_dev.dv_xname);
for (;;) {
@@ -275,12 +275,12 @@ struct ssh_softc *sc;
printf("%s: ssh_sched- nexus %x/%d ready %x/%d\n",
sc->sc_dev.dv_xname, sc->sc_nexus,
sc->sc_nexus->xs->sc_link->target,
- sc->ready_list.tqh_first,
- sc->ready_list.tqh_first->xs->sc_link->target);
+ TAILQ_FIRST(&sc->ready_list),
+ TAILQ_FIRST(&sc->ready_list)->xs->sc_link->target);
return;
}
#endif
- for (acb = sc->ready_list.tqh_first; acb; acb = acb->chain.tqe_next) {
+ TAILQ_FOREACH(acb, &sc->ready_list, chain) {
slp = acb->xs->sc_link;
i = slp->target;
if (!(sc->sc_tinfo[i].lubusy & (1 << slp->lun))) {
@@ -388,7 +388,7 @@ ssh_scsidone(acb, stat)
if (acb == sc->sc_nexus) {
sc->sc_nexus = NULL;
sc->sc_tinfo[slp->target].lubusy &= ~(1<<slp->lun);
- if (sc->ready_list.tqh_first)
+ if (!TAILQ_EMPTY(&sc->ready_list))
dosched = 1; /* start next command */
--sc->sc_active;
SSH_TRACE('d','a',stat,0)
@@ -397,8 +397,7 @@ ssh_scsidone(acb, stat)
SSH_TRACE('d','r',stat,0)
} else {
register struct ssh_acb *acb2;
- for (acb2 = sc->nexus_list.tqh_first; acb2;
- acb2 = acb2->chain.tqe_next)
+ TAILQ_FOREACH(acb2, &sc->nexus_list, chain)
if (acb2 == acb) {
TAILQ_REMOVE(&sc->nexus_list, acb, chain);
sc->sc_tinfo[slp->target].lubusy
@@ -408,7 +407,7 @@ ssh_scsidone(acb, stat)
}
if (acb2)
;
- else if (acb->chain.tqe_next) {
+ else if (TAILQ_NEXT(acb, chain) != NULL) {
TAILQ_REMOVE(&sc->ready_list, acb, chain);
--sc->sc_active;
} else {
@@ -602,7 +601,7 @@ struct ssh_softc *sc;
sc->sc_nexus->xs->error = XS_DRIVER_STUFFUP;
ssh_scsidone(sc->sc_nexus, sc->sc_nexus->stat[0]);
}
- while ((acb = sc->nexus_list.tqh_first)) {
+ while ((acb = TAILQ_FIRST(&sc->nexus_list))) {
acb->xs->error = XS_DRIVER_STUFFUP;
ssh_scsidone(acb, acb->stat[0]);
}
@@ -769,7 +768,7 @@ ssh_start (sc, target, lun, cbuf, clen, buf, len)
}
#endif
- if (sc->nexus_list.tqh_first == NULL) {
+ if (TAILQ_EMPTY(&sc->nexus_list)) {
if (rp->ssh_istat & SSH_ISTAT_CON)
printf("%s: ssh_select while connected?\n",
sc->sc_dev.dv_xname);
@@ -909,7 +908,7 @@ ssh_checkintr(sc, istat, dstat, sstat0, status)
printf("%s: message was not COMMAND COMPLETE: %x\n",
sc->sc_dev.dv_xname, acb->msg[0]);
#endif
- if (sc->nexus_list.tqh_first)
+ if (!TAILQ_EMPTY(&sc->nexus_list))
rp->ssh_dcntl |= SSH_DCNTL_STD;
return 1;
}
@@ -989,7 +988,7 @@ ssh_checkintr(sc, istat, dstat, sstat0, status)
printf ("Yikes, it's not busy now!\n");
#if 0
*status = -1;
- if (sc->nexus_list.tqh_first)
+ if (!TAILQ_EMPTY(&sc->nexus_list))
rp->ssh_dsp = sc->sc_scriptspa + Ent_wait_reselect;
return 1;
#endif
@@ -1003,7 +1002,7 @@ ssh_checkintr(sc, istat, dstat, sstat0, status)
#endif
*status = -1;
acb->xs->error = XS_SELTIMEOUT;
- if (sc->nexus_list.tqh_first)
+ if (!TAILQ_EMPTY(&sc->nexus_list))
rp->ssh_dsp = sc->sc_scriptspa + Ent_wait_reselect;
return 1;
}
@@ -1023,7 +1022,7 @@ ssh_checkintr(sc, istat, dstat, sstat0, status)
sshabort (sc, rp, "sshchkintr");
#endif
*status = STS_BUSY;
- if (sc->nexus_list.tqh_first)
+ if (!TAILQ_EMPTY(&sc->nexus_list))
rp->ssh_dsp = sc->sc_scriptspa + Ent_wait_reselect;
return 1;
}
@@ -1142,7 +1141,7 @@ ssh_checkintr(sc, istat, dstat, sstat0, status)
if (sc->sc_nexus == NULL)
rp->ssh_dsp = sc->sc_scriptspa + Ent_wait_reselect;
/* XXXX start another command ? */
- if (sc->ready_list.tqh_first)
+ if (!TAILQ_EMPTY(&sc->ready_list))
ssh_sched(sc);
return (0);
}
@@ -1175,8 +1174,7 @@ ssh_checkintr(sc, istat, dstat, sstat0, status)
* locate acb of reselecting device
* set sc->sc_nexus to acb
*/
- for (acb = sc->nexus_list.tqh_first; acb;
- acb = acb->chain.tqe_next) {
+ TAILQ_FOREACH(acb, &sc->nexus_list, chain) {
if (reselid != (acb->ds.scsi_addr >> 16) ||
reselun != (acb->msgout[0] & 0x07))
continue;
@@ -1193,7 +1191,7 @@ ssh_checkintr(sc, istat, dstat, sstat0, status)
if (acb == NULL) {
printf("%s: target ID %02x reselect nexus_list %p\n",
sc->sc_dev.dv_xname, reselid,
- sc->nexus_list.tqh_first);
+ TAILQ_FIRST(&sc->nexus_list));
panic("unable to find reselecting device");
}
dma_cachectl ((caddr_t)acb, sizeof(*acb));
@@ -1512,25 +1510,25 @@ struct ssh_softc *sc;
s = splbio();
printf("%s@%x regs %x istat %x\n",
sc->sc_dev.dv_xname, sc, rp, rp->ssh_istat);
- if (acb = sc->free_list.tqh_first) {
+ if (acb = TAILQ_FIRST(&sc->free_list)) {
printf("Free list:\n");
while (acb) {
ssh_dump_acb(acb);
- acb = acb->chain.tqe_next;
+ acb = TAILQ_NEXT(acb, chain);
}
}
- if (acb = sc->ready_list.tqh_first) {
+ if (acb = TAILQ_FIRST(&sc->ready_list)) {
printf("Ready list:\n");
while (acb) {
ssh_dump_acb(acb);
- acb = acb->chain.tqe_next;
+ acb = TAILQ_NEXT(acb, chain);
}
}
- if (acb = sc->nexus_list.tqh_first) {
+ if (acb = TAILQ_FIRST(&sc->nexus_list)) {
printf("Nexus list:\n");
while (acb) {
ssh_dump_acb(acb);
- acb = acb->chain.tqe_next;
+ acb = TAILQ_NEXT(acb, chain);
}
}
if (sc->sc_nexus) {
diff --git a/sys/arch/mvme68k/mvme68k/autoconf.c b/sys/arch/mvme68k/mvme68k/autoconf.c
index 3bbdb2f48b0..9ac3ca519f4 100644
--- a/sys/arch/mvme68k/mvme68k/autoconf.c
+++ b/sys/arch/mvme68k/mvme68k/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.27 2004/07/30 22:29:48 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.28 2004/12/25 23:02:25 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -304,8 +304,7 @@ getdisk(str, len, defpart, devp)
if ((dv = parsedisk(str, len, defpart, devp)) == NULL) {
printf("use one of:");
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK)
printf(" %s[a-p]", dv->dv_xname);
#ifdef NFSCLIENT
@@ -338,7 +337,7 @@ parsedisk(str, len, defpart, devp)
} else
part = defpart;
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
majdev = findblkmajor(dv);
diff --git a/sys/arch/mvme88k/mvme88k/autoconf.c b/sys/arch/mvme88k/mvme88k/autoconf.c
index 2d1ac6ef381..0854bcf2736 100644
--- a/sys/arch/mvme88k/mvme88k/autoconf.c
+++ b/sys/arch/mvme88k/mvme88k/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.29 2004/07/20 20:33:21 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.30 2004/12/25 23:02:25 miod Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -153,8 +153,7 @@ getdisk(str, len, defpart, devp)
if ((dv = parsedisk(str, len, defpart, devp)) == NULL) {
printf("use one of:");
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK)
printf(" %s[a-p]", dv->dv_xname);
#ifdef NFSCLIENT
@@ -187,7 +186,7 @@ parsedisk(str, len, defpart, devp)
} else
part = defpart;
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
majdev = findblkmajor(dv);
diff --git a/sys/arch/mvme88k/mvme88k/bus_dma.c b/sys/arch/mvme88k/mvme88k/bus_dma.c
index b0475260e53..e37d73dd6f3 100644
--- a/sys/arch/mvme88k/mvme88k/bus_dma.c
+++ b/sys/arch/mvme88k/mvme88k/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.2 2004/11/09 19:17:01 claudio Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.3 2004/12/25 23:02:25 miod Exp $ */
/* $NetBSD: bus_dma.c,v 1.2 2001/06/10 02:31:25 briggs Exp $ */
/*-
@@ -641,13 +641,13 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
* Compute the location, size, and number of segments actually
* returned by the VM code.
*/
- m = mlist.tqh_first;
+ m = TAILQ_FIRST(&mlist);
curseg = 0;
lastaddr = segs[curseg].ds_addr = VM_PAGE_TO_PHYS(m);
segs[curseg].ds_len = PAGE_SIZE;
- m = m->pageq.tqe_next;
+ m = TAILQ_NEXT(m, pageq);
- for (; m != NULL; m = m->pageq.tqe_next) {
+ for (; m != TAILQ_END(&mlist); m = TAILQ_NEXT(m, pageq)) {
curaddr = VM_PAGE_TO_PHYS(m);
#ifdef DIAGNOSTIC
if (curaddr < low || curaddr >= high) {
diff --git a/sys/arch/mvmeppc/mvmeppc/autoconf.c b/sys/arch/mvmeppc/mvmeppc/autoconf.c
index c17449362aa..720f1ae33a1 100644
--- a/sys/arch/mvmeppc/mvmeppc/autoconf.c
+++ b/sys/arch/mvmeppc/mvmeppc/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.11 2004/11/17 20:26:38 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.12 2004/12/25 23:02:25 miod Exp $ */
/*
* Copyright (c) 1996, 1997 Per Fogelstrom
* Copyright (c) 1995 Theo de Raadt
@@ -37,7 +37,7 @@
* from: Utah Hdr: autoconf.c 1.31 91/01/21
*
* from: @(#)autoconf.c 8.1 (Berkeley) 6/10/93
- * $Id: autoconf.c,v 1.11 2004/11/17 20:26:38 miod Exp $
+ * $Id: autoconf.c,v 1.12 2004/12/25 23:02:25 miod Exp $
*/
/*
@@ -227,8 +227,7 @@ getdisk(str, len, defpart, devp)
if ((dv = parsedisk(str, len, defpart, devp)) == NULL) {
printf("use one of:");
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK)
printf(" %s[a-p]", dv->dv_xname);
#ifdef NFSCLIENT
@@ -265,7 +264,7 @@ parsedisk(str, len, defpart, devp)
} else
part = defpart;
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
majdev = findblkmajor(dv);
@@ -491,7 +490,7 @@ getdevunit(name, unit)
char *name;
int unit;
{
- struct device *dev = alldevs.tqh_first;
+ struct device *dev = TAILQ_FIRST(&alldevs);
char num[10], fullname[16];
int lunit;
@@ -505,7 +504,7 @@ getdevunit(name, unit)
strlcat(fullname, num, sizeof fullname);
while (strcmp(dev->dv_xname, fullname) != 0) {
- if ((dev = dev->dv_list.tqe_next) == NULL)
+ if ((dev = TAILQ_NEXT(dev, dv_list)) == NULL)
return NULL;
}
return dev;
diff --git a/sys/arch/mvmeppc/mvmeppc/bus_dma.c b/sys/arch/mvmeppc/mvmeppc/bus_dma.c
index 75313ef6f26..f771d919e17 100644
--- a/sys/arch/mvmeppc/mvmeppc/bus_dma.c
+++ b/sys/arch/mvmeppc/mvmeppc/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.16 2004/11/09 19:17:01 claudio Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.17 2004/12/25 23:02:25 miod Exp $ */
/* $NetBSD: bus_dma.c,v 1.2 2001/06/10 02:31:25 briggs Exp $ */
/*-
@@ -628,14 +628,14 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
* Compute the location, size, and number of segments actually
* returned by the VM code.
*/
- m = mlist.tqh_first;
+ m = TAILQ_FIRST(&mlist);
curseg = 0;
lastaddr = VM_PAGE_TO_PHYS(m);
segs[curseg].ds_addr = PHYS_TO_PCI_MEM(lastaddr);
segs[curseg].ds_len = PAGE_SIZE;
- m = m->pageq.tqe_next;
+ m = TAILQ_NEXT(m, pageq);
- for (; m != NULL; m = m->pageq.tqe_next) {
+ for (; m != TAILQ_END(&mlist); m = TAILQ_NEXT(m, pageq)) {
curaddr = VM_PAGE_TO_PHYS(m);
#ifdef DIAGNOSTIC
if (curaddr < low || curaddr >= high) {
diff --git a/sys/arch/sgi/sgi/autoconf.c b/sys/arch/sgi/sgi/autoconf.c
index 2c0bf898bb1..981548945e8 100644
--- a/sys/arch/sgi/sgi/autoconf.c
+++ b/sys/arch/sgi/sgi/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.8 2004/10/23 08:21:27 mjc Exp $ */
+/* $OpenBSD: autoconf.c,v 1.9 2004/12/25 23:02:25 miod Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
* Copyright (c) 1995 Theo de Raadt
@@ -172,8 +172,7 @@ getdisk(str, len, defpart, devp)
if ((dv = parsedisk(str, len, defpart, devp)) == NULL) {
printf("use one of:");
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK)
printf(" %s[a-p]", dv->dv_xname);
#ifdef NFSCLIENT
@@ -206,7 +205,7 @@ parsedisk(str, len, defpart, devp)
} else
part = defpart;
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
majdev = findblkmajor(dv);
@@ -430,7 +429,7 @@ getdevunit(name, unit)
char *name;
int unit;
{
- struct device *dev = alldevs.tqh_first;
+ struct device *dev = TAILQ_FIRST(&alldevs);
char num[10], fullname[16];
int lunit;
@@ -444,7 +443,7 @@ getdevunit(name, unit)
strlcat(fullname, num, sizeof(fullname));
while (strcmp(dev->dv_xname, fullname) != 0) {
- if ((dev = dev->dv_list.tqe_next) == NULL)
+ if ((dev = TAILQ_NEXT(dev, dv_list)) == NULL)
return NULL;
}
return dev;
diff --git a/sys/arch/sparc/dev/fd.c b/sys/arch/sparc/dev/fd.c
index f441f05123d..5cff44d21e8 100644
--- a/sys/arch/sparc/dev/fd.c
+++ b/sys/arch/sparc/dev/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.38 2004/09/29 07:35:11 miod Exp $ */
+/* $OpenBSD: fd.c,v 1.39 2004/12/25 23:02:25 miod Exp $ */
/* $NetBSD: fd.c,v 1.51 1997/05/24 20:16:19 pk Exp $ */
/*-
@@ -788,7 +788,7 @@ fdstart(fd)
struct fd_softc *fd;
{
struct fdc_softc *fdc = (void *)fd->sc_dv.dv_parent;
- int active = fdc->sc_drives.tqh_first != 0;
+ int active = !TAILQ_EMPTY(&fdc->sc_drives);
/* Link into controller queue. */
fd->sc_q.b_active = 1;
@@ -812,7 +812,7 @@ fdfinish(fd, bp)
* another drive is waiting to be serviced, since there is a long motor
* startup delay whenever we switch.
*/
- if (fd->sc_drivechain.tqe_next && ++fd->sc_ops >= 8) {
+ if (TAILQ_NEXT(fd, sc_drivechain) != NULL && ++fd->sc_ops >= 8) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
if (bp->b_actf) {
@@ -861,7 +861,7 @@ fd_set_motor(fdc)
if (fdc->sc_flags & FDC_82077) {
status = FDO_FRST | FDO_FDMAEN;
- if ((fd = fdc->sc_drives.tqh_first) != NULL)
+ if ((fd = TAILQ_FIRST(&fdc->sc_drives)) != NULL)
status |= fd->sc_drive;
for (n = 0; n < 4; n++)
@@ -903,7 +903,7 @@ fd_motor_on(arg)
s = splbio();
fd->sc_flags &= ~FD_MOTOR_WAIT;
- if ((fdc->sc_drives.tqh_first == fd) && (fdc->sc_state == MOTORWAIT))
+ if (fd == TAILQ_FIRST(&fdc->sc_drives) && fdc->sc_state == MOTORWAIT)
(void) fdcstate(fdc);
splx(s);
}
@@ -1079,7 +1079,7 @@ fdcstatus(fdc, s)
struct fdc_softc *fdc;
char *s;
{
- struct fd_softc *fd = fdc->sc_drives.tqh_first;
+ struct fd_softc *fd = TAILQ_FIRST(&fdc->sc_drives);
int n;
/* Just print last status */
@@ -1133,7 +1133,7 @@ fdctimeout(arg)
int s;
s = splbio();
- fd = fdc->sc_drives.tqh_first;
+ fd = TAILQ_FIRST(&fdc->sc_drives);
if (fd == NULL) {
printf("%s: timeout but no I/O pending: statu %d, istatus=%d\n",
fdc->sc_dev.dv_xname, fdc->sc_state, fdc->sc_istatus);
@@ -1303,7 +1303,7 @@ fdcstate(fdc)
loop:
/* Is there a drive for the controller to do a transfer with? */
- fd = fdc->sc_drives.tqh_first;
+ fd = TAILQ_FIRST(&fdc->sc_drives);
if (fd == NULL) {
fdc->sc_state = DEVIDLE;
return (0);
@@ -1682,7 +1682,7 @@ fdcretry(fdc)
struct buf *bp;
int error = EIO;
- fd = fdc->sc_drives.tqh_first;
+ fd = TAILQ_FIRST(&fdc->sc_drives);
bp = fd->sc_q.b_actf;
fdc->sc_overruns = 0;
diff --git a/sys/arch/sparc/sparc/autoconf.c b/sys/arch/sparc/sparc/autoconf.c
index 87b04ec2073..b05e4bc4ace 100644
--- a/sys/arch/sparc/sparc/autoconf.c
+++ b/sys/arch/sparc/sparc/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.59 2003/06/23 09:23:31 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.60 2004/12/25 23:02:25 miod Exp $ */
/* $NetBSD: autoconf.c,v 1.73 1997/07/29 09:41:53 fair Exp $ */
/*
@@ -1847,8 +1847,7 @@ getdisk(str, len, defpart, devp)
#ifdef RAMDISK_HOOKS
printf(" %s[a-p]", fakerdrootdev.dv_xname);
#endif
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK)
printf(" %s[a-p]", dv->dv_xname);
#ifdef NFSCLIENT
@@ -1888,7 +1887,7 @@ parsedisk(str, len, defpart, devp)
}
#endif
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
#ifdef RAMDISK_HOOKS
@@ -2150,8 +2149,7 @@ gotroot:
/*
* Find mountroot hook and execute.
*/
- for (mrhp = mrh_list.lh_first; mrhp != NULL;
- mrhp = mrhp->mr_link.le_next)
+ LIST_FOREACH(mrhp, &mrh_list, mr_link)
if (mrhp->mr_device == bootdv) {
if (findblkmajor(mrhp->mr_device) == major(rootdev))
(*mrhp->mr_func)(bootdv);
@@ -2217,7 +2215,7 @@ getdevunit(name, unit)
char *name;
int unit;
{
- struct device *dev = alldevs.tqh_first;
+ struct device *dev = TAILQ_FIRST(&alldevs);
char num[10], fullname[16];
int lunit;
@@ -2231,7 +2229,7 @@ getdevunit(name, unit)
strlcat(fullname, num, sizeof fullname);
while (strcmp(dev->dv_xname, fullname) != 0) {
- if ((dev = dev->dv_list.tqe_next) == NULL)
+ if ((dev = TAILQ_NEXT(dev, dv_list)) == NULL)
return NULL;
}
return dev;
diff --git a/sys/arch/sparc/sparc/pmap.c b/sys/arch/sparc/sparc/pmap.c
index 956305c6bc4..99be27c55ff 100644
--- a/sys/arch/sparc/sparc/pmap.c
+++ b/sys/arch/sparc/sparc/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.137 2004/05/08 21:45:26 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.138 2004/12/25 23:02:25 miod Exp $ */
/* $NetBSD: pmap.c,v 1.118 1998/05/19 19:00:18 thorpej Exp $ */
/*
@@ -1215,7 +1215,8 @@ me_alloc(mh, newpm, newvreg, newvseg)
struct segmap *sp;
/* try free list first */
- if ((me = segm_freelist.tqh_first) != NULL) {
+ if (!TAILQ_EMPTY(&segm_freelist)) {
+ me = TAILQ_FIRST(&segm_freelist);
TAILQ_REMOVE(&segm_freelist, me, me_list);
#ifdef DEBUG
if (me->me_pmap != NULL)
@@ -1245,7 +1246,7 @@ me_alloc(mh, newpm, newvreg, newvseg)
}
/* no luck, take head of LRU list */
- if ((me = segm_lru.tqh_first) == NULL)
+ if ((me = TAILQ_FIRST(&segm_lru)) == NULL)
panic("me_alloc: all pmegs gone");
pm = me->me_pmap;
@@ -1453,7 +1454,8 @@ region_alloc(mh, newpm, newvr)
struct regmap *rp;
/* try free list first */
- if ((me = region_freelist.tqh_first) != NULL) {
+ if (!TAILQ_EMPTY(&region_freelist)) {
+ me = TAILQ_FIRST(&region_freelist);
TAILQ_REMOVE(&region_freelist, me, me_list);
#ifdef DEBUG
if (me->me_pmap != NULL)
@@ -1475,7 +1477,7 @@ region_alloc(mh, newpm, newvr)
}
/* no luck, take head of LRU list */
- if ((me = region_lru.tqh_first) == NULL)
+ if ((me = TAILQ_FIRST(&region_lru)) == NULL)
panic("region_alloc: all smegs gone");
pm = me->me_pmap;
@@ -3562,10 +3564,10 @@ pmap_release(pm)
if (CPU_ISSUN4OR4C) {
#if defined(SUN4_MMU3L)
- if (pm->pm_reglist.tqh_first)
+ if (!TAILQ_EMPTY(&pm->pm_reglist));
panic("pmap_release: region list not empty");
#endif
- if (pm->pm_seglist.tqh_first)
+ if (!TAILQ_EMPTY(&pm->pm_seglist));
panic("pmap_release: segment list not empty");
if ((c = pm->pm_ctx) != NULL) {
diff --git a/sys/arch/sparc64/dev/iommu.c b/sys/arch/sparc64/dev/iommu.c
index bca2e3994f2..5caf6e2439c 100644
--- a/sys/arch/sparc64/dev/iommu.c
+++ b/sys/arch/sparc64/dev/iommu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iommu.c,v 1.35 2004/03/19 21:04:00 miod Exp $ */
+/* $OpenBSD: iommu.c,v 1.36 2004/12/25 23:02:25 miod Exp $ */
/* $NetBSD: iommu.c,v 1.47 2002/02/08 20:03:45 eeh Exp $ */
/*
@@ -1644,7 +1644,7 @@ iommu_dvmamem_map(bus_dma_tag_t t, bus_dma_tag_t t0, bus_dma_segment_t *segs,
* Now take this and map it into the CPU.
*/
mlist = segs[0]._ds_mlist;
- for (m = mlist->tqh_first; m != NULL; m = m->pageq.tqe_next) {
+ TAILQ_FOREACH(m, mlist, pageq) {
#ifdef DIAGNOSTIC
if (size == 0)
panic("iommu_dvmamem_map: size botch");
diff --git a/sys/arch/sparc64/sparc64/autoconf.c b/sys/arch/sparc64/sparc64/autoconf.c
index 10d98b86eaf..1bbed64ee62 100644
--- a/sys/arch/sparc64/sparc64/autoconf.c
+++ b/sys/arch/sparc64/sparc64/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.36 2004/10/23 08:21:27 mjc Exp $ */
+/* $OpenBSD: autoconf.c,v 1.37 2004/12/25 23:02:25 miod Exp $ */
/* $NetBSD: autoconf.c,v 1.51 2001/07/24 19:32:11 eeh Exp $ */
/*
@@ -786,8 +786,7 @@ getdisk(str, len, defpart, devp)
#ifdef RAMDISK_HOOKS
printf(" %s[a-p]", fakerdrootdev.dv_xname);
#endif
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK)
printf(" %s[a-p]", dv->dv_xname);
#ifdef NFSCLIENT
@@ -827,7 +826,7 @@ parsedisk(str, len, defpart, devp)
}
#endif
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
#ifdef RAMDISK_HOOKS
@@ -1336,7 +1335,7 @@ getdevunit(name, unit)
char *name;
int unit;
{
- struct device *dev = alldevs.tqh_first;
+ struct device *dev = TAILQ_FIRST(&alldevs);
char num[10], fullname[16];
int lunit;
@@ -1350,7 +1349,7 @@ getdevunit(name, unit)
strlcat(fullname, num, sizeof fullname);
while (strcmp(dev->dv_xname, fullname) != 0) {
- if ((dev = dev->dv_list.tqe_next) == NULL)
+ if ((dev = TAILQ_NEXT(dev, dv_list)) == NULL)
return NULL;
}
return dev;
diff --git a/sys/arch/sparc64/sparc64/db_interface.c b/sys/arch/sparc64/sparc64/db_interface.c
index c2727adbce5..bc30cf1f2d9 100644
--- a/sys/arch/sparc64/sparc64/db_interface.c
+++ b/sys/arch/sparc64/sparc64/db_interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_interface.c,v 1.18 2003/12/20 20:08:17 miod Exp $ */
+/* $OpenBSD: db_interface.c,v 1.19 2004/12/25 23:02:25 miod Exp $ */
/* $NetBSD: db_interface.c,v 1.61 2001/07/31 06:55:47 eeh Exp $ */
/*
@@ -832,7 +832,7 @@ db_ctx_cmd(addr, have_addr, count, modif)
struct proc *p;
/* XXX LOCKING XXX */
- for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
+ LIST_FOREACH(p, &allproc, p_list) {
if (p->p_stat) {
db_printf("process %p:", p);
db_printf("pid:%d pmap:%p ctx:%x tf:%p fpstate %p "
@@ -910,7 +910,7 @@ db_setpcb(addr, have_addr, count, modif)
return;
}
- for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
+ LIST_FOREACH(p, &allproc, p_list) {
pp = p->p_pptr;
if (p->p_stat && p->p_pid == addr) {
curproc = p;
@@ -1062,7 +1062,7 @@ db_uvmhistdump(addr, have_addr, count, modif)
char *modif;
{
- uvmhist_dump(uvm_histories.lh_first);
+ uvmhist_dump(LIST_FIRST(&uvm_histories));
}
#endif
diff --git a/sys/arch/vax/if/if_de.c b/sys/arch/vax/if/if_de.c
index 3b4a4ec94d5..fba8c7ebf4f 100644
--- a/sys/arch/vax/if/if_de.c
+++ b/sys/arch/vax/if/if_de.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_de.c,v 1.15 2004/09/15 17:46:43 grange Exp $ */
+/* $OpenBSD: if_de.c,v 1.16 2004/12/25 23:02:25 miod Exp $ */
/* $NetBSD: if_de.c,v 1.27 1997/04/19 15:02:29 ragge Exp $ */
/*
@@ -256,7 +256,7 @@ deinit(ds)
int s,incaddr;
/* not yet, if address still unknown */
- if (ifp->if_addrlist.tqh_first == (struct ifaddr *)0)
+ if (TAILQ_EMPTY(&ifp->if_addrlist))
return;
if (ds->ds_flags & DSF_RUNNING)
diff --git a/sys/arch/vax/uba/uba.c b/sys/arch/vax/uba/uba.c
index b63f49547e2..4ce9b98cc04 100644
--- a/sys/arch/vax/uba/uba.c
+++ b/sys/arch/vax/uba/uba.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uba.c,v 1.20 2004/07/07 23:10:46 deraadt Exp $ */
+/* $OpenBSD: uba.c,v 1.21 2004/12/25 23:02:25 miod Exp $ */
/* $NetBSD: uba.c,v 1.43 2000/01/24 02:40:36 matt Exp $ */
/*
* Copyright (c) 1996 Jonathan Stone.
@@ -711,7 +711,7 @@ ubarelse(uh, amr)
uh->uh_mrwant = 0;
wakeup((caddr_t)&uh->uh_mrwant);
}
- while ((uu = uh->uh_resq.sqh_first)) {
+ while ((uu = SIMPLEQ_FIRST(&uh->uh_resq)) != NULL) {
SIMPLEQ_REMOVE_HEAD(&uh->uh_resq, uu_resq);
if ((*uu->uu_ready)(uu) == 0)
break;
diff --git a/sys/arch/vax/uba/uda.c b/sys/arch/vax/uba/uda.c
index 607f7bffaee..fd0e633c0f5 100644
--- a/sys/arch/vax/uba/uda.c
+++ b/sys/arch/vax/uba/uda.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uda.c,v 1.11 2003/06/02 23:27:58 millert Exp $ */
+/* $OpenBSD: uda.c,v 1.12 2004/12/25 23:02:25 miod Exp $ */
/* $NetBSD: uda.c,v 1.25 1997/07/04 13:26:02 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
@@ -297,7 +297,7 @@ udago(usc, bp)
* again. (Then we would trash the wait queue). Just queue the
* buf and let the rest be done in udaready.
*/
- if (sc->sc_bufq.sqh_first)
+ if (!SIMPLEQ_EMPTY(&sc->sc_bufq))
BUFQ_INSERT_TAIL(&sc->sc_bufq, bp)
else {
if (ubaqueue(uu, bp))
@@ -322,7 +322,7 @@ udaready(uu)
struct uda_softc *sc = uu->uu_softc;
struct buf *bp;
- while ((bp = sc->sc_bufq.sqh_first)) {
+ while ((bp = SIMPLEQ_FIRST(&sc->sc_bufq)) != NULL) {
if (ubaqueue(uu, bp)) {
BUFQ_REMOVE_HEAD(&sc->sc_bufq, bp);
mscp_dgo(sc->sc_softc, (UBAI_ADDR(uu->uu_ubinfo) |
diff --git a/sys/arch/vax/vax/bus_dma.c b/sys/arch/vax/vax/bus_dma.c
index 181a96120fe..ceb7fe94f73 100644
--- a/sys/arch/vax/vax/bus_dma.c
+++ b/sys/arch/vax/vax/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.13 2004/11/09 19:17:01 claudio Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.14 2004/12/25 23:02:26 miod Exp $ */
/* $NetBSD: bus_dma.c,v 1.5 1999/11/13 00:32:20 thorpej Exp $ */
/*-
@@ -714,16 +714,16 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
* Compute the location, size, and number of segments actually
* returned by the VM code.
*/
- m = mlist.tqh_first;
+ m = TAILQ_FIRST(&mlist);
curseg = 0;
lastaddr = segs[curseg].ds_addr = VM_PAGE_TO_PHYS(m);
segs[curseg].ds_len = PAGE_SIZE;
#ifdef DEBUG_DMA
printf("alloc: page %lx\n", lastaddr);
#endif /* DEBUG_DMA */
- m = m->pageq.tqe_next;
+ m = TAILQ_NEXT(m, pageq);
- for (; m != NULL; m = m->pageq.tqe_next) {
+ for (; m != TAILQ_END(&mlist); m = TAILQ_NEXT(m, pageq)) {
curaddr = VM_PAGE_TO_PHYS(m);
#ifdef DIAGNOSTIC
if (curaddr < low || curaddr >= high) {
diff --git a/sys/arch/vax/vax/rootfil.c b/sys/arch/vax/vax/rootfil.c
index a481700a8d2..237d27346af 100644
--- a/sys/arch/vax/vax/rootfil.c
+++ b/sys/arch/vax/vax/rootfil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rootfil.c,v 1.16 2003/06/02 23:27:59 millert Exp $ */
+/* $OpenBSD: rootfil.c,v 1.17 2004/12/25 23:02:26 miod Exp $ */
/* $NetBSD: rootfil.c,v 1.14 1996/10/13 03:35:58 christos Exp $ */
/*
@@ -334,8 +334,7 @@ getdisk(str, len, defpart, devp)
#ifdef RAMDISK_HOOKS
printf(" %s[a-p]", fakerdrootdev.dv_xname);
#endif
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK)
printf(" %s[a-p]", dv->dv_xname);
#ifdef NFSCLIENT
@@ -375,7 +374,7 @@ parsedisk(str, len, defpart, devp)
}
#endif
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ TAILQ_FOREACH(dv, &alldevs, dv_list) {
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
#ifdef RAMDISK_HOOKS