summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/alpha/tc/esp.c3
-rw-r--r--sys/cam/cam_periph.c3
-rw-r--r--sys/cam/scsi/scsi_da.c3
-rw-r--r--sys/cam/scsi/scsi_low.c18
-rw-r--r--sys/dev/awi/awi.c12
-rw-r--r--sys/dev/de/if_de.c9
-rw-r--r--sys/dev/ed/if_ed.c3
-rw-r--r--sys/dev/fe/if_fe.c3
-rw-r--r--sys/dev/ie/if_ie.c3
-rw-r--r--sys/dev/mii/mii.c12
-rw-r--r--sys/dev/pccard/pccard.c3
-rw-r--r--sys/dev/ray/if_ray.c3
-rw-r--r--sys/dev/sf/if_sf.c3
-rw-r--r--sys/dev/sn/if_sn.c3
-rw-r--r--sys/dev/tx/if_tx.c3
-rw-r--r--sys/dev/usb/if_aue.c3
-rw-r--r--sys/dev/wl/if_wl.c3
-rw-r--r--sys/fs/specfs/spec_vnops.c3
-rw-r--r--sys/i386/isa/bs/bs.c3
-rw-r--r--sys/i386/isa/if_le.c3
-rw-r--r--sys/i386/isa/if_wl.c3
-rw-r--r--sys/kern/kern_linker.c3
-rw-r--r--sys/kern/subr_devstat.c3
-rw-r--r--sys/kern/vfs_aio.c6
-rw-r--r--sys/kern/vfs_init.c3
-rw-r--r--sys/miscfs/specfs/spec_vnops.c3
-rw-r--r--sys/net/if.c27
-rw-r--r--sys/net/if_atmsubr.c3
-rw-r--r--sys/net/if_ef.c3
-rw-r--r--sys/net/if_media.c3
-rw-r--r--sys/net/if_tun.c3
-rw-r--r--sys/netinet/in.c3
-rw-r--r--sys/netinet/in_gif.c3
-rw-r--r--sys/netinet/in_pcb.c6
-rw-r--r--sys/netinet/ip_input.c3
-rw-r--r--sys/netinet/ip_output.c6
-rw-r--r--sys/netipx/ipx_input.c3
-rw-r--r--sys/pci/if_de.c9
-rw-r--r--sys/pci/if_pcn.c3
-rw-r--r--sys/pci/if_sf.c3
-rw-r--r--sys/pci/if_sis.c3
-rw-r--r--sys/pci/if_ste.c3
-rw-r--r--sys/pci/if_tx.c3
-rw-r--r--sys/pci/if_wb.c3
-rw-r--r--sys/ufs/ffs/ffs_softdep.c39
-rw-r--r--sys/ufs/ffs/ffs_vnops.c3
-rw-r--r--sys/ufs/ufs/ufs_extattr.c3
47 files changed, 85 insertions, 170 deletions
diff --git a/sys/alpha/tc/esp.c b/sys/alpha/tc/esp.c
index 4b46dab..d9f7577 100644
--- a/sys/alpha/tc/esp.c
+++ b/sys/alpha/tc/esp.c
@@ -1080,8 +1080,7 @@ printf("%s: unimplemented message: %d\n", device_get_nameunit(sc->sc_dev), sc->s
* singly linked list.
*/
lunit = sc->sc_imess[0] & 0x07;
- for (ecb = TAILQ_FIRST(&sc->nexus_list); ecb;
- ecb = TAILQ_NEXT(ecb, chain)) {
+ TAILQ_FOREACH(ecb, &sc->nexus_list, chain) {
sc_link = ecb->xs->sc_link;
if (sc_link->lun == lunit &&
sc->sc_selid == (1<<sc_link->target)) {
diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c
index b7920b9..675859c 100644
--- a/sys/cam/cam_periph.c
+++ b/sys/cam/cam_periph.c
@@ -208,8 +208,7 @@ cam_periph_find(struct cam_path *path, char *name)
continue;
s = splsoftcam();
- for (periph = TAILQ_FIRST(&(*p_drv)->units); periph != NULL;
- periph = TAILQ_NEXT(periph, unit_links)) {
+ TAILQ_FOREACH(periph, &(*p_drv)->units, unit_links) {
if (xpt_path_comp(periph->path, path) == 0) {
splx(s);
return(periph);
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 91c2661..70385c7 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -1568,8 +1568,7 @@ dashutdown(void * arg, int howto)
struct cam_periph *periph;
struct da_softc *softc;
- for (periph = TAILQ_FIRST(&dadriver.units); periph != NULL;
- periph = TAILQ_NEXT(periph, unit_links)) {
+ TAILQ_FOREACH(periph, &dadriver.units, unit_links) {
union ccb ccb;
softc = (struct da_softc *)periph->softc;
diff --git a/sys/cam/scsi/scsi_low.c b/sys/cam/scsi/scsi_low.c
index 25c9437..683c31d 100644
--- a/sys/cam/scsi/scsi_low.c
+++ b/sys/cam/scsi/scsi_low.c
@@ -341,11 +341,9 @@ scsi_low_timeout(arg)
{
struct targ_info *ti;
- for (ti = TAILQ_FIRST(&slp->sl_titab); ti != NULL;
- ti = TAILQ_NEXT(ti, ti_chain))
+ TAILQ_FOREACH(ti, &slp->sl_titab, ti_chain)
{
- for (cb = TAILQ_FIRST(&ti->ti_discq); cb != NULL;
- cb = TAILQ_NEXT(cb, ccb_chain))
+ TAILQ_FOREACH(cb, &ti->ti_discq, ccb_chain)
{
cb->ccb_tc -= SCSI_LOW_TIMEOUT_CHECK_INTERVAL;
if (cb->ccb_tc < 0)
@@ -930,8 +928,7 @@ scsi_low_start(slp)
}
#endif /* SCSI_LOW_DIAGNOSTIC */
- for (cb = TAILQ_FIRST(&slp->sl_start); cb != NULL;
- cb = TAILQ_NEXT(cb, ccb_chain))
+ TAILQ_FOREACH(cb, &slp->sl_start, ccb_chain)
{
ti = cb->ti;
li = cb->li;
@@ -1347,8 +1344,7 @@ scsi_low_reset_nexus(slp, fdone)
}
/* disconnected nexus */
- for (ti = TAILQ_FIRST(&slp->sl_titab); ti != NULL;
- ti = TAILQ_NEXT(ti, ti_chain))
+ TAILQ_FOREACH(ti, &slp->sl_titab, ti_chain)
{
for (cb = TAILQ_FIRST(&ti->ti_discq); cb != NULL; cb = ncb)
{
@@ -1363,8 +1359,7 @@ scsi_low_reset_nexus(slp, fdone)
}
}
- for (li = LIST_FIRST(&ti->ti_litab); li != NULL;
- li = LIST_NEXT(li, lun_chain))
+ LIST_FOREACH(li, &ti->ti_litab, lun_chain)
{
li->li_state = UNIT_SLEEP;
li->li_disc = 0;
@@ -2496,8 +2491,7 @@ scsi_low_info(slp, ti, s)
printf("%s: SCSI_LOW: %s\n", slp->sl_xname, s);
if (ti == NULL)
{
- for (ti = TAILQ_FIRST(&slp->sl_titab); ti != NULL;
- ti = TAILQ_NEXT(ti, ti_chain))
+ TAILQ_FOREACH(ti, &slp->sl_titab, ti_chain)
scsi_low_print(slp, ti);
}
else
diff --git a/sys/dev/awi/awi.c b/sys/dev/awi/awi.c
index 749e042..77e22a6 100644
--- a/sys/dev/awi/awi.c
+++ b/sys/dev/awi/awi.c
@@ -791,8 +791,7 @@ awi_init(sc)
#ifdef __FreeBSD__
if (ifp->if_amcount != 0)
goto set_mib;
- for (ifma = LIST_FIRST(&ifp->if_multiaddrs); ifma != NULL;
- ifma = LIST_NEXT(ifma, ifma_link)) {
+ LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
if (n == AWI_GROUP_ADDR_SIZE)
@@ -1939,8 +1938,7 @@ awi_recv_beacon(sc, m0, rxts, rssi)
return;
}
- for (bp = TAILQ_FIRST(&sc->sc_scan); bp != NULL;
- bp = TAILQ_NEXT(bp, list)) {
+ TAILQ_FOREACH(bp, &sc->sc_scan, list) {
if (memcmp(bp->esrc, wh->i_addr2, ETHER_ADDR_LEN) == 0 &&
memcmp(bp->bssid, wh->i_addr3, ETHER_ADDR_LEN) == 0)
break;
@@ -2182,8 +2180,7 @@ awi_recv_auth(sc, m0)
if (status != 0) {
printf("%s: authentication failed (reason %d)\n",
sc->sc_dev.dv_xname, status);
- for (bp = TAILQ_FIRST(&sc->sc_scan); bp != NULL;
- bp = TAILQ_NEXT(bp, list)) {
+ TAILQ_FOREACH(bp, &sc->sc_scan, list) {
if (memcmp(bp->esrc, sc->sc_bss.esrc, ETHER_ADDR_LEN)
== 0) {
bp->fails++;
@@ -2294,8 +2291,7 @@ awi_recv_asresp(sc, m0)
if (status != 0) {
printf("%s: association failed (reason %d)\n",
sc->sc_dev.dv_xname, status);
- for (bp = TAILQ_FIRST(&sc->sc_scan); bp != NULL;
- bp = TAILQ_NEXT(bp, list)) {
+ TAILQ_FOREACH(bp, &sc->sc_scan, list) {
if (memcmp(bp->esrc, sc->sc_bss.esrc, ETHER_ADDR_LEN)
== 0) {
bp->fails++;
diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c
index b756bae..714947b 100644
--- a/sys/dev/de/if_de.c
+++ b/sys/dev/de/if_de.c
@@ -3012,8 +3012,7 @@ tulip_addr_filter(
#endif
multicnt = 0;
- for (ifma = LIST_FIRST(&sc->tulip_if.if_multiaddrs); ifma != NULL;
- ifma = LIST_NEXT(ifma, ifma_link)) {
+ LIST_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family == AF_LINK)
multicnt++;
@@ -3041,8 +3040,7 @@ tulip_addr_filter(
*/
bzero(sc->tulip_setupdata, sizeof(sc->tulip_setupdata));
- for (ifma = LIST_FIRST(&sc->tulip_if.if_multiaddrs); ifma != NULL;
- ifma = LIST_NEXT(ifma, ifma_link)) {
+ LIST_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@@ -3092,8 +3090,7 @@ tulip_addr_filter(
/*
* Else can get perfect filtering for 16 addresses.
*/
- for (ifma = LIST_FIRST(&sc->tulip_if.if_multiaddrs); ifma != NULL;
- ifma = LIST_NEXT(ifma, ifma_link)) {
+ LIST_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
addrp = LLADDR((struct sockaddr_dl *)ifma->ifma_addr);
diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c
index 700f193..afa9cd4 100644
--- a/sys/dev/ed/if_ed.c
+++ b/sys/dev/ed/if_ed.c
@@ -3286,8 +3286,7 @@ ds_getmcaf(sc, mcaf)
mcaf[0] = 0;
mcaf[1] = 0;
- for (ifma = LIST_FIRST(&sc->arpcom.ac_if.if_multiaddrs); ifma;
- ifma = LIST_NEXT(ifma, ifma_link)) {
+ LIST_FOREACH(ifma, &sc->arpcom.ac_if.if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
index = ds_crc(LLADDR((struct sockaddr_dl *)ifma->ifma_addr))
diff --git a/sys/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c
index e5a49d0..a670a90 100644
--- a/sys/dev/fe/if_fe.c
+++ b/sys/dev/fe/if_fe.c
@@ -2120,8 +2120,7 @@ fe_mcaf ( struct fe_softc *sc )
struct ifmultiaddr *ifma;
filter = fe_filter_nothing;
- for (ifma = LIST_FIRST(&sc->arpcom.ac_if.if_multiaddrs); ifma;
- ifma = LIST_NEXT(ifma, ifma_link)) {
+ LIST_FOREACH(ifma, &sc->arpcom.ac_if.if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
index = fe_hash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
diff --git a/sys/dev/ie/if_ie.c b/sys/dev/ie/if_ie.c
index 3f7033d..ccc1f54 100644
--- a/sys/dev/ie/if_ie.c
+++ b/sys/dev/ie/if_ie.c
@@ -2150,8 +2150,7 @@ ie_mc_reset(int unit)
* Step through the list of addresses.
*/
ie->mcast_count = 0;
- for (ifma = LIST_FIRST(&ie->arpcom.ac_if.if_multiaddrs); ifma;
- ifma = LIST_NEXT(ifma, ifma_link)) {
+ LIST_FOREACH(ifma, &ie->arpcom.ac_if.if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
diff --git a/sys/dev/mii/mii.c b/sys/dev/mii/mii.c
index fe07873..2e77fe5 100644
--- a/sys/dev/mii/mii.c
+++ b/sys/dev/mii/mii.c
@@ -229,8 +229,7 @@ static void miibus_mediainit(dev)
MIIBUS_MEDIAINIT(device_get_parent(dev));
mii = device_get_softc(dev);
- for (m = LIST_FIRST(&mii->mii_media.ifm_list); m != NULL;
- m = LIST_NEXT(m, ifm_list)) {
+ LIST_FOREACH(m, &mii->mii_media.ifm_list, ifm_list) {
media = m->ifm_media;
if (media == (IFM_ETHER|IFM_AUTO))
break;
@@ -290,8 +289,7 @@ mii_mediachg(mii)
mii->mii_media_status = 0;
mii->mii_media_active = IFM_NONE;
- for (child = LIST_FIRST(&mii->mii_phys); child != NULL;
- child = LIST_NEXT(child, mii_list)) {
+ LIST_FOREACH(child, &mii->mii_phys, mii_list) {
rv = (*child->mii_service)(child, mii, MII_MEDIACHG);
if (rv)
return (rv);
@@ -308,8 +306,7 @@ mii_tick(mii)
{
struct mii_softc *child;
- for (child = LIST_FIRST(&mii->mii_phys); child != NULL;
- child = LIST_NEXT(child, mii_list))
+ LIST_FOREACH(child, &mii->mii_phys, mii_list)
(void) (*child->mii_service)(child, mii, MII_TICK);
}
@@ -325,7 +322,6 @@ mii_pollstat(mii)
mii->mii_media_status = 0;
mii->mii_media_active = IFM_NONE;
- for (child = LIST_FIRST(&mii->mii_phys); child != NULL;
- child = LIST_NEXT(child, mii_list))
+ LIST_FOREACH(child, &mii->mii_phys, mii_list)
(void) (*child->mii_service)(child, mii, MII_POLLSTAT);
}
diff --git a/sys/dev/pccard/pccard.c b/sys/dev/pccard/pccard.c
index 2b67922..69ba238 100644
--- a/sys/dev/pccard/pccard.c
+++ b/sys/dev/pccard/pccard.c
@@ -321,8 +321,7 @@ pccard_function_init(struct pccard_function *pf)
}
bus = device_get_parent(pf->dev);
/* Remember which configuration entry we are using. */
- for (cfe = STAILQ_FIRST(&pf->cfe_head); cfe != NULL;
- cfe = STAILQ_NEXT(cfe, cfe_list)) {
+ STAILQ_FOREACH(cfe, &pf->cfe_head, cfe_list) {
for (i = 0; i < cfe->num_iospace; i++)
cfe->iores[i] = NULL;
cfe->irqres = NULL;
diff --git a/sys/dev/ray/if_ray.c b/sys/dev/ray/if_ray.c
index 2563daf..ea6a5cc 100644
--- a/sys/dev/ray/if_ray.c
+++ b/sys/dev/ray/if_ray.c
@@ -589,8 +589,7 @@ ray_detach(device_t dev)
untimeout(ray_com_ecf_timo, sc, sc->com_timerh);
untimeout(ray_tx_timo, sc, sc->tx_timerh);
com = TAILQ_FIRST(&sc->sc_comq);
- for (com = TAILQ_FIRST(&sc->sc_comq); com != NULL;
- com = TAILQ_NEXT(com, c_chain)) {
+ TAILQ_FOREACH(com, &sc->sc_comq, c_chain) {
com->c_flags |= RAY_COM_FDETACHED;
com->c_retval = 0;
RAY_DPRINTF(sc, RAY_DBG_STOP, "looking at com %p %b",
diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c
index 29f3fe3..fbaac99 100644
--- a/sys/dev/sf/if_sf.c
+++ b/sys/dev/sf/if_sf.c
@@ -492,8 +492,7 @@ static int sf_ifmedia_upd(ifp)
sc->sf_link = 0;
if (mii->mii_instance) {
struct mii_softc *miisc;
- for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL;
- miisc = LIST_NEXT(miisc, mii_list))
+ LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
mii_phy_reset(miisc);
}
mii_mediachg(mii);
diff --git a/sys/dev/sn/if_sn.c b/sys/dev/sn/if_sn.c
index e9a856d..bd5e172 100644
--- a/sys/dev/sn/if_sn.c
+++ b/sys/dev/sn/if_sn.c
@@ -1461,8 +1461,7 @@ sn_getmcf(struct arpcom *ac, u_char *mcf)
bzero(mcf, MCFSZ);
- for (ifma = LIST_FIRST(&ac->ac_if.if_multiaddrs); ifma;
- ifma = LIST_NEXT(ifma, ifma_link)) {
+ LIST_FOREACH(ifma, &ac->ac_if.if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
return 0;
index = smc_crc(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)) & 0x3f;
diff --git a/sys/dev/tx/if_tx.c b/sys/dev/tx/if_tx.c
index ca2a89d..934b943 100644
--- a/sys/dev/tx/if_tx.c
+++ b/sys/dev/tx/if_tx.c
@@ -1340,8 +1340,7 @@ epic_init(sc)
mii = device_get_softc(sc->miibus);
if (mii->mii_instance) {
struct mii_softc *miisc;
- for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL;
- miisc = LIST_NEXT(miisc, mii_list))
+ LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
mii_phy_reset(miisc);
}
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c
index 01f9d2d..50856e6 100644
--- a/sys/dev/usb/if_aue.c
+++ b/sys/dev/usb/if_aue.c
@@ -1331,8 +1331,7 @@ Static int aue_ifmedia_upd(ifp)
sc->aue_link = 0;
if (mii->mii_instance) {
struct mii_softc *miisc;
- for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL;
- miisc = LIST_NEXT(miisc, mii_list))
+ LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
mii_phy_reset(miisc);
}
mii_mediachg(mii);
diff --git a/sys/dev/wl/if_wl.c b/sys/dev/wl/if_wl.c
index 67a50d7..b52762c8 100644
--- a/sys/dev/wl/if_wl.c
+++ b/sys/dev/wl/if_wl.c
@@ -2060,8 +2060,7 @@ wlconfig(int unit)
outw(PIOP1(base), AC_MCSETUP|AC_CW_EL); /* ac_command */
outw(PIOR1(base), OFFSET_CU + 8);
#if defined(__FreeBSD__) && __FreeBSD_version >= 300000
- for (ifma = LIST_FIRST(&sc->wl_if.if_multiaddrs); ifma;
- ifma = LIST_NEXT(ifma, ifma_link)) {
+ LIST_FOREACH(ifma, &sc->wl_if.if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index 3b9536d..dce8212 100644
--- a/sys/fs/specfs/spec_vnops.c
+++ b/sys/fs/specfs/spec_vnops.c
@@ -357,8 +357,7 @@ loop1:
* MARK/SCAN initialization to avoid infinite loops
*/
s = splbio();
- for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp;
- bp = TAILQ_NEXT(bp, b_vnbufs)) {
+ TAILQ_FOREACH(bp, &vp->v_dirtyblkhd, b_vnbufs) {
bp->b_flags &= ~B_SCANNED;
}
splx(s);
diff --git a/sys/i386/isa/bs/bs.c b/sys/i386/isa/bs/bs.c
index 97a506f..f091776 100644
--- a/sys/i386/isa/bs/bs.c
+++ b/sys/i386/isa/bs/bs.c
@@ -450,8 +450,7 @@ again:
{
struct targ_info *tmpti;
- for (tmpti = TAILQ_FIRST(&bsc->sc_titab); tmpti;
- tmpti = TAILQ_NEXT(tmpti, ti_tchain))
+ TAILQ_FOREACH(tmpti, &bsc->sc_titab, ti_tchain)
if (tmpti->ti_phase >= DISCONNECTED)
goto retry;
}
diff --git a/sys/i386/isa/if_le.c b/sys/i386/isa/if_le.c
index b23f0e3..7abd008 100644
--- a/sys/i386/isa/if_le.c
+++ b/sys/i386/isa/if_le.c
@@ -560,8 +560,7 @@ le_multi_filter(
sc->le_flags |= IFF_MULTICAST;
- for (ifma = LIST_FIRST(&sc->le_ac.ac_if.if_multiaddrs); ifma;
- ifma = LIST_NEXT(ifma, ifma_link)) {
+ LIST_FOREACH(ifma, &sc->le_ac.ac_if.if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
diff --git a/sys/i386/isa/if_wl.c b/sys/i386/isa/if_wl.c
index 67a50d7..b52762c8 100644
--- a/sys/i386/isa/if_wl.c
+++ b/sys/i386/isa/if_wl.c
@@ -2060,8 +2060,7 @@ wlconfig(int unit)
outw(PIOP1(base), AC_MCSETUP|AC_CW_EL); /* ac_command */
outw(PIOR1(base), OFFSET_CU + 8);
#if defined(__FreeBSD__) && __FreeBSD_version >= 300000
- for (ifma = LIST_FIRST(&sc->wl_if.if_multiaddrs); ifma;
- ifma = LIST_NEXT(ifma, ifma_link)) {
+ LIST_FOREACH(ifma, &sc->wl_if.if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index b286311..e24f171 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -574,8 +574,7 @@ linker_file_lookup_symbol(linker_file_t file, const char* name, int deps)
*/
struct common_symbol* cp;
- for (cp = STAILQ_FIRST(&file->common); cp;
- cp = STAILQ_NEXT(cp, link))
+ STAILQ_FOREACH(cp, &file->common, link)
if (!strcmp(cp->name, name)) {
KLD_DPF(SYM, ("linker_file_lookup_symbol: old common value=%x\n", cp->address));
return cp->address;
diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c
index 0d0942e..3c15b43 100644
--- a/sys/kern/subr_devstat.c
+++ b/sys/kern/subr_devstat.c
@@ -80,8 +80,7 @@ devstat_add_entry(struct devstat *ds, const char *dev_name,
if (devstat_num_devs == 1)
STAILQ_INSERT_TAIL(devstat_head, ds, dev_links);
else {
- for (ds_tmp = STAILQ_FIRST(devstat_head); ds_tmp != NULL;
- ds_tmp = STAILQ_NEXT(ds_tmp, dev_links)) {
+ STAILQ_FOREACH(ds_tmp, devstat_head, dev_links) {
struct devstat *ds_next;
ds_next = STAILQ_NEXT(ds_tmp, dev_links);
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index 65f4fbf..c16cc8c 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -2135,8 +2135,7 @@ lio_listio(struct proc *p, struct lio_listio_args *uap)
jobref = fuword(&iocb->_aiocb_private.kernelinfo);
- for (cb = TAILQ_FIRST(&ki->kaio_jobdone); cb;
- cb = TAILQ_NEXT(cb, plist)) {
+ TAILQ_FOREACH(cb, &ki->kaio_jobdone, plist) {
if (((intptr_t)cb->uaiocb._aiocb_private.kernelinfo)
== jobref) {
if (cb->uaiocb.aio_lio_opcode
@@ -2157,8 +2156,7 @@ lio_listio(struct proc *p, struct lio_listio_args *uap)
}
s = splbio();
- for (cb = TAILQ_FIRST(&ki->kaio_bufdone); cb;
- cb = TAILQ_NEXT(cb, plist)) {
+ TAILQ_FOREACH(cb, &ki->kaio_bufdone, plist) {
if (((intptr_t)cb->uaiocb._aiocb_private.kernelinfo)
== jobref) {
found++;
diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c
index 3f36a5f..76d1155 100644
--- a/sys/kern/vfs_init.c
+++ b/sys/kern/vfs_init.c
@@ -331,8 +331,7 @@ vfs_register(struct vfsconf *vfc)
* preserved by re-registering the oid after modifying its
* number.
*/
- for (oidp = SLIST_FIRST(&sysctl__vfs_children); oidp;
- oidp = SLIST_NEXT(oidp, oid_link))
+ SLIST_FOREACH(oidp, &sysctl__vfs_children, oid_link)
if (strcmp(oidp->oid_name, vfc->vfc_name) == 0) {
sysctl_unregister_oid(oidp);
oidp->oid_number = vfc->vfc_typenum;
diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c
index 3b9536d..dce8212 100644
--- a/sys/miscfs/specfs/spec_vnops.c
+++ b/sys/miscfs/specfs/spec_vnops.c
@@ -357,8 +357,7 @@ loop1:
* MARK/SCAN initialization to avoid infinite loops
*/
s = splbio();
- for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp;
- bp = TAILQ_NEXT(bp, b_vnbufs)) {
+ TAILQ_FOREACH(bp, &vp->v_dirtyblkhd, b_vnbufs) {
bp->b_flags &= ~B_SCANNED;
}
splx(s);
diff --git a/sys/net/if.c b/sys/net/if.c
index d0be0de..c1a4bd3 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -358,8 +358,7 @@ ifa_ifwithaddr(addr)
#define equal(a1, a2) \
(bcmp((caddr_t)(a1), (caddr_t)(a2), ((struct sockaddr *)(a1))->sa_len) == 0)
TAILQ_FOREACH(ifp, &ifnet, if_link)
- for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa;
- ifa = TAILQ_NEXT(ifa, ifa_link)) {
+ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
if (ifa->ifa_addr->sa_family != addr->sa_family)
continue;
if (equal(addr, ifa->ifa_addr))
@@ -385,8 +384,7 @@ ifa_ifwithdstaddr(addr)
TAILQ_FOREACH(ifp, &ifnet, if_link)
if (ifp->if_flags & IFF_POINTOPOINT)
- for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa;
- ifa = TAILQ_NEXT(ifa, ifa_link)) {
+ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
if (ifa->ifa_addr->sa_family != addr->sa_family)
continue;
if (ifa->ifa_dstaddr && equal(addr, ifa->ifa_dstaddr))
@@ -424,8 +422,7 @@ ifa_ifwithnet(addr)
* addresses in this address family.
*/
TAILQ_FOREACH(ifp, &ifnet, if_link) {
- for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa;
- ifa = TAILQ_NEXT(ifa, ifa_link)) {
+ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
register char *cp, *cp2, *cp3;
if (ifa->ifa_addr->sa_family != af)
@@ -510,8 +507,7 @@ ifaof_ifpforaddr(addr, ifp)
if (af >= AF_MAX)
return (0);
- for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa;
- ifa = TAILQ_NEXT(ifa, ifa_link)) {
+ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
if (ifa->ifa_addr->sa_family != af)
continue;
if (ifa_maybe == 0)
@@ -1186,8 +1182,7 @@ if_addmulti(ifp, sa, retifma)
* If the matching multicast address already exists
* then don't add a new one, just add a reference
*/
- for (ifma = LIST_FIRST(&ifp->if_multiaddrs); ifma;
- ifma = LIST_NEXT(ifma, ifma_link)) {
+ LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (equal(sa, ifma->ifma_addr)) {
ifma->ifma_refcount++;
if (retifma)
@@ -1229,8 +1224,7 @@ if_addmulti(ifp, sa, retifma)
*retifma = ifma;
if (llsa != 0) {
- for (ifma = LIST_FIRST(&ifp->if_multiaddrs); ifma;
- ifma = LIST_NEXT(ifma, ifma_link)) {
+ LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (equal(ifma->ifma_addr, llsa))
break;
}
@@ -1273,8 +1267,7 @@ if_delmulti(ifp, sa)
struct ifmultiaddr *ifma;
int s;
- for (ifma = LIST_FIRST(&ifp->if_multiaddrs); ifma;
- ifma = LIST_NEXT(ifma, ifma_link))
+ LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
if (equal(sa, ifma->ifma_addr))
break;
if (ifma == 0)
@@ -1306,8 +1299,7 @@ if_delmulti(ifp, sa)
* in the record for the link-layer address. (So we don't complain
* in that case.)
*/
- for (ifma = LIST_FIRST(&ifp->if_multiaddrs); ifma;
- ifma = LIST_NEXT(ifma, ifma_link))
+ LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
if (equal(sa, ifma->ifma_addr))
break;
if (ifma == 0)
@@ -1382,8 +1374,7 @@ ifmaof_ifpforaddr(sa, ifp)
{
struct ifmultiaddr *ifma;
- for (ifma = LIST_FIRST(&ifp->if_multiaddrs); ifma;
- ifma = LIST_NEXT(ifma, ifma_link))
+ LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
if (equal(ifma->ifma_addr, sa))
break;
diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c
index 423ceaa..5d085cf 100644
--- a/sys/net/if_atmsubr.c
+++ b/sys/net/if_atmsubr.c
@@ -313,8 +313,7 @@ atm_ifattach(ifp)
ifp->if_snd.ifq_maxlen = 50; /* dummy */
#if defined(__NetBSD__) || defined(__OpenBSD__)
- for (ifa = TAILQ_FIRST(&ifp->if_addrlist); ifa != 0;
- ifa = TAILQ_NEXT(ifa, ifa_list))
+ TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list)
#elif defined(__FreeBSD__) && (__FreeBSD__ > 2)
for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa;
ifa = TAILQ_NEXT(ifa, ifa_link))
diff --git a/sys/net/if_ef.c b/sys/net/if_ef.c
index 11d3950..3111195 100644
--- a/sys/net/if_ef.c
+++ b/sys/net/if_ef.c
@@ -163,8 +163,7 @@ ef_detach(struct efnet *sc)
if (ifp->if_flags & IFF_RUNNING) {
/* find internet addresses and delete routes */
register struct ifaddr *ifa;
- for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa;
- ifa = TAILQ_NEXT(ifa, ifa_link)) {
+ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
rtinit(ifa, (int)RTM_DELETE, 0);
}
}
diff --git a/sys/net/if_media.c b/sys/net/if_media.c
index 3759f03..d6f9d26 100644
--- a/sys/net/if_media.c
+++ b/sys/net/if_media.c
@@ -351,8 +351,7 @@ ifmedia_match(ifm, target, mask)
match = NULL;
mask = ~mask;
- for (next = LIST_FIRST(&ifm->ifm_list); next != NULL;
- next = LIST_NEXT(next, ifm_list)) {
+ LIST_FOREACH(next, &ifm->ifm_list, ifm_list) {
if ((next->ifm_media & mask) == (target & mask)) {
#if defined(IFMEDIA_DEBUG) || defined(DIAGNOSTIC)
if (match) {
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 1df5477..51ef8847 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -241,8 +241,7 @@ tunclose(dev, foo, bar, p)
s = splimp();
/* find internet addresses and delete routes */
- for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa;
- ifa = TAILQ_NEXT(ifa, ifa_link))
+ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
if (ifa->ifa_addr->sa_family == AF_INET)
rtinit(ifa, (int)RTM_DELETE,
tp->tun_flags & TUN_DSTADDR ? RTF_HOST : 0);
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index f7d575b..b9ab8b3 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -92,8 +92,7 @@ in_localaddr(in)
if ((i & ia->ia_netmask) == ia->ia_net)
return (1);
} else {
- for (ia = TAILQ_FIRST(&in_ifaddrhead); ia;
- ia = TAILQ_NEXT(ia, ia_link))
+ TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link)
if ((i & ia->ia_subnetmask) == ia->ia_subnet)
return (1);
}
diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c
index a27339b..17955ad 100644
--- a/sys/netinet/in_gif.c
+++ b/sys/netinet/in_gif.c
@@ -350,8 +350,7 @@ gif_encapcheck4(m, off, proto, arg)
return 0;
}
/* reject packets with broadcast on source */
- for (ia4 = TAILQ_FIRST(&in_ifaddrhead); ia4;
- ia4 = TAILQ_NEXT(ia4, ia_link))
+ TAILQ_FOREACH(ia4, &in_ifaddrhead, ia_link)
{
if ((ia4->ia_ifa.ifa_ifp->if_flags & IFF_BROADCAST) == 0)
continue;
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 6db09f6..3f99451 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -459,8 +459,7 @@ in_pcbladdr(inp, nam, plocal_sin)
imo = inp->inp_moptions;
if (imo->imo_multicast_ifp != NULL) {
ifp = imo->imo_multicast_ifp;
- for (ia = TAILQ_FIRST(&in_ifaddrhead); ia;
- ia = TAILQ_NEXT(ia, ia_link))
+ TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link)
if (ia->ia_ifp == ifp)
break;
if (ia == 0)
@@ -858,8 +857,7 @@ in_pcblookup_local(pcbinfo, laddr, lport_arg, wild_okay)
* Port is in use by one or more PCBs. Look for best
* fit.
*/
- for (inp = LIST_FIRST(&phd->phd_pcblist); inp != NULL;
- inp = LIST_NEXT(inp, inp_portlist)) {
+ LIST_FOREACH(inp, &phd->phd_pcblist, inp_portlist) {
wildcard = 0;
#ifdef INET6
if ((inp->inp_vflag & INP_IPV4) == 0)
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 7552234..ca36031 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -494,8 +494,7 @@ pass:
(m->m_flags & (M_MCAST|M_BCAST)) == 0)
goto ours;
- for (ia = TAILQ_FIRST(&in_ifaddrhead); ia;
- ia = TAILQ_NEXT(ia, ia_link)) {
+ TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) {
#define satosin(sa) ((struct sockaddr_in *)(sa))
#ifdef BOOTP_COMPAT
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 00147da..9a876ee 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -314,8 +314,7 @@ ip_output(m0, opt, ro, flags, imo)
if (ip->ip_src.s_addr == INADDR_ANY) {
register struct in_ifaddr *ia1;
- for (ia1 = TAILQ_FIRST(&in_ifaddrhead); ia1;
- ia1 = TAILQ_NEXT(ia1, ia_link))
+ TAILQ_FOREACH(ia1, &in_ifaddrhead, ia_link)
if (ia1->ia_ifp == ifp) {
ip->ip_src = IA_SIN(ia1)->sin_addr;
break;
@@ -581,8 +580,7 @@ sendit:
* as the packet runs through ip_input() as
* it is done through a ISR.
*/
- for (ia = TAILQ_FIRST(&in_ifaddrhead); ia;
- ia = TAILQ_NEXT(ia, ia_link)) {
+ TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) {
/*
* If the addr to forward to is one
* of ours, we pretend to
diff --git a/sys/netipx/ipx_input.c b/sys/netipx/ipx_input.c
index 840935a..ed78acf 100644
--- a/sys/netipx/ipx_input.c
+++ b/sys/netipx/ipx_input.c
@@ -498,8 +498,7 @@ struct ifnet *ifp;
ia->ia_addr.sipx_addr.x_host;
if (ifp != NULL && (ifp->if_flags & IFF_POINTOPOINT))
- for(ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa != NULL;
- ifa = TAILQ_NEXT(ifa, ifa_link)) {
+ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
if (ifa->ifa_addr->sa_family == AF_IPX) {
ipx->ipx_sna = IA_SIPX(ifa)->sipx_addr;
break;
diff --git a/sys/pci/if_de.c b/sys/pci/if_de.c
index b756bae..714947b 100644
--- a/sys/pci/if_de.c
+++ b/sys/pci/if_de.c
@@ -3012,8 +3012,7 @@ tulip_addr_filter(
#endif
multicnt = 0;
- for (ifma = LIST_FIRST(&sc->tulip_if.if_multiaddrs); ifma != NULL;
- ifma = LIST_NEXT(ifma, ifma_link)) {
+ LIST_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family == AF_LINK)
multicnt++;
@@ -3041,8 +3040,7 @@ tulip_addr_filter(
*/
bzero(sc->tulip_setupdata, sizeof(sc->tulip_setupdata));
- for (ifma = LIST_FIRST(&sc->tulip_if.if_multiaddrs); ifma != NULL;
- ifma = LIST_NEXT(ifma, ifma_link)) {
+ LIST_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@@ -3092,8 +3090,7 @@ tulip_addr_filter(
/*
* Else can get perfect filtering for 16 addresses.
*/
- for (ifma = LIST_FIRST(&sc->tulip_if.if_multiaddrs); ifma != NULL;
- ifma = LIST_NEXT(ifma, ifma_link)) {
+ LIST_FOREACH(ifma, &sc->tulip_if.if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
addrp = LLADDR((struct sockaddr_dl *)ifma->ifma_addr);
diff --git a/sys/pci/if_pcn.c b/sys/pci/if_pcn.c
index 0934bbf..0da955b 100644
--- a/sys/pci/if_pcn.c
+++ b/sys/pci/if_pcn.c
@@ -1245,8 +1245,7 @@ static int pcn_ifmedia_upd(ifp)
sc->pcn_link = 0;
if (mii->mii_instance) {
struct mii_softc *miisc;
- for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL;
- miisc = LIST_NEXT(miisc, mii_list))
+ LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
mii_phy_reset(miisc);
}
mii_mediachg(mii);
diff --git a/sys/pci/if_sf.c b/sys/pci/if_sf.c
index 29f3fe3..fbaac99 100644
--- a/sys/pci/if_sf.c
+++ b/sys/pci/if_sf.c
@@ -492,8 +492,7 @@ static int sf_ifmedia_upd(ifp)
sc->sf_link = 0;
if (mii->mii_instance) {
struct mii_softc *miisc;
- for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL;
- miisc = LIST_NEXT(miisc, mii_list))
+ LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
mii_phy_reset(miisc);
}
mii_mediachg(mii);
diff --git a/sys/pci/if_sis.c b/sys/pci/if_sis.c
index cbbe36d..32ed486 100644
--- a/sys/pci/if_sis.c
+++ b/sys/pci/if_sis.c
@@ -1499,8 +1499,7 @@ static int sis_ifmedia_upd(ifp)
sc->sis_link = 0;
if (mii->mii_instance) {
struct mii_softc *miisc;
- for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL;
- miisc = LIST_NEXT(miisc, mii_list))
+ LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
mii_phy_reset(miisc);
}
mii_mediachg(mii);
diff --git a/sys/pci/if_ste.c b/sys/pci/if_ste.c
index ddaa2c4..8a14d01 100644
--- a/sys/pci/if_ste.c
+++ b/sys/pci/if_ste.c
@@ -441,8 +441,7 @@ static int ste_ifmedia_upd(ifp)
sc->ste_link = 0;
if (mii->mii_instance) {
struct mii_softc *miisc;
- for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL;
- miisc = LIST_NEXT(miisc, mii_list))
+ LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
mii_phy_reset(miisc);
}
mii_mediachg(mii);
diff --git a/sys/pci/if_tx.c b/sys/pci/if_tx.c
index ca2a89d..934b943 100644
--- a/sys/pci/if_tx.c
+++ b/sys/pci/if_tx.c
@@ -1340,8 +1340,7 @@ epic_init(sc)
mii = device_get_softc(sc->miibus);
if (mii->mii_instance) {
struct mii_softc *miisc;
- for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL;
- miisc = LIST_NEXT(miisc, mii_list))
+ LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
mii_phy_reset(miisc);
}
diff --git a/sys/pci/if_wb.c b/sys/pci/if_wb.c
index 7f93cb0..67e0b57 100644
--- a/sys/pci/if_wb.c
+++ b/sys/pci/if_wb.c
@@ -741,8 +741,7 @@ static void wb_reset(sc)
if (mii->mii_instance) {
struct mii_softc *miisc;
- for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL;
- miisc = LIST_NEXT(miisc, mii_list))
+ LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
mii_phy_reset(miisc);
}
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index 5507262..c55ee11 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -861,8 +861,7 @@ pagedep_lookup(ip, lbn, flags, pagedeppp)
mp = ITOV(ip)->v_mount;
pagedephd = PAGEDEP_HASH(mp, ip->i_number, lbn);
top:
- for (pagedep = LIST_FIRST(pagedephd); pagedep;
- pagedep = LIST_NEXT(pagedep, pd_hash))
+ LIST_FOREACH(pagedep, pagedephd, pd_hash)
if (ip->i_number == pagedep->pd_ino &&
lbn == pagedep->pd_lbn &&
mp == pagedep->pd_mnt)
@@ -930,8 +929,7 @@ inodedep_lookup(fs, inum, flags, inodedeppp)
firsttry = 1;
inodedephd = INODEDEP_HASH(fs, inum);
top:
- for (inodedep = LIST_FIRST(inodedephd); inodedep;
- inodedep = LIST_NEXT(inodedep, id_hash))
+ LIST_FOREACH(inodedep, inodedephd, id_hash)
if (inum == inodedep->id_ino && fs == inodedep->id_fs)
break;
if (inodedep) {
@@ -1003,8 +1001,7 @@ newblk_lookup(fs, newblkno, flags, newblkpp)
newblkhd = NEWBLK_HASH(fs, newblkno);
top:
- for (newblk = LIST_FIRST(newblkhd); newblk;
- newblk = LIST_NEXT(newblk, nb_hash))
+ LIST_FOREACH(newblk, newblkhd, nb_hash)
if (newblkno == newblk->nb_newblkno && fs == newblk->nb_fs)
break;
if (newblk) {
@@ -1336,8 +1333,7 @@ softdep_setup_allocdirect(ip, lbn, newblkno, oldblkno, newsize, oldsize, bp)
FREE_LOCK(&lk);
return;
}
- for (oldadp = TAILQ_FIRST(adphead); oldadp;
- oldadp = TAILQ_NEXT(oldadp, ad_next)) {
+ TAILQ_FOREACH(oldadp, adphead, ad_next) {
if (oldadp->ad_lbn >= lbn)
break;
}
@@ -1569,8 +1565,7 @@ setup_allocindir_phase2(bp, ip, aip)
panic("setup_allocindir_phase2: not indir blk");
for (indirdep = NULL, newindirdep = NULL; ; ) {
ACQUIRE_LOCK(&lk);
- for (wk = LIST_FIRST(&bp->b_dep); wk;
- wk = LIST_NEXT(wk, wk_list)) {
+ LIST_FOREACH(wk, &bp->b_dep, wk_list) {
if (wk->wk_type != D_INDIRDEP)
continue;
indirdep = WK_INDIRDEP(wk);
@@ -1861,8 +1856,7 @@ deallocate_dependencies(bp, inodedep)
* If the inode has already been written, then they
* can be dumped directly onto the work list.
*/
- for (dirrem = LIST_FIRST(&pagedep->pd_dirremhd); dirrem;
- dirrem = LIST_NEXT(dirrem, dm_next)) {
+ LIST_FOREACH(dirrem, &pagedep->pd_dirremhd, dm_next) {
LIST_REMOVE(dirrem, dm_next);
dirrem->dm_dirinum = pagedep->pd_ino;
if (inodedep == NULL ||
@@ -2964,8 +2958,7 @@ initiate_write_filepage(pagedep, bp)
pagedep->pd_state |= IOSTARTED;
ACQUIRE_LOCK(&lk);
for (i = 0; i < DAHASHSZ; i++) {
- for (dap = LIST_FIRST(&pagedep->pd_diraddhd[i]); dap;
- dap = LIST_NEXT(dap, da_pdlist)) {
+ LIST_FOREACH(dap, &pagedep->pd_diraddhd[i], da_pdlist) {
ep = (struct direct *)
((char *)bp->b_data + dap->da_offset);
if (ep->d_ino != dap->da_newinum)
@@ -3270,8 +3263,7 @@ handle_allocdirect_partdone(adp)
*/
inodedep = adp->ad_inodedep;
bsize = inodedep->id_fs->fs_bsize;
- for (listadp = TAILQ_FIRST(&inodedep->id_inoupdt); listadp;
- listadp = TAILQ_NEXT(listadp, ad_next)) {
+ TAILQ_FOREACH(listadp, &inodedep->id_inoupdt, ad_next) {
/* found our block */
if (listadp == adp)
break;
@@ -3290,8 +3282,7 @@ handle_allocdirect_partdone(adp)
*/
if (listadp == NULL) {
#ifdef DEBUG
- for (listadp = TAILQ_FIRST(&inodedep->id_newinoupdt); listadp;
- listadp = TAILQ_NEXT(listadp, ad_next))
+ TAILQ_FOREACH(listadp, &inodedep->id_newinoupdt, ad_next)
/* found our block */
if (listadp == adp)
break;
@@ -4005,8 +3996,7 @@ loop:
* As we hold the buffer locked, none of its dependencies
* will disappear.
*/
- for (wk = LIST_FIRST(&bp->b_dep); wk;
- wk = LIST_NEXT(wk, wk_list)) {
+ LIST_FOREACH(wk, &bp->b_dep, wk_list) {
switch (wk->wk_type) {
case D_ALLOCDIRECT:
@@ -4226,8 +4216,7 @@ flush_inodedep_deps(fs, ino)
ACQUIRE_LOCK(&lk);
if (inodedep_lookup(fs, ino, 0, &inodedep) == 0)
return (0);
- for (adp = TAILQ_FIRST(&inodedep->id_inoupdt); adp;
- adp = TAILQ_NEXT(adp, ad_next)) {
+ TAILQ_FOREACH(adp, &inodedep->id_inoupdt, ad_next) {
if (adp->ad_state & DEPCOMPLETE)
continue;
bp = adp->ad_buf;
@@ -4248,8 +4237,7 @@ flush_inodedep_deps(fs, ino)
}
if (adp != NULL)
continue;
- for (adp = TAILQ_FIRST(&inodedep->id_newinoupdt); adp;
- adp = TAILQ_NEXT(adp, ad_next)) {
+ TAILQ_FOREACH(adp, &inodedep->id_newinoupdt, ad_next) {
if (adp->ad_state & DEPCOMPLETE)
continue;
bp = adp->ad_buf;
@@ -4545,8 +4533,7 @@ clear_remove(p)
pagedephd = &pagedep_hashtbl[next++];
if (next >= pagedep_hash)
next = 0;
- for (pagedep = LIST_FIRST(pagedephd); pagedep;
- pagedep = LIST_NEXT(pagedep, pd_hash)) {
+ LIST_FOREACH(pagedep, pagedephd, pd_hash) {
if (LIST_FIRST(&pagedep->pd_dirremhd) == NULL)
continue;
mp = pagedep->pd_mnt;
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index bc26dd4..a01217d 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -171,8 +171,7 @@ ffs_fsync(ap)
skipmeta = 1;
s = splbio();
loop:
- for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp;
- bp = TAILQ_NEXT(bp, b_vnbufs))
+ TAILQ_FOREACH(bp, &vp->v_dirtyblkhd, b_vnbufs)
bp->b_flags &= ~B_SCANNED;
for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) {
nbp = TAILQ_NEXT(bp, b_vnbufs);
diff --git a/sys/ufs/ufs/ufs_extattr.c b/sys/ufs/ufs/ufs_extattr.c
index 143c734..a9182eb 100644
--- a/sys/ufs/ufs/ufs_extattr.c
+++ b/sys/ufs/ufs/ufs_extattr.c
@@ -888,8 +888,7 @@ ufs_extattr_vnode_inactive(struct vnode *vp, struct proc *p)
return;
}
- for (uele = LIST_FIRST(&ump->um_extattr.uepm_list); uele != NULL;
- uele = LIST_NEXT(uele, uele_entries))
+ LIST_FOREACH(uele, &ump->um_extattr.uepm_list, uele_entries)
ufs_extattr_rm(vp, uele->uele_attrname, NULL, p);
ufs_extattr_uepm_unlock(ump, p);
OpenPOWER on IntegriCloud