summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/alpha/tc/esp.c10
-rw-r--r--sys/cam/cam_periph.c8
-rw-r--r--sys/cam/cam_xpt.c12
-rw-r--r--sys/cam/scsi/scsi_cd.c3
-rw-r--r--sys/cam/scsi/scsi_da.c3
-rw-r--r--sys/cam/scsi/scsi_low.c40
-rw-r--r--sys/cam/scsi/scsi_low_pisa.c4
-rw-r--r--sys/cam/scsi/scsi_pt.c3
-rw-r--r--sys/coda/coda_subr.c4
-rw-r--r--sys/dev/aic7xxx/aicasm/aicasm.c14
-rw-r--r--sys/dev/aic7xxx/aicasm/aicasm_symbol.c40
-rw-r--r--sys/dev/asr/asr.c2
-rw-r--r--sys/dev/de/if_de.c12
-rw-r--r--sys/dev/ed/if_ed.c4
-rw-r--r--sys/dev/eisa/eisaconf.c6
-rw-r--r--sys/dev/ex/if_ex.c2
-rw-r--r--sys/dev/fe/if_fe.c4
-rw-r--r--sys/dev/ie/if_ie.c4
-rw-r--r--sys/dev/pdq/pdq_ifsubr.c4
-rw-r--r--sys/dev/sf/if_sf.c2
-rw-r--r--sys/dev/sk/if_sk.c2
-rw-r--r--sys/dev/sn/if_sn.c4
-rw-r--r--sys/dev/ti/if_ti.c4
-rw-r--r--sys/dev/usb/uhci.c2
-rw-r--r--sys/dev/wl/if_wl.c6
-rw-r--r--sys/dev/xe/if_xe.c8
-rw-r--r--sys/fs/coda/coda_subr.c4
-rw-r--r--sys/fs/fdescfs/fdesc_vnops.c2
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c2
-rw-r--r--sys/fs/ntfs/ntfs_subr.c10
-rw-r--r--sys/fs/nullfs/null_subr.c2
-rw-r--r--sys/fs/nwfs/nwfs_node.c2
-rw-r--r--sys/fs/nwfs/nwfs_vfsops.c4
-rw-r--r--sys/fs/procfs/procfs_vnops.c2
-rw-r--r--sys/fs/umapfs/umap_subr.c2
-rw-r--r--sys/fs/unionfs/union_vfsops.c4
-rw-r--r--sys/gnu/ext2fs/ext2_vfsops.c8
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vfsops.c8
-rw-r--r--sys/i386/isa/bs/bs.c34
-rw-r--r--sys/i386/isa/bs/bs_pisa.c4
-rw-r--r--sys/i386/isa/bs/bsfunc.c30
-rw-r--r--sys/i386/isa/if_le.c4
-rw-r--r--sys/i386/isa/if_wl.c6
-rw-r--r--sys/i4b/driver/i4b_ispppsubr.c8
-rw-r--r--sys/kern/kern_linker.c24
-rw-r--r--sys/kern/kern_module.c6
-rw-r--r--sys/kern/kern_sysctl.c2
-rw-r--r--sys/kern/vfs_export.c2
-rw-r--r--sys/kern/vfs_subr.c2
-rw-r--r--sys/miscfs/fdesc/fdesc_vnops.c2
-rw-r--r--sys/miscfs/nullfs/null_subr.c2
-rw-r--r--sys/miscfs/procfs/procfs_vnops.c2
-rw-r--r--sys/miscfs/umapfs/umap_subr.c2
-rw-r--r--sys/miscfs/union/union_vfsops.c4
-rw-r--r--sys/msdosfs/msdosfs_vfsops.c2
-rw-r--r--sys/net/bridge.c4
-rw-r--r--sys/net/if.c12
-rw-r--r--sys/net/if_ef.c2
-rw-r--r--sys/net/if_fddisubr.c2
-rw-r--r--sys/net/if_vlan.c3
-rw-r--r--sys/net/pfil.c2
-rw-r--r--sys/net/rtsock.c2
-rw-r--r--sys/netatalk/aarp.c4
-rw-r--r--sys/netinet/if_ether.c6
-rw-r--r--sys/netinet/in.c18
-rw-r--r--sys/netinet/in_pcb.c36
-rw-r--r--sys/netinet/ip_divert.c9
-rw-r--r--sys/netinet/ip_dummynet.c6
-rw-r--r--sys/netinet/ip_encap.c8
-rw-r--r--sys/netinet/ip_fw.c29
-rw-r--r--sys/netinet/ip_icmp.c4
-rw-r--r--sys/netinet/ip_input.c2
-rw-r--r--sys/netinet/ip_output.c6
-rw-r--r--sys/netinet/raw_ip.c12
-rw-r--r--sys/netinet/tcp_subr.c8
-rw-r--r--sys/netinet/tcp_timewait.c8
-rw-r--r--sys/netinet/udp_usrreq.c4
-rw-r--r--sys/netipx/ipx_input.c4
-rw-r--r--sys/netipx/ipx_ip.c6
-rw-r--r--sys/netipx/ipx_usrreq.c4
-rw-r--r--sys/netnatm/natm_pcb.c8
-rw-r--r--sys/netncp/ncp_conn.c4
-rw-r--r--sys/netncp/ncp_subr.c8
-rw-r--r--sys/ntfs/ntfs_subr.c10
-rw-r--r--sys/nwfs/nwfs_node.c2
-rw-r--r--sys/nwfs/nwfs_vfsops.c4
-rw-r--r--sys/pci/if_de.c12
-rw-r--r--sys/pci/if_sf.c2
-rw-r--r--sys/pci/if_sk.c2
-rw-r--r--sys/pci/if_ti.c4
-rw-r--r--sys/pci/if_tl.c2
-rw-r--r--sys/ufs/ffs/ffs_softdep.c4
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c8
-rw-r--r--sys/ufs/ufs/ufs_extattr.c12
-rw-r--r--sys/ufs/ufs/ufs_quota.c28
-rw-r--r--sys/vm/vm_meter.c2
-rw-r--r--sys/vm/vm_object.c6
-rw-r--r--sys/vm/vm_pageout.c2
-rw-r--r--sys/vm/vm_pager.c2
99 files changed, 356 insertions, 360 deletions
diff --git a/sys/alpha/tc/esp.c b/sys/alpha/tc/esp.c
index e956811..4b46dab 100644
--- a/sys/alpha/tc/esp.c
+++ b/sys/alpha/tc/esp.c
@@ -367,7 +367,7 @@ esp_init(sc, doreset)
esp_done(ecb);
sc->sc_nexus = NULL;
}
- while ((ecb = sc->nexus_list.tqh_first) != NULL) {
+ while ((ecb = TAILQ_FIRST(&sc->nexus_list)) != NULL) {
ecb->xs->error = XS_TIMEOUT;
esp_done(ecb);
}
@@ -550,7 +550,7 @@ esp_scsi_cmd(xs)
/* Get a esp command block */
s = splbio();
- ecb = sc->free_list.tqh_first;
+ ecb = TAILQ_FIRST(&sc->free_list);
if (ecb) {
TAILQ_REMOVE(&sc->free_list, ecb, chain);
ECB_SETQ(ecb, ECB_QNONE);
@@ -657,7 +657,7 @@ esp_sched(sc)
* Find first ecb in ready queue that is for a target/lunit
* combinations that is not busy.
*/
- for (ecb = sc->ready_list.tqh_first; ecb; ecb = ecb->chain.tqe_next) {
+ TAILQ_FOREACH(ecb, &sc->ready_list, chain) {
sc_link = ecb->xs->sc_link;
t = sc_link->target;
if (!(sc->sc_tinfo[t].lubusy & (1 << sc_link->lun))) {
@@ -1080,8 +1080,8 @@ 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 = sc->nexus_list.tqh_first; ecb;
- ecb = ecb->chain.tqe_next) {
+ for (ecb = TAILQ_FIRST(&sc->nexus_list); ecb;
+ ecb = TAILQ_NEXT(ecb, 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 a7370eb..b7920b9 100644
--- a/sys/cam/cam_periph.c
+++ b/sys/cam/cam_periph.c
@@ -696,17 +696,17 @@ cam_periph_getccb(struct cam_periph *periph, u_int32_t priority)
s = splsoftcam();
- while (periph->ccb_list.slh_first == NULL) {
+ while (SLIST_FIRST(&periph->ccb_list) == NULL) {
if (periph->immediate_priority > priority)
periph->immediate_priority = priority;
xpt_schedule(periph, priority);
- if ((periph->ccb_list.slh_first != NULL)
- && (periph->ccb_list.slh_first->pinfo.priority == priority))
+ if ((SLIST_FIRST(&periph->ccb_list) != NULL)
+ && (SLIST_FIRST(&periph->ccb_list)->pinfo.priority == priority))
break;
tsleep(&periph->ccb_list, PRIBIO, "cgticb", 0);
}
- ccb_h = periph->ccb_list.slh_first;
+ ccb_h = SLIST_FIRST(&periph->ccb_list);
SLIST_REMOVE_HEAD(&periph->ccb_list, periph_links.sle);
splx(s);
return ((union ccb *)ccb_h);
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 6ed9f85..142fdf4 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -1213,9 +1213,9 @@ ptstartover:
base_periph_found = 1;
device = periph->path->device;
- for (i = 0, periph = device->periphs.slh_first;
+ for (i = 0, periph = SLIST_FIRST(&device->periphs);
periph != NULL;
- periph = periph->periph_links.sle_next, i++) {
+ periph = SLIST_NEXT(periph, periph_links), i++) {
/*
* Check to see whether we have a
* passthrough device or not.
@@ -1228,7 +1228,7 @@ ptstartover:
periph->periph_name);
ccb->cgdl.unit_number =
periph->unit_number;
- if (periph->periph_links.sle_next)
+ if (SLIST_NEXT(periph, periph_links))
ccb->cgdl.status =
CAM_GDEVLIST_MORE_DEVS;
else
@@ -3063,9 +3063,9 @@ xpt_action(union ccb *start_ccb)
* Traverse the list of peripherals and attempt to find
* the requested peripheral.
*/
- for (nperiph = periph_head->slh_first, i = 0;
+ for (nperiph = SLIST_FIRST(periph_head), i = 0;
(nperiph != NULL) && (i <= cgdl->index);
- nperiph = nperiph->periph_links.sle_next, i++) {
+ nperiph = SLIST_NEXT(nperiph, periph_links), i++) {
if (i == cgdl->index) {
strncpy(cgdl->periph_name,
nperiph->periph_name,
@@ -4611,7 +4611,7 @@ xpt_get_ccb(struct cam_ed *device)
int s;
s = splsoftcam();
- if ((new_ccb = (union ccb *)ccb_freeq.slh_first) == NULL) {
+ if ((new_ccb = (union ccb *)SLIST_FIRST(&ccb_freeq)) == NULL) {
new_ccb = malloc(sizeof(*new_ccb), M_DEVBUF, M_NOWAIT);
if (new_ccb == NULL) {
splx(s);
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c
index 080da36..57873bb 100644
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -546,8 +546,7 @@ cdasync(void *callback_arg, u_int32_t code,
* that will occur.
*/
softc->flags |= CD_FLAG_RETRY_UA;
- for (ccbh = LIST_FIRST(&softc->pending_ccbs);
- ccbh != NULL; ccbh = LIST_NEXT(ccbh, periph_links.le))
+ LIST_FOREACH(ccbh, &softc->pending_ccbs, periph_links.le)
ccbh->ccb_state |= CD_CCB_RETRY_UA;
splx(s);
/* FALLTHROUGH */
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index aaadaa9..91c2661 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -956,8 +956,7 @@ daasync(void *callback_arg, u_int32_t code,
* that will occur.
*/
softc->flags |= DA_FLAG_RETRY_UA;
- for (ccbh = LIST_FIRST(&softc->pending_ccbs);
- ccbh != NULL; ccbh = LIST_NEXT(ccbh, periph_links.le))
+ LIST_FOREACH(ccbh, &softc->pending_ccbs, periph_links.le)
ccbh->ccb_state |= DA_CCB_RETRY_UA;
splx(s);
/* FALLTHROUGH*/
diff --git a/sys/cam/scsi/scsi_low.c b/sys/cam/scsi/scsi_low.c
index a9a1ae6..25c9437 100644
--- a/sys/cam/scsi/scsi_low.c
+++ b/sys/cam/scsi/scsi_low.c
@@ -280,7 +280,7 @@ scsi_low_alloc_ti(slp, targ)
{
struct targ_info *ti;
- if (slp->sl_titab.tqh_first == NULL)
+ if (TAILQ_FIRST(&slp->sl_titab) == NULL)
TAILQ_INIT(&slp->sl_titab);
ti = malloc(sizeof(struct targ_info), M_DEVBUF, M_NOWAIT);
@@ -306,9 +306,9 @@ scsi_low_free_ti(slp)
struct targ_info *ti, *tib;
struct lun_info *li, *nli;
- for (ti = slp->sl_titab.tqh_first; ti; ti = tib)
+ for (ti = TAILQ_FIRST(&slp->sl_titab); ti; ti = tib)
{
- tib = ti->ti_chain.tqe_next;
+ tib = TAILQ_NEXT(ti, ti_chain);
for (li = LIST_FIRST(&ti->ti_litab); li != NULL; li = nli)
{
nli = LIST_NEXT(li, lun_chain);
@@ -341,11 +341,11 @@ scsi_low_timeout(arg)
{
struct targ_info *ti;
- for (ti = slp->sl_titab.tqh_first; ti != NULL;
- ti = ti->ti_chain.tqe_next)
+ for (ti = TAILQ_FIRST(&slp->sl_titab); ti != NULL;
+ ti = TAILQ_NEXT(ti, ti_chain))
{
- for (cb = ti->ti_discq.tqh_first; cb != NULL;
- cb = cb->ccb_chain.tqe_next)
+ for (cb = TAILQ_FIRST(&ti->ti_discq); cb != NULL;
+ cb = TAILQ_NEXT(cb, ccb_chain))
{
cb->ccb_tc -= SCSI_LOW_TIMEOUT_CHECK_INTERVAL;
if (cb->ccb_tc < 0)
@@ -355,7 +355,7 @@ scsi_low_timeout(arg)
}
else
{
- cb = slp->sl_start.tqh_first;
+ cb = TAILQ_FIRST(&slp->sl_start);
if (cb != NULL)
{
cb->ccb_tc -= SCSI_LOW_TIMEOUT_CHECK_INTERVAL;
@@ -605,7 +605,7 @@ scsi_low_dettach(slp)
struct scsi_low_softc *slp;
{
- if (slp->sl_disc > 0 || slp->sl_start.tqh_first != NULL)
+ if (slp->sl_disc > 0 || TAILQ_FIRST(&slp->sl_start) != NULL)
return EBUSY;
/*
@@ -930,8 +930,8 @@ scsi_low_start(slp)
}
#endif /* SCSI_LOW_DIAGNOSTIC */
- for (cb = slp->sl_start.tqh_first; cb != NULL;
- cb = cb->ccb_chain.tqe_next)
+ for (cb = TAILQ_FIRST(&slp->sl_start); cb != NULL;
+ cb = TAILQ_NEXT(cb, ccb_chain))
{
ti = cb->ti;
li = cb->li;
@@ -1305,7 +1305,7 @@ scsi_low_done(slp, cb)
retry:
cb->ccb_rcnt ++;
- if (slp->sl_start.tqh_first != cb)
+ if (TAILQ_FIRST(&slp->sl_start) != cb)
{
TAILQ_REMOVE(&slp->sl_start, cb, ccb_chain);
TAILQ_INSERT_HEAD(&slp->sl_start, cb, ccb_chain);
@@ -1347,12 +1347,12 @@ scsi_low_reset_nexus(slp, fdone)
}
/* disconnected nexus */
- for (ti = slp->sl_titab.tqh_first; ti != NULL;
- ti = ti->ti_chain.tqe_next)
+ for (ti = TAILQ_FIRST(&slp->sl_titab); ti != NULL;
+ ti = TAILQ_NEXT(ti, ti_chain))
{
- for (cb = ti->ti_discq.tqh_first; cb != NULL; cb = ncb)
+ for (cb = TAILQ_FIRST(&ti->ti_discq); cb != NULL; cb = ncb)
{
- ncb = cb->ccb_chain.tqe_next;
+ ncb = TAILQ_NEXT(cb, ccb_chain);
TAILQ_REMOVE(&ti->ti_discq, cb, ccb_chain);
TAILQ_INSERT_HEAD(&slp->sl_start, cb, ccb_chain);
scsi_low_clear_ccb(cb);
@@ -1460,8 +1460,8 @@ scsi_low_establish_ccb(ti, li, tag)
/*
* Search ccb matching with lun and tag.
*/
- cb = ti->ti_discq.tqh_first;
- for ( ; cb != NULL; cb = cb->ccb_chain.tqe_next)
+ cb = TAILQ_FIRST(&ti->ti_discq);
+ for ( ; cb != NULL; cb = TAILQ_NEXT(cb, ccb_chain))
if (cb->li == li && cb->ccb_tag == tag)
goto found;
return cb;
@@ -2496,8 +2496,8 @@ scsi_low_info(slp, ti, s)
printf("%s: SCSI_LOW: %s\n", slp->sl_xname, s);
if (ti == NULL)
{
- for (ti = slp->sl_titab.tqh_first; ti != NULL;
- ti = ti->ti_chain.tqe_next)
+ for (ti = TAILQ_FIRST(&slp->sl_titab); ti != NULL;
+ ti = TAILQ_NEXT(ti, ti_chain))
scsi_low_print(slp, ti);
}
else
diff --git a/sys/cam/scsi/scsi_low_pisa.c b/sys/cam/scsi/scsi_low_pisa.c
index 3918ffc..c9510bd 100644
--- a/sys/cam/scsi/scsi_low_pisa.c
+++ b/sys/cam/scsi/scsi_low_pisa.c
@@ -146,7 +146,7 @@ scsi_low_activate(dh)
/* rescan the scsi bus */
#ifdef SCSIBUS_RESCAN
if (PISA_RES_EVENT(dh) == PISA_EVENT_INSERT &&
- sc->sl_start.tqh_first == NULL)
+ TAILQ_FIRST(&sc->sl_start) == NULL)
scsi_probe_busses((int) sc->sl_link.scsipi_scsi.scsibus, -1, -1);
#endif
return 0;
@@ -163,7 +163,7 @@ scsi_low_notify(dh, ev)
switch(ev)
{
case PISA_EVENT_QUERY_SUSPEND:
- if (sc->sl_start.tqh_first != NULL)
+ if (TAILQ_FIRST(&sc->sl_start) != NULL)
return SD_EVENT_STATUS_BUSY;
break;
diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c
index 8f51ea8..541964f 100644
--- a/sys/cam/scsi/scsi_pt.c
+++ b/sys/cam/scsi/scsi_pt.c
@@ -490,8 +490,7 @@ ptasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg)
* that will occur.
*/
softc->flags |= PT_FLAG_RETRY_UA;
- for (ccbh = LIST_FIRST(&softc->pending_ccbs);
- ccbh != NULL; ccbh = LIST_NEXT(ccbh, periph_links.le))
+ LIST_FOREACH(ccbh, &softc->pending_ccbs, periph_links.le)
ccbh->ccb_state |= PT_CCB_RETRY_UA;
splx(s);
/* FALLTHROUGH */
diff --git a/sys/coda/coda_subr.c b/sys/coda/coda_subr.c
index 43422a9..3fe1e18 100644
--- a/sys/coda/coda_subr.c
+++ b/sys/coda/coda_subr.c
@@ -311,10 +311,10 @@ coda_checkunmounting(mp)
struct cnode *cp;
int count = 0, bad = 0;
loop:
- for (vp = mp->mnt_vnodelist.lh_first; vp; vp = nvp) {
+ for (vp = LIST_FIRST(&mp->mnt_vnodelist); vp; vp = nvp) {
if (vp->v_mount != mp)
goto loop;
- nvp = vp->v_mntvnodes.le_next;
+ nvp = LIST_NEXT(vp, v_mntvnodes);
cp = VTOC(vp);
count++;
if (!(cp->c_flags & C_UNMOUNTING)) {
diff --git a/sys/dev/aic7xxx/aicasm/aicasm.c b/sys/dev/aic7xxx/aicasm/aicasm.c
index 8ca1f65..1402b3a 100644
--- a/sys/dev/aic7xxx/aicasm/aicasm.c
+++ b/sys/dev/aic7xxx/aicasm/aicasm.c
@@ -178,9 +178,9 @@ main(int argc, char *argv[])
"times\n", appname);
}
includes_search_curdir = 0;
- for (include_dir = search_path.slh_first;
+ for (include_dir = SLIST_FIRST(&search_path);
include_dir != NULL;
- include_dir = include_dir->links.sle_next)
+ include_dir = SLIST_NEXT(include_dir, links))
/*
* All entries before a '-I-' only
* apply to includes specified with
@@ -276,9 +276,9 @@ back_patch()
{
struct instruction *cur_instr;
- for(cur_instr = seq_program.stqh_first;
+ for(cur_instr = STAILQ_FIRST(&seq_program);
cur_instr != NULL;
- cur_instr = cur_instr->links.stqe_next) {
+ cur_instr = STAILQ_NEXT(cur_instr, links)) {
if (cur_instr->patch_label != NULL) {
struct ins_format3 *f3_instr;
u_int address;
@@ -316,12 +316,12 @@ output_code()
*/\n");
fprintf(ofile, "static uint8_t seqprog[] = {\n");
- for(cur_instr = seq_program.stqh_first;
+ for(cur_instr = STAILQ_FIRST(&seq_program);
cur_instr != NULL;
- cur_instr = cur_instr->links.stqe_next) {
+ cur_instr = STAILQ_NEXT(cur_instr, links)) {
fprintf(ofile, "%s\t0x%02x, 0x%02x, 0x%02x, 0x%02x",
- cur_instr == seq_program.stqh_first ? "" : ",\n",
+ cur_instr == STAILQ_FIRST(&seq_program) ? "" : ",\n",
#if BYTE_ORDER == LITTLE_ENDIAN
cur_instr->format.bytes[0],
cur_instr->format.bytes[1],
diff --git a/sys/dev/aic7xxx/aicasm/aicasm_symbol.c b/sys/dev/aic7xxx/aicasm/aicasm_symbol.c
index 1e51d62..974c8c4 100644
--- a/sys/dev/aic7xxx/aicasm/aicasm_symbol.c
+++ b/sys/dev/aic7xxx/aicasm/aicasm_symbol.c
@@ -191,11 +191,11 @@ symlist_search(symlist_t *symlist, char *symname)
{
symbol_node_t *curnode;
- curnode = symlist->slh_first;
+ curnode = SLIST_FIRST(symlist);
while(curnode != NULL) {
if (strcmp(symname, curnode->symbol->name) == 0)
break;
- curnode = curnode->links.sle_next;
+ curnode = SLIST_NEXT(curnode, links);
}
return (curnode);
}
@@ -231,7 +231,7 @@ symlist_add(symlist_t *symlist, symbol_t *symbol, int how)
/* NOTREACHED */
}
- curnode = symlist->slh_first;
+ curnode = SLIST_FIRST(symlist);
if (curnode == NULL
|| (mask && (curnode->symbol->info.minfo->mask >
newnode->symbol->info.minfo->mask))
@@ -242,14 +242,14 @@ symlist_add(symlist_t *symlist, symbol_t *symbol, int how)
}
while (1) {
- if (curnode->links.sle_next == NULL) {
+ if (SLIST_NEXT(curnode, links) == NULL) {
SLIST_INSERT_AFTER(curnode, newnode,
links);
break;
} else {
symbol_t *cursymbol;
- cursymbol = curnode->links.sle_next->symbol;
+ cursymbol = SLIST_NEXT(curnode, links)->symbol;
if ((mask && (cursymbol->info.minfo->mask >
symbol->info.minfo->mask))
|| (!mask &&(cursymbol->info.rinfo->address >
@@ -259,7 +259,7 @@ symlist_add(symlist_t *symlist, symbol_t *symbol, int how)
break;
}
}
- curnode = curnode->links.sle_next;
+ curnode = SLIST_NEXT(curnode, links);
}
} else {
SLIST_INSERT_HEAD(symlist, newnode, links);
@@ -271,9 +271,9 @@ symlist_free(symlist_t *symlist)
{
symbol_node_t *node1, *node2;
- node1 = symlist->slh_first;
+ node1 = SLIST_FIRST(symlist);
while (node1 != NULL) {
- node2 = node1->links.sle_next;
+ node2 = SLIST_NEXT(node1, links);
free(node1);
node1 = node2;
}
@@ -287,7 +287,7 @@ symlist_merge(symlist_t *symlist_dest, symlist_t *symlist_src1,
symbol_node_t *node;
*symlist_dest = *symlist_src1;
- while((node = symlist_src2->slh_first) != NULL) {
+ while((node = SLIST_FIRST(symlist_src2)) != NULL) {
SLIST_REMOVE_HEAD(symlist_src2, links);
SLIST_INSERT_HEAD(symlist_dest, node, links);
}
@@ -357,28 +357,28 @@ symtable_dump(FILE *ofile)
}
/* Put in the masks and bits */
- while (masks.slh_first != NULL) {
+ while (SLIST_FIRST(&masks) != NULL) {
symbol_node_t *curnode;
symbol_node_t *regnode;
char *regname;
- curnode = masks.slh_first;
+ curnode = SLIST_FIRST(&masks);
SLIST_REMOVE_HEAD(&masks, links);
regnode =
- curnode->symbol->info.minfo->symrefs.slh_first;
+ SLIST_FIRST(&curnode->symbol->info.minfo->symrefs);
regname = regnode->symbol->name;
regnode = symlist_search(&registers, regname);
SLIST_INSERT_AFTER(regnode, curnode, links);
}
/* Add the aliases */
- while (aliases.slh_first != NULL) {
+ while (SLIST_FIRST(&aliases) != NULL) {
symbol_node_t *curnode;
symbol_node_t *regnode;
char *regname;
- curnode = aliases.slh_first;
+ curnode = SLIST_FIRST(&aliases);
SLIST_REMOVE_HEAD(&aliases, links);
regname = curnode->symbol->info.ainfo->parent->name;
@@ -391,13 +391,13 @@ symtable_dump(FILE *ofile)
"/*
* DO NOT EDIT - This file is automatically generated.
*/\n");
- while (registers.slh_first != NULL) {
+ while (SLIST_FIRST(&registers) != NULL) {
symbol_node_t *curnode;
u_int8_t value;
char *tab_str;
char *tab_str2;
- curnode = registers.slh_first;
+ curnode = SLIST_FIRST(&registers);
SLIST_REMOVE_HEAD(&registers, links);
switch(curnode->symbol->type) {
case REGISTER:
@@ -439,10 +439,10 @@ symtable_dump(FILE *ofile)
}
fprintf(ofile, "\n\n");
- while (constants.slh_first != NULL) {
+ while (SLIST_FIRST(&constants) != NULL) {
symbol_node_t *curnode;
- curnode = constants.slh_first;
+ curnode = SLIST_FIRST(&constants);
SLIST_REMOVE_HEAD(&constants, links);
fprintf(ofile, "#define\t%-8s\t0x%02x\n",
curnode->symbol->name,
@@ -453,10 +453,10 @@ symtable_dump(FILE *ofile)
fprintf(ofile, "\n\n/* Downloaded Constant Definitions */\n");
- while (download_constants.slh_first != NULL) {
+ while (SLIST_FIRST(&download_constants) != NULL) {
symbol_node_t *curnode;
- curnode = download_constants.slh_first;
+ curnode = SLIST_FIRST(&download_constants);
SLIST_REMOVE_HEAD(&download_constants, links);
fprintf(ofile, "#define\t%-8s\t0x%02x\n",
curnode->symbol->name,
diff --git a/sys/dev/asr/asr.c b/sys/dev/asr/asr.c
index 058c304..9f1b859 100644
--- a/sys/dev/asr/asr.c
+++ b/sys/dev/asr/asr.c
@@ -2249,7 +2249,7 @@ ASR_sync (
* issuing a shutdown or an adapter reset).
*/
if ((sc != (Asr_softc_t *)NULL)
- && (sc->ha_ccb.lh_first != (struct ccb_hdr *)NULL)
+ && (LIST_FIRST(&sc->ha_ccb) != (struct ccb_hdr *)NULL)
&& ((TID = ASR_getTid (sc, bus, target, lun)) != (tid_t)-1)
&& (TID != (tid_t)0)) {
defAlignLong(PRIVATE_SCSI_SCB_EXECUTE_MESSAGE,Message);
diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c
index 108518e..b756bae 100644
--- a/sys/dev/de/if_de.c
+++ b/sys/dev/de/if_de.c
@@ -3012,8 +3012,8 @@ tulip_addr_filter(
#endif
multicnt = 0;
- for (ifma = sc->tulip_if.if_multiaddrs.lh_first; ifma != NULL;
- ifma = ifma->ifma_link.le_next) {
+ for (ifma = LIST_FIRST(&sc->tulip_if.if_multiaddrs); ifma != NULL;
+ ifma = LIST_NEXT(ifma, ifma_link)) {
if (ifma->ifma_addr->sa_family == AF_LINK)
multicnt++;
@@ -3041,8 +3041,8 @@ tulip_addr_filter(
*/
bzero(sc->tulip_setupdata, sizeof(sc->tulip_setupdata));
- for (ifma = sc->tulip_if.if_multiaddrs.lh_first; ifma != NULL;
- ifma = ifma->ifma_link.le_next) {
+ for (ifma = LIST_FIRST(&sc->tulip_if.if_multiaddrs); ifma != NULL;
+ ifma = LIST_NEXT(ifma, ifma_link)) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@@ -3092,8 +3092,8 @@ tulip_addr_filter(
/*
* Else can get perfect filtering for 16 addresses.
*/
- for (ifma = sc->tulip_if.if_multiaddrs.lh_first; ifma != NULL;
- ifma = ifma->ifma_link.le_next) {
+ for (ifma = LIST_FIRST(&sc->tulip_if.if_multiaddrs); ifma != NULL;
+ ifma = LIST_NEXT(ifma, 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 08e7cc1..700f193 100644
--- a/sys/dev/ed/if_ed.c
+++ b/sys/dev/ed/if_ed.c
@@ -3286,8 +3286,8 @@ ds_getmcaf(sc, mcaf)
mcaf[0] = 0;
mcaf[1] = 0;
- for (ifma = sc->arpcom.ac_if.if_multiaddrs.lh_first; ifma;
- ifma = ifma->ifma_link.le_next) {
+ for (ifma = LIST_FIRST(&sc->arpcom.ac_if.if_multiaddrs); ifma;
+ ifma = LIST_NEXT(ifma, 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/eisa/eisaconf.c b/sys/dev/eisa/eisaconf.c
index a781251..d67b453 100644
--- a/sys/dev/eisa/eisaconf.c
+++ b/sys/dev/eisa/eisaconf.c
@@ -539,12 +539,12 @@ eisa_add_resvaddr(struct eisa_device *e_dev, struct resvlist *head, u_long base,
reservation->size = size;
reservation->flags = flags;
- if (!head->lh_first) {
+ if (!LIST_FIRST(head)) {
LIST_INSERT_HEAD(head, reservation, links);
}
else {
resvaddr_t *node;
- for(node = head->lh_first; node; node = node->links.le_next) {
+ LIST_FOREACH(node, head, links) {
if (node->addr > reservation->addr) {
/*
* List is sorted in increasing
@@ -564,7 +564,7 @@ eisa_add_resvaddr(struct eisa_device *e_dev, struct resvlist *head, u_long base,
return (EEXIST);
}
- if (!node->links.le_next) {
+ if (!LIST_NEXT(node, links)) {
LIST_INSERT_AFTER(node, reservation, links);
break;
}
diff --git a/sys/dev/ex/if_ex.c b/sys/dev/ex/if_ex.c
index 3ff0f5b..2a3dcfd 100644
--- a/sys/dev/ex/if_ex.c
+++ b/sys/dev/ex/if_ex.c
@@ -282,7 +282,7 @@ ex_init(void *xsc)
DODEBUG(Start_End, printf("ex_init%d: start\n", ifp->if_unit););
- if (ifp->if_addrhead.tqh_first == NULL) {
+ if (TAILQ_FIRST(&ifp->if_addrhead) == NULL) {
return;
}
s = splimp();
diff --git a/sys/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c
index 3e789b4..e5a49d0 100644
--- a/sys/dev/fe/if_fe.c
+++ b/sys/dev/fe/if_fe.c
@@ -2120,8 +2120,8 @@ fe_mcaf ( struct fe_softc *sc )
struct ifmultiaddr *ifma;
filter = fe_filter_nothing;
- for (ifma = sc->arpcom.ac_if.if_multiaddrs.lh_first; ifma;
- ifma = ifma->ifma_link.le_next) {
+ for (ifma = LIST_FIRST(&sc->arpcom.ac_if.if_multiaddrs); ifma;
+ ifma = LIST_NEXT(ifma, 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 ebebabb..3f7033d 100644
--- a/sys/dev/ie/if_ie.c
+++ b/sys/dev/ie/if_ie.c
@@ -2150,8 +2150,8 @@ ie_mc_reset(int unit)
* Step through the list of addresses.
*/
ie->mcast_count = 0;
- for (ifma = ie->arpcom.ac_if.if_multiaddrs.lh_first; ifma;
- ifma = ifma->ifma_link.le_next) {
+ for (ifma = LIST_FIRST(&ie->arpcom.ac_if.if_multiaddrs); ifma;
+ ifma = LIST_NEXT(ifma, ifma_link)) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
diff --git a/sys/dev/pdq/pdq_ifsubr.c b/sys/dev/pdq/pdq_ifsubr.c
index ac9d3d2..3c437a8 100644
--- a/sys/dev/pdq/pdq_ifsubr.c
+++ b/sys/dev/pdq/pdq_ifsubr.c
@@ -227,8 +227,8 @@ pdq_os_addr_fill(
pdq_softc_t *sc = (pdq_softc_t *) pdq->pdq_os_ctx;
struct ifmultiaddr *ifma;
- for (ifma = sc->sc_if.if_multiaddrs.lh_first; ifma && num_addrs > 0;
- ifma = ifma->ifma_link.le_next) {
+ for (ifma = LIST_FIRST(&sc->sc_if.if_multiaddrs); ifma && num_addrs > 0;
+ ifma = LIST_NEXT(ifma, ifma_link)) {
char *mcaddr;
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c
index ff01bf0..29f3fe3 100644
--- a/sys/dev/sf/if_sf.c
+++ b/sys/dev/sf/if_sf.c
@@ -450,7 +450,7 @@ static void sf_setmulti(sc)
i = 1;
/* First find the tail of the list. */
LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
- if (ifma->ifma_link.le_next == NULL)
+ if (LIST_NEXT(ifma, ifma_link) == NULL)
break;
}
/* Now traverse the list backwards. */
diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c
index a0dc45a..a6dba79 100644
--- a/sys/dev/sk/if_sk.c
+++ b/sys/dev/sk/if_sk.c
@@ -559,7 +559,7 @@ static void sk_setmulti(sc_if)
i = 1;
/* First find the tail of the list. */
LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
- if (ifma->ifma_link.le_next == NULL)
+ if (LIST_NEXT(ifma, ifma_link) == NULL)
break;
}
/* Now traverse the list backwards. */
diff --git a/sys/dev/sn/if_sn.c b/sys/dev/sn/if_sn.c
index 2b39024..e9a856d 100644
--- a/sys/dev/sn/if_sn.c
+++ b/sys/dev/sn/if_sn.c
@@ -1461,8 +1461,8 @@ sn_getmcf(struct arpcom *ac, u_char *mcf)
bzero(mcf, MCFSZ);
- for (ifma = ac->ac_if.if_multiaddrs.lh_first; ifma;
- ifma = ifma->ifma_link.le_next) {
+ for (ifma = LIST_FIRST(&ac->ac_if.if_multiaddrs); ifma;
+ ifma = LIST_NEXT(ifma, 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/ti/if_ti.c b/sys/dev/ti/if_ti.c
index cb28d01..1d52547 100644
--- a/sys/dev/ti/if_ti.c
+++ b/sys/dev/ti/if_ti.c
@@ -1073,8 +1073,8 @@ static void ti_setmulti(sc)
CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1);
/* First, zot all the existing filters. */
- while (sc->ti_mc_listhead.slh_first != NULL) {
- mc = sc->ti_mc_listhead.slh_first;
+ while (SLIST_FIRST(&sc->ti_mc_listhead) != NULL) {
+ mc = SLIST_FIRST(&sc->ti_mc_listhead);
ti_del_mcast(sc, &mc->mc_addr);
SLIST_REMOVE_HEAD(&sc->ti_mc_listhead, mc_entries);
free(mc, M_DEVBUF);
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index 1628268..761a458 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -985,7 +985,7 @@ uhci_intr(void *arg)
* We scan all interrupt descriptors to see if any have
* completed.
*/
- for (ii = LIST_FIRST(&sc->sc_intrhead); ii; ii = LIST_NEXT(ii, list))
+ LIST_FOREACH(ii, &sc->sc_intrhead, list)
uhci_check_intr(sc, ii);
DPRINTFN(10, ("%s: uhci_intr: exit\n", USBDEVNAME(sc->sc_bus.bdev)));
diff --git a/sys/dev/wl/if_wl.c b/sys/dev/wl/if_wl.c
index e1aec04..67a50d7 100644
--- a/sys/dev/wl/if_wl.c
+++ b/sys/dev/wl/if_wl.c
@@ -682,7 +682,7 @@ wlinit(void *xsc)
printf("wl%d: entered wlinit()\n",sc->unit);
#endif
#if defined(__FreeBSD__) && __FreeBSD_version >= 300000
- if (ifp->if_addrhead.tqh_first == (struct ifaddr *)0) {
+ if (TAILQ_FIRST(&ifp->if_addrhead) == (struct ifaddr *)0) {
#else
if (ifp->if_addrlist == (struct ifaddr *)0) {
#endif
@@ -2060,8 +2060,8 @@ 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 = sc->wl_if.if_multiaddrs.lh_first; ifma;
- ifma = ifma->ifma_link.le_next) {
+ for (ifma = LIST_FIRST(&sc->wl_if.if_multiaddrs); ifma;
+ ifma = LIST_NEXT(ifma, ifma_link)) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
diff --git a/sys/dev/xe/if_xe.c b/sys/dev/xe/if_xe.c
index 78742ba..d0e1dd2 100644
--- a/sys/dev/xe/if_xe.c
+++ b/sys/dev/xe/if_xe.c
@@ -1590,10 +1590,10 @@ xe_setmulti(struct xe_softc *scp) {
int count;
ifp = &scp->arpcom.ac_if;
- maddr = ifp->if_multiaddrs.lh_first;
+ maddr = LIST_FIRST(&ifp->if_multiaddrs);
/* Get length of multicast list */
- for (count = 0; maddr != NULL; maddr = maddr->ifma_link.le_next, count++);
+ for (count = 0; maddr != NULL; maddr = LIST_NEXT(maddr, ifma_link), count++);
if ((ifp->if_flags & IFF_PROMISC) || (ifp->if_flags & IFF_ALLMULTI) || (count > 9)) {
/*
@@ -1643,7 +1643,7 @@ xe_setaddrs(struct xe_softc *scp) {
u_int8_t *addr;
u_int8_t page, slot, byte, i;
- maddr = scp->arpcom.ac_if.if_multiaddrs.lh_first;
+ maddr = LIST_FIRST(&scp->arpcom.ac_if.if_multiaddrs);
XE_SELECT_PAGE(page = 0x50);
@@ -1653,7 +1653,7 @@ xe_setaddrs(struct xe_softc *scp) {
addr = (u_int8_t *)(&scp->arpcom.ac_enaddr);
else {
while (maddr != NULL && maddr->ifma_addr->sa_family != AF_LINK)
- maddr = maddr->ifma_link.le_next;
+ maddr = LIST_NEXT(maddr, ifma_link);
if (maddr != NULL)
addr = LLADDR((struct sockaddr_dl *)maddr->ifma_addr);
else
diff --git a/sys/fs/coda/coda_subr.c b/sys/fs/coda/coda_subr.c
index 43422a9..3fe1e18 100644
--- a/sys/fs/coda/coda_subr.c
+++ b/sys/fs/coda/coda_subr.c
@@ -311,10 +311,10 @@ coda_checkunmounting(mp)
struct cnode *cp;
int count = 0, bad = 0;
loop:
- for (vp = mp->mnt_vnodelist.lh_first; vp; vp = nvp) {
+ for (vp = LIST_FIRST(&mp->mnt_vnodelist); vp; vp = nvp) {
if (vp->v_mount != mp)
goto loop;
- nvp = vp->v_mntvnodes.le_next;
+ nvp = LIST_NEXT(vp, v_mntvnodes);
cp = VTOC(vp);
count++;
if (!(cp->c_flags & C_UNMOUNTING)) {
diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c
index 4a8f061..c6bb2d6 100644
--- a/sys/fs/fdescfs/fdesc_vnops.c
+++ b/sys/fs/fdescfs/fdesc_vnops.c
@@ -106,7 +106,7 @@ fdesc_allocvp(ftype, ix, mp, vpp, p)
fc = FD_NHASH(ix);
loop:
- for (fd = fc->lh_first; fd != 0; fd = fd->fd_hash.le_next) {
+ LIST_FOREACH(fd, fc, fd_hash) {
if (fd->fd_ix == ix && fd->fd_vnode->v_mount == mp) {
if (vget(fd->fd_vnode, 0, p))
goto loop;
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index 652e92b..449d691 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -769,7 +769,7 @@ msdosfs_unmount(mp, mntflags, p)
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), vp->v_freelist.tqe_prev,
vp->v_mount);
printf("cleanblkhd %p, dirtyblkhd %p, numoutput %ld, type %d\n",
TAILQ_FIRST(&vp->v_cleanblkhd),
diff --git a/sys/fs/ntfs/ntfs_subr.c b/sys/fs/ntfs/ntfs_subr.c
index d9b38d4..38324f2 100644
--- a/sys/fs/ntfs/ntfs_subr.c
+++ b/sys/fs/ntfs/ntfs_subr.c
@@ -123,7 +123,7 @@ ntfs_findvattr(ntmp, ip, lvapp, vapp, type, name, namelen, vcn)
*lvapp = NULL;
*vapp = NULL;
- for (vap = ip->i_valist.lh_first; vap; vap = vap->va_list.le_next) {
+ LIST_FOREACH(vap, &ip->i_valist, va_list) {
ddprintf(("ntfs_findvattr: type: 0x%x, vcn: %d - %d\n", \
vap->va_type, (u_int32_t) vap->va_vcnstart, \
(u_int32_t) vap->va_vcnend));
@@ -452,13 +452,13 @@ ntfs_ntput(ip)
dprintf(("ntfs_ntput: deallocating ntnode: %d\n",
ip->i_number));
- if (ip->i_fnlist.lh_first)
+ if (LIST_FIRST(&ip->i_fnlist))
panic("ntfs_ntput: ntnode has fnodes\n");
ntfs_nthashrem(ip);
- while (ip->i_valist.lh_first != NULL) {
- vap = ip->i_valist.lh_first;
+ while (LIST_FIRST(&ip->i_valist) != NULL) {
+ vap = LIST_FIRST(&ip->i_valist);
LIST_REMOVE(vap,va_list);
ntfs_freentvattr(vap);
}
@@ -719,7 +719,7 @@ ntfs_fget(
dprintf(("ntfs_fget: ino: %d, attrtype: 0x%x, attrname: %s\n",
ip->i_number,attrtype, attrname?attrname:""));
*fpp = NULL;
- for (fp = ip->i_fnlist.lh_first; fp != NULL; fp = fp->f_fnlist.le_next){
+ LIST_FOREACH(fp, &ip->i_fnlist, f_fnlist){
dprintf(("ntfs_fget: fnode: attrtype: %d, attrname: %s\n",
fp->f_attrtype, fp->f_attrname?fp->f_attrname:""));
diff --git a/sys/fs/nullfs/null_subr.c b/sys/fs/nullfs/null_subr.c
index 68b0431..fe5f988 100644
--- a/sys/fs/nullfs/null_subr.c
+++ b/sys/fs/nullfs/null_subr.c
@@ -121,7 +121,7 @@ null_node_find(mp, lowervp)
hd = NULL_NHASH(lowervp);
loop:
lockmgr(&null_hashlock, LK_EXCLUSIVE, NULL, p);
- for (a = hd->lh_first; a != 0; a = a->null_hash.le_next) {
+ LIST_FOREACH(a, hd, null_hash) {
if (a->null_lowervp == lowervp && NULLTOV(a)->v_mount == mp) {
vp = NULLTOV(a);
lockmgr(&null_hashlock, LK_RELEASE, NULL, p);
diff --git a/sys/fs/nwfs/nwfs_node.c b/sys/fs/nwfs/nwfs_node.c
index 885ebac..02a4ee3 100644
--- a/sys/fs/nwfs/nwfs_node.c
+++ b/sys/fs/nwfs/nwfs_node.c
@@ -99,7 +99,7 @@ nwfs_sysctl_vnprint(SYSCTL_HANDLER_ARGS) {
printf("Name:uc:hc:fid:pfid\n");
for(i = 0; i <= nwnodehash; i++) {
nhpp = &nwhashtbl[i];
- for (np = nhpp->lh_first; np != 0; np = np->n_hash.le_next) {
+ LIST_FOREACH(np, nhpp, n_hash) {
vp = NWTOV(np);
vprint(NULL, vp);
printf("%s:%d:%d:%d:%d\n",np->n_name,vp->v_usecount,vp->v_holdcnt,
diff --git a/sys/fs/nwfs/nwfs_vfsops.c b/sys/fs/nwfs/nwfs_vfsops.c
index c0f0844..3e76b30 100644
--- a/sys/fs/nwfs/nwfs_vfsops.c
+++ b/sys/fs/nwfs/nwfs_vfsops.c
@@ -498,9 +498,9 @@ nwfs_sync(mp, waitfor, cred, p)
* Force stale buffer cache information to be flushed.
*/
loop:
- for (vp = mp->mnt_vnodelist.lh_first;
+ for (vp = LIST_FIRST(&mp->mnt_vnodelist);
vp != NULL;
- vp = vp->v_mntvnodes.le_next) {
+ vp = LIST_NEXT(vp, v_mntvnodes)) {
/*
* If the vnode that we are about to sync is no longer
* associated with this mount point, start over.
diff --git a/sys/fs/procfs/procfs_vnops.c b/sys/fs/procfs/procfs_vnops.c
index 27e3707..2831966 100644
--- a/sys/fs/procfs/procfs_vnops.c
+++ b/sys/fs/procfs/procfs_vnops.c
@@ -875,7 +875,7 @@ procfs_readdir(ap)
#ifdef PROCFS_ZOMBIE
if (p == 0 && doingzomb == 0) {
doingzomb = 1;
- p = zombproc.lh_first;
+ p = LIST_FIRST(&zombproc);
goto again;
}
#endif
diff --git a/sys/fs/umapfs/umap_subr.c b/sys/fs/umapfs/umap_subr.c
index a04b132..9b9806e 100644
--- a/sys/fs/umapfs/umap_subr.c
+++ b/sys/fs/umapfs/umap_subr.c
@@ -157,7 +157,7 @@ umap_node_find(mp, targetvp)
*/
hd = UMAP_NHASH(targetvp);
loop:
- for (a = hd->lh_first; a != 0; a = a->umap_hash.le_next) {
+ LIST_FOREACH(a, hd, umap_hash) {
if (a->umap_lowervp == targetvp &&
a->umap_vnode->v_mount == mp) {
vp = UMAPTOV(a);
diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c
index 94cba85..dfa6eae 100644
--- a/sys/fs/unionfs/union_vfsops.c
+++ b/sys/fs/unionfs/union_vfsops.c
@@ -337,9 +337,9 @@ union_unmount(mp, mntflags, p)
int n;
/* count #vnodes held on mount list */
- for (n = 0, vp = mp->mnt_vnodelist.lh_first;
+ for (n = 0, vp = LIST_FIRST(&mp->mnt_vnodelist);
vp != NULLVP;
- vp = vp->v_mntvnodes.le_next)
+ vp = LIST_NEXT(vp, v_mntvnodes))
n++;
/* if this is unchanged then stop */
diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c
index 7119096..25af8d2 100644
--- a/sys/gnu/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/ext2fs/ext2_vfsops.c
@@ -562,12 +562,12 @@ ext2_reload(mountp, cred, p)
loop:
mtx_enter(&mntvnode_mtx, MTX_DEF);
- for (vp = mountp->mnt_vnodelist.lh_first; vp != NULL; vp = nvp) {
+ for (vp = LIST_FIRST(&mountp->mnt_vnodelist); vp != NULL; vp = nvp) {
if (vp->v_mount != mountp) {
mtx_exit(&mntvnode_mtx, MTX_DEF);
goto loop;
}
- nvp = vp->v_mntvnodes.le_next;
+ nvp = LIST_NEXT(vp, v_mntvnodes);
/*
* Step 4: invalidate all inactive vnodes.
*/
@@ -920,7 +920,7 @@ ext2_sync(mp, waitfor, cred, p)
*/
mtx_enter(&mntvnode_mtx, MTX_DEF);
loop:
- for (vp = mp->mnt_vnodelist.lh_first; vp != NULL; vp = nvp) {
+ for (vp = LIST_FIRST(&mp->mnt_vnodelist); vp != NULL; vp = nvp) {
/*
* If the vnode that we are about to sync is no longer
* associated with this mount point, start over.
@@ -928,7 +928,7 @@ loop:
if (vp->v_mount != mp)
goto loop;
mtx_enter(&vp->v_interlock, MTX_DEF);
- nvp = vp->v_mntvnodes.le_next;
+ nvp = LIST_NEXT(vp, v_mntvnodes);
ip = VTOI(vp);
if (vp->v_type == VNON ||
((ip->i_flag &
diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c
index 7119096..25af8d2 100644
--- a/sys/gnu/fs/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c
@@ -562,12 +562,12 @@ ext2_reload(mountp, cred, p)
loop:
mtx_enter(&mntvnode_mtx, MTX_DEF);
- for (vp = mountp->mnt_vnodelist.lh_first; vp != NULL; vp = nvp) {
+ for (vp = LIST_FIRST(&mountp->mnt_vnodelist); vp != NULL; vp = nvp) {
if (vp->v_mount != mountp) {
mtx_exit(&mntvnode_mtx, MTX_DEF);
goto loop;
}
- nvp = vp->v_mntvnodes.le_next;
+ nvp = LIST_NEXT(vp, v_mntvnodes);
/*
* Step 4: invalidate all inactive vnodes.
*/
@@ -920,7 +920,7 @@ ext2_sync(mp, waitfor, cred, p)
*/
mtx_enter(&mntvnode_mtx, MTX_DEF);
loop:
- for (vp = mp->mnt_vnodelist.lh_first; vp != NULL; vp = nvp) {
+ for (vp = LIST_FIRST(&mp->mnt_vnodelist); vp != NULL; vp = nvp) {
/*
* If the vnode that we are about to sync is no longer
* associated with this mount point, start over.
@@ -928,7 +928,7 @@ loop:
if (vp->v_mount != mp)
goto loop;
mtx_enter(&vp->v_interlock, MTX_DEF);
- nvp = vp->v_mntvnodes.le_next;
+ nvp = LIST_NEXT(vp, v_mntvnodes);
ip = VTOI(vp);
if (vp->v_type == VNON ||
((ip->i_flag &
diff --git a/sys/i386/isa/bs/bs.c b/sys/i386/isa/bs/bs.c
index fdbc8a1..97a506f 100644
--- a/sys/i386/isa/bs/bs.c
+++ b/sys/i386/isa/bs/bs.c
@@ -238,7 +238,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);
@@ -281,7 +281,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;
@@ -386,7 +386,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);
@@ -415,12 +415,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);
@@ -450,8 +450,8 @@ again:
{
struct targ_info *tmpti;
- for (tmpti = bsc->sc_titab.tqh_first; tmpti;
- tmpti = tmpti->ti_tchain.tqe_next)
+ for (tmpti = TAILQ_FIRST(&bsc->sc_titab); tmpti;
+ tmpti = TAILQ_NEXT(tmpti, ti_tchain))
if (tmpti->ti_phase >= DISCONNECTED)
goto retry;
}
@@ -615,7 +615,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_FIRST(&ti->ti_ctab) == NULL || ti->ti_phase != DISCONNECTED)
{
bs_printf(ti, "reselect", "phase mismatch");
BS_SETUP_PHASE(UNDEF)
@@ -670,7 +670,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_FIRST(&ti->ti_ctab))
ti->ti_error |= BSTIMEOUT;
}
@@ -835,7 +835,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;
@@ -869,7 +869,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;
@@ -942,7 +942,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)
@@ -1196,7 +1196,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_FIRST(&bsc->sc_sttab) == NULL)
{
BS_HOST_TERMINATE;
bscmdstart(ti, BSCMDSTART);
@@ -1374,7 +1374,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");
@@ -1591,7 +1591,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;
@@ -1602,7 +1602,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;
}
}
@@ -1658,7 +1658,7 @@ 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_FIRST(&ti->ti_ctab))
ti->ti_error |= (BSTIMEOUT | BSABNORMAL);
bs_reset_nexus(bsc);
}
diff --git a/sys/i386/isa/bs/bs_pisa.c b/sys/i386/isa/bs/bs_pisa.c
index 62ae84b..059cb7e 100644
--- a/sys/i386/isa/bs/bs_pisa.c
+++ b/sys/i386/isa/bs/bs_pisa.c
@@ -26,6 +26,8 @@
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
*/
#include <dev/isa/bs/bsif.h>
@@ -103,7 +105,7 @@ bs_activate(arg)
bsc->sc_irqmasks = (1 << ia->ia_irq);
- while((ti = bsc->sc_titab.tqh_first) != NULL)
+ while((ti = TAILQ_FIRST(&bsc->sc_titab)) != NULL)
TAILQ_REMOVE(&bsc->sc_titab, ti, ti_tchain);
bsc->sc_openf = 0;
diff --git a/sys/i386/isa/bs/bsfunc.c b/sys/i386/isa/bs/bsfunc.c
index 8800d3d..c0e5540 100644
--- a/sys/i386/isa/bs/bsfunc.c
+++ b/sys/i386/isa/bs/bsfunc.c
@@ -95,17 +95,17 @@ 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)
+ else TAILQ_FOREACH(ti, &bsc->sc_titab, ti_tchain)
{
if (bsc->sc_dtgnum && ti->ti_phase < DISCONNECTED)
continue;
- cb = ti->ti_ctab.tqh_first;
+ cb = TAILQ_FIRST(&ti->ti_ctab);
if (cb && ((cb->tc -= BS_TIMEOUT_CHECK_INTERVAL) < 0))
bs_timeout_target(ti);
}
@@ -257,7 +257,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)
{
@@ -418,7 +418,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)
@@ -478,13 +478,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)
@@ -510,11 +510,11 @@ 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_FIRST(&ti->ti_ctab))
bscmdstart(ti, BSCMDSTART);
}
}
@@ -539,7 +539,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);
@@ -548,7 +548,7 @@ bs_reset_nexus(bsc)
BS_SETUP_PHASE(UNDEF)
bs_hostque_delete(bsc, ti);
- if ((cb = ti->ti_ctab.tqh_first) != NULL)
+ if ((cb = TAILQ_FIRST(&ti->ti_ctab)) != NULL)
{
if (bsc->sc_hstate == BSC_TARG_CHECK)
{
@@ -573,7 +573,7 @@ bs_reset_nexus(bsc)
ti->ti_flags &= ~BSNEXUS;
#endif /* BS_DIAG */
- for ( ; cb; cb = cb->ccb_chain.tqe_next)
+ for ( ; cb; cb = TAILQ_NEXT(cb, ccb_chain))
{
bs_kill_msg(cb);
cb->bsccb_flags &= ~(BSITSDONE | BSCASTAT);
@@ -581,7 +581,7 @@ bs_reset_nexus(bsc)
}
if (bsc->sc_hstate != BSC_TARG_CHECK &&
- ti->ti_bctab.tqh_first == NULL)
+ TAILQ_FIRST(&ti->ti_bctab) == NULL)
ti->ti_bctab = ti->ti_ctab;
TAILQ_INIT(&ti->ti_ctab);
@@ -872,7 +872,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, ti_tchain)
bs_debug_print(bsc, ti);
}
@@ -903,7 +903,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/i386/isa/if_le.c b/sys/i386/isa/if_le.c
index 838a5f0..b23f0e3 100644
--- a/sys/i386/isa/if_le.c
+++ b/sys/i386/isa/if_le.c
@@ -560,8 +560,8 @@ le_multi_filter(
sc->le_flags |= IFF_MULTICAST;
- for (ifma = sc->le_ac.ac_if.if_multiaddrs.lh_first; ifma;
- ifma = ifma->ifma_link.le_next) {
+ for (ifma = LIST_FIRST(&sc->le_ac.ac_if.if_multiaddrs); ifma;
+ ifma = LIST_NEXT(ifma, 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 e1aec04..67a50d7 100644
--- a/sys/i386/isa/if_wl.c
+++ b/sys/i386/isa/if_wl.c
@@ -682,7 +682,7 @@ wlinit(void *xsc)
printf("wl%d: entered wlinit()\n",sc->unit);
#endif
#if defined(__FreeBSD__) && __FreeBSD_version >= 300000
- if (ifp->if_addrhead.tqh_first == (struct ifaddr *)0) {
+ if (TAILQ_FIRST(&ifp->if_addrhead) == (struct ifaddr *)0) {
#else
if (ifp->if_addrlist == (struct ifaddr *)0) {
#endif
@@ -2060,8 +2060,8 @@ 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 = sc->wl_if.if_multiaddrs.lh_first; ifma;
- ifma = ifma->ifma_link.le_next) {
+ for (ifma = LIST_FIRST(&sc->wl_if.if_multiaddrs); ifma;
+ ifma = LIST_NEXT(ifma, ifma_link)) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
diff --git a/sys/i4b/driver/i4b_ispppsubr.c b/sys/i4b/driver/i4b_ispppsubr.c
index 3f1cd7f..7da2ea7 100644
--- a/sys/i4b/driver/i4b_ispppsubr.c
+++ b/sys/i4b/driver/i4b_ispppsubr.c
@@ -4200,9 +4200,9 @@ sppp_get_ip_addrs(struct sppp *sp, u_long *src, u_long *dst, u_long *srcmask)
#if defined(__FreeBSD__) && __FreeBSD__ >= 3
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
#elif defined(__NetBSD__) || defined (__OpenBSD__)
- for (ifa = ifp->if_addrlist.tqh_first;
+ for (ifa = TAILQ_FIRST(&ifp->if_addrlist);
ifa;
- ifa = ifa->ifa_list.tqe_next)
+ ifa = TAILQ_NEXT(ifa, ifa_list))
#else
for (ifa = ifp->if_addrlist;
ifa;
@@ -4249,9 +4249,9 @@ sppp_set_ip_addr(struct sppp *sp, u_long src)
#if defined(__FreeBSD__) && __FreeBSD__ >= 3
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
#elif defined(__NetBSD__) || defined (__OpenBSD__)
- for (ifa = ifp->if_addrlist.tqh_first;
+ for (ifa = TAILQ_FIRST(&ifp->if_addrlist);
ifa;
- ifa = ifa->ifa_list.tqe_next)
+ ifa = TAILQ_NEXT(ifa, ifa_list))
#else
for (ifa = ifp->if_addrlist;
ifa;
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index 5591342..b286311 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -321,7 +321,7 @@ linker_load_file(const char* filename, linker_file_t* result)
lf = NULL;
foundfile = 0;
- for (lc = TAILQ_FIRST(&classes); lc; lc = TAILQ_NEXT(lc, link)) {
+ TAILQ_FOREACH(lc, &classes, link) {
KLD_DPF(FILE, ("linker_load_file: trying to load %s as %s\n",
filename, lc->desc));
error = LINKER_LOAD_FILE(lc, filename, &lf);
@@ -367,7 +367,7 @@ linker_find_file_by_name(const char* filename)
sprintf(koname, "%s.ko", filename);
lockmgr(&lock, LK_SHARED, 0, curproc);
- for (lf = TAILQ_FIRST(&linker_files); lf; lf = TAILQ_NEXT(lf, link)) {
+ TAILQ_FOREACH(lf, &linker_files, link) {
if (!strcmp(lf->filename, koname))
break;
if (!strcmp(lf->filename, filename))
@@ -387,7 +387,7 @@ linker_find_file_by_id(int fileid)
linker_file_t lf = 0;
lockmgr(&lock, LK_SHARED, 0, curproc);
- for (lf = TAILQ_FIRST(&linker_files); lf; lf = TAILQ_NEXT(lf, link))
+ TAILQ_FOREACH(lf, &linker_files, link)
if (lf->id == fileid)
break;
lockmgr(&lock, LK_RELEASE, 0, curproc);
@@ -623,7 +623,7 @@ linker_ddb_lookup(const char *symstr, c_linker_sym_t *sym)
{
linker_file_t lf;
- for (lf = TAILQ_FIRST(&linker_files); lf; lf = TAILQ_NEXT(lf, link)) {
+ TAILQ_FOREACH(lf, &linker_files, link) {
if (LINKER_LOOKUP_SYMBOL(lf, symstr, sym) == 0)
return 0;
}
@@ -641,7 +641,7 @@ linker_ddb_search_symbol(caddr_t value, c_linker_sym_t *sym, long *diffp)
best = 0;
bestdiff = off;
- for (lf = TAILQ_FIRST(&linker_files); lf; lf = TAILQ_NEXT(lf, link)) {
+ TAILQ_FOREACH(lf, &linker_files, link) {
if (LINKER_SEARCH_SYMBOL(lf, value, &es, &diff) != 0)
continue;
if (es != 0 && diff < bestdiff) {
@@ -667,7 +667,7 @@ linker_ddb_symbol_values(c_linker_sym_t sym, linker_symval_t *symval)
{
linker_file_t lf;
- for (lf = TAILQ_FIRST(&linker_files); lf; lf = TAILQ_NEXT(lf, link)) {
+ TAILQ_FOREACH(lf, &linker_files, link) {
if (LINKER_SYMBOL_VALUES(lf, sym, symval) == 0)
return 0;
}
@@ -912,7 +912,7 @@ kldsym(struct proc *p, struct kldsym_args *uap)
} else
error = ENOENT;
} else {
- for (lf = TAILQ_FIRST(&linker_files); lf; lf = TAILQ_NEXT(lf, link)) {
+ TAILQ_FOREACH(lf, &linker_files, link) {
if (LINKER_LOOKUP_SYMBOL(lf, symstr, &sym) == 0 &&
LINKER_SYMBOL_VALUES(lf, sym, &symval) == 0) {
lookup.symvalue = (uintptr_t)symval.value;
@@ -939,7 +939,7 @@ modlist_lookup(const char *name)
{
modlist_t mod;
- for (mod = TAILQ_FIRST(&found_modules); mod; mod = TAILQ_NEXT(mod, link)) {
+ TAILQ_FOREACH(mod, &found_modules, link) {
if (!strcmp(mod->name, name))
return mod;
}
@@ -992,7 +992,7 @@ linker_preload(void* arg)
}
printf("Preloaded %s \"%s\" at %p.\n", modtype, modname, modptr);
lf = NULL;
- for (lc = TAILQ_FIRST(&classes); lc; lc = TAILQ_NEXT(lc, link)) {
+ TAILQ_FOREACH(lc, &classes, link) {
error = LINKER_LINK_PRELOAD(lc, modname, &lf);
if (error) {
lf = NULL;
@@ -1033,7 +1033,7 @@ linker_preload(void* arg)
* resolve relocation dependency requirements
*/
restart:
- for (lf = TAILQ_FIRST(&loaded_files); lf; lf = TAILQ_NEXT(lf, loaded)) {
+ TAILQ_FOREACH(lf, &loaded_files, loaded) {
deps = (struct linker_set*)
linker_file_lookup_symbol(lf, MDT_SETNAME, 0);
/*
@@ -1102,7 +1102,7 @@ restart:
/*
* At this point, we check to see what could not be resolved..
*/
- for (lf = TAILQ_FIRST(&loaded_files); lf; lf = TAILQ_NEXT(lf, loaded)) {
+ TAILQ_FOREACH(lf, &loaded_files, loaded) {
printf("KLD file %s is missing dependencies\n", lf->filename);
linker_file_unload(lf);
TAILQ_REMOVE(&loaded_files, lf, loaded);
@@ -1111,7 +1111,7 @@ restart:
/*
* We made it. Finish off the linking in the order we determined.
*/
- for (lf = TAILQ_FIRST(&depended_files); lf; lf = TAILQ_NEXT(lf, loaded)) {
+ TAILQ_FOREACH(lf, &depended_files, loaded) {
if (linker_kernel_file) {
linker_kernel_file->refs++;
error = linker_file_add_dependancy(lf, linker_kernel_file);
diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c
index aa9ecb6..b9d35d7 100644
--- a/sys/kern/kern_module.c
+++ b/sys/kern/kern_module.c
@@ -81,7 +81,7 @@ module_shutdown(void* arg1, int arg2)
{
module_t mod;
- for (mod = TAILQ_FIRST(&modules); mod; mod = TAILQ_NEXT(mod, link))
+ TAILQ_FOREACH(mod, &modules, link)
MOD_EVENT(mod, MOD_SHUTDOWN);
}
@@ -168,7 +168,7 @@ module_lookupbyname(const char* name)
{
module_t mod;
- for (mod = TAILQ_FIRST(&modules); mod; mod = TAILQ_NEXT(mod, link)) {
+ TAILQ_FOREACH(mod, &modules, link) {
if (!strcmp(mod->name, name))
return mod;
}
@@ -181,7 +181,7 @@ module_lookupbyid(int modid)
{
module_t mod;
- for (mod = TAILQ_FIRST(&modules); mod; mod = TAILQ_NEXT(mod, link)) {
+ TAILQ_FOREACH(mod, &modules, link) {
if (mod->id == modid)
return mod;
}
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index d06ca89..dd361d7 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -222,7 +222,7 @@ sysctl_ctx_entry_find(struct sysctl_ctx_list *clist, struct sysctl_oid *oidp)
if (clist == NULL || oidp == NULL)
return(NULL);
- for (e = TAILQ_FIRST(clist); e != NULL; e = TAILQ_NEXT(e, link)) {
+ TAILQ_FOREACH(e, clist, link) {
if(e->entry == oidp)
return(e);
}
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c
index 3d76f7a..3abcc82 100644
--- a/sys/kern/vfs_export.c
+++ b/sys/kern/vfs_export.c
@@ -1147,7 +1147,7 @@ pbrelvp(bp)
KASSERT(bp->b_vp != NULL, ("pbrelvp: NULL"));
/* XXX REMOVE ME */
- if (bp->b_vnbufs.tqe_next != NULL) {
+ if (TAILQ_NEXT(bp, b_vnbufs) != NULL) {
panic(
"relpbuf(): b_vp was probably reassignbuf()d %p %x",
bp,
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 3d76f7a..3abcc82 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1147,7 +1147,7 @@ pbrelvp(bp)
KASSERT(bp->b_vp != NULL, ("pbrelvp: NULL"));
/* XXX REMOVE ME */
- if (bp->b_vnbufs.tqe_next != NULL) {
+ if (TAILQ_NEXT(bp, b_vnbufs) != NULL) {
panic(
"relpbuf(): b_vp was probably reassignbuf()d %p %x",
bp,
diff --git a/sys/miscfs/fdesc/fdesc_vnops.c b/sys/miscfs/fdesc/fdesc_vnops.c
index 4a8f061..c6bb2d6 100644
--- a/sys/miscfs/fdesc/fdesc_vnops.c
+++ b/sys/miscfs/fdesc/fdesc_vnops.c
@@ -106,7 +106,7 @@ fdesc_allocvp(ftype, ix, mp, vpp, p)
fc = FD_NHASH(ix);
loop:
- for (fd = fc->lh_first; fd != 0; fd = fd->fd_hash.le_next) {
+ LIST_FOREACH(fd, fc, fd_hash) {
if (fd->fd_ix == ix && fd->fd_vnode->v_mount == mp) {
if (vget(fd->fd_vnode, 0, p))
goto loop;
diff --git a/sys/miscfs/nullfs/null_subr.c b/sys/miscfs/nullfs/null_subr.c
index 68b0431..fe5f988 100644
--- a/sys/miscfs/nullfs/null_subr.c
+++ b/sys/miscfs/nullfs/null_subr.c
@@ -121,7 +121,7 @@ null_node_find(mp, lowervp)
hd = NULL_NHASH(lowervp);
loop:
lockmgr(&null_hashlock, LK_EXCLUSIVE, NULL, p);
- for (a = hd->lh_first; a != 0; a = a->null_hash.le_next) {
+ LIST_FOREACH(a, hd, null_hash) {
if (a->null_lowervp == lowervp && NULLTOV(a)->v_mount == mp) {
vp = NULLTOV(a);
lockmgr(&null_hashlock, LK_RELEASE, NULL, p);
diff --git a/sys/miscfs/procfs/procfs_vnops.c b/sys/miscfs/procfs/procfs_vnops.c
index 27e3707..2831966 100644
--- a/sys/miscfs/procfs/procfs_vnops.c
+++ b/sys/miscfs/procfs/procfs_vnops.c
@@ -875,7 +875,7 @@ procfs_readdir(ap)
#ifdef PROCFS_ZOMBIE
if (p == 0 && doingzomb == 0) {
doingzomb = 1;
- p = zombproc.lh_first;
+ p = LIST_FIRST(&zombproc);
goto again;
}
#endif
diff --git a/sys/miscfs/umapfs/umap_subr.c b/sys/miscfs/umapfs/umap_subr.c
index a04b132..9b9806e 100644
--- a/sys/miscfs/umapfs/umap_subr.c
+++ b/sys/miscfs/umapfs/umap_subr.c
@@ -157,7 +157,7 @@ umap_node_find(mp, targetvp)
*/
hd = UMAP_NHASH(targetvp);
loop:
- for (a = hd->lh_first; a != 0; a = a->umap_hash.le_next) {
+ LIST_FOREACH(a, hd, umap_hash) {
if (a->umap_lowervp == targetvp &&
a->umap_vnode->v_mount == mp) {
vp = UMAPTOV(a);
diff --git a/sys/miscfs/union/union_vfsops.c b/sys/miscfs/union/union_vfsops.c
index 94cba85..dfa6eae 100644
--- a/sys/miscfs/union/union_vfsops.c
+++ b/sys/miscfs/union/union_vfsops.c
@@ -337,9 +337,9 @@ union_unmount(mp, mntflags, p)
int n;
/* count #vnodes held on mount list */
- for (n = 0, vp = mp->mnt_vnodelist.lh_first;
+ for (n = 0, vp = LIST_FIRST(&mp->mnt_vnodelist);
vp != NULLVP;
- vp = vp->v_mntvnodes.le_next)
+ vp = LIST_NEXT(vp, v_mntvnodes))
n++;
/* if this is unchanged then stop */
diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c
index 652e92b..449d691 100644
--- a/sys/msdosfs/msdosfs_vfsops.c
+++ b/sys/msdosfs/msdosfs_vfsops.c
@@ -769,7 +769,7 @@ msdosfs_unmount(mp, mntflags, p)
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), vp->v_freelist.tqe_prev,
vp->v_mount);
printf("cleanblkhd %p, dirtyblkhd %p, numoutput %ld, type %d\n",
TAILQ_FIRST(&vp->v_cleanblkhd),
diff --git a/sys/net/bridge.c b/sys/net/bridge.c
index b86ecbe..78a96ca 100644
--- a/sys/net/bridge.c
+++ b/sys/net/bridge.c
@@ -146,7 +146,7 @@ static void
bdg_promisc_off(int clear_used)
{
struct ifnet *ifp ;
- for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link) ) {
+ TAILQ_FOREACH(ifp, &ifnet, if_link) {
if ( (ifp2sc[ifp->if_index].flags & IFF_BDG_PROMISC) ) {
int s, ret ;
s = splimp();
@@ -173,7 +173,7 @@ bdg_promisc_on()
struct ifnet *ifp ;
int s ;
- for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link) ) {
+ TAILQ_FOREACH(ifp, &ifnet, if_link) {
if ( !BDG_USED(ifp) )
continue ;
if ( 0 == ( ifp->if_flags & IFF_UP) ) {
diff --git a/sys/net/if.c b/sys/net/if.c
index 5ca3ed7..d0be0de 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -110,7 +110,7 @@ ifinit(dummy)
int s;
s = splimp();
- for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link)) {
+ TAILQ_FOREACH(ifp, &ifnet, if_link) {
if (ifp->if_snd.ifq_maxlen == 0) {
printf("%s%d XXX: driver didn't set ifq_maxlen\n",
ifp->if_name, ifp->if_unit);
@@ -357,7 +357,7 @@ ifa_ifwithaddr(addr)
#define equal(a1, a2) \
(bcmp((caddr_t)(a1), (caddr_t)(a2), ((struct sockaddr *)(a1))->sa_len) == 0)
- for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link))
+ TAILQ_FOREACH(ifp, &ifnet, if_link)
for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa;
ifa = TAILQ_NEXT(ifa, ifa_link)) {
if (ifa->ifa_addr->sa_family != addr->sa_family)
@@ -383,7 +383,7 @@ ifa_ifwithdstaddr(addr)
register struct ifnet *ifp;
register struct ifaddr *ifa;
- for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link))
+ 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)) {
@@ -423,7 +423,7 @@ ifa_ifwithnet(addr)
* Scan though each interface, looking for ones that have
* addresses in this address family.
*/
- for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link)) {
+ TAILQ_FOREACH(ifp, &ifnet, if_link) {
for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa;
ifa = TAILQ_NEXT(ifa, ifa_link)) {
register char *cp, *cp2, *cp3;
@@ -671,7 +671,7 @@ if_slowtimo(arg)
register struct ifnet *ifp;
int s = splimp();
- for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link)) {
+ TAILQ_FOREACH(ifp, &ifnet, if_link) {
if (ifp->if_timer == 0 || --ifp->if_timer)
continue;
if (ifp->if_watchdog)
@@ -719,7 +719,7 @@ ifunit(char *name)
/*
* Now search all the interfaces for this name/number
*/
- for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link)) {
+ TAILQ_FOREACH(ifp, &ifnet, if_link) {
if (strcmp(ifp->if_name, namebuf))
continue;
if (unit == ifp->if_unit)
diff --git a/sys/net/if_ef.c b/sys/net/if_ef.c
index 17b4a40..11d3950 100644
--- a/sys/net/if_ef.c
+++ b/sys/net/if_ef.c
@@ -518,7 +518,7 @@ ef_load(void)
struct ef_link *efl = NULL;
int error = 0, d;
- for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link)) {
+ TAILQ_FOREACH(ifp, &ifnet, if_link) {
if (ifp->if_type != IFT_ETHER) continue;
EFDEBUG("Found interface %s%d\n", ifp->if_name, ifp->if_unit);
efl = (struct ef_link*)malloc(sizeof(struct ef_link),
diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c
index ccffc9b..bc7136d 100644
--- a/sys/net/if_fddisubr.c
+++ b/sys/net/if_fddisubr.c
@@ -537,7 +537,7 @@ fddi_ifattach(ifp)
bcopy(((struct arpcom *)ifp)->ac_enaddr, LLADDR(sdl), ifp->if_addrlen);
#elif defined(__NetBSD__)
LIST_INIT(&((struct arpcom *)ifp)->ac_multiaddrs);
- for (ifa = TAILQ_FIRST(&ifp->if_addrlist); ifa != NULL; ifa = TAILQ_NEXT(ifa, ifa_list))
+ TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list)
#else
for (ifa = ifp->if_addrlist; ifa != NULL; ifa = ifa->ifa_next)
#endif
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 93f072a..2656c7cf 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -135,8 +135,7 @@ vlan_setmulti(struct ifnet *ifp)
}
/* Now program new ones. */
- 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;
mc = malloc(sizeof(struct vlan_mc_entry), M_DEVBUF, M_NOWAIT);
diff --git a/sys/net/pfil.c b/sys/net/pfil.c
index d4f066c..02d9656 100644
--- a/sys/net/pfil.c
+++ b/sys/net/pfil.c
@@ -150,7 +150,7 @@ pfil_list_remove(list, func)
{
struct packet_filter_hook *pfh;
- for (pfh = list->tqh_first; pfh; pfh = TAILQ_NEXT(pfh, pfil_link))
+ TAILQ_FOREACH(pfh, list, pfil_link)
if (pfh->pfil_func == func) {
TAILQ_REMOVE(list, pfh, pfil_link);
free(pfh, M_IFADDR);
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 0000c90..2dba7d9 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -893,7 +893,7 @@ sysctl_iflist(af, w)
int len, error = 0;
bzero((caddr_t)&info, sizeof(info));
- for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link)) {
+ TAILQ_FOREACH(ifp, &ifnet, if_link) {
if (w->w_arg && w->w_arg != ifp->if_index)
continue;
ifa = TAILQ_FIRST(&ifp->if_addrhead);
diff --git a/sys/netatalk/aarp.c b/sys/netatalk/aarp.c
index 0493870..e75d30a 100644
--- a/sys/netatalk/aarp.c
+++ b/sys/netatalk/aarp.c
@@ -330,7 +330,7 @@ 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;
+ for (aa = (struct at_ifaddr *)TAILQ_FIRST(&ac->ac_if.if_addrhead); aa;
aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) {
if ( AA_SAT( aa )->sat_family == AF_APPLETALK &&
( aa->aa_flags & AFA_PHASE2 ) == 0 ) {
@@ -526,7 +526,7 @@ 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;
+ for (aa = (struct at_ifaddr *)TAILQ_FIRST(&ac->ac_if.if_addrhead); aa;
aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) {
if ( AA_SAT( aa )->sat_family == AF_APPLETALK &&
( aa->aa_flags & AFA_PROBING )) {
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index 94d0c11..7044845 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -136,13 +136,13 @@ arptimer(ignored_arg)
void *ignored_arg;
{
int s = splnet();
- register struct llinfo_arp *la = llinfo_arp.lh_first;
+ register struct llinfo_arp *la = LIST_FIRST(&llinfo_arp);
struct llinfo_arp *ola;
timeout(arptimer, (caddr_t)0, arpt_prune * hz);
while ((ola = la) != 0) {
register struct rtentry *rt = la->la_rt;
- la = la->la_le.le_next;
+ la = LIST_NEXT(la, la_le);
if (rt->rt_expire && rt->rt_expire <= time_second)
arptfree(ola); /* timer has expired, clear */
}
@@ -523,7 +523,7 @@ in_arpinput(m)
op = ntohs(ea->arp_op);
(void)memcpy(&isaddr, ea->arp_spa, sizeof (isaddr));
(void)memcpy(&itaddr, ea->arp_tpa, sizeof (itaddr));
- for (ia = in_ifaddrhead.tqh_first; ia; ia = ia->ia_link.tqe_next)
+ TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link)
#ifdef BRIDGE
/*
* For a bridge, we want to check the address irrespective
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index f8d591e..f7d575b 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -87,13 +87,13 @@ in_localaddr(in)
register struct in_ifaddr *ia;
if (subnetsarelocal) {
- for (ia = in_ifaddrhead.tqh_first; ia;
- ia = ia->ia_link.tqe_next)
+ for (ia = TAILQ_FIRST(&in_ifaddrhead); ia;
+ ia = TAILQ_NEXT(ia, ia_link))
if ((i & ia->ia_netmask) == ia->ia_net)
return (1);
} else {
- for (ia = in_ifaddrhead.tqh_first; ia;
- ia = ia->ia_link.tqe_next)
+ for (ia = TAILQ_FIRST(&in_ifaddrhead); ia;
+ ia = TAILQ_NEXT(ia, ia_link))
if ((i & ia->ia_subnetmask) == ia->ia_subnet)
return (1);
}
@@ -236,8 +236,8 @@ in_control(so, cmd, data, ifp, p)
* the first one on the interface.
*/
if (ifp)
- for (iap = in_ifaddrhead.tqh_first; iap;
- iap = iap->ia_link.tqe_next)
+ for (iap = TAILQ_FIRST(&in_ifaddrhead); iap;
+ iap = TAILQ_NEXT(iap, ia_link))
if (iap->ia_ifp == ifp) {
if (((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr.s_addr ==
iap->ia_addr.sin_addr.s_addr) {
@@ -257,7 +257,7 @@ in_control(so, cmd, data, ifp, p)
if (ifp == 0)
return (EADDRNOTAVAIL);
if (ifra->ifra_addr.sin_family == AF_INET) {
- for (oia = ia; ia; ia = ia->ia_link.tqe_next) {
+ for (oia = ia; ia; ia = TAILQ_NEXT(ia, ia_link)) {
if (ia->ia_ifp == ifp &&
ia->ia_addr.sin_addr.s_addr ==
ifra->ifra_addr.sin_addr.s_addr)
@@ -742,8 +742,8 @@ in_broadcast(in, ifp)
* with a broadcast address.
*/
#define ia ((struct in_ifaddr *)ifa)
- for (ifa = ifp->if_addrhead.tqh_first; ifa;
- ifa = ifa->ifa_link.tqe_next)
+ for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa;
+ ifa = TAILQ_NEXT(ifa, ifa_link))
if (ifa->ifa_addr->sa_family == AF_INET &&
(in.s_addr == ia->ia_broadaddr.sin_addr.s_addr ||
in.s_addr == ia->ia_netbroadcast.s_addr ||
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 5e3383be..6db09f6 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -394,10 +394,10 @@ in_pcbladdr(inp, nam, plocal_sin)
#define sintosa(sin) ((struct sockaddr *)(sin))
#define ifatoia(ifa) ((struct in_ifaddr *)(ifa))
if (sin->sin_addr.s_addr == INADDR_ANY)
- sin->sin_addr = IA_SIN(in_ifaddrhead.tqh_first)->sin_addr;
+ sin->sin_addr = IA_SIN(TAILQ_FIRST(&in_ifaddrhead))->sin_addr;
else if (sin->sin_addr.s_addr == (u_long)INADDR_BROADCAST &&
- (in_ifaddrhead.tqh_first->ia_ifp->if_flags & IFF_BROADCAST))
- sin->sin_addr = satosin(&in_ifaddrhead.tqh_first->ia_broadaddr)->sin_addr;
+ (TAILQ_FIRST(&in_ifaddrhead)->ia_ifp->if_flags & IFF_BROADCAST))
+ sin->sin_addr = satosin(&TAILQ_FIRST(&in_ifaddrhead)->ia_broadaddr)->sin_addr;
}
if (inp->inp_laddr.s_addr == INADDR_ANY) {
register struct route *ro;
@@ -442,7 +442,7 @@ in_pcbladdr(inp, nam, plocal_sin)
ia = ifatoia(ifa_ifwithnet(sintosa(sin)));
sin->sin_port = fport;
if (ia == 0)
- ia = in_ifaddrhead.tqh_first;
+ ia = TAILQ_FIRST(&in_ifaddrhead);
if (ia == 0)
return (EADDRNOTAVAIL);
}
@@ -459,8 +459,8 @@ in_pcbladdr(inp, nam, plocal_sin)
imo = inp->inp_moptions;
if (imo->imo_multicast_ifp != NULL) {
ifp = imo->imo_multicast_ifp;
- for (ia = in_ifaddrhead.tqh_first; ia;
- ia = ia->ia_link.tqe_next)
+ for (ia = TAILQ_FIRST(&in_ifaddrhead); ia;
+ ia = TAILQ_NEXT(ia, ia_link))
if (ia->ia_ifp == ifp)
break;
if (ia == 0)
@@ -709,7 +709,7 @@ in_pcbnotify(head, dst, fport_arg, laddr, lport_arg, cmd, notify, tcp_sequence,
}
errno = inetctlerrmap[cmd];
s = splnet();
- for (inp = head->lh_first; inp != NULL;) {
+ for (inp = LIST_FIRST(head); inp != NULL;) {
#ifdef INET6
if ((inp->inp_vflag & INP_IPV4) == 0) {
inp = LIST_NEXT(inp, inp_list);
@@ -721,7 +721,7 @@ in_pcbnotify(head, dst, fport_arg, laddr, lport_arg, cmd, notify, tcp_sequence,
(lport && inp->inp_lport != lport) ||
(laddr.s_addr && inp->inp_laddr.s_addr != laddr.s_addr) ||
(fport && inp->inp_fport != fport)) {
- inp = inp->inp_list.le_next;
+ inp = LIST_NEXT(inp, inp_list);
continue;
}
/*
@@ -734,11 +734,11 @@ in_pcbnotify(head, dst, fport_arg, laddr, lport_arg, cmd, notify, tcp_sequence,
* and TCP port numbers.
*/
if ((tcp_seq_check == 1) && (tcp_seq_vs_sess(inp, tcp_sequence) == 0)) {
- inp = inp->inp_list.le_next;
+ inp = LIST_NEXT(inp, inp_list);
break;
}
oinp = inp;
- inp = inp->inp_list.le_next;
+ inp = LIST_NEXT(inp, inp_list);
if (notify)
(*notify)(oinp, errno);
}
@@ -819,7 +819,7 @@ in_pcblookup_local(pcbinfo, laddr, lport_arg, wild_okay)
* matches the local address and port we're looking for.
*/
head = &pcbinfo->hashbase[INP_PCBHASH(INADDR_ANY, lport, 0, pcbinfo->hashmask)];
- for (inp = head->lh_first; inp != NULL; inp = inp->inp_hash.le_next) {
+ LIST_FOREACH(inp, head, inp_hash) {
#ifdef INET6
if ((inp->inp_vflag & INP_IPV4) == 0)
continue;
@@ -849,7 +849,7 @@ in_pcblookup_local(pcbinfo, laddr, lport_arg, wild_okay)
*/
porthash = &pcbinfo->porthashbase[INP_PCBPORTHASH(lport,
pcbinfo->porthashmask)];
- for (phd = porthash->lh_first; phd != NULL; phd = phd->phd_hash.le_next) {
+ LIST_FOREACH(phd, porthash, phd_hash) {
if (phd->phd_port == lport)
break;
}
@@ -858,8 +858,8 @@ in_pcblookup_local(pcbinfo, laddr, lport_arg, wild_okay)
* Port is in use by one or more PCBs. Look for best
* fit.
*/
- for (inp = phd->phd_pcblist.lh_first; inp != NULL;
- inp = inp->inp_portlist.le_next) {
+ for (inp = LIST_FIRST(&phd->phd_pcblist); inp != NULL;
+ inp = LIST_NEXT(inp, inp_portlist)) {
wildcard = 0;
#ifdef INET6
if ((inp->inp_vflag & INP_IPV4) == 0)
@@ -909,7 +909,7 @@ in_pcblookup_hash(pcbinfo, faddr, fport_arg, laddr, lport_arg, wildcard,
* First look for an exact match.
*/
head = &pcbinfo->hashbase[INP_PCBHASH(faddr.s_addr, lport, fport, pcbinfo->hashmask)];
- for (inp = head->lh_first; inp != NULL; inp = inp->inp_hash.le_next) {
+ LIST_FOREACH(inp, head, inp_hash) {
#ifdef INET6
if ((inp->inp_vflag & INP_IPV4) == 0)
continue;
@@ -931,7 +931,7 @@ in_pcblookup_hash(pcbinfo, faddr, fport_arg, laddr, lport_arg, wildcard,
#endif /* defined(INET6) */
head = &pcbinfo->hashbase[INP_PCBHASH(INADDR_ANY, lport, 0, pcbinfo->hashmask)];
- for (inp = head->lh_first; inp != NULL; inp = inp->inp_hash.le_next) {
+ LIST_FOREACH(inp, head, inp_hash) {
#ifdef INET6
if ((inp->inp_vflag & INP_IPV4) == 0)
continue;
@@ -998,7 +998,7 @@ in_pcbinshash(inp)
/*
* Go through port list and look for a head for this lport.
*/
- for (phd = pcbporthash->lh_first; phd != NULL; phd = phd->phd_hash.le_next) {
+ LIST_FOREACH(phd, pcbporthash, phd_hash) {
if (phd->phd_port == inp->inp_lport)
break;
}
@@ -1060,7 +1060,7 @@ in_pcbremlists(inp)
LIST_REMOVE(inp, inp_hash);
LIST_REMOVE(inp, inp_portlist);
- if (phd->phd_pcblist.lh_first == NULL) {
+ if (LIST_FIRST(&phd->phd_pcblist) == NULL) {
LIST_REMOVE(phd, phd_hash);
free(phd, M_PCB);
}
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index 04e931a..df5ec22 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -174,8 +174,7 @@ divert_packet(struct mbuf *m, int incoming, int port)
KASSERT((m->m_flags & M_PKTHDR), ("%s: !PKTHDR", __FUNCTION__));
/* Find IP address for receive interface */
- for (ifa = m->m_pkthdr.rcvif->if_addrhead.tqh_first;
- ifa != NULL; ifa = ifa->ifa_link.tqe_next) {
+ TAILQ_FOREACH(ifa, &m->m_pkthdr.rcvif->if_addrhead, ifa_link) {
if (ifa->ifa_addr == NULL)
continue;
if (ifa->ifa_addr->sa_family != AF_INET)
@@ -216,7 +215,7 @@ divert_packet(struct mbuf *m, int incoming, int port)
/* Put packet on socket queue, if any */
sa = NULL;
nport = htons((u_int16_t)port);
- for (inp = divcb.lh_first; inp != NULL; inp = inp->inp_list.le_next) {
+ LIST_FOREACH(inp, &divcb, inp_list) {
if (inp->inp_lport == nport)
sa = inp->inp_socket;
}
@@ -491,8 +490,8 @@ div_pcblist(SYSCTL_HANDLER_ARGS)
return ENOMEM;
s = splnet();
- for (inp = divcbinfo.listhead->lh_first, i = 0; inp && i < n;
- inp = inp->inp_list.le_next) {
+ for (inp = LIST_FIRST(divcbinfo.listhead), i = 0; inp && i < n;
+ inp = LIST_NEXT(inp, inp_list)) {
if (inp->inp_gencnt <= gencnt && !prison_xinpcb(req->p, inp))
inp_list[i++] = inp;
}
diff --git a/sys/netinet/ip_dummynet.c b/sys/netinet/ip_dummynet.c
index 8060437..c0d436e 100644
--- a/sys/netinet/ip_dummynet.c
+++ b/sys/netinet/ip_dummynet.c
@@ -1282,7 +1282,7 @@ dummynet_flush()
s = splimp() ;
/* remove all references to pipes ...*/
- for (chain= ip_fw_chain.lh_first ; chain; chain = chain->chain.le_next)
+ for (chain= LIST_FIRST(&ip_fw_chain) ; chain; chain = LIST_NEXT(chain, chain))
chain->rule->pipe_ptr = NULL ;
/* prevent future matches... */
p = all_pipes ;
@@ -1658,7 +1658,7 @@ delete_pipe(struct dn_pipe *p)
else
a->next = b->next ;
/* remove references to this pipe from the ip_fw rules. */
- for (chain = ip_fw_chain.lh_first ; chain; chain = chain->chain.le_next)
+ for (chain = LIST_FIRST(&ip_fw_chain) ; chain; chain = LIST_NEXT(chain, chain))
if (chain->rule->pipe_ptr == &(b->fs))
chain->rule->pipe_ptr = NULL ;
@@ -1692,7 +1692,7 @@ delete_pipe(struct dn_pipe *p)
else
a->next = b->next ;
/* remove references to this flow_set from the ip_fw rules. */
- for (chain = ip_fw_chain.lh_first; chain; chain = chain->chain.le_next)
+ LIST_FOREACH(chain, &ip_fw_chain, chain)
if (chain->rule->pipe_ptr == b)
chain->rule->pipe_ptr = NULL ;
diff --git a/sys/netinet/ip_encap.c b/sys/netinet/ip_encap.c
index 7cb8058..7d623ea 100644
--- a/sys/netinet/ip_encap.c
+++ b/sys/netinet/ip_encap.c
@@ -153,7 +153,7 @@ encap4_input(m, va_alist)
match = NULL;
matchprio = 0;
- for (ep = LIST_FIRST(&encaptab); ep; ep = LIST_NEXT(ep, chain)) {
+ LIST_FOREACH(ep, &encaptab, chain) {
if (ep->af != AF_INET)
continue;
if (ep->proto >= 0 && ep->proto != proto)
@@ -249,7 +249,7 @@ encap6_input(mp, offp, proto)
match = NULL;
matchprio = 0;
- for (ep = LIST_FIRST(&encaptab); ep; ep = LIST_NEXT(ep, chain)) {
+ LIST_FOREACH(ep, &encaptab, chain) {
if (ep->af != AF_INET6)
continue;
if (ep->proto >= 0 && ep->proto != proto)
@@ -333,7 +333,7 @@ encap_attach(af, proto, sp, sm, dp, dm, psw, arg)
}
/* check if anyone have already attached with exactly same config */
- for (ep = LIST_FIRST(&encaptab); ep; ep = LIST_NEXT(ep, chain)) {
+ LIST_FOREACH(ep, &encaptab, chain) {
if (ep->af != af)
continue;
if (ep->proto != proto)
@@ -428,7 +428,7 @@ encap_detach(cookie)
const struct encaptab *ep = cookie;
struct encaptab *p;
- for (p = LIST_FIRST(&encaptab); p; p = LIST_NEXT(p, chain)) {
+ LIST_FOREACH(p, &encaptab, chain) {
if (p == ep) {
LIST_REMOVE(p, chain);
free(p, M_NETADDR); /*XXX*/
diff --git a/sys/netinet/ip_fw.c b/sys/netinet/ip_fw.c
index 1aefb7a..19dfb74 100644
--- a/sys/netinet/ip_fw.c
+++ b/sys/netinet/ip_fw.c
@@ -473,8 +473,7 @@ iface_match(struct ifnet *ifp, union ip_fw_if *ifu, int byname)
} else if (ifu->fu_via_ip.s_addr != 0) { /* Zero == wildcard */
struct ifaddr *ia;
- for (ia = ifp->if_addrhead.tqh_first;
- ia != NULL; ia = ia->ifa_link.tqe_next) {
+ TAILQ_FOREACH(ia, &ifp->if_addrhead, ifa_link) {
if (ia->ifa_addr == NULL)
continue;
if (ia->ifa_addr->sa_family != AF_INET)
@@ -904,10 +903,10 @@ lookup_next_rule(struct ip_fw_chain *me)
int rule = me->rule->fw_skipto_rule ; /* guess... */
if ( (me->rule->fw_flg & IP_FW_F_COMMAND) == IP_FW_F_SKIPTO )
- for (chain = me->chain.le_next; chain ; chain = chain->chain.le_next )
+ for (chain = LIST_NEXT(me, chain); chain ; chain = LIST_NEXT(chain, chain) )
if (chain->rule->fw_number >= rule)
return chain ;
- return me->chain.le_next ; /* failure or not a skipto */
+ return LIST_NEXT(me, chain) ; /* failure or not a skipto */
}
/*
@@ -1462,7 +1461,7 @@ flush_rule_ptrs()
{
struct ip_fw_chain *fcp ;
- for (fcp = ip_fw_chain.lh_first; fcp; fcp = fcp->chain.le_next) {
+ LIST_FOREACH(fcp, &ip_fw_chain, chain) {
fcp->rule->next_rule_ptr = NULL ;
}
}
@@ -1501,7 +1500,7 @@ add_entry(struct ip_fw_head *chainptr, struct ip_fw *frwl)
s = splnet();
- if (chainptr->lh_first == 0) {
+ if (LIST_FIRST(chainptr) == 0) {
LIST_INSERT_HEAD(chainptr, fwc, chain);
splx(s);
return(0);
@@ -1509,7 +1508,7 @@ add_entry(struct ip_fw_head *chainptr, struct ip_fw *frwl)
/* If entry number is 0, find highest numbered rule and add 100 */
if (ftmp->fw_number == 0) {
- for (fcp = LIST_FIRST(chainptr); fcp; fcp = LIST_NEXT(fcp, chain)) {
+ LIST_FOREACH(fcp, chainptr, chain) {
if (fcp->rule->fw_number != (u_short)-1)
nbr = fcp->rule->fw_number;
else
@@ -1521,7 +1520,7 @@ add_entry(struct ip_fw_head *chainptr, struct ip_fw *frwl)
}
/* Got a valid number; now insert it, keeping the list ordered */
- for (fcp = LIST_FIRST(chainptr); fcp; fcp = LIST_NEXT(fcp, chain)) {
+ LIST_FOREACH(fcp, chainptr, chain) {
if (fcp->rule->fw_number > ftmp->fw_number) {
if (fcpl) {
LIST_INSERT_AFTER(fcpl, fwc, chain);
@@ -1583,7 +1582,7 @@ zero_entry(struct ip_fw *frwl)
if (frwl == 0) {
s = splnet();
- for (fcp = LIST_FIRST(&ip_fw_chain); fcp; fcp = LIST_NEXT(fcp, chain)) {
+ LIST_FOREACH(fcp, &ip_fw_chain, chain) {
fcp->rule->fw_bcnt = fcp->rule->fw_pcnt = 0;
fcp->rule->fw_loghighest = fcp->rule->fw_logamount;
fcp->rule->timestamp = 0;
@@ -1598,7 +1597,7 @@ zero_entry(struct ip_fw *frwl)
* same number, so we don't stop after finding the first
* match if zeroing a specific entry.
*/
- for (fcp = LIST_FIRST(&ip_fw_chain); fcp; fcp = LIST_NEXT(fcp, chain))
+ LIST_FOREACH(fcp, &ip_fw_chain, chain)
if (frwl->fw_number == fcp->rule->fw_number) {
s = splnet();
while (fcp && frwl->fw_number == fcp->rule->fw_number) {
@@ -1637,7 +1636,7 @@ resetlog_entry(struct ip_fw *frwl)
if (frwl == 0) {
s = splnet();
counter = 0;
- for (fcp = LIST_FIRST(&ip_fw_chain); fcp; fcp = LIST_NEXT(fcp, chain))
+ LIST_FOREACH(fcp, &ip_fw_chain, chain)
fcp->rule->fw_loghighest = fcp->rule->fw_pcnt +
fcp->rule->fw_logamount;
splx(s);
@@ -1650,7 +1649,7 @@ resetlog_entry(struct ip_fw *frwl)
* same number, so we don't stop after finding the first
* match if zeroing a specific entry.
*/
- for (fcp = LIST_FIRST(&ip_fw_chain); fcp; fcp = LIST_NEXT(fcp, chain))
+ LIST_FOREACH(fcp, &ip_fw_chain, chain)
if (frwl->fw_number == fcp->rule->fw_number) {
s = splnet();
while (fcp && frwl->fw_number == fcp->rule->fw_number) {
@@ -1889,9 +1888,9 @@ ip_fw_ctl(struct sockopt *sopt)
s = splnet();
remove_dyn_rule(NULL, 1 /* force delete */);
splx(s);
- for (fcp = ip_fw_chain.lh_first;
+ for (fcp = LIST_FIRST(&ip_fw_chain);
fcp != 0 && fcp->rule->fw_number != IPFW_DEFAULT_RULE;
- fcp = ip_fw_chain.lh_first) {
+ fcp = LIST_FIRST(&ip_fw_chain)) {
s = splnet();
LIST_REMOVE(fcp, chain);
#ifdef DUMMYNET
@@ -1987,7 +1986,7 @@ ip_fw_init(void)
add_entry(&ip_fw_chain, &default_rule))
panic("ip_fw_init");
- ip_fw_default_rule = ip_fw_chain.lh_first ;
+ ip_fw_default_rule = LIST_FIRST(&ip_fw_chain) ;
printf("IP packet filtering initialized, "
#ifdef IPDIVERT
"divert enabled, "
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index d1694bf..98758ca 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -631,7 +631,7 @@ icmp_reflect(m)
* or anonymous), use the address which corresponds
* to the incoming interface.
*/
- for (ia = in_ifaddrhead.tqh_first; ia; ia = ia->ia_link.tqe_next) {
+ TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) {
if (t.s_addr == IA_SIN(ia)->sin_addr.s_addr)
break;
if (ia->ia_ifp && (ia->ia_ifp->if_flags & IFF_BROADCAST) &&
@@ -647,7 +647,7 @@ icmp_reflect(m)
* and was received on an interface with no IP address.
*/
if (ia == (struct in_ifaddr *)0)
- ia = in_ifaddrhead.tqh_first;
+ ia = TAILQ_FIRST(&in_ifaddrhead);
t = IA_SIN(ia)->sin_addr;
ip->ip_src = t;
ip->ip_ttl = MAXTTL;
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index c73db86..7552234 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -391,7 +391,7 @@ iphack:
*/
m0 = m;
pfh = pfil_hook_get(PFIL_IN, &inetsw[ip_protox[IPPROTO_IP]].pr_pfh);
- for (; pfh; pfh = pfh->pfil_link.tqe_next)
+ for (; pfh; pfh = TAILQ_NEXT(pfh, pfil_link))
if (pfh->pfil_func) {
rv = pfh->pfil_func(ip, hlen,
m->m_pkthdr.rcvif, 0, &m0);
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 1b19fd7..00147da 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -314,8 +314,8 @@ ip_output(m0, opt, ro, flags, imo)
if (ip->ip_src.s_addr == INADDR_ANY) {
register struct in_ifaddr *ia1;
- for (ia1 = in_ifaddrhead.tqh_first; ia1;
- ia1 = ia1->ia_link.tqe_next)
+ for (ia1 = TAILQ_FIRST(&in_ifaddrhead); ia1;
+ ia1 = TAILQ_NEXT(ia1, ia_link))
if (ia1->ia_ifp == ifp) {
ip->ip_src = IA_SIN(ia1)->sin_addr;
break;
@@ -441,7 +441,7 @@ sendit:
*/
m1 = m;
pfh = pfil_hook_get(PFIL_OUT, &inetsw[ip_protox[IPPROTO_IP]].pr_pfh);
- for (; pfh; pfh = pfh->pfil_link.tqe_next)
+ for (; pfh; pfh = TAILQ_NEXT(pfh, pfil_link))
if (pfh->pfil_func) {
rv = pfh->pfil_func(ip, hlen, ifp, 1, &m1);
if (rv) {
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 0342d39..a6e850f 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -385,8 +385,8 @@ rip_ctlinput(cmd, sa, vip)
switch (cmd) {
case PRC_IFDOWN:
- for (ia = in_ifaddrhead.tqh_first; ia;
- ia = ia->ia_link.tqe_next) {
+ for (ia = TAILQ_FIRST(&in_ifaddrhead); ia;
+ ia = TAILQ_NEXT(ia, ia_link)) {
if (ia->ia_ifa.ifa_addr == sa
&& (ia->ia_flags & IFA_ROUTE)) {
/*
@@ -406,8 +406,8 @@ rip_ctlinput(cmd, sa, vip)
break;
case PRC_IFUP:
- for (ia = in_ifaddrhead.tqh_first; ia;
- ia = ia->ia_link.tqe_next) {
+ for (ia = TAILQ_FIRST(&in_ifaddrhead); ia;
+ ia = TAILQ_NEXT(ia, ia_link)) {
if (ia->ia_ifa.ifa_addr == sa)
break;
}
@@ -609,8 +609,8 @@ rip_pcblist(SYSCTL_HANDLER_ARGS)
return ENOMEM;
s = splnet();
- for (inp = ripcbinfo.listhead->lh_first, i = 0; inp && i < n;
- inp = inp->inp_list.le_next) {
+ for (inp = LIST_FIRST(ripcbinfo.listhead), i = 0; inp && i < n;
+ inp = LIST_NEXT(inp, inp_list)) {
if (inp->inp_gencnt <= gencnt)
inp_list[i++] = inp;
}
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 5b1db4f..0da8440 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -749,8 +749,8 @@ tcp_drain()
* where we're really low on mbufs, this is potentially
* usefull.
*/
- for (inpb = tcbinfo.listhead->lh_first; inpb;
- inpb = inpb->inp_list.le_next) {
+ for (inpb = LIST_FIRST(tcbinfo.listhead); inpb;
+ inpb = LIST_NEXT(inpb, inp_list)) {
if ((tcpb = intotcpcb(inpb))) {
while ((te = LIST_FIRST(&tcpb->t_segq))
!= NULL) {
@@ -841,8 +841,8 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
return ENOMEM;
s = splnet();
- for (inp = tcbinfo.listhead->lh_first, i = 0; inp && i < n;
- inp = inp->inp_list.le_next) {
+ for (inp = LIST_FIRST(tcbinfo.listhead), i = 0; inp && i < n;
+ inp = LIST_NEXT(inp, inp_list)) {
if (inp->inp_gencnt <= gencnt && !prison_xinpcb(req->p, inp))
inp_list[i++] = inp;
}
diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
index 5b1db4f..0da8440 100644
--- a/sys/netinet/tcp_timewait.c
+++ b/sys/netinet/tcp_timewait.c
@@ -749,8 +749,8 @@ tcp_drain()
* where we're really low on mbufs, this is potentially
* usefull.
*/
- for (inpb = tcbinfo.listhead->lh_first; inpb;
- inpb = inpb->inp_list.le_next) {
+ for (inpb = LIST_FIRST(tcbinfo.listhead); inpb;
+ inpb = LIST_NEXT(inpb, inp_list)) {
if ((tcpb = intotcpcb(inpb))) {
while ((te = LIST_FIRST(&tcpb->t_segq))
!= NULL) {
@@ -841,8 +841,8 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
return ENOMEM;
s = splnet();
- for (inp = tcbinfo.listhead->lh_first, i = 0; inp && i < n;
- inp = inp->inp_list.le_next) {
+ for (inp = LIST_FIRST(tcbinfo.listhead), i = 0; inp && i < n;
+ inp = LIST_NEXT(inp, inp_list)) {
if (inp->inp_gencnt <= gencnt && !prison_xinpcb(req->p, inp))
inp_list[i++] = inp;
}
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 5ddcecc..5c92f62 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -560,8 +560,8 @@ udp_pcblist(SYSCTL_HANDLER_ARGS)
return ENOMEM;
s = splnet();
- for (inp = udbinfo.listhead->lh_first, i = 0; inp && i < n;
- inp = inp->inp_list.le_next) {
+ for (inp = LIST_FIRST(udbinfo.listhead), i = 0; inp && i < n;
+ inp = LIST_NEXT(inp, inp_list)) {
if (inp->inp_gencnt <= gencnt && !prison_xinpcb(req->p, inp))
inp_list[i++] = inp;
}
diff --git a/sys/netipx/ipx_input.c b/sys/netipx/ipx_input.c
index dc4a1a3..840935a 100644
--- a/sys/netipx/ipx_input.c
+++ b/sys/netipx/ipx_input.c
@@ -498,8 +498,8 @@ struct ifnet *ifp;
ia->ia_addr.sipx_addr.x_host;
if (ifp != NULL && (ifp->if_flags & IFF_POINTOPOINT))
- for(ifa = ifp->if_addrhead.tqh_first; ifa != NULL;
- ifa = ifa->ifa_link.tqe_next) {
+ for(ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa != NULL;
+ ifa = TAILQ_NEXT(ifa, ifa_link)) {
if (ifa->ifa_addr->sa_family == AF_IPX) {
ipx->ipx_sna = IA_SIPX(ifa)->sipx_addr;
break;
diff --git a/sys/netipx/ipx_ip.c b/sys/netipx/ipx_ip.c
index 042d276..d4c9693 100644
--- a/sys/netipx/ipx_ip.c
+++ b/sys/netipx/ipx_ip.c
@@ -348,12 +348,12 @@ ipxip_route(so, sopt)
register struct in_ifaddr *ia;
struct ifnet *ifp = ro.ro_rt->rt_ifp;
- for (ia = in_ifaddrhead.tqh_first; ia != NULL;
- ia = ia->ia_link.tqe_next)
+ for (ia = TAILQ_FIRST(&in_ifaddrhead); ia != NULL;
+ ia = TAILQ_NEXT(ia, ia_link))
if (ia->ia_ifp == ifp)
break;
if (ia == NULL)
- ia = in_ifaddrhead.tqh_first;
+ ia = TAILQ_FIRST(&in_ifaddrhead);
if (ia == NULL) {
RTFREE(ro.ro_rt);
return (EADDRNOTAVAIL);
diff --git a/sys/netipx/ipx_usrreq.c b/sys/netipx/ipx_usrreq.c
index 22b2e2f..4939568 100644
--- a/sys/netipx/ipx_usrreq.c
+++ b/sys/netipx/ipx_usrreq.c
@@ -125,8 +125,8 @@ ipx_input(m, ipxp)
if (ipx_neteqnn(ipx->ipx_sna.x_net, ipx_zeronet) && ifp != NULL) {
register struct ifaddr *ifa;
- for (ifa = ifp->if_addrhead.tqh_first; ifa != NULL;
- ifa = ifa->ifa_link.tqe_next) {
+ for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa != NULL;
+ ifa = TAILQ_NEXT(ifa, ifa_link)) {
if (ifa->ifa_addr->sa_family == AF_IPX) {
ipx_ipx.sipx_addr.x_net =
IA_SIPX(ifa)->sipx_addr.x_net;
diff --git a/sys/netnatm/natm_pcb.c b/sys/netnatm/natm_pcb.c
index 46bcb7c..ccb253a 100644
--- a/sys/netnatm/natm_pcb.c
+++ b/sys/netnatm/natm_pcb.c
@@ -125,8 +125,8 @@ u_int8_t vpi;
* lookup required
*/
- for (cpcb = natm_pcbs.lh_first ; cpcb != NULL ;
- cpcb = cpcb->pcblist.le_next) {
+ for (cpcb = LIST_FIRST(&natm_pcbs) ; cpcb != NULL ;
+ cpcb = LIST_NEXT(cpcb, pcblist)) {
if (ifp == cpcb->npcb_ifp && vci == cpcb->npcb_vci && vpi == cpcb->npcb_vpi)
break;
}
@@ -177,8 +177,8 @@ int npcb_dump()
struct natmpcb *cpcb;
printf("npcb dump:\n");
- for (cpcb = natm_pcbs.lh_first ; cpcb != NULL ;
- cpcb = cpcb->pcblist.le_next) {
+ for (cpcb = LIST_FIRST(&natm_pcbs) ; cpcb != NULL ;
+ cpcb = LIST_NEXT(cpcb, pcblist)) {
printf("if=%s, vci=%d, vpi=%d, IP=0x%x, sock=%p, flags=0x%x, inq=%d\n",
cpcb->npcb_ifp->if_xname, cpcb->npcb_vci, cpcb->npcb_vpi,
cpcb->ipaddr.s_addr, cpcb->npcb_socket,
diff --git a/sys/netncp/ncp_conn.c b/sys/netncp/ncp_conn.c
index e62b147..f020731 100644
--- a/sys/netncp/ncp_conn.c
+++ b/sys/netncp/ncp_conn.c
@@ -470,8 +470,8 @@ ncp_conn_putprochandles(struct proc *p) {
int haveone = 0;
lockmgr(&lhlock, LK_EXCLUSIVE, 0, p);
- for (hp = lhlist.slh_first; hp; hp = nhp) {
- nhp = hp->nh_next.sle_next;
+ for (hp = SLIST_FIRST(&lhlist); hp; hp = nhp) {
+ nhp = SLIST_NEXT(hp, nh_next);
if (hp->nh_proc != p) continue;
haveone = 1;
hp->nh_conn->ref_cnt -= hp->nh_ref;
diff --git a/sys/netncp/ncp_subr.c b/sys/netncp/ncp_subr.c
index 4601690..00c8503 100644
--- a/sys/netncp/ncp_subr.c
+++ b/sys/netncp/ncp_subr.c
@@ -82,8 +82,8 @@ ncp_at_exit(struct proc *p) {
if (ncp_conn_putprochandles(p) == 0) return;
ncp_conn_locklist(LK_EXCLUSIVE, p);
- for (ncp = conn_list.slh_first; ncp; ncp = nncp) {
- nncp = ncp->nc_next.sle_next;
+ for (ncp = SLIST_FIRST(&conn_list); ncp; ncp = nncp) {
+ nncp = SLIST_NEXT(ncp, nc_next);
if (ncp->ref_cnt != 0) continue;
if (ncp_conn_lock(ncp, p, p->p_ucred,NCPM_READ|NCPM_EXECUTE|NCPM_WRITE))
continue;
@@ -113,8 +113,8 @@ ncp_done(void) {
untimeout(ncp_timer,NULL,ncp_timer_handle);
rm_at_exit(ncp_at_exit);
ncp_conn_locklist(LK_EXCLUSIVE, p);
- for (ncp = conn_list.slh_first; ncp; ncp = nncp) {
- nncp = ncp->nc_next.sle_next;
+ for (ncp = SLIST_FIRST(&conn_list); ncp; ncp = nncp) {
+ nncp = SLIST_NEXT(ncp, nc_next);
ncp->ref_cnt = 0;
if (ncp_conn_lock(ncp, p, p->p_ucred,NCPM_READ|NCPM_EXECUTE|NCPM_WRITE)) {
NCPFATAL("Can't lock connection !\n");
diff --git a/sys/ntfs/ntfs_subr.c b/sys/ntfs/ntfs_subr.c
index d9b38d4..38324f2 100644
--- a/sys/ntfs/ntfs_subr.c
+++ b/sys/ntfs/ntfs_subr.c
@@ -123,7 +123,7 @@ ntfs_findvattr(ntmp, ip, lvapp, vapp, type, name, namelen, vcn)
*lvapp = NULL;
*vapp = NULL;
- for (vap = ip->i_valist.lh_first; vap; vap = vap->va_list.le_next) {
+ LIST_FOREACH(vap, &ip->i_valist, va_list) {
ddprintf(("ntfs_findvattr: type: 0x%x, vcn: %d - %d\n", \
vap->va_type, (u_int32_t) vap->va_vcnstart, \
(u_int32_t) vap->va_vcnend));
@@ -452,13 +452,13 @@ ntfs_ntput(ip)
dprintf(("ntfs_ntput: deallocating ntnode: %d\n",
ip->i_number));
- if (ip->i_fnlist.lh_first)
+ if (LIST_FIRST(&ip->i_fnlist))
panic("ntfs_ntput: ntnode has fnodes\n");
ntfs_nthashrem(ip);
- while (ip->i_valist.lh_first != NULL) {
- vap = ip->i_valist.lh_first;
+ while (LIST_FIRST(&ip->i_valist) != NULL) {
+ vap = LIST_FIRST(&ip->i_valist);
LIST_REMOVE(vap,va_list);
ntfs_freentvattr(vap);
}
@@ -719,7 +719,7 @@ ntfs_fget(
dprintf(("ntfs_fget: ino: %d, attrtype: 0x%x, attrname: %s\n",
ip->i_number,attrtype, attrname?attrname:""));
*fpp = NULL;
- for (fp = ip->i_fnlist.lh_first; fp != NULL; fp = fp->f_fnlist.le_next){
+ LIST_FOREACH(fp, &ip->i_fnlist, f_fnlist){
dprintf(("ntfs_fget: fnode: attrtype: %d, attrname: %s\n",
fp->f_attrtype, fp->f_attrname?fp->f_attrname:""));
diff --git a/sys/nwfs/nwfs_node.c b/sys/nwfs/nwfs_node.c
index 885ebac..02a4ee3 100644
--- a/sys/nwfs/nwfs_node.c
+++ b/sys/nwfs/nwfs_node.c
@@ -99,7 +99,7 @@ nwfs_sysctl_vnprint(SYSCTL_HANDLER_ARGS) {
printf("Name:uc:hc:fid:pfid\n");
for(i = 0; i <= nwnodehash; i++) {
nhpp = &nwhashtbl[i];
- for (np = nhpp->lh_first; np != 0; np = np->n_hash.le_next) {
+ LIST_FOREACH(np, nhpp, n_hash) {
vp = NWTOV(np);
vprint(NULL, vp);
printf("%s:%d:%d:%d:%d\n",np->n_name,vp->v_usecount,vp->v_holdcnt,
diff --git a/sys/nwfs/nwfs_vfsops.c b/sys/nwfs/nwfs_vfsops.c
index c0f0844..3e76b30 100644
--- a/sys/nwfs/nwfs_vfsops.c
+++ b/sys/nwfs/nwfs_vfsops.c
@@ -498,9 +498,9 @@ nwfs_sync(mp, waitfor, cred, p)
* Force stale buffer cache information to be flushed.
*/
loop:
- for (vp = mp->mnt_vnodelist.lh_first;
+ for (vp = LIST_FIRST(&mp->mnt_vnodelist);
vp != NULL;
- vp = vp->v_mntvnodes.le_next) {
+ vp = LIST_NEXT(vp, v_mntvnodes)) {
/*
* If the vnode that we are about to sync is no longer
* associated with this mount point, start over.
diff --git a/sys/pci/if_de.c b/sys/pci/if_de.c
index 108518e..b756bae 100644
--- a/sys/pci/if_de.c
+++ b/sys/pci/if_de.c
@@ -3012,8 +3012,8 @@ tulip_addr_filter(
#endif
multicnt = 0;
- for (ifma = sc->tulip_if.if_multiaddrs.lh_first; ifma != NULL;
- ifma = ifma->ifma_link.le_next) {
+ for (ifma = LIST_FIRST(&sc->tulip_if.if_multiaddrs); ifma != NULL;
+ ifma = LIST_NEXT(ifma, ifma_link)) {
if (ifma->ifma_addr->sa_family == AF_LINK)
multicnt++;
@@ -3041,8 +3041,8 @@ tulip_addr_filter(
*/
bzero(sc->tulip_setupdata, sizeof(sc->tulip_setupdata));
- for (ifma = sc->tulip_if.if_multiaddrs.lh_first; ifma != NULL;
- ifma = ifma->ifma_link.le_next) {
+ for (ifma = LIST_FIRST(&sc->tulip_if.if_multiaddrs); ifma != NULL;
+ ifma = LIST_NEXT(ifma, ifma_link)) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
@@ -3092,8 +3092,8 @@ tulip_addr_filter(
/*
* Else can get perfect filtering for 16 addresses.
*/
- for (ifma = sc->tulip_if.if_multiaddrs.lh_first; ifma != NULL;
- ifma = ifma->ifma_link.le_next) {
+ for (ifma = LIST_FIRST(&sc->tulip_if.if_multiaddrs); ifma != NULL;
+ ifma = LIST_NEXT(ifma, 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_sf.c b/sys/pci/if_sf.c
index ff01bf0..29f3fe3 100644
--- a/sys/pci/if_sf.c
+++ b/sys/pci/if_sf.c
@@ -450,7 +450,7 @@ static void sf_setmulti(sc)
i = 1;
/* First find the tail of the list. */
LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
- if (ifma->ifma_link.le_next == NULL)
+ if (LIST_NEXT(ifma, ifma_link) == NULL)
break;
}
/* Now traverse the list backwards. */
diff --git a/sys/pci/if_sk.c b/sys/pci/if_sk.c
index a0dc45a..a6dba79 100644
--- a/sys/pci/if_sk.c
+++ b/sys/pci/if_sk.c
@@ -559,7 +559,7 @@ static void sk_setmulti(sc_if)
i = 1;
/* First find the tail of the list. */
LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
- if (ifma->ifma_link.le_next == NULL)
+ if (LIST_NEXT(ifma, ifma_link) == NULL)
break;
}
/* Now traverse the list backwards. */
diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c
index cb28d01..1d52547 100644
--- a/sys/pci/if_ti.c
+++ b/sys/pci/if_ti.c
@@ -1073,8 +1073,8 @@ static void ti_setmulti(sc)
CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1);
/* First, zot all the existing filters. */
- while (sc->ti_mc_listhead.slh_first != NULL) {
- mc = sc->ti_mc_listhead.slh_first;
+ while (SLIST_FIRST(&sc->ti_mc_listhead) != NULL) {
+ mc = SLIST_FIRST(&sc->ti_mc_listhead);
ti_del_mcast(sc, &mc->mc_addr);
SLIST_REMOVE_HEAD(&sc->ti_mc_listhead, mc_entries);
free(mc, M_DEVBUF);
diff --git a/sys/pci/if_tl.c b/sys/pci/if_tl.c
index b4c576b..eaa3f058 100644
--- a/sys/pci/if_tl.c
+++ b/sys/pci/if_tl.c
@@ -954,7 +954,7 @@ static void tl_setmulti(sc)
i = 1;
/* First find the tail of the list. */
LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
- if (ifma->ifma_link.le_next == NULL)
+ if (LIST_NEXT(ifma, ifma_link) == NULL)
break;
}
/* Now traverse the list backwards. */
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index 0dab2f1..5507262 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -1200,7 +1200,7 @@ bmsafemap_lookup(bp)
if (lk.lkt_held == -1)
panic("bmsafemap_lookup: lock not held");
#endif
- 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_BMSAFEMAP)
return (WK_BMSAFEMAP(wk));
FREE_LOCK(&lk);
@@ -4665,7 +4665,7 @@ softdep_count_dependencies(bp, wantcount)
retval = 0;
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) {
switch (wk->wk_type) {
case D_INODEDEP:
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index cf2c1b1..fee14d7 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -455,12 +455,12 @@ ffs_reload(mp, cred, p)
loop:
mtx_enter(&mntvnode_mtx, MTX_DEF);
- for (vp = mp->mnt_vnodelist.lh_first; vp != NULL; vp = nvp) {
+ for (vp = LIST_FIRST(&mp->mnt_vnodelist); vp != NULL; vp = nvp) {
if (vp->v_mount != mp) {
mtx_exit(&mntvnode_mtx, MTX_DEF);
goto loop;
}
- nvp = vp->v_mntvnodes.le_next;
+ nvp = LIST_NEXT(vp, v_mntvnodes);
/*
* Step 4: invalidate all inactive vnodes.
*/
@@ -939,7 +939,7 @@ ffs_sync(mp, waitfor, cred, p)
}
mtx_enter(&mntvnode_mtx, MTX_DEF);
loop:
- for (vp = mp->mnt_vnodelist.lh_first; vp != NULL; vp = nvp) {
+ for (vp = LIST_FIRST(&mp->mnt_vnodelist); vp != NULL; vp = nvp) {
/*
* If the vnode that we are about to sync is no longer
* associated with this mount point, start over.
@@ -947,7 +947,7 @@ loop:
if (vp->v_mount != mp)
goto loop;
mtx_enter(&vp->v_interlock, MTX_DEF);
- nvp = vp->v_mntvnodes.le_next;
+ nvp = LIST_NEXT(vp, v_mntvnodes);
ip = VTOI(vp);
if (vp->v_type == VNON || ((ip->i_flag &
(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 &&
diff --git a/sys/ufs/ufs/ufs_extattr.c b/sys/ufs/ufs/ufs_extattr.c
index 90348e3..143c734 100644
--- a/sys/ufs/ufs/ufs_extattr.c
+++ b/sys/ufs/ufs/ufs_extattr.c
@@ -116,9 +116,9 @@ ufs_extattr_find_attr(struct ufsmount *ump, const char *attrname)
{
struct ufs_extattr_list_entry *search_attribute;
- for (search_attribute = ump->um_extattr.uepm_list.lh_first;
+ for (search_attribute = LIST_FIRST(&ump->um_extattr.uepm_list);
search_attribute;
- search_attribute = search_attribute->uele_entries.le_next) {
+ search_attribute = LIST_NEXT(search_attribute, uele_entries)) {
if (!(strncmp(attrname, search_attribute->uele_attrname,
UFS_EXTATTR_MAXEXTATTRNAME))) {
return (search_attribute);
@@ -217,8 +217,8 @@ ufs_extattr_stop(struct mount *mp, struct proc *p)
goto unlock;
}
- while (ump->um_extattr.uepm_list.lh_first != NULL) {
- uele = ump->um_extattr.uepm_list.lh_first;
+ while (LIST_FIRST(&ump->um_extattr.uepm_list) != NULL) {
+ uele = LIST_FIRST(&ump->um_extattr.uepm_list);
ufs_extattr_disable(ump, uele->uele_attrname, p);
}
@@ -888,8 +888,8 @@ ufs_extattr_vnode_inactive(struct vnode *vp, struct proc *p)
return;
}
- for (uele = ump->um_extattr.uepm_list.lh_first; uele != NULL;
- uele = uele->uele_entries.le_next)
+ for (uele = LIST_FIRST(&ump->um_extattr.uepm_list); uele != NULL;
+ uele = LIST_NEXT(uele, uele_entries))
ufs_extattr_rm(vp, uele->uele_attrname, NULL, p);
ufs_extattr_uepm_unlock(ump, p);
diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c
index 58dad6e..1b3c69a 100644
--- a/sys/ufs/ufs/ufs_quota.c
+++ b/sys/ufs/ufs/ufs_quota.c
@@ -436,8 +436,8 @@ quotaon(p, mp, type, fname)
* NB: only need to add dquot's for inodes being modified.
*/
again:
- for (vp = mp->mnt_vnodelist.lh_first; vp != NULL; vp = nextvp) {
- nextvp = vp->v_mntvnodes.le_next;
+ for (vp = LIST_FIRST(&mp->mnt_vnodelist); vp != NULL; vp = nextvp) {
+ nextvp = LIST_NEXT(vp, v_mntvnodes);
if (vp->v_type == VNON || vp->v_writecount == 0)
continue;
if (vget(vp, LK_EXCLUSIVE, p))
@@ -448,7 +448,7 @@ again:
break;
}
vput(vp);
- if (vp->v_mntvnodes.le_next != nextvp || vp->v_mount != mp)
+ if (LIST_NEXT(vp, v_mntvnodes) != nextvp || vp->v_mount != mp)
goto again;
}
ump->um_qflags[type] &= ~QTF_OPENING;
@@ -481,8 +481,8 @@ quotaoff(p, mp, type)
* deleting any references to quota file being closed.
*/
again:
- for (vp = mp->mnt_vnodelist.lh_first; vp != NULL; vp = nextvp) {
- nextvp = vp->v_mntvnodes.le_next;
+ for (vp = LIST_FIRST(&mp->mnt_vnodelist); vp != NULL; vp = nextvp) {
+ nextvp = LIST_NEXT(vp, v_mntvnodes);
if (vp->v_type == VNON)
continue;
if (vget(vp, LK_EXCLUSIVE, p))
@@ -492,7 +492,7 @@ again:
ip->i_dquot[type] = NODQUOT;
dqrele(vp, dq);
vput(vp);
- if (vp->v_mntvnodes.le_next != nextvp || vp->v_mount != mp)
+ if (LIST_NEXT(vp, v_mntvnodes) != nextvp || vp->v_mount != mp)
goto again;
}
dqflush(qvp);
@@ -668,10 +668,10 @@ qsync(mp)
*/
mtx_enter(&mntvnode_mtx, MTX_DEF);
again:
- for (vp = mp->mnt_vnodelist.lh_first; vp != NULL; vp = nextvp) {
+ for (vp = LIST_FIRST(&mp->mnt_vnodelist); vp != NULL; vp = nextvp) {
if (vp->v_mount != mp)
goto again;
- nextvp = vp->v_mntvnodes.le_next;
+ nextvp = LIST_NEXT(vp, v_mntvnodes);
if (vp->v_type == VNON)
continue;
mtx_enter(&vp->v_interlock, MTX_DEF);
@@ -690,7 +690,7 @@ again:
}
vput(vp);
mtx_enter(&mntvnode_mtx, MTX_DEF);
- if (vp->v_mntvnodes.le_next != nextvp)
+ if (LIST_NEXT(vp, v_mntvnodes) != nextvp)
goto again;
}
mtx_exit(&mntvnode_mtx, MTX_DEF);
@@ -752,7 +752,7 @@ dqget(vp, id, ump, type, dqp)
* Check the cache first.
*/
dqh = DQHASH(dqvp, id);
- for (dq = dqh->lh_first; dq; dq = dq->dq_hash.le_next) {
+ LIST_FOREACH(dq, dqh, dq_hash) {
if (dq->dq_id != id ||
dq->dq_ump->um_quotas[dq->dq_type] != dqvp)
continue;
@@ -769,7 +769,7 @@ dqget(vp, id, ump, type, dqp)
/*
* Not in cache, allocate a new one.
*/
- if (dqfreelist.tqh_first == NODQUOT &&
+ if (TAILQ_FIRST(&dqfreelist) == NODQUOT &&
numdquot < MAXQUOTAS * desiredvnodes)
desireddquot += DQUOTINC;
if (numdquot < desireddquot) {
@@ -777,7 +777,7 @@ dqget(vp, id, ump, type, dqp)
M_WAITOK | M_ZERO);
numdquot++;
} else {
- if ((dq = dqfreelist.tqh_first) == NULL) {
+ if ((dq = TAILQ_FIRST(&dqfreelist)) == NULL) {
tablefull("dquot");
*dqp = NODQUOT;
return (EUSERS);
@@ -946,8 +946,8 @@ dqflush(vp)
* fall off the head of the free list and be re-used).
*/
for (dqh = &dqhashtbl[dqhash]; dqh >= dqhashtbl; dqh--) {
- for (dq = dqh->lh_first; dq; dq = nextdq) {
- nextdq = dq->dq_hash.le_next;
+ for (dq = LIST_FIRST(dqh); dq; dq = nextdq) {
+ nextdq = LIST_NEXT(dq, dq_hash);
if (dq->dq_ump->um_quotas[dq->dq_type] != vp)
continue;
if (dq->dq_cnt)
diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
index d0283ba..3a31ad4 100644
--- a/sys/vm/vm_meter.c
+++ b/sys/vm/vm_meter.c
@@ -79,7 +79,7 @@ loadav(struct loadavg *avg)
register struct proc *p;
ALLPROC_LOCK(AP_SHARED);
- for (nrun = 0, p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
+ for (nrun = 0, p = LIST_FIRST(&allproc); p != 0; p = LIST_NEXT(p, p_list)) {
switch (p->p_stat) {
case SSLEEP:
if (p->p_priority > PZERO || p->p_slptime != 0)
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 83ab496..1e16917 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -536,7 +536,7 @@ vm_object_page_clean(object, start, end, flags)
clearobjflags = 1;
- for(p = TAILQ_FIRST(&object->memq); p; p = TAILQ_NEXT(p, listq)) {
+ TAILQ_FOREACH(p, &object->memq, listq) {
vm_page_flag_set(p, PG_CLEANCHK);
if ((flags & OBJPC_NOSYNC) && (p->flags & PG_NOSYNC))
clearobjflags = 0;
@@ -1620,7 +1620,7 @@ vm_object_in_map( object)
{
struct proc *p;
ALLPROC_LOCK(AP_SHARED);
- for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
+ LIST_FOREACH(p, &allproc, p_list) {
if( !p->p_vmspace /* || (p->p_flag & (P_SYSTEM|P_WEXIT)) */)
continue;
if( _vm_object_in_map(&p->p_vmspace->vm_map, object, 0)) {
@@ -1707,7 +1707,7 @@ DB_SHOW_COMMAND(object, vm_object_print_static)
db_indent += 2;
count = 0;
- for (p = TAILQ_FIRST(&object->memq); p != NULL; p = TAILQ_NEXT(p, listq)) {
+ TAILQ_FOREACH(p, &object->memq, listq) {
if (count == 0)
db_iprintf("memory:=");
else if (count == 6) {
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index 0dd7ecb..4046e0e 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -1463,7 +1463,7 @@ vm_daemon()
*/
ALLPROC_LOCK(AP_SHARED);
- for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
+ LIST_FOREACH(p, &allproc, p_list) {
vm_pindex_t limit, size;
/*
diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c
index 6dbcca2..648b340 100644
--- a/sys/vm/vm_pager.c
+++ b/sys/vm/vm_pager.c
@@ -329,7 +329,7 @@ vm_pager_object_lookup(pg_list, handle)
{
register vm_object_t object;
- for (object = TAILQ_FIRST(pg_list); object != NULL; object = TAILQ_NEXT(object,pager_object_list))
+ TAILQ_FOREACH(object, pg_list, pager_object_list)
if (object->handle == handle)
return (object);
return (NULL);
OpenPOWER on IntegriCloud