Use <sys/queue.h> macro API.
This commit is contained in:
parent
a7ecc804fb
commit
ef9e85abba
@ -94,7 +94,7 @@ ntfs_nthashlookup(dev, inum)
|
||||
struct ntnode *ip;
|
||||
|
||||
mtx_enter(&ntfs_nthash_mtx, MTX_DEF);
|
||||
for (ip = NTNOHASH(dev, inum)->lh_first; ip; ip = ip->i_hash.le_next)
|
||||
LIST_FOREACH(ip, NTNOHASH(dev, inum), i_hash)
|
||||
if (inum == ip->i_number && dev == ip->i_dev)
|
||||
break;
|
||||
mtx_exit(&ntfs_nthash_mtx, MTX_DEF);
|
||||
|
@ -397,8 +397,7 @@ union_allocvp(vpp, mp, dvp, upperdvp, cnp, uppervp, lowervp, docache)
|
||||
while (union_list_lock(hash))
|
||||
continue;
|
||||
|
||||
for (un = unhead[hash].lh_first; un != 0;
|
||||
un = un->un_cache.le_next) {
|
||||
LIST_FOREACH(un, &unhead[hash], un_cache) {
|
||||
if ((un->un_lowervp == lowervp ||
|
||||
un->un_lowervp == NULLVP) &&
|
||||
(un->un_uppervp == uppervp ||
|
||||
|
@ -78,7 +78,7 @@ ufs_ihashlookup(dev, inum)
|
||||
struct inode *ip;
|
||||
|
||||
mtx_enter(&ufs_ihash_mtx, MTX_DEF);
|
||||
for (ip = INOHASH(dev, inum)->lh_first; ip; ip = ip->i_hash.le_next)
|
||||
LIST_FOREACH(ip, INOHASH(dev, inum), i_hash)
|
||||
if (inum == ip->i_number && dev == ip->i_dev)
|
||||
break;
|
||||
mtx_exit(&ufs_ihash_mtx, MTX_DEF);
|
||||
@ -103,7 +103,7 @@ ufs_ihashget(dev, inum)
|
||||
|
||||
loop:
|
||||
mtx_enter(&ufs_ihash_mtx, MTX_DEF);
|
||||
for (ip = INOHASH(dev, inum)->lh_first; ip; ip = ip->i_hash.le_next) {
|
||||
LIST_FOREACH(ip, INOHASH(dev, inum), i_hash) {
|
||||
if (inum == ip->i_number && dev == ip->i_dev) {
|
||||
vp = ITOV(ip);
|
||||
mtx_enter(&vp->v_interlock, MTX_DEF);
|
||||
|
@ -397,8 +397,7 @@ union_allocvp(vpp, mp, dvp, upperdvp, cnp, uppervp, lowervp, docache)
|
||||
while (union_list_lock(hash))
|
||||
continue;
|
||||
|
||||
for (un = unhead[hash].lh_first; un != 0;
|
||||
un = un->un_cache.le_next) {
|
||||
LIST_FOREACH(un, &unhead[hash], un_cache) {
|
||||
if ((un->un_lowervp == lowervp ||
|
||||
un->un_lowervp == NULLVP) &&
|
||||
(un->un_uppervp == uppervp ||
|
||||
|
@ -96,15 +96,13 @@ extern u_char inetctlerrmap[];
|
||||
{ \
|
||||
register struct in_ifaddr *ia; \
|
||||
\
|
||||
for (ia = in_ifaddrhead.tqh_first; \
|
||||
for (ia = TAILQ_FIRST(&in_ifaddrhead); \
|
||||
ia != NULL && ((ia->ia_ifp->if_flags & IFF_POINTOPOINT)? \
|
||||
IA_DSTSIN(ia):IA_SIN(ia))->sin_addr.s_addr != (addr).s_addr; \
|
||||
ia = ia->ia_link.tqe_next) \
|
||||
ia = TAILQ_NEXT(ia, ia_link)) \
|
||||
continue; \
|
||||
if (ia == NULL) \
|
||||
for (ia = in_ifaddrhead.tqh_first; \
|
||||
ia != NULL; \
|
||||
ia = ia->ia_link.tqe_next) \
|
||||
TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) \
|
||||
if (ia->ia_ifp->if_flags & IFF_POINTOPOINT && \
|
||||
IA_SIN(ia)->sin_addr.s_addr == (addr).s_addr) \
|
||||
break; \
|
||||
@ -119,9 +117,9 @@ extern u_char inetctlerrmap[];
|
||||
/* struct ifnet *ifp; */ \
|
||||
/* struct in_ifaddr *ia; */ \
|
||||
{ \
|
||||
for ((ia) = in_ifaddrhead.tqh_first; \
|
||||
for ((ia) = TAILQ_FIRST(&in_ifaddrhead); \
|
||||
(ia) != NULL && (ia)->ia_ifp != (ifp); \
|
||||
(ia) = (ia)->ia_link.tqe_next) \
|
||||
(ia) = TAILQ_NEXT((ia), ia_link)) \
|
||||
continue; \
|
||||
}
|
||||
#endif
|
||||
@ -184,8 +182,7 @@ struct in_multistep {
|
||||
do { \
|
||||
register struct ifmultiaddr *ifma; \
|
||||
\
|
||||
for (ifma = (ifp)->if_multiaddrs.lh_first; ifma; \
|
||||
ifma = ifma->ifma_link.le_next) { \
|
||||
LIST_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { \
|
||||
if (ifma->ifma_addr->sa_family == AF_INET \
|
||||
&& ((struct sockaddr_in *)ifma->ifma_addr)->sin_addr.s_addr == \
|
||||
(addr).s_addr) \
|
||||
@ -206,14 +203,14 @@ do { \
|
||||
/* struct in_multi *inm; */ \
|
||||
do { \
|
||||
if (((inm) = (step).i_inm) != NULL) \
|
||||
(step).i_inm = (step).i_inm->inm_link.le_next; \
|
||||
(step).i_inm = LIST_NEXT((step).i_inm, inm_link); \
|
||||
} while(0)
|
||||
|
||||
#define IN_FIRST_MULTI(step, inm) \
|
||||
/* struct in_multistep step; */ \
|
||||
/* struct in_multi *inm; */ \
|
||||
do { \
|
||||
(step).i_inm = in_multihead.lh_first; \
|
||||
(step).i_inm = LIST_FIRST(&in_multihead); \
|
||||
IN_NEXT_MULTI((step), (inm)); \
|
||||
} while(0)
|
||||
|
||||
|
@ -94,7 +94,7 @@ ntfs_nthashlookup(dev, inum)
|
||||
struct ntnode *ip;
|
||||
|
||||
mtx_enter(&ntfs_nthash_mtx, MTX_DEF);
|
||||
for (ip = NTNOHASH(dev, inum)->lh_first; ip; ip = ip->i_hash.le_next)
|
||||
LIST_FOREACH(ip, NTNOHASH(dev, inum), i_hash)
|
||||
if (inum == ip->i_number && dev == ip->i_dev)
|
||||
break;
|
||||
mtx_exit(&ntfs_nthash_mtx, MTX_DEF);
|
||||
|
@ -517,8 +517,8 @@ wx_mc_setup(sc)
|
||||
return (wx_init(sc));
|
||||
}
|
||||
|
||||
for (ifma = ifp->if_multiaddrs.lh_first, sc->wx_nmca = 0;
|
||||
ifma != NULL; ifma = ifma->ifma_link.le_next) {
|
||||
sc->wx_nmca = 0;
|
||||
LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
|
||||
if (ifma->ifma_addr->sa_family != AF_LINK) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1608,8 +1608,8 @@ setup_allocindir_phase2(bp, ip, aip)
|
||||
if (aip->ai_oldblkno == 0)
|
||||
oldaip = NULL;
|
||||
else
|
||||
for (oldaip=LIST_FIRST(&indirdep->ir_deplisthd);
|
||||
oldaip; oldaip = LIST_NEXT(oldaip, ai_next))
|
||||
|
||||
LIST_FOREACH(oldaip, &indirdep->ir_deplisthd, ai_next)
|
||||
if (oldaip->ai_offset == aip->ai_offset)
|
||||
break;
|
||||
freefrag = NULL;
|
||||
@ -2351,8 +2351,8 @@ softdep_change_directoryentry_offset(dp, base, oldloc, newloc, entrysize)
|
||||
goto done;
|
||||
oldoffset = offset + (oldloc - base);
|
||||
newoffset = offset + (newloc - base);
|
||||
for (dap = LIST_FIRST(&pagedep->pd_diraddhd[DIRADDHASH(oldoffset)]);
|
||||
dap; dap = LIST_NEXT(dap, da_pdlist)) {
|
||||
|
||||
LIST_FOREACH(dap, &pagedep->pd_diraddhd[DIRADDHASH(oldoffset)], da_pdlist) {
|
||||
if (dap->da_offset != oldoffset)
|
||||
continue;
|
||||
dap->da_offset = newoffset;
|
||||
@ -2364,8 +2364,8 @@ softdep_change_directoryentry_offset(dp, base, oldloc, newloc, entrysize)
|
||||
break;
|
||||
}
|
||||
if (dap == NULL) {
|
||||
for (dap = LIST_FIRST(&pagedep->pd_pendinghd);
|
||||
dap; dap = LIST_NEXT(dap, da_pdlist)) {
|
||||
|
||||
LIST_FOREACH(dap, &pagedep->pd_pendinghd, da_pdlist) {
|
||||
if (dap->da_offset == oldoffset) {
|
||||
dap->da_offset = newoffset;
|
||||
break;
|
||||
@ -2531,13 +2531,13 @@ newdirrem(bp, dp, ip, isrmdir, prevdirremp)
|
||||
* be de-allocated. Check for an entry on both the pd_dirraddhd
|
||||
* list and the pd_pendinghd list.
|
||||
*/
|
||||
for (dap = LIST_FIRST(&pagedep->pd_diraddhd[DIRADDHASH(offset)]);
|
||||
dap; dap = LIST_NEXT(dap, da_pdlist))
|
||||
|
||||
LIST_FOREACH(dap, &pagedep->pd_diraddhd[DIRADDHASH(offset)], da_pdlist)
|
||||
if (dap->da_offset == offset)
|
||||
break;
|
||||
if (dap == NULL) {
|
||||
for (dap = LIST_FIRST(&pagedep->pd_pendinghd);
|
||||
dap; dap = LIST_NEXT(dap, da_pdlist))
|
||||
|
||||
LIST_FOREACH(dap, &pagedep->pd_pendinghd, da_pdlist)
|
||||
if (dap->da_offset == offset)
|
||||
break;
|
||||
if (dap == NULL)
|
||||
@ -4045,8 +4045,8 @@ softdep_sync_metadata(ap)
|
||||
|
||||
case D_INDIRDEP:
|
||||
restart:
|
||||
for (aip = LIST_FIRST(&WK_INDIRDEP(wk)->ir_deplisthd);
|
||||
aip; aip = LIST_NEXT(aip, ai_next)) {
|
||||
|
||||
LIST_FOREACH(aip, &WK_INDIRDEP(wk)->ir_deplisthd, ai_next) {
|
||||
if (aip->ai_state & DEPCOMPLETE)
|
||||
continue;
|
||||
nbp = aip->ai_buf;
|
||||
@ -4686,8 +4686,8 @@ softdep_count_dependencies(bp, wantcount)
|
||||
|
||||
case D_INDIRDEP:
|
||||
indirdep = WK_INDIRDEP(wk);
|
||||
for (aip = LIST_FIRST(&indirdep->ir_deplisthd);
|
||||
aip; aip = LIST_NEXT(aip, ai_next)) {
|
||||
|
||||
LIST_FOREACH(aip, &indirdep->ir_deplisthd, ai_next) {
|
||||
/* indirect block pointer dependency */
|
||||
retval += 1;
|
||||
if (!wantcount)
|
||||
@ -4698,8 +4698,8 @@ softdep_count_dependencies(bp, wantcount)
|
||||
case D_PAGEDEP:
|
||||
pagedep = WK_PAGEDEP(wk);
|
||||
for (i = 0; i < DAHASHSZ; i++) {
|
||||
for (dap = LIST_FIRST(&pagedep->pd_diraddhd[i]);
|
||||
dap; dap = LIST_NEXT(dap, da_pdlist)) {
|
||||
|
||||
LIST_FOREACH(dap, &pagedep->pd_diraddhd[i], da_pdlist) {
|
||||
/* directory entry dependency */
|
||||
retval += 1;
|
||||
if (!wantcount)
|
||||
|
@ -78,7 +78,7 @@ ufs_ihashlookup(dev, inum)
|
||||
struct inode *ip;
|
||||
|
||||
mtx_enter(&ufs_ihash_mtx, MTX_DEF);
|
||||
for (ip = INOHASH(dev, inum)->lh_first; ip; ip = ip->i_hash.le_next)
|
||||
LIST_FOREACH(ip, INOHASH(dev, inum), i_hash)
|
||||
if (inum == ip->i_number && dev == ip->i_dev)
|
||||
break;
|
||||
mtx_exit(&ufs_ihash_mtx, MTX_DEF);
|
||||
@ -103,7 +103,7 @@ ufs_ihashget(dev, inum)
|
||||
|
||||
loop:
|
||||
mtx_enter(&ufs_ihash_mtx, MTX_DEF);
|
||||
for (ip = INOHASH(dev, inum)->lh_first; ip; ip = ip->i_hash.le_next) {
|
||||
LIST_FOREACH(ip, INOHASH(dev, inum), i_hash) {
|
||||
if (inum == ip->i_number && dev == ip->i_dev) {
|
||||
vp = ITOV(ip);
|
||||
mtx_enter(&vp->v_interlock, MTX_DEF);
|
||||
|
Loading…
Reference in New Issue
Block a user