From ecd80f47f422eb3c05104502c79ca7902e7240f1 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Mon, 2 Aug 2004 13:22:34 +0000 Subject: [PATCH] Change (almost) all references to tqh_first and tqe_next and tqe_prev to the correct TAILQ macros. Exceptions are contrib/ipfilter, which will be handled separately, and dev/misc/labpc, which makes some very wiered things and therefore needs much more care. --- sys/dev/disk/i386/bs/bs.c | 37 ++++++++++--------- sys/dev/disk/i386/bs/bsfunc.c | 49 ++++++++++++------------- sys/dev/disk/i386/bs/bsfunc.h | 4 +- sys/dev/misc/streams/streams.c | 5 ++- sys/dev/netif/re/if_re.c | 16 ++++---- sys/dev/netif/re/if_rereg.h | 3 +- sys/dev/netif/wl/if_wl.c | 4 +- sys/emulation/svr4/svr4_socket.c | 4 +- sys/emulation/svr4/svr4_sockio.c | 15 +++----- sys/i386/include/physio_proc.h | 4 +- sys/i386/isa/ccbque.h | 4 +- sys/net/if.c | 3 +- sys/net/ip6fw/ip6_fw.c | 14 +++---- sys/net/sppp/if_spppsubr.c | 11 ++---- sys/netinet6/icmp6.c | 6 +-- sys/netinet6/in6_ifattach.c | 25 ++++--------- sys/netinet6/in6_prefix.c | 11 ++---- sys/netinet6/in6_var.h | 4 +- sys/netinet6/nd6.c | 11 ++---- sys/netinet6/nd6_nbr.c | 4 +- sys/netproto/atalk/aarp.c | 12 +++--- sys/netproto/ipsec/key.c | 6 +-- sys/netproto/ipsec/xform_ipip.c | 8 ++-- sys/netproto/key/key.c | 6 +-- sys/platform/pc32/include/physio_proc.h | 4 +- sys/sys/ccbque.h | 4 +- sys/sys/socketvar.h | 4 +- sys/vfs/msdosfs/msdosfs_vfsops.c | 4 +- sys/vfs/nfs/nfs_nqlease.c | 17 ++++----- sys/vfs/nfs/nfs_socket.c | 14 +++---- sys/vfs/nfs/nfs_srvcache.c | 11 +++--- sys/vfs/nfs/nfs_syscalls.c | 21 +++++------ sys/vfs/nfs/nfs_vnops.c | 4 +- sys/vfs/ufs/ufs_quota.c | 7 ++-- 34 files changed, 157 insertions(+), 199 deletions(-) diff --git a/sys/dev/disk/i386/bs/bs.c b/sys/dev/disk/i386/bs/bs.c index ec0e2a01ab..a042a967a6 100644 --- a/sys/dev/disk/i386/bs/bs.c +++ b/sys/dev/disk/i386/bs/bs.c @@ -1,7 +1,7 @@ /* $NecBSD: bs.c,v 1.1 1997/07/18 09:18:59 kmatsuda Exp $ */ /* $NetBSD$ */ /* $FreeBSD: src/sys/i386/isa/bs/bs.c,v 1.8 1999/12/03 11:58:11 nyan Exp $ */ -/* $DragonFly: src/sys/dev/disk/i386/bs/Attic/bs.c,v 1.6 2004/02/13 01:04:14 joerg Exp $ */ +/* $DragonFly: src/sys/dev/disk/i386/bs/Attic/bs.c,v 1.7 2004/08/02 13:22:32 joerg Exp $ */ /* * [NetBSD for NEC PC98 series] * Copyright (c) 1994, 1995, 1996 NetBSD/pc98 porting staff. @@ -239,7 +239,7 @@ bscmdstart(ti, flags) struct bsccb *cb; struct bs_softc *bsc = ti->ti_bsc; - if ((cb = ti->ti_ctab.tqh_first) == NULL) + if ((cb = TAILQ_FIRST(&ti->ti_ctab)) == NULL) { if (bsc->sc_nexus == NULL) bshoststart(bsc, NULL); @@ -282,7 +282,7 @@ bscmddone(ti) struct targ_info *ti; { struct bs_softc *bsc = ti->ti_bsc; - struct bsccb *cb = ti->ti_ctab.tqh_first; + struct bsccb *cb = TAILQ_FIRST(&ti->ti_ctab); union ccb *ccb; int error; @@ -387,7 +387,7 @@ bscmddone(ti) } bs_free_ccb(cb); - cb = ti->ti_ctab.tqh_first; + cb = TAILQ_FIRST(&ti->ti_ctab); } while (cb != NULL && (cb->bsccb_flags & BSITSDONE) != 0); @@ -416,12 +416,12 @@ bshoststart(bsc, ti) again: if (ti == NULL) { - if ((ti = bsc->sc_sttab.tqh_first) == NULL) + if ((ti = TAILQ_FIRST(&bsc->sc_sttab)) == NULL) return; bs_hostque_delete(bsc, ti); } - if ((cb = ti->ti_ctab.tqh_first) == NULL) + if ((cb = TAILQ_FIRST(&ti->ti_ctab)) == NULL) { bs_printf(ti, "bshoststart", "Warning: No ccb"); BS_SETUP_PHASE(FREE); @@ -451,10 +451,10 @@ again: { struct targ_info *tmpti; - for (tmpti = bsc->sc_titab.tqh_first; tmpti; - tmpti = tmpti->ti_tchain.tqe_next) + TAILQ_FOREACH(tmpti, &bsc->sc_titab; ti_tchain) { if (tmpti->ti_phase >= DISCONNECTED) goto retry; + } } /* start selection */ @@ -616,7 +616,7 @@ bs_reselect(bsc) /* confirm nexus */ BS_HOST_START bshw_setup_ctrl_reg(bsc, ti->ti_cfgflags); - if (ti->ti_ctab.tqh_first == NULL || ti->ti_phase != DISCONNECTED) + if (TAILQ_EMPTY(&ti->ti_ctab) || ti->ti_phase != DISCONNECTED) { bs_printf(ti, "reselect", "phase mismatch"); BS_SETUP_PHASE(UNDEF) @@ -671,7 +671,7 @@ bs_poll_timeout(bsc, s) bs_printf(NULL, s, "timeout"); bsc->sc_flags |= BSRESET; - if ((ti = bsc->sc_nexus) && ti->ti_ctab.tqh_first) + if ((ti = bsc->sc_nexus) && !TAILQ_EMPTY(&ti->ti_ctab)) ti->ti_error |= BSTIMEOUT; } @@ -836,7 +836,7 @@ bs_quick_abort(ti, msg) { struct bsccb *cb; - if ((cb = ti->ti_ctab.tqh_first) == NULL) + if ((cb = TAILQ_FIRST(&ti->ti_ctab)) == NULL) return; cb->msgoutlen = 1; @@ -870,7 +870,7 @@ bs_msgin_ext(ti) struct targ_info *ti; { struct bs_softc *bsc = ti->ti_bsc; - struct bsccb *cb = ti->ti_ctab.tqh_first; + struct bsccb *cb = TAILQ_FIRST(&ti->ti_ctab); int count; u_int reqlen; u_int32_t *ptr; @@ -943,7 +943,7 @@ bs_msg_reject(ti) struct targ_info *ti; { struct bs_softc *bsc = ti->ti_bsc; - struct bsccb *cb = ti->ti_ctab.tqh_first; + struct bsccb *cb = TAILQ_FIRST(&ti->ti_ctab); char *s = "unexpected msg reject"; switch (ti->ti_ophase) @@ -1197,7 +1197,7 @@ bs_disconnect_phase(bsc, ti, cb) ti->ti_flags &= ~BSNEXUS; #endif /* BS_DIAG */ BS_SETUP_PHASE(FREE); - if (cb || bsc->sc_sttab.tqh_first == NULL) + if (cb || TAILQ_EMPTY(&bsc->sc_sttab)) { BS_HOST_TERMINATE; bscmdstart(ti, BSCMDSTART); @@ -1375,7 +1375,7 @@ bs_sequencer(bsc) } ti = bsc->sc_nexus; - if (ti == NULL || (cb = ti->ti_ctab.tqh_first) == NULL) + if (ti == NULL || (cb = TAILQ_FIRST(&ti->ti_ctab)) == NULL) { bs_debug_print_all(bsc); bs_printf(ti, "bsintr", "no nexus"); @@ -1592,7 +1592,7 @@ bs_scsi_cmd_poll_internal(cti) /* setup timeout count */ if ((ti = bsc->sc_nexus) == NULL || - (cb = ti->ti_ctab.tqh_first) == NULL) + (cb = TAILQ_FIRST(&ti->ti_ctab)) == NULL) waits = BS_DEFAULT_TIMEOUT_SECOND * 1000000; else waits = cb->tcmax * 1000000; @@ -1603,7 +1603,7 @@ bs_scsi_cmd_poll_internal(cti) if ((ti = bsc->sc_ti[i]) != NULL) { ti->ti_flags |= BSFORCEIOPOLL; - if ((cb = ti->ti_ctab.tqh_first) != NULL) + if ((cb = TAILQ_FIRST(&ti->ti_ctab)) != NULL) cb->bsccb_flags |= BSFORCEIOPOLL; } } @@ -1659,7 +1659,8 @@ bs_scsi_cmd_poll(cti, targetcb) { if (bs_scsi_cmd_poll_internal(cti) != COMPLETE) { - if ((ti = bsc->sc_nexus) && ti->ti_ctab.tqh_first) + if ((ti = bsc->sc_nexus) && + !TAILQ_EMPTY(&ti->ti_ctab)) ti->ti_error |= (BSTIMEOUT | BSABNORMAL); bs_reset_nexus(bsc); } diff --git a/sys/dev/disk/i386/bs/bsfunc.c b/sys/dev/disk/i386/bs/bsfunc.c index 5ede326ae0..891a938930 100644 --- a/sys/dev/disk/i386/bs/bsfunc.c +++ b/sys/dev/disk/i386/bs/bsfunc.c @@ -1,7 +1,7 @@ /* $NecBSD: bsfunc.c,v 1.2 1997/10/31 17:43:37 honda Exp $ */ /* $NetBSD$ */ /* $FreeBSD: src/sys/i386/isa/bs/bsfunc.c,v 1.7.2.2 2001/07/26 02:32:18 nyan Exp $ */ -/* $DragonFly: src/sys/dev/disk/i386/bs/Attic/bsfunc.c,v 1.6 2004/03/15 01:10:43 dillon Exp $ */ +/* $DragonFly: src/sys/dev/disk/i386/bs/Attic/bsfunc.c,v 1.7 2004/08/02 13:22:32 joerg Exp $ */ /* * [NetBSD for NEC PC98 series] * Copyright (c) 1994, 1995, 1996 NetBSD/pc98 porting staff. @@ -96,19 +96,20 @@ bstimeout(arg) bsc->sc_flags &= ~BSSTARTTIMEOUT; /* check */ - if ((ti = bsc->sc_nexus) && (cb = ti->ti_ctab.tqh_first)) + if ((ti = bsc->sc_nexus) && (cb = TAILQ_FIRST(&ti->ti_ctab))) { if ((cb->tc -= BS_TIMEOUT_CHECK_INTERVAL) < 0) bs_timeout_target(ti); } - else for (ti = bsc->sc_titab.tqh_first; ti; ti = ti->ti_tchain.tqe_next) - { - if (bsc->sc_dtgnum && ti->ti_phase < DISCONNECTED) - continue; - - cb = ti->ti_ctab.tqh_first; - if (cb && ((cb->tc -= BS_TIMEOUT_CHECK_INTERVAL) < 0)) - bs_timeout_target(ti); + else { + TAILQ_FOREACH(ti, &bsc->sc_titab, ti_tichain) { + if (bsc->sc_dtgnum && ti->ti_phase < DISCONNECTED) + continue; + + cb = TAILQ_FIRST(&ti->ti_ctab); + if (cb && ((cb->tc -= BS_TIMEOUT_CHECK_INTERVAL) < 0)) + bs_timeout_target(ti); + } } /* try to recover */ @@ -258,7 +259,7 @@ bs_start_syncmsg(ti, cb, flag) msg.flag = 0; lun = ti->ti_lun; if (cb == NULL) - cb = ti->ti_ctab.tqh_first; + cb = TAILQ_FIRST(&ti->ti_ctab); } else if (ti->ti_cfgflags & BS_SCSI_SYNC) { @@ -419,7 +420,7 @@ bs_force_abort(ti) { struct bs_softc *bsc = ti->ti_bsc; struct msgbase msg; - struct bsccb *cb = ti->ti_ctab.tqh_first; + struct bsccb *cb = TAILQ_FIRST(&ti->ti_ctab); u_int lun; if (cb) @@ -479,13 +480,13 @@ bs_scsibus_start(bsc) bshw_bus_reset(bsc); bshw_chip_reset(bsc); printf(" done. scsi bus ready.\n"); - nextti = bsc->sc_titab.tqh_first; + nextti = TAILQ_FIRST(&bsc->sc_titab); error = COMPLETE; } if ((ti = nextti) == NULL) break; - nextti = ti->ti_tchain.tqe_next; + nextti = TAILQ_NEXT(ti, ti_tchain); bits = (1 << ti->ti_id); if (skip & bits) @@ -511,11 +512,10 @@ bs_scsibus_start(bsc) bsc->sc_hstate = BSC_RDY; /* recover */ - for (ti = bsc->sc_titab.tqh_first; ti; ti = ti->ti_tchain.tqe_next) - { + TAILQ_FOREACH(ti, &bsc->sc_titab; ti_tchain) { ti->ti_ctab = ti->ti_bctab; TAILQ_INIT(&ti->ti_bctab); - if (ti->ti_ctab.tqh_first) + if (!TAILQ_EMPTY(&ti->ti_ctab)) bscmdstart(ti, BSCMDSTART); } } @@ -540,8 +540,7 @@ bs_reset_nexus(bsc) bsc->sc_dtgnum = 0; /* target state clear */ - for (ti = bsc->sc_titab.tqh_first; ti; ti = ti->ti_tchain.tqe_next) - { + TAILQ_FOREACH(ti, &bsc->sc_titab, ti_tchain) { if (ti->ti_state == BS_TARG_SYNCH) bs_analyze_syncmsg(ti, NULL); if (ti->ti_state > BS_TARG_START) @@ -549,8 +548,9 @@ bs_reset_nexus(bsc) BS_SETUP_PHASE(UNDEF) bs_hostque_delete(bsc, ti); - if ((cb = ti->ti_ctab.tqh_first) != NULL) + if (!TAILQ_EMPTY(&ti->ti_ctab)) { + cb = TAILQ_FIRST(&ti->ti_ctab); if (bsc->sc_hstate == BSC_TARG_CHECK) { ti->ti_error |= BSFATALIO; @@ -574,15 +574,14 @@ bs_reset_nexus(bsc) ti->ti_flags &= ~BSNEXUS; #endif /* BS_DIAG */ - for ( ; cb; cb = cb->ccb_chain.tqe_next) - { + TAILQ_FOREACH(cb, &ti->ti_ctab, ccb_chain) { bs_kill_msg(cb); cb->bsccb_flags &= ~(BSITSDONE | BSCASTAT); cb->error = 0; } if (bsc->sc_hstate != BSC_TARG_CHECK && - ti->ti_bctab.tqh_first == NULL) + TAILQ_EMPTY(&ti->ti_bctab)) ti->ti_bctab = ti->ti_ctab; TAILQ_INIT(&ti->ti_ctab); @@ -867,7 +866,7 @@ bs_debug_print_all(bsc) { struct targ_info *ti; - for (ti = bsc->sc_titab.tqh_first; ti; ti = ti->ti_tchain.tqe_next) + TAILQ_FOREACH(ti, &bsc->sc_titab.tqh_first, ti_tchain) bs_debug_print(bsc, ti); } @@ -898,7 +897,7 @@ bs_debug_print(bsc, ti) ti->ti_lun, phase[(int) ti->ti_phase]); printf("msgptr %x msg[0] %x status %x tqh %lx fl %x\n", (u_int) (ti->ti_msginptr), (u_int) (ti->ti_msgin[0]), - ti->ti_status, (u_long) (cb = ti->ti_ctab.tqh_first), + ti->ti_status, (u_long) (cb = TAILQ_FIRST(&ti->ti_ctab)), ti->ti_flags); if (cb) printf("cmdlen %x cmdaddr %lx cmd[0] %x\n", diff --git a/sys/dev/disk/i386/bs/bsfunc.h b/sys/dev/disk/i386/bs/bsfunc.h index 7123e3904b..4f5ae3c4fb 100644 --- a/sys/dev/disk/i386/bs/bsfunc.h +++ b/sys/dev/disk/i386/bs/bsfunc.h @@ -1,6 +1,6 @@ /* $NecBSD: bsfunc.h,v 1.1 1997/07/18 09:19:03 kmatsuda Exp $ */ /* $NetBSD$ */ -/* $DragonFly: src/sys/dev/disk/i386/bs/Attic/bsfunc.h,v 1.3 2004/02/13 01:04:14 joerg Exp $ */ +/* $DragonFly: src/sys/dev/disk/i386/bs/Attic/bsfunc.h,v 1.4 2004/08/02 13:22:32 joerg Exp $ */ /* * [NetBSD for NEC PC98 series] * Copyright (c) 1994, 1995, 1996 NetBSD/pc98 porting staff. @@ -114,7 +114,7 @@ bs_check_link(ti, cb) struct bsccb *nextcb; return ((ti->ti_flags & BSLINK) && - (nextcb = cb->ccb_chain.tqe_next) && + (nextcb = TAILQ_NEXT(cb, ccb_chain)) && (nextcb->bsccb_flags & BSLINK)); } diff --git a/sys/dev/misc/streams/streams.c b/sys/dev/misc/streams/streams.c index 84e5e920d2..1407b1ff2d 100644 --- a/sys/dev/misc/streams/streams.c +++ b/sys/dev/misc/streams/streams.c @@ -31,7 +31,7 @@ * in 3.0-980524-SNAP then hacked a bit (but probably not enough :-). * * $FreeBSD: src/sys/dev/streams/streams.c,v 1.16.2.1 2001/02/26 04:23:07 jlemon Exp $ - * $DragonFly: src/sys/dev/misc/streams/Attic/streams.c,v 1.12 2004/05/19 22:52:44 dillon Exp $ + * $DragonFly: src/sys/dev/misc/streams/Attic/streams.c,v 1.13 2004/08/02 13:22:32 joerg Exp $ */ #include @@ -355,7 +355,7 @@ svr4_delete_socket(struct thread *td, struct file *fp) return; } - for (e = svr4_head.tqh_first; e != NULL; e = e->entries.tqe_next) + TAILQ_FOREACH(e, &svr4_head, entries) { if (e->td == td && e->cookie == cookie) { TAILQ_REMOVE(&svr4_head, e, entries); DPRINTF(("svr4_delete_socket: %s [%p,%d,%d]\n", @@ -364,6 +364,7 @@ svr4_delete_socket(struct thread *td, struct file *fp) free(e, M_TEMP); return; } + } } static int diff --git a/sys/dev/netif/re/if_re.c b/sys/dev/netif/re/if_re.c index 401690ee8b..984d9e886c 100644 --- a/sys/dev/netif/re/if_re.c +++ b/sys/dev/netif/re/if_re.c @@ -33,7 +33,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/re/if_re.c,v 1.25 2004/06/09 14:34:01 naddy Exp $ - * $DragonFly: src/sys/dev/netif/re/if_re.c,v 1.3 2004/07/23 07:16:28 joerg Exp $ + * $DragonFly: src/sys/dev/netif/re/if_re.c,v 1.4 2004/08/02 13:22:32 joerg Exp $ */ /* @@ -739,8 +739,8 @@ re_probe(device_t dev) * Temporarily map the I/O space so we can read the chip ID register. */ sc = malloc(sizeof(*sc), M_TEMP, M_WAITOK | M_ZERO); - rid = RE_PCI_LOMEM; - sc->re_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + rid = RE_PCI_LOIO; + sc->re_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); if (sc->re_res == NULL) { device_printf(dev, "couldn't map ports/memory\n"); @@ -752,7 +752,7 @@ re_probe(device_t dev) sc->re_bhandle = rman_get_bushandle(sc->re_res); hwrev = CSR_READ_4(sc, RE_TXCFG) & RE_TXCFG_HWREV; - bus_release_resource(dev, SYS_RES_MEMORY, RE_PCI_LOMEM, sc->re_res); + bus_release_resource(dev, SYS_RES_IOPORT, RE_PCI_LOIO, sc->re_res); free(sc, M_TEMP); /* @@ -1011,8 +1011,8 @@ re_attach(device_t dev) */ pci_enable_busmaster(dev); - rid = RE_PCI_LOMEM; - sc->re_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + rid = RE_PCI_LOIO; + sc->re_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); if (sc->re_res == NULL) { @@ -1195,7 +1195,7 @@ re_detach(device_t dev) if (sc->re_irq) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->re_irq); if (sc->re_res) - bus_release_resource(dev, SYS_RES_MEMORY, RE_PCI_LOMEM, + bus_release_resource(dev, SYS_RES_IOPORT, RE_PCI_LOMEM, sc->re_res); /* Unload and free the RX DMA ring memory and map */ @@ -2234,7 +2234,7 @@ re_resume(device_t dev) /* reenable busmastering */ pci_enable_busmaster(dev); - pci_enable_io(dev, SYS_RES_MEMORY); + pci_enable_io(dev, SYS_RES_IOPORT); #endif /* reinitialize interface if necessary */ diff --git a/sys/dev/netif/re/if_rereg.h b/sys/dev/netif/re/if_rereg.h index 99b48c42b9..315ed0adf1 100644 --- a/sys/dev/netif/re/if_rereg.h +++ b/sys/dev/netif/re/if_rereg.h @@ -33,7 +33,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_rlreg.h,v 1.42 2004/05/24 19:39:23 jhb Exp $ - * $DragonFly: src/sys/dev/netif/re/if_rereg.h,v 1.1 2004/07/07 09:47:27 joerg Exp $ + * $DragonFly: src/sys/dev/netif/re/if_rereg.h,v 1.2 2004/08/02 13:22:32 joerg Exp $ */ /* @@ -815,3 +815,4 @@ struct re_softc { */ #define RE_PCI_LOMEM 0x14 +#define RE_PCI_LOIO 0x10 diff --git a/sys/dev/netif/wl/if_wl.c b/sys/dev/netif/wl/if_wl.c index c2e845d94e..19f78df0c4 100644 --- a/sys/dev/netif/wl/if_wl.c +++ b/sys/dev/netif/wl/if_wl.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/i386/isa/if_wl.c,v 1.27.2.2 2000/07/17 21:24:32 archie Exp $ */ -/* $DragonFly: src/sys/dev/netif/wl/if_wl.c,v 1.13 2004/07/23 07:16:30 joerg Exp $ */ +/* $DragonFly: src/sys/dev/netif/wl/if_wl.c,v 1.14 2004/08/02 13:22:32 joerg Exp $ */ /* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -672,7 +672,7 @@ wlinit(void *xsc) printf("wl%d: entered wlinit()\n",sc->unit); #endif #if defined(__DragonFly__) || (defined(__FreeBSD__) && __FreeBSD_version >= 300000) - if (ifp->if_addrhead.tqh_first == (struct ifaddr *)0) { + if (TAILQ_EMPTY(&ifp->if_addrhead)) { #else if (ifp->if_addrlist == (struct ifaddr *)0) { #endif diff --git a/sys/emulation/svr4/svr4_socket.c b/sys/emulation/svr4/svr4_socket.c index 274441372f..011652955d 100644 --- a/sys/emulation/svr4/svr4_socket.c +++ b/sys/emulation/svr4/svr4_socket.c @@ -29,7 +29,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/svr4/svr4_socket.c,v 1.7 1999/12/08 12:00:48 newton Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_socket.c,v 1.5 2003/08/07 21:17:19 dillon Exp $ + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_socket.c,v 1.6 2004/08/02 13:22:32 joerg Exp $ */ /* @@ -95,7 +95,7 @@ svr4_find_socket(td, fp, dev, ino) DPRINTF(("svr4_find_socket: [%p,%d,%d]: ", td, dev, ino)); - for (e = svr4_head.tqh_first; e != NULL; e = e->entries.tqe_next) + TAILQ_FOREACH(e, &svr4_head, entries) if (e->td == td && e->dev == dev && e->ino == ino) { #ifdef DIAGNOSTIC if (e->cookie != NULL && e->cookie != cookie) diff --git a/sys/emulation/svr4/svr4_sockio.c b/sys/emulation/svr4/svr4_sockio.c index 888e407b2a..48821cb4f4 100644 --- a/sys/emulation/svr4/svr4_sockio.c +++ b/sys/emulation/svr4/svr4_sockio.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/svr4/svr4_sockio.c,v 1.7 1999/12/08 12:00:48 newton Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_sockio.c,v 1.6 2003/09/12 00:43:30 daver Exp $ + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_sockio.c,v 1.7 2004/08/02 13:22:32 joerg Exp $ */ #include @@ -104,15 +104,12 @@ svr4_sock_ioctl(fp, td, retval, fd, cmd, data) * entry per physical interface? */ - for (ifp = ifnet.tqh_first; - ifp != 0; ifp = ifp->if_link.tqe_next) - if ((ifa = ifp->if_addrhead.tqh_first) == NULL) + TAILQ_FOREACH(ifp, &ifnet, if_link) { + if (TAILQ_EMPTY(&ifp->if_addrhead)) ifnum++; - else - for (;ifa != NULL; - ifa = ifa->ifa_link.tqe_next) - ifnum++; - + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) + ifnum++; + } DPRINTF(("SIOCGIFNUM %d\n", ifnum)); return copyout(&ifnum, data, sizeof(ifnum)); diff --git a/sys/i386/include/physio_proc.h b/sys/i386/include/physio_proc.h index 9f6a5f7159..ad8890b51f 100644 --- a/sys/i386/include/physio_proc.h +++ b/sys/i386/include/physio_proc.h @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/i386/include/physio_proc.h,v 1.1.2.1 2000/10/29 11:05:48 non Exp $ */ -/* $DragonFly: src/sys/i386/include/Attic/physio_proc.h,v 1.7 2004/02/16 20:11:21 dillon Exp $ */ +/* $DragonFly: src/sys/i386/include/Attic/physio_proc.h,v 1.8 2004/08/02 13:22:32 joerg Exp $ */ /* $NecBSD: physio_proc.h,v 3.4 1999/07/23 20:47:03 honda Exp $ */ /* $NetBSD$ */ @@ -58,7 +58,7 @@ physio_proc_enter(bp) if (bp == NULL || (bp->b_flags & B_PHYS) == 0) return NULL; - if ((pp = physio_proc_freet.tqh_first) == NULL) + if ((pp = TAILQ_FIRST(&physio_proc_freet)) == NULL) return NULL; s = splstatclock(); diff --git a/sys/i386/isa/ccbque.h b/sys/i386/isa/ccbque.h index 5a0a245374..73a59d0524 100644 --- a/sys/i386/isa/ccbque.h +++ b/sys/i386/isa/ccbque.h @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/ccbque.h,v 1.3.6.2 2000/10/21 07:44:24 nyan Exp $ - * $DragonFly: src/sys/i386/isa/Attic/ccbque.h,v 1.4 2003/08/26 21:42:19 rob Exp $ + * $DragonFly: src/sys/i386/isa/Attic/ccbque.h,v 1.5 2004/08/02 13:22:32 joerg Exp $ */ /* * Common command control queue funcs. @@ -79,7 +79,7 @@ DEV##_get_ccb() \ if (CCBTYPE##que.count < CCBTYPE##que.maxccb) \ { \ CCBTYPE##que.count ++; \ - cb = CCBTYPE##que.CCBTYPE##tab.tqh_first; \ + cb = TAILQ_FIRST(&CCBTYPE##que.CCBTYPE##tab); \ if (cb != NULL) \ { \ TAILQ_REMOVE(&CCBTYPE##que.CCBTYPE##tab, cb, CHAIN);\ diff --git a/sys/net/if.c b/sys/net/if.c index 2ffab792cc..0d0332d3a4 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -32,7 +32,7 @@ * * @(#)if.c 8.3 (Berkeley) 1/4/94 * $FreeBSD: src/sys/net/if.c,v 1.185 2004/03/13 02:35:03 brooks Exp $ - * $DragonFly: src/sys/net/if.c,v 1.18 2004/06/04 07:45:45 hmp Exp $ + * $DragonFly: src/sys/net/if.c,v 1.19 2004/08/02 13:22:32 joerg Exp $ */ #include "opt_compat.h" @@ -1397,7 +1397,6 @@ ifconf(u_long cmd, caddr_t data, struct thread *td) } addrs = 0; - ifa = ifp->if_addrhead.tqh_first; TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (space <= sizeof(ifr)) break; diff --git a/sys/net/ip6fw/ip6_fw.c b/sys/net/ip6fw/ip6_fw.c index f384ab255a..23a6b30255 100644 --- a/sys/net/ip6fw/ip6_fw.c +++ b/sys/net/ip6fw/ip6_fw.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/ip6_fw.c,v 1.2.2.9 2002/04/28 05:40:27 suz Exp $ */ -/* $DragonFly: src/sys/net/ip6fw/ip6_fw.c,v 1.9 2004/07/23 14:14:30 joerg Exp $ */ +/* $DragonFly: src/sys/net/ip6fw/ip6_fw.c,v 1.10 2004/08/02 13:22:33 joerg Exp $ */ /* $KAME: ip6_fw.c,v 1.21 2001/01/24 01:25:32 itojun Exp $ */ /* @@ -337,18 +337,16 @@ iface_match(struct ifnet *ifp, union ip6_fw_if *ifu, int byname) } return(1); } else if (!IN6_IS_ADDR_UNSPECIFIED(&ifu->fu_via_ip6)) { /* Zero == wildcard */ - struct ifaddr *ia; + struct ifaddr *ifa; - for (ia = ifp->if_addrlist.tqh_first; ia; ia = ia->ifa_list.tqe_next) - { - - if (ia->ifa_addr == NULL) + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { + if (ifa->ifa_addr == NULL) continue; - if (ia->ifa_addr->sa_family != AF_INET6) + if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (!IN6_ARE_ADDR_EQUAL(&ifu->fu_via_ip6, &(((struct sockaddr_in6 *) - (ia->ifa_addr))->sin6_addr))) + (ifa->ifa_addr))->sin6_addr))) continue; return(1); } diff --git a/sys/net/sppp/if_spppsubr.c b/sys/net/sppp/if_spppsubr.c index 791a5b8c50..7be547f47a 100644 --- a/sys/net/sppp/if_spppsubr.c +++ b/sys/net/sppp/if_spppsubr.c @@ -18,7 +18,7 @@ * From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997 * * $FreeBSD: src/sys/net/if_spppsubr.c,v 1.59.2.13 2002/07/03 15:44:41 joerg Exp $ - * $DragonFly: src/sys/net/sppp/if_spppsubr.c,v 1.15 2004/06/04 07:45:46 hmp Exp $ + * $DragonFly: src/sys/net/sppp/if_spppsubr.c,v 1.16 2004/08/02 13:22:33 joerg Exp $ */ #include @@ -4870,9 +4870,8 @@ sppp_get_ip6_addrs(struct sppp *sp, struct in6_addr *src, struct in6_addr *dst, * aliases don't make any sense on a p2p link anyway. */ #if defined(__DragonFly__) - for (ifa = ifp->if_addrhead.tqh_first, si = 0; - ifa; - ifa = ifa->ifa_link.tqe_next) + si = 0; + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) #elif defined(__NetBSD__) || defined (__OpenBSD__) for (ifa = ifp->if_addrlist.tqh_first, si = 0; ifa; @@ -4935,9 +4934,7 @@ sppp_set_ip6_addr(struct sppp *sp, const struct in6_addr *src) sin6 = NULL; #if defined(__DragonFly__) - for (ifa = ifp->if_addrhead.tqh_first; - ifa; - ifa = ifa->ifa_link.tqe_next) + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) #elif defined(__NetBSD__) || defined (__OpenBSD__) for (ifa = ifp->if_addrlist.tqh_first; ifa; diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 67b8b9c4a7..e61bee1e6c 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/icmp6.c,v 1.6.2.13 2003/05/06 06:46:58 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/icmp6.c,v 1.11 2004/06/07 07:02:42 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/icmp6.c,v 1.12 2004/08/02 13:22:33 joerg Exp $ */ /* $KAME: icmp6.c,v 1.211 2001/04/04 05:56:20 itojun Exp $ */ /* @@ -1754,9 +1754,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6, for (; ifp; ifp = TAILQ_NEXT(ifp, if_list)) { - for (ifa = ifp->if_addrlist.tqh_first; ifa; - ifa = ifa->ifa_list.tqe_next) - { + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ifa6 = (struct in6_ifaddr *)ifa; diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 1a5e5bbd8f..3e98b37a8c 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/in6_ifattach.c,v 1.2.2.6 2002/04/28 05:40:26 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/in6_ifattach.c,v 1.6 2004/06/07 07:02:42 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/in6_ifattach.c,v 1.7 2004/08/02 13:22:33 joerg Exp $ */ /* $KAME: in6_ifattach.c,v 1.118 2001/05/24 07:44:00 itojun Exp $ */ /* @@ -235,10 +235,7 @@ get_hw_ifid(struct ifnet *ifp, static u_int8_t allone[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - for (ifa = ifp->if_addrlist.tqh_first; - ifa; - ifa = ifa->ifa_list.tqe_next) - { + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family != AF_LINK) continue; sdl = (struct sockaddr_dl *)ifa->ifa_addr; @@ -377,8 +374,7 @@ get_ifid(struct ifnet *ifp0, } /* next, try to get it from some other hardware interface */ - for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_list.tqe_next) - { + TAILQ_FOREACH(ifp, &ifnet, if_list) { if (ifp == ifp0) continue; if (get_hw_ifid(ifp, in6) != 0) @@ -677,8 +673,7 @@ in6_nigroup_attach(const char *name, int namelen) if (in6_nigroup(NULL, name, namelen, &mltaddr.sin6_addr) != 0) return; - for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_list.tqe_next) - { + TAILQ_FOREACH(ifp, &ifnet, if_list) { mltaddr.sin6_addr.s6_addr16[1] = htons(ifp->if_index); IN6_LOOKUP_MULTI(mltaddr.sin6_addr, ifp, in6m); if (!in6m) { @@ -705,8 +700,7 @@ in6_nigroup_detach(const char *name, int namelen) if (in6_nigroup(NULL, name, namelen, &mltaddr.sin6_addr) != 0) return; - for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_list.tqe_next) - { + TAILQ_FOREACH(ifp, &ifnet, if_list) { mltaddr.sin6_addr.s6_addr16[1] = htons(ifp->if_index); IN6_LOOKUP_MULTI(mltaddr.sin6_addr, ifp, in6m); if (in6m) @@ -879,20 +873,15 @@ in6_ifdetach(struct ifnet *ifp) nd6_purge(ifp); /* nuke any of IPv6 addresses we have */ - for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = next) + TAILQ_FOREACH_MUTABLE(ifa, &ifp->if_addrlist, ifa_list, next) { - next = ifa->ifa_list.tqe_next; if (ifa->ifa_addr->sa_family != AF_INET6) continue; in6_purgeaddr(ifa); } /* undo everything done by in6_ifattach(), just in case */ - for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = next) - { - next = ifa->ifa_list.tqe_next; - - + TAILQ_FOREACH_MUTABLE(ifa, &ifp->if_addrlist, ifa_list, next) { if (ifa->ifa_addr->sa_family != AF_INET6 || !IN6_IS_ADDR_LINKLOCAL(&satosin6(&ifa->ifa_addr)->sin6_addr)) { continue; diff --git a/sys/netinet6/in6_prefix.c b/sys/netinet6/in6_prefix.c index 970a2ebc6a..da8ce892c8 100644 --- a/sys/netinet6/in6_prefix.c +++ b/sys/netinet6/in6_prefix.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/in6_prefix.c,v 1.4.2.3 2001/07/03 11:01:52 ume Exp $ */ -/* $DragonFly: src/sys/netinet6/in6_prefix.c,v 1.5 2004/05/20 18:30:36 cpressey Exp $ */ +/* $DragonFly: src/sys/netinet6/in6_prefix.c,v 1.6 2004/08/02 13:22:33 joerg Exp $ */ /* $KAME: in6_prefix.c,v 1.47 2001/03/25 08:41:39 itojun Exp $ */ /* @@ -1012,9 +1012,7 @@ link_stray_ia6s(struct rr_prefix *rpp) { struct ifaddr *ifa; - for (ifa = rpp->rp_ifp->if_addrlist.tqh_first; ifa; - ifa = ifa->ifa_list.tqe_next) - { + TAILQ_FOREACH(ifa, &rpp->rp_ifp->if_addrlist, ifa_list) { struct rp_addr *rap; struct rr_prefix *orpp; int error = 0; @@ -1130,10 +1128,7 @@ in6_prefix_ioctl(struct socket *so, u_long cmd, caddr_t data, free_rp_entries(&rp_tmp); break; } - for (ifa = ifp->if_addrlist.tqh_first; - ifa; - ifa = ifa->ifa_list.tqe_next) - { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { if (ifa->ifa_addr == NULL) continue; /* just for safety */ if (ifa->ifa_addr->sa_family != AF_INET6) diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index 8850b2933b..4df4278440 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/in6_var.h,v 1.3.2.3 2002/04/28 05:40:27 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/in6_var.h,v 1.4 2003/08/23 11:02:45 rob Exp $ */ +/* $DragonFly: src/sys/netinet6/in6_var.h,v 1.5 2004/08/02 13:22:33 joerg Exp $ */ /* $KAME: in6_var.h,v 1.56 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -479,7 +479,7 @@ MALLOC_DECLARE(M_IPMADDR); /* struct in6_ifaddr *ia; */ \ do { \ struct ifaddr *ifa; \ - for (ifa = (ifp)->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) { \ + TAILQ_FOREACH(ifa, &(ifp)->if_addrhead, ifa_list) { \ if (!ifa->ifa_addr) \ continue; \ if (ifa->ifa_addr->sa_family == AF_INET6) \ diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 81e67a83d7..55c6c7d4ad 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/nd6.c,v 1.2.2.15 2003/05/06 06:46:58 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/nd6.c,v 1.7 2004/07/17 09:43:06 joerg Exp $ */ +/* $DragonFly: src/sys/netinet6/nd6.c,v 1.8 2004/08/02 13:22:33 joerg Exp $ */ /* $KAME: nd6.c,v 1.144 2001/05/24 07:44:00 itojun Exp $ */ /* @@ -645,9 +645,7 @@ regen_tmpaddr(struct in6_ifaddr *ia6) /* deprecated/invalidated temporary struct in6_ifaddr *public_ifa6 = NULL; ifp = ia6->ia_ifa.ifa_ifp; - for (ifa = ifp->if_addrlist.tqh_first; ifa; - ifa = ifa->ifa_list.tqe_next) - { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_list) { struct in6_ifaddr *it6; if (ifa->ifa_addr->sa_family != AF_INET6) @@ -898,10 +896,7 @@ nd6_is_addr_neighbor(struct sockaddr_in6 *addr, struct ifnet *ifp) * If the address matches one of our addresses, * it should be a neighbor. */ - for (ifa = ifp->if_addrlist.tqh_first; - ifa; - ifa = ifa->ifa_list.tqe_next) - { + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) next: continue; diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index c9a3e00eff..deee34b624 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/nd6_nbr.c,v 1.4.2.6 2003/01/23 21:06:47 sam Exp $ */ -/* $DragonFly: src/sys/netinet6/nd6_nbr.c,v 1.5 2004/06/02 14:43:01 eirikn Exp $ */ +/* $DragonFly: src/sys/netinet6/nd6_nbr.c,v 1.6 2004/08/02 13:22:33 joerg Exp $ */ /* $KAME: nd6_nbr.c,v 1.86 2002/01/21 02:33:04 jinmei Exp $ */ /* @@ -992,7 +992,7 @@ nd6_dad_find(struct ifaddr *ifa) { struct dadq *dp; - for (dp = dadq.tqh_first; dp; dp = dp->dad_list.tqe_next) { + TAILQ_FOREACH(dp, &dadq, dad_list) { if (dp->dad_ifa == ifa) return dp; } diff --git a/sys/netproto/atalk/aarp.c b/sys/netproto/atalk/aarp.c index a628664b81..ca99a5acc5 100644 --- a/sys/netproto/atalk/aarp.c +++ b/sys/netproto/atalk/aarp.c @@ -3,7 +3,7 @@ * All Rights Reserved. * * $FreeBSD: src/sys/netatalk/aarp.c,v 1.12.2.2 2001/06/23 20:43:09 iedowse Exp $ - * $DragonFly: src/sys/netproto/atalk/aarp.c,v 1.12 2004/07/17 09:43:06 joerg Exp $ + * $DragonFly: src/sys/netproto/atalk/aarp.c,v 1.13 2004/08/02 13:22:33 joerg Exp $ */ #include "opt_atalk.h" @@ -297,6 +297,7 @@ static void at_aarpinput( struct arpcom *ac, struct mbuf *m) { struct ether_aarp *ea; + struct ifaddr *ifa; struct at_ifaddr *aa; struct aarptab *aat; struct ether_header *eh; @@ -334,8 +335,8 @@ at_aarpinput( struct arpcom *ac, struct mbuf *m) * Since we don't know the net, we just look for the first * phase 1 address on the interface. */ - for (aa = (struct at_ifaddr *)ac->ac_if.if_addrhead.tqh_first; aa; - aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) { + TAILQ_FOREACH(ifa, &ac->ac_if.if_addrhead, ifa_link) { + aa = (struct at_ifaddr *)ifa; if ( AA_SAT( aa )->sat_family == AF_APPLETALK && ( aa->aa_flags & AFA_PHASE2 ) == 0 ) { break; @@ -519,6 +520,7 @@ aarpprobe( void *arg ) struct mbuf *m; struct ether_header *eh; struct ether_aarp *ea; + struct ifaddr *ifa; struct at_ifaddr *aa; struct llc *llc; struct sockaddr sa; @@ -530,8 +532,8 @@ aarpprobe( void *arg ) * interface with the same address as we're looking for. If the * net is phase 2, generate an 802.2 and SNAP header. */ - for (aa = (struct at_ifaddr *)ac->ac_if.if_addrhead.tqh_first; aa; - aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) { + TAILQ_FOREACH(ifa, &ac->ac_if.if_addrhead, ifa_link) { + aa = (struct at_ifaddr *)ifa; if ( AA_SAT( aa )->sat_family == AF_APPLETALK && ( aa->aa_flags & AFA_PROBING )) { break; diff --git a/sys/netproto/ipsec/key.c b/sys/netproto/ipsec/key.c index 20604a6d36..8d548e468e 100644 --- a/sys/netproto/ipsec/key.c +++ b/sys/netproto/ipsec/key.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netipsec/key.c,v 1.3.2.1 2003/01/24 05:11:35 sam Exp $ */ -/* $DragonFly: src/sys/netproto/ipsec/key.c,v 1.7 2004/06/02 14:43:02 eirikn Exp $ */ +/* $DragonFly: src/sys/netproto/ipsec/key.c,v 1.8 2004/08/02 13:22:33 joerg Exp $ */ /* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */ /* @@ -3641,9 +3641,7 @@ key_ismyaddr(sa) #ifdef INET case AF_INET: sin = (struct sockaddr_in *)sa; - for (ia = in_ifaddrhead.tqh_first; ia; - ia = ia->ia_link.tqe_next) - { + TAILQ_FOREACH(ia, &in_ifaddrhead; ia_link) { if (sin->sin_family == ia->ia_addr.sin_family && sin->sin_len == ia->ia_addr.sin_len && sin->sin_addr.s_addr == ia->ia_addr.sin_addr.s_addr) diff --git a/sys/netproto/ipsec/xform_ipip.c b/sys/netproto/ipsec/xform_ipip.c index ca1783ed7f..7c875cbfcc 100644 --- a/sys/netproto/ipsec/xform_ipip.c +++ b/sys/netproto/ipsec/xform_ipip.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netipsec/xform_ipip.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */ -/* $DragonFly: src/sys/netproto/ipsec/xform_ipip.c,v 1.7 2004/06/02 14:43:02 eirikn Exp $ */ +/* $DragonFly: src/sys/netproto/ipsec/xform_ipip.c,v 1.8 2004/08/02 13:22:33 joerg Exp $ */ /* $OpenBSD: ip_ipip.c,v 1.25 2002/06/10 18:04:55 itojun Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -316,10 +316,8 @@ _ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp) if ((m->m_pkthdr.rcvif == NULL || !(m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK)) && ipip_allow != 2) { - for (ifp = ifnet.tqh_first; ifp != 0; - ifp = ifp->if_list.tqe_next) { - for (ifa = ifp->if_addrlist.tqh_first; ifa != 0; - ifa = ifa->ifa_list.tqe_next) { + TAILQ_FOREACH(ifp, &ifnetif_list) { + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_link) { #ifdef INET if (ipo) { if (ifa->ifa_addr->sa_family != diff --git a/sys/netproto/key/key.c b/sys/netproto/key/key.c index bbf39c426d..4ab8fb62d0 100644 --- a/sys/netproto/key/key.c +++ b/sys/netproto/key/key.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netkey/key.c,v 1.16.2.13 2002/07/24 18:17:40 ume Exp $ */ -/* $DragonFly: src/sys/netproto/key/key.c,v 1.8 2004/06/02 14:43:03 eirikn Exp $ */ +/* $DragonFly: src/sys/netproto/key/key.c,v 1.9 2004/08/02 13:22:33 joerg Exp $ */ /* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */ /* @@ -3801,9 +3801,7 @@ key_ismyaddr(sa) #ifdef INET case AF_INET: sin = (struct sockaddr_in *)sa; - for (ia = in_ifaddrhead.tqh_first; ia; - ia = ia->ia_link.tqe_next) - { + TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) { if (sin->sin_family == ia->ia_addr.sin_family && sin->sin_len == ia->ia_addr.sin_len && sin->sin_addr.s_addr == ia->ia_addr.sin_addr.s_addr) diff --git a/sys/platform/pc32/include/physio_proc.h b/sys/platform/pc32/include/physio_proc.h index b9461941b3..87b5fbdc20 100644 --- a/sys/platform/pc32/include/physio_proc.h +++ b/sys/platform/pc32/include/physio_proc.h @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/i386/include/physio_proc.h,v 1.1.2.1 2000/10/29 11:05:48 non Exp $ */ -/* $DragonFly: src/sys/platform/pc32/include/Attic/physio_proc.h,v 1.7 2004/02/16 20:11:21 dillon Exp $ */ +/* $DragonFly: src/sys/platform/pc32/include/Attic/physio_proc.h,v 1.8 2004/08/02 13:22:32 joerg Exp $ */ /* $NecBSD: physio_proc.h,v 3.4 1999/07/23 20:47:03 honda Exp $ */ /* $NetBSD$ */ @@ -58,7 +58,7 @@ physio_proc_enter(bp) if (bp == NULL || (bp->b_flags & B_PHYS) == 0) return NULL; - if ((pp = physio_proc_freet.tqh_first) == NULL) + if ((pp = TAILQ_FIRST(&physio_proc_freet)) == NULL) return NULL; s = splstatclock(); diff --git a/sys/sys/ccbque.h b/sys/sys/ccbque.h index 240870e468..2b7c95a4c0 100644 --- a/sys/sys/ccbque.h +++ b/sys/sys/ccbque.h @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/ccbque.h,v 1.3.6.2 2000/10/21 07:44:24 nyan Exp $ - * $DragonFly: src/sys/sys/ccbque.h,v 1.4 2003/08/26 21:42:19 rob Exp $ + * $DragonFly: src/sys/sys/ccbque.h,v 1.5 2004/08/02 13:22:32 joerg Exp $ */ /* * Common command control queue funcs. @@ -79,7 +79,7 @@ DEV##_get_ccb() \ if (CCBTYPE##que.count < CCBTYPE##que.maxccb) \ { \ CCBTYPE##que.count ++; \ - cb = CCBTYPE##que.CCBTYPE##tab.tqh_first; \ + cb = TAILQ_FIRST(&CCBTYPE##que.CCBTYPE##tab); \ if (cb != NULL) \ { \ TAILQ_REMOVE(&CCBTYPE##que.CCBTYPE##tab, cb, CHAIN);\ diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index de12e97614..c6588df49f 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -32,7 +32,7 @@ * * @(#)socketvar.h 8.3 (Berkeley) 2/19/95 * $FreeBSD: src/sys/sys/socketvar.h,v 1.46.2.10 2003/08/24 08:24:39 hsu Exp $ - * $DragonFly: src/sys/sys/socketvar.h,v 1.13 2004/06/06 19:16:10 dillon Exp $ + * $DragonFly: src/sys/sys/socketvar.h,v 1.14 2004/08/02 13:22:34 joerg Exp $ */ #ifndef _SYS_SOCKETVAR_H_ @@ -202,7 +202,7 @@ struct xsocket { #define soreadable(so) \ ((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \ ((so)->so_state & SS_CANTRCVMORE) || \ - (so)->so_comp.tqh_first || (so)->so_error) + !TAILQ_EMPTY(&(so)->so_comp) || (so)->so_error) /* can we write something to so? */ #define sowriteable(so) \ diff --git a/sys/vfs/msdosfs/msdosfs_vfsops.c b/sys/vfs/msdosfs/msdosfs_vfsops.c index 69409a04b0..e5e235cbed 100644 --- a/sys/vfs/msdosfs/msdosfs_vfsops.c +++ b/sys/vfs/msdosfs/msdosfs_vfsops.c @@ -1,5 +1,5 @@ /* $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/msdosfs/Attic/msdosfs_vfsops.c,v 1.60.2.8 2004/03/02 09:43:04 tjr Exp $ */ -/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vfsops.c,v 1.16 2004/05/26 07:45:26 dillon Exp $ */ +/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vfsops.c,v 1.17 2004/08/02 13:22:34 joerg Exp $ */ /* $NetBSD: msdosfs_vfsops.c,v 1.51 1997/11/17 15:36:58 ws Exp $ */ /*- @@ -769,7 +769,7 @@ msdosfs_unmount(struct mount *mp, int mntflags, struct thread *td) printf("id %lu, mount %p, op %p\n", vp->v_id, vp->v_mount, vp->v_op); printf("freef %p, freeb %p, mount %p\n", - vp->v_freelist.tqe_next, vp->v_freelist.tqe_prev, + TAILQ_NEXT(vp, v_freelist), TAILQ_PREV(vp, v_freelist), vp->v_mount); printf("cleanblkhd %p, dirtyblkhd %p, numoutput %ld, type %d\n", TAILQ_FIRST(&vp->v_cleanblkhd), diff --git a/sys/vfs/nfs/nfs_nqlease.c b/sys/vfs/nfs/nfs_nqlease.c index 5d2f0073b9..8b63b28ab4 100644 --- a/sys/vfs/nfs/nfs_nqlease.c +++ b/sys/vfs/nfs/nfs_nqlease.c @@ -35,7 +35,7 @@ * * @(#)nfs_nqlease.c 8.9 (Berkeley) 5/20/95 * $FreeBSD: src/sys/nfs/nfs_nqlease.c,v 1.50 2000/02/13 03:32:05 peter Exp $ - * $DragonFly: src/sys/vfs/nfs/Attic/nfs_nqlease.c,v 1.16 2004/06/02 14:43:04 eirikn Exp $ + * $DragonFly: src/sys/vfs/nfs/Attic/nfs_nqlease.c,v 1.17 2004/08/02 13:22:34 joerg Exp $ */ @@ -1034,13 +1034,13 @@ nqnfs_clientd(struct nfsmount *nmp, struct ucred *cred, struct nfsd_cargs *ncd, * processes in nfs_reply) and there is data in the receive * queue, poke for callbacks. */ - if (nfs_reqq.tqh_first == 0 && nmp->nm_so && + if (TAILQ_EMPTY(&nfs_reqq) && nmp->nm_so && nmp->nm_so->so_rcv.sb_cc > 0) { - myrep.r_flags = R_GETONEREP; - myrep.r_nmp = nmp; - myrep.r_mrep = (struct mbuf *)0; - myrep.r_td = NULL; - (void) nfs_reply(&myrep); + myrep.r_flags = R_GETONEREP; + myrep.r_nmp = nmp; + myrep.r_mrep = (struct mbuf *)0; + myrep.r_td = NULL; + nfs_reply(&myrep); } /* @@ -1121,8 +1121,7 @@ nqnfs_clientd(struct nfsmount *nmp, struct ucred *cred, struct nfsd_cargs *ncd, /* * Finally, we can free up the mount structure. */ - for (nuidp = nmp->nm_uidlruhead.tqh_first; nuidp != 0; nuidp = nnuidp) { - nnuidp = nuidp->nu_lru.tqe_next; + TAILQ_FOREACH_MUTABLE(nuidp, &nmp->nm_uidlruhead, nu_lru, nnuidp) { LIST_REMOVE(nuidp, nu_hash); TAILQ_REMOVE(&nmp->nm_uidlruhead, nuidp, nu_lru); free((caddr_t)nuidp, M_NFSUID); diff --git a/sys/vfs/nfs/nfs_socket.c b/sys/vfs/nfs/nfs_socket.c index aa610ffa4a..2e52f6edf4 100644 --- a/sys/vfs/nfs/nfs_socket.c +++ b/sys/vfs/nfs/nfs_socket.c @@ -35,7 +35,7 @@ * * @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95 * $FreeBSD: src/sys/nfs/nfs_socket.c,v 1.60.2.6 2003/03/26 01:44:46 alfred Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_socket.c,v 1.17 2004/06/02 14:43:04 eirikn Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_socket.c,v 1.18 2004/08/02 13:22:34 joerg Exp $ */ /* @@ -402,7 +402,7 @@ nfs_reconnect(struct nfsreq *rep) * Loop through outstanding request list and fix up all requests * on old socket. */ - for (rp = nfs_reqq.tqh_first; rp != 0; rp = rp->r_chain.tqe_next) { + TAILQ_FOREACH(rp, &nfs_reqq, r_chain) { if (rp->r_nmp == nmp) rp->r_flags |= R_MUSTRESEND; } @@ -828,8 +828,7 @@ nfsmout: * Loop through the request list to match up the reply * Iff no match, just drop the datagram */ - for (rep = nfs_reqq.tqh_first; rep != 0; - rep = rep->r_chain.tqe_next) { + TAILQ_FOREACH(rep, &nfs_reqq, r_chain) { if (rep->r_mrep == NULL && rxid == rep->r_xid) { /* Found it.. */ rep->r_mrep = mrep; @@ -1383,7 +1382,7 @@ nfs_timer(void *arg /* never used */) struct thread *td = &thread0; /* XXX for credentials, will break if sleep */ s = splnet(); - for (rep = nfs_reqq.tqh_first; rep != 0; rep = rep->r_chain.tqe_next) { + TAILQ_FOREACH(rep, &nfs_reqq, r_chain) { nmp = rep->r_nmp; if (rep->r_mrep || (rep->r_flags & (R_SOFTTERM|R_MASKTIMER))) continue; @@ -1483,8 +1482,7 @@ nfs_timer(void *arg /* never used */) * completed now. */ cur_usec = nfs_curusec(); - for (slp = nfssvc_sockhead.tqh_first; slp != 0; - slp = slp->ns_chain.tqe_next) { + TAILQ_FOREACH(slp, &nfssvc_sockhead, ns_chain) { if (slp->ns_tq.lh_first && slp->ns_tq.lh_first->nd_time<=cur_usec) nfsrv_wakenfsd(slp); } @@ -2342,7 +2340,7 @@ nfsrv_wakenfsd(struct nfssvc_sock *slp) if ((slp->ns_flag & SLP_VALID) == 0) return; - for (nd = nfsd_head.tqh_first; nd != 0; nd = nd->nfsd_chain.tqe_next) { + TAILQ_FOREACH(nd, &nfsd_head, nfsd_chain) { if (nd->nfsd_flag & NFSD_WAITING) { nd->nfsd_flag &= ~NFSD_WAITING; if (nd->nfsd_slp) diff --git a/sys/vfs/nfs/nfs_srvcache.c b/sys/vfs/nfs/nfs_srvcache.c index 84761d5914..c833508b53 100644 --- a/sys/vfs/nfs/nfs_srvcache.c +++ b/sys/vfs/nfs/nfs_srvcache.c @@ -35,7 +35,7 @@ * * @(#)nfs_srvcache.c 8.3 (Berkeley) 3/30/95 * $FreeBSD: src/sys/nfs/nfs_srvcache.c,v 1.21 2000/02/13 03:32:06 peter Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_srvcache.c,v 1.8 2004/06/06 19:16:11 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_srvcache.c,v 1.9 2004/08/02 13:22:34 joerg Exp $ */ /* @@ -183,7 +183,7 @@ loop: } rp->rc_flag |= RC_LOCKED; /* If not at end of LRU chain, move it there */ - if (rp->rc_lru.tqe_next) { + if (TAILQ_NEXT(rp, rc_lru) != NULL) { TAILQ_REMOVE(&nfsrvlruhead, rp, rc_lru); TAILQ_INSERT_TAIL(&nfsrvlruhead, rp, rc_lru); } @@ -224,11 +224,11 @@ loop: numnfsrvcache++; rp->rc_flag = RC_LOCKED; } else { - rp = nfsrvlruhead.tqh_first; + rp = TAILQ_FIRST(&nfsrvlruhead); while ((rp->rc_flag & RC_LOCKED) != 0) { rp->rc_flag |= RC_WANTED; (void) tsleep((caddr_t)rp, 0, "nfsrc", 0); - rp = nfsrvlruhead.tqh_first; + rp = TAILQ_FIRST(&nfsrvlruhead); } rp->rc_flag |= RC_LOCKED; LIST_REMOVE(rp, rc_hash); @@ -333,8 +333,7 @@ nfsrv_cleancache(void) { struct nfsrvcache *rp, *nextrp; - for (rp = nfsrvlruhead.tqh_first; rp != 0; rp = nextrp) { - nextrp = rp->rc_lru.tqe_next; + TAILQ_FOREACH_MUTABLE(rp, &nfsrvlruhead, rc_lru, nextrp) { LIST_REMOVE(rp, rc_hash); TAILQ_REMOVE(&nfsrvlruhead, rp, rc_lru); if (rp->rc_flag & RC_REPMBUF) diff --git a/sys/vfs/nfs/nfs_syscalls.c b/sys/vfs/nfs/nfs_syscalls.c index 4ac5e4f63f..d716a04896 100644 --- a/sys/vfs/nfs/nfs_syscalls.c +++ b/sys/vfs/nfs/nfs_syscalls.c @@ -35,7 +35,7 @@ * * @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95 * $FreeBSD: src/sys/nfs/nfs_syscalls.c,v 1.58.2.1 2000/11/26 02:30:06 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_syscalls.c,v 1.17 2004/06/06 19:16:11 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_syscalls.c,v 1.18 2004/08/02 13:22:34 joerg Exp $ */ #include @@ -252,7 +252,7 @@ nfssvc(struct nfssvc_args *uap) free((caddr_t)nuidp, M_NFSUID); } else { if (nuidp == (struct nfsuid *)0) { - nuidp = slp->ns_uidlruhead.tqh_first; + nuidp = TAILQ_FIRST(&slp->ns_uidlruhead); LIST_REMOVE(nuidp, nu_hash); TAILQ_REMOVE(&slp->ns_uidlruhead, nuidp, nu_lru); @@ -465,8 +465,7 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td) } if (nfsd->nfsd_slp == (struct nfssvc_sock *)0 && (nfsd_head_flag & NFSD_CHECKSLP) != 0) { - for (slp = nfssvc_sockhead.tqh_first; slp != 0; - slp = slp->ns_chain.tqe_next) { + TAILQ_FOREACH(slp, &nfssvc_sockhead, ns_chain) { if ((slp->ns_flag & (SLP_VALID | SLP_DOREC)) == (SLP_VALID | SLP_DOREC)) { slp->ns_flag &= ~SLP_DOREC; @@ -750,9 +749,8 @@ nfsrv_zapsock(struct nfssvc_sock *slp) m_freem(rec->nr_packet); free(rec, M_NFSRVDESC); } - for (nuidp = slp->ns_uidlruhead.tqh_first; nuidp != 0; - nuidp = nnuidp) { - nnuidp = nuidp->nu_lru.tqe_next; + TAILQ_FOREACH_MUTABLE(nuidp, &slp->ns_uidlruhead, nu_lru, + nnuidp) { LIST_REMOVE(nuidp, nu_hash); TAILQ_REMOVE(&slp->ns_uidlruhead, nuidp, nu_lru); if (nuidp->nu_flag & NU_NAM) @@ -832,8 +830,7 @@ nfsrv_init(int terminating) panic("nfsd init"); nfssvc_sockhead_flag |= SLP_INIT; if (terminating) { - for (slp = nfssvc_sockhead.tqh_first; slp != 0; slp = nslp) { - nslp = slp->ns_chain.tqe_next; + TAILQ_FOREACH_MUTABLE(slp, &nfssvc_sockhead, ns_chain, nslp) { if (slp->ns_flag & SLP_VALID) nfsrv_zapsock(slp); TAILQ_REMOVE(&nfssvc_sockhead, slp, ns_chain); @@ -936,7 +933,7 @@ nfssvc_iod(struct thread *td) */ for (;;) { while (((nmp = nfs_iodmount[myiod]) == NULL - || nmp->nm_bufq.tqh_first == NULL) + || TAILQ_EMPTY(&nmp->nm_bufq)) && error == 0) { if (nmp) nmp->nm_bufqiods--; @@ -954,7 +951,7 @@ nfssvc_iod(struct thread *td) nfs_numasync--; return (error); } - while ((bp = nmp->nm_bufq.tqh_first) != NULL) { + while ((bp = TAILQ_FIRST(&nmp->nm_bufq)) != NULL) { /* Take one off the front of the list */ TAILQ_REMOVE(&nmp->nm_bufq, bp, b_freelist); nmp->nm_bufqlen--; @@ -1144,7 +1141,7 @@ nfs_savenickauth(struct nfsmount *nmp, struct ucred *cred, int len, malloc(sizeof (struct nfsuid), M_NFSUID, M_WAITOK); } else { - nuidp = nmp->nm_uidlruhead.tqh_first; + nuidp = TAILQ_FIRST(&nmp->nm_uidlruhead); LIST_REMOVE(nuidp, nu_hash); TAILQ_REMOVE(&nmp->nm_uidlruhead, nuidp, nu_lru); diff --git a/sys/vfs/nfs/nfs_vnops.c b/sys/vfs/nfs/nfs_vnops.c index a34ea4f7a2..fea41486c9 100644 --- a/sys/vfs/nfs/nfs_vnops.c +++ b/sys/vfs/nfs/nfs_vnops.c @@ -35,7 +35,7 @@ * * @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95 * $FreeBSD: src/sys/nfs/nfs_vnops.c,v 1.150.2.5 2001/12/20 19:56:28 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_vnops.c,v 1.24 2004/06/04 05:06:40 hmp Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_vnops.c,v 1.25 2004/08/02 13:22:34 joerg Exp $ */ @@ -1447,7 +1447,7 @@ again: nfsm_build(tl, u_int32_t *, NFSX_V3CREATEVERF); #ifdef INET if (!TAILQ_EMPTY(&in_ifaddrhead)) - *tl++ = IA_SIN(in_ifaddrhead.tqh_first)->sin_addr.s_addr; + *tl++ = IA_SIN(TAILQ_FIRST(&in_ifaddrhead))->sin_addr.s_addr; else #endif *tl++ = create_verf; diff --git a/sys/vfs/ufs/ufs_quota.c b/sys/vfs/ufs/ufs_quota.c index 3c094c4a35..f929965c32 100644 --- a/sys/vfs/ufs/ufs_quota.c +++ b/sys/vfs/ufs/ufs_quota.c @@ -35,7 +35,7 @@ * * @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95 * $FreeBSD: src/sys/ufs/ufs/ufs_quota.c,v 1.27.2.3 2002/01/15 10:33:32 phk Exp $ - * $DragonFly: src/sys/vfs/ufs/ufs_quota.c,v 1.14 2004/07/18 19:43:48 drhodus Exp $ + * $DragonFly: src/sys/vfs/ufs/ufs_quota.c,v 1.15 2004/08/02 13:22:34 joerg Exp $ */ #include @@ -783,15 +783,14 @@ dqget(struct vnode *vp, u_long id, struct ufsmount *ump, int type, /* * Not in cache, allocate a new one. */ - if (dqfreelist.tqh_first == NODQUOT && - numdquot < MAXQUOTAS * desiredvnodes) + if (TAILQ_EMPTY(&dqfreelist) && numdquot < MAXQUOTAS * desiredvnodes) desireddquot += DQUOTINC; if (numdquot < desireddquot) { dq = (struct dquot *)malloc(sizeof *dq, M_DQUOT, M_WAITOK); bzero((char *)dq, sizeof *dq); numdquot++; } else { - if ((dq = dqfreelist.tqh_first) == NULL) { + if ((dq = TAILQ_FIRST(&dqfreelist)) == NULL) { tablefull("dquot"); *dqp = NODQUOT; return (EUSERS); -- 2.41.0