summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-05-28 22:17:22 +0000
committerPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-05-28 22:17:22 +0000
commita13a7e762ef3dc8ab0824ee1ffac2c9aac6ef5ec (patch)
tree05e0320ae1cb708df822ccf57fee458dacf84036
parenta66c971a33649b54c477de18433901a9fa704860 (diff)
avoid bypassing sys/queue.h in many places in the kernel.
many assumptions were made about the way the various list types are implemented. lots of suggestions and help from otto and miod. ok otto@
-rw-r--r--sys/adosfs/adutil.c13
-rw-r--r--sys/arch/macppc/stand/alloc.c16
-rw-r--r--sys/arch/mvme68k/dev/sbic.c5
-rw-r--r--sys/arch/mvme68k/dev/ssh.c5
-rw-r--r--sys/arch/sparc64/dev/fd.c4
-rw-r--r--sys/arch/sparc64/stand/ofwboot/alloc.c16
-rw-r--r--sys/dev/microcode/aic7xxx/aicasm_gram.y10
-rw-r--r--sys/dev/microcode/aic7xxx/aicasm_scan.l10
-rw-r--r--sys/netinet6/nd6.c36
-rw-r--r--sys/netinet6/nd6_rtr.c25
-rw-r--r--sys/xfs/xfs_node-bsd.c8
11 files changed, 68 insertions, 80 deletions
diff --git a/sys/adosfs/adutil.c b/sys/adosfs/adutil.c
index 70c0130d282..b9f0cb48a0a 100644
--- a/sys/adosfs/adutil.c
+++ b/sys/adosfs/adutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adutil.c,v 1.16 2007/03/21 17:29:31 thib Exp $ */
+/* $OpenBSD: adutil.c,v 1.17 2007/05/28 22:17:21 pyr Exp $ */
/* $NetBSD: adutil.c,v 1.15 1996/10/13 02:52:07 christos Exp $ */
/*
@@ -65,10 +65,8 @@ adosfs_ahashget(mp, an)
hp = &VFSTOADOSFS(mp)->anodetab[AHASH(an)];
- for (;;)
- for (ap = hp->lh_first; ; ap = ap->link.le_next) {
- if (ap == NULL)
- return (NULL);
+ for (;;) {
+ LIST_FOREACH(ap, hp, link) {
if (ABLKTOINO(ap->block) == an) {
vp = ATOV(ap);
if (!vget(vp, LK_EXCLUSIVE, p))
@@ -76,6 +74,9 @@ adosfs_ahashget(mp, an)
break;
}
}
+ if (ap == NULL)
+ return (NULL);
+ }
/* NOTREACHED */
}
@@ -95,7 +96,7 @@ adosfs_ainshash(amp, ap)
hp = &amp->anodetab[AHASH(ap->block)];
- for (aq = hp->lh_first; aq ; aq = aq->link.le_next) {
+ LIST_FOREACH(aq, hp, link) {
if (aq->block == ap->block) {
lockmgr(&ap->a_lock, LK_RELEASE, NULL);
return (EEXIST);
diff --git a/sys/arch/macppc/stand/alloc.c b/sys/arch/macppc/stand/alloc.c
index 370ba80bba2..94a9cc7af08 100644
--- a/sys/arch/macppc/stand/alloc.c
+++ b/sys/arch/macppc/stand/alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alloc.c,v 1.4 2005/09/15 20:42:33 kettenis Exp $ */
+/* $OpenBSD: alloc.c,v 1.5 2007/05/28 22:17:21 pyr Exp $ */
/* $NetBSD: alloc.c,v 1.1 1997/04/16 20:29:16 thorpej Exp $ */
/*
@@ -114,15 +114,14 @@ alloc(unsigned size)
#ifdef ALLOC_FIRST_FIT
/* scan freelist */
- for (f = freelist.lh_first; f != NULL && f->size < size;
- f = f->list.le_next)
- /* noop */ ;
+ LIST_FOREACH(f, &freelist, list)
+ if (f->size >= size)
+ break;
bestf = f;
failed = (bestf == (struct fl *)0);
#else
/* scan freelist */
- f = freelist.lh_first;
- while (f != NULL) {
+ LIST_FOREACH(f, &freelist, list) {
if (f->size >= size) {
if (f->size == size) /* exact match */
goto found;
@@ -133,7 +132,6 @@ alloc(unsigned size)
bestsize = f->size;
}
}
- f = f->list.le_next;
}
/* no match in freelist if bestsize unchanged */
@@ -201,13 +199,13 @@ freeall()
struct ml *m;
/* Release chunks on freelist... */
- while ((m = freelist.lh_first) != NULL) {
+ while ((m = LIST_FIRST(&freelist)) != NULL) {
LIST_REMOVE(m, list);
OF_release(m, m->size);
}
/* ...and allocated list. */
- while ((m = allocatedlist.lh_first) != NULL) {
+ while ((m = LIST_FIRST(&allocated)) != NULL)) {
LIST_REMOVE(m, list);
OF_release(m, m->size);
}
diff --git a/sys/arch/mvme68k/dev/sbic.c b/sys/arch/mvme68k/dev/sbic.c
index 177a690d33b..1d96a9f776e 100644
--- a/sys/arch/mvme68k/dev/sbic.c
+++ b/sys/arch/mvme68k/dev/sbic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sbic.c,v 1.17 2005/12/03 18:09:37 krw Exp $ */
+/* $OpenBSD: sbic.c,v 1.18 2007/05/28 22:17:21 pyr Exp $ */
/* $NetBSD: sbic.c,v 1.2 1996/04/23 16:32:54 chuck Exp $ */
/*
@@ -57,6 +57,7 @@
#include <sys/disklabel.h>
#include <sys/dkstat.h>
#include <sys/buf.h>
+#include <sys/queue.h>
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
#include <uvm/uvm_extern.h>
@@ -643,7 +644,7 @@ sbic_scsidone(acb, stat)
dosched = 1; /* start next command */
} else
- if ( dev->ready_list.tqh_last == &acb->chain.tqe_next ) {
+ if (TAILQ_LAST(&dev->ready_list) == TAILQ_NEXT(acb, chain)) {
TAILQ_REMOVE(&dev->ready_list, acb, chain);
diff --git a/sys/arch/mvme68k/dev/ssh.c b/sys/arch/mvme68k/dev/ssh.c
index 814f3d150d1..a92aae8a528 100644
--- a/sys/arch/mvme68k/dev/ssh.c
+++ b/sys/arch/mvme68k/dev/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.14 2005/12/03 18:09:37 krw Exp $ */
+/* $OpenBSD: ssh.c,v 1.15 2007/05/28 22:17:21 pyr Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
@@ -46,6 +46,7 @@
#include <sys/dkstat.h>
#include <sys/buf.h>
#include <sys/malloc.h>
+#include <sys/queue.h>
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
@@ -391,7 +392,7 @@ ssh_scsidone(acb, stat)
dosched = 1; /* start next command */
--sc->sc_active;
SSH_TRACE('d','a',stat,0)
- } else if (sc->ready_list.tqh_last == &acb->chain.tqe_next) {
+ } else if (TAILQ_LAST(&sc->ready_list) == TAILQ_NEXT(acb, chain)) {
TAILQ_REMOVE(&sc->ready_list, acb, chain);
SSH_TRACE('d','r',stat,0)
} else {
diff --git a/sys/arch/sparc64/dev/fd.c b/sys/arch/sparc64/dev/fd.c
index f57073d9238..e2c4413ec1e 100644
--- a/sys/arch/sparc64/dev/fd.c
+++ b/sys/arch/sparc64/dev/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.10 2007/04/27 22:20:01 krw Exp $ */
+/* $OpenBSD: fd.c,v 1.11 2007/05/28 22:17:21 pyr Exp $ */
/* $NetBSD: fd.c,v 1.112 2003/08/07 16:29:35 agc Exp $ */
/*-
@@ -1078,7 +1078,7 @@ fdcstatus(fdc, s)
struct fdc_softc *fdc;
char *s;
{
- struct fd_softc *fd = fdc->sc_drives.tqh_first;
+ struct fd_softc *fd = TAILQ_FIRST(&fdc->sc_drives);
int n;
/* Just print last status */
diff --git a/sys/arch/sparc64/stand/ofwboot/alloc.c b/sys/arch/sparc64/stand/ofwboot/alloc.c
index 7fd70b4e2a0..84852829d83 100644
--- a/sys/arch/sparc64/stand/ofwboot/alloc.c
+++ b/sys/arch/sparc64/stand/ofwboot/alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alloc.c,v 1.3 2002/03/14 03:16:01 millert Exp $ */
+/* $OpenBSD: alloc.c,v 1.4 2007/05/28 22:17:21 pyr Exp $ */
/* $NetBSD: alloc.c,v 1.1 2000/08/20 14:58:37 mrg Exp $ */
/*
@@ -112,15 +112,14 @@ alloc(size)
#ifdef ALLOC_FIRST_FIT
/* scan freelist */
- for (f = freelist.lh_first; f != NULL && f->size < size;
- f = f->list.le_next)
- /* noop */ ;
+ LIST_FOREACH(f, &freelist, list)
+ if (f->size >= size)
+ break;
bestf = f;
failed = (bestf == (struct fl *)0);
#else
/* scan freelist */
- f = freelist.lh_first;
- while (f != NULL) {
+ LIST_FOREACH(f, &freelist, list) {
if (f->size >= size) {
if (f->size == size) /* exact match */
goto found;
@@ -131,7 +130,6 @@ alloc(size)
bestsize = f->size;
}
}
- f = f->list.le_next;
}
/* no match in freelist if bestsize unchanged */
@@ -201,13 +199,13 @@ freeall()
struct ml *m;
/* Release chunks on freelist... */
- while ((m = freelist.lh_first) != NULL) {
+ while ((m = TAILQ_FIRST(&freelist)) != NULL)) {
LIST_REMOVE(m, list);
OF_release(m, m->size);
}
/* ...and allocated list. */
- while ((m = allocatedlist.lh_first) != NULL) {
+ while ((m = TAILQ_FIRST(&allocatedlist)) != NULL)) {
LIST_REMOVE(m, list);
OF_release(m, m->size);
}
diff --git a/sys/dev/microcode/aic7xxx/aicasm_gram.y b/sys/dev/microcode/aic7xxx/aicasm_gram.y
index 7d98873715f..cd70b0395c9 100644
--- a/sys/dev/microcode/aic7xxx/aicasm_gram.y
+++ b/sys/dev/microcode/aic7xxx/aicasm_gram.y
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: aicasm_gram.y,v 1.14 2006/12/23 21:08:01 krw Exp $ */
+/* $OpenBSD: aicasm_gram.y,v 1.15 2007/05/28 22:17:21 pyr Exp $ */
/* $NetBSD: aicasm_gram.y,v 1.3 2003/04/19 19:26:11 fvdl Exp $ */
/*
@@ -1845,9 +1845,7 @@ type_check(symbol_t *symbol, expression_t *expression, int opcode)
* expression are defined for this register.
*/
if (symbol->info.rinfo->typecheck_masks != FALSE) {
- for(node = expression->referenced_syms.slh_first;
- node != NULL;
- node = node->links.sle_next) {
+ SLIST_FOREACH(node, &expression->referenced_syms, links) {
if ((node->symbol->type == MASK
|| node->symbol->type == FIELD
|| node->symbol->type == ENUM
@@ -1943,8 +1941,8 @@ yyerror(const char *string)
static int
is_download_const(expression_t *immed)
{
- if ((immed->referenced_syms.slh_first != NULL)
- && (immed->referenced_syms.slh_first->symbol->type == DOWNLOAD_CONST))
+ if (!SLIST_EMPTY(&immed->referenced_syms))
+ && (SLIST_FIRST(&immed->referenced_syms)->symbol->type == DOWNLOAD_CONST))
return (TRUE);
return (FALSE);
diff --git a/sys/dev/microcode/aic7xxx/aicasm_scan.l b/sys/dev/microcode/aic7xxx/aicasm_scan.l
index 27fe114d60f..57f9eaaa762 100644
--- a/sys/dev/microcode/aic7xxx/aicasm_scan.l
+++ b/sys/dev/microcode/aic7xxx/aicasm_scan.l
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: aicasm_scan.l,v 1.9 2004/09/18 19:51:53 mickey Exp $ */
+/* $OpenBSD: aicasm_scan.l,v 1.10 2007/05/28 22:17:21 pyr Exp $ */
/*
* Lexical Analyzer for the Aic7xxx SCSI Host adapter sequencer assembler.
*
@@ -39,7 +39,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: aicasm_scan.l,v 1.9 2004/09/18 19:51:53 mickey Exp $
+ * $Id: aicasm_scan.l,v 1.10 2007/05/28 22:17:21 pyr Exp $
*
* $FreeBSD: src/sys/dev/aic7xxx/aicasm/aicasm_scan.l,v 1.22 2003/12/16 23:54:07 gibbs Exp $
*/
@@ -459,9 +459,7 @@ include_file(char *file_name, include_type type)
if (newfile == NULL && type != SOURCE_FILE) {
path_entry_t include_dir;
- for (include_dir = search_path.slh_first;
- include_dir != NULL;
- include_dir = include_dir->links.sle_next) {
+ SLIST_FOREACH(include_dir, &search_path, links) {
char fullname[PATH_MAX];
if ((include_dir->quoted_includes_only == TRUE)
@@ -595,7 +593,7 @@ yywrap()
if (yyfilename != NULL)
free(yyfilename);
yyfilename = NULL;
- include = include_stack.slh_first;
+ include = SLIST_FIRST(&include_stack);
if (include != NULL) {
yy_switch_to_buffer(include->buffer);
yylineno = include->lineno;
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index db9a812e9ff..b574f0889d8 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.c,v 1.72 2006/06/16 16:49:40 henning Exp $ */
+/* $OpenBSD: nd6.c,v 1.73 2007/05/28 22:17:21 pyr Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
@@ -557,8 +557,8 @@ nd6_timer(ignored_arg)
}
/* expire prefix list */
- pr = nd_prefix.lh_first;
- while (pr) {
+ pr = LIST_FIRST(&nd_prefix);
+ while (pr != NULL) {
/*
* check prefix lifetime.
* since pltime is just for autoconf, pltime processing for
@@ -567,7 +567,7 @@ nd6_timer(ignored_arg)
if (pr->ndpr_vltime != ND6_INFINITE_LIFETIME &&
time_second - pr->ndpr_lastupdate > pr->ndpr_vltime) {
struct nd_prefix *t;
- t = pr->ndpr_next;
+ t = LIST_NEXT(pr, ndpr_entry);
/*
* address expiration and prefix expiration are
@@ -577,7 +577,7 @@ nd6_timer(ignored_arg)
prelist_remove(pr);
pr = t;
} else
- pr = pr->ndpr_next;
+ pr = LIST_NEXT(pr, ndpr_entry);
}
splx(s);
}
@@ -618,8 +618,8 @@ nd6_purge(ifp)
}
/* Nuke prefix list entries toward ifp */
- for (pr = nd_prefix.lh_first; pr; pr = npr) {
- npr = pr->ndpr_next;
+ for (pr = LIST_FIRST(&nd_prefix); pr != NULL; pr = npr) {
+ npr = LIST_NEXT(pr, ndpr_entry);
if (pr->ndpr_ifp == ifp) {
/*
* Because if_detach() does *not* release prefixes
@@ -796,7 +796,7 @@ nd6_is_addr_neighbor(addr, ifp)
* If the address matches one of our on-link prefixes, it should be a
* neighbor.
*/
- for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) {
+ LIST_FOREACH(pr, &nd_prefix, ndpr_entry) {
if (pr->ndpr_ifp != ifp)
continue;
@@ -1301,7 +1301,7 @@ nd6_ioctl(cmd, data, ifp)
*/
bzero(oprl, sizeof(*oprl));
s = splsoftnet();
- pr = nd_prefix.lh_first;
+ pr = LIST_FIRST(&nd_prefix);
while (pr && i < PRLSTSIZ) {
struct nd_pfxrouter *pfr;
int j;
@@ -1314,7 +1314,7 @@ nd6_ioctl(cmd, data, ifp)
oprl->prefix[i].if_index = pr->ndpr_ifp->if_index;
oprl->prefix[i].expire = pr->ndpr_expire;
- pfr = pr->ndpr_advrtrs.lh_first;
+ pfr = LIST_FIRST(&pr->ndpr_advrtrs);
j = 0;
while(pfr) {
if (j < DRLSTSIZ) {
@@ -1332,13 +1332,13 @@ nd6_ioctl(cmd, data, ifp)
#undef RTRADDR
}
j++;
- pfr = pfr->pfr_next;
+ pfr = LIST_NEXT(pfr, pfr_entry);
}
oprl->prefix[i].advrtrs = j;
oprl->prefix[i].origin = PR_ORIG_RA;
i++;
- pr = pr->ndpr_next;
+ pr = LIST_NEXT(pr, ndpr_entry);
}
splx(s);
@@ -1372,10 +1372,10 @@ nd6_ioctl(cmd, data, ifp)
struct nd_prefix *pr, *next;
s = splsoftnet();
- for (pr = nd_prefix.lh_first; pr; pr = next) {
+ for (pr = LIST_FIRST(&nd_prefix); pr; pr = next) {
struct in6_ifaddr *ia, *ia_next;
- next = pr->ndpr_next;
+ next = LIST_NEXT(pr, ndpr_entry);
if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr))
continue; /* XXX */
@@ -2110,7 +2110,7 @@ fill_prlist(oldp, oldlenp, ol)
}
l = 0;
- for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) {
+ LIST_FOREACH(pr, &nd_prefix, ndpr_entry) {
u_short advrtrs;
size_t advance;
struct sockaddr_in6 *sin6;
@@ -2152,8 +2152,7 @@ fill_prlist(oldp, oldlenp, ol)
p->flags = pr->ndpr_stateflags;
p->origin = PR_ORIG_RA;
advrtrs = 0;
- for (pfr = pr->ndpr_advrtrs.lh_first; pfr;
- pfr = pfr->pfr_next) {
+ LIST_FOREACH(pfr, &pr->ndpr_advrtrs, pfr_entry) {
if ((void *)&sin6[advrtrs + 1] > (void *)pe) {
advrtrs++;
continue;
@@ -2170,8 +2169,7 @@ fill_prlist(oldp, oldlenp, ol)
}
else {
advrtrs = 0;
- for (pfr = pr->ndpr_advrtrs.lh_first; pfr;
- pfr = pfr->pfr_next)
+ LIST_FOREACH(pfr, &pr->ndpr_advrtrs, pfr_entry)
advrtrs++;
}
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index ad3b6954885..be040679dcd 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_rtr.c,v 1.41 2006/11/15 03:07:44 itojun Exp $ */
+/* $OpenBSD: nd6_rtr.c,v 1.42 2007/05/28 22:17:21 pyr Exp $ */
/* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */
/*
@@ -41,6 +41,7 @@
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/syslog.h>
+#include <sys/queue.h>
#include <dev/rndvar.h>
#include <net/if.h>
@@ -507,7 +508,7 @@ defrtrlist_del(dr)
/*
* Also delete all the pointers to the router in each prefix lists.
*/
- for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) {
+ LIST_FOREACH(pr, &nd_prefix, ndpr_entry) {
struct nd_pfxrouter *pfxrtr;
if ((pfxrtr = pfxrtr_lookup(pr, dr)) != NULL)
pfxrtr_del(pfxrtr);
@@ -822,7 +823,7 @@ pfxrtr_lookup(pr, dr)
{
struct nd_pfxrouter *search;
- for (search = pr->ndpr_advrtrs.lh_first; search; search = search->pfr_next) {
+ LIST_FOREACH(search, &pr->ndpr_advrtrs, pfr_entry) {
if (search->router == dr)
break;
}
@@ -862,7 +863,7 @@ nd6_prefix_lookup(pr)
{
struct nd_prefix *search;
- for (search = nd_prefix.lh_first; search; search = search->ndpr_next) {
+ LIST_FOREACH(search, &nd_prefix, ndpr_entry) {
if (pr->ndpr_ifp == search->ndpr_ifp &&
pr->ndpr_plen == search->ndpr_plen &&
in6_are_prefix_equal(&pr->ndpr_prefix.sin6_addr,
@@ -958,8 +959,8 @@ prelist_remove(pr)
LIST_REMOVE(pr, ndpr_entry);
/* free list of routers that adversed the prefix */
- for (pfr = pr->ndpr_advrtrs.lh_first; pfr; pfr = next) {
- next = pfr->pfr_next;
+ for (pfr = LIST_FIRST(&p->ndpr_advrtrs); pfr != NULL; pfr = next) {
+ next = LIST_NEXT(pfr, pfr_entry);
free(pfr, M_IP6NDP);
}
@@ -1272,7 +1273,7 @@ pfxlist_onlink_check()
* Check if there is a prefix that has a reachable advertising
* router.
*/
- for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) {
+ LIST_FOREACH(pr, &nd_prefix, ndpr_entry) {
if (pr->ndpr_raf_onlink && find_pfxlist_reachable_router(pr))
break;
}
@@ -1286,7 +1287,7 @@ pfxlist_onlink_check()
* Detach prefixes which have no reachable advertising
* router, and attach other prefixes.
*/
- for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) {
+ LIST_FOREACH(pr, &nd_prefix, ndpr_entry) {
/* XXX: a link-local prefix should never be detached */
if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr))
continue;
@@ -1307,7 +1308,7 @@ pfxlist_onlink_check()
}
} else {
/* there is no prefix that has a reachable router */
- for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) {
+ LIST_FOREACH(pr, &nd_prefix, ndpr_entry) {
if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr))
continue;
@@ -1327,7 +1328,7 @@ pfxlist_onlink_check()
* interfaces. Such cases will be handled in nd6_prefix_onlink,
* so we don't have to care about them.
*/
- for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) {
+ LIST_FOREACH(pr, &nd_prefix, ndpr_entry) {
int e;
if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr))
@@ -1434,7 +1435,7 @@ nd6_prefix_onlink(pr)
* Although such a configuration is expected to be rare, we explicitly
* allow it.
*/
- for (opr = nd_prefix.lh_first; opr; opr = opr->ndpr_next) {
+ LIST_FOREACH(opr, &nd_prefix, ndpr_entry) {
if (opr == pr)
continue;
@@ -1559,7 +1560,7 @@ nd6_prefix_offlink(pr)
* If there's one, try to make the prefix on-link on the
* interface.
*/
- for (opr = nd_prefix.lh_first; opr; opr = opr->ndpr_next) {
+ LIST_FOREACH(opr, &nd_prefix, ndpr_entry) {
if (opr == pr)
continue;
diff --git a/sys/xfs/xfs_node-bsd.c b/sys/xfs/xfs_node-bsd.c
index d5440f5635f..306abdc970d 100644
--- a/sys/xfs/xfs_node-bsd.c
+++ b/sys/xfs/xfs_node-bsd.c
@@ -31,6 +31,7 @@
* SUCH DAMAGE.
*/
+#include <sys/queue.h>
#include <xfs/xfs_locl.h>
#include <xfs/xfs_common.h>
#include <xfs/xfs_fs.h>
@@ -275,13 +276,6 @@ free_all_xfs_nodes(struct xfs *xfsp, int flags, int unmountp)
return error;
}
-#ifndef LIST_FOREACH
-#define LIST_FOREACH(var, head, field) \
- for ((var) = ((head)->lh_first); \
- (var); \
- (var) = ((var)->field.le_next))
-#endif
-
void
vattr2xfs_attr(const struct vattr *va, struct xfs_attr *xa)
{