From 74c6273a873834bf7d4ffc0a625dd0e09e701679 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sun, 29 Apr 2012 14:12:00 +0200 Subject: [PATCH] kernel: Use LIST_FOREACH in some places. --- sys/gnu/vfs/ext2fs/ext2_quota.c | 2 +- sys/net/ip6fw/ip6_fw.c | 4 ++-- sys/vfs/nfs/nfs_node.c | 6 +++--- sys/vfs/ufs/ufs_quota.c | 3 +-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/sys/gnu/vfs/ext2fs/ext2_quota.c b/sys/gnu/vfs/ext2fs/ext2_quota.c index eb7c98b2a8..b12a8dc647 100644 --- a/sys/gnu/vfs/ext2fs/ext2_quota.c +++ b/sys/gnu/vfs/ext2fs/ext2_quota.c @@ -727,7 +727,7 @@ ext2_dqget(struct vnode *vp, u_long id, struct ext2mount *ump, int type, * 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; diff --git a/sys/net/ip6fw/ip6_fw.c b/sys/net/ip6fw/ip6_fw.c index ef3f567f1b..7030e0181a 100644 --- a/sys/net/ip6fw/ip6_fw.c +++ b/sys/net/ip6fw/ip6_fw.c @@ -869,7 +869,7 @@ add_entry6(struct ip6_fw_head *chainptr, struct ip6_fw *frwl) /* If entry number is 0, find highest numbered rule and add 100 */ if (ftmp->fw_number == 0) { - for (fcp = chainptr->lh_first; fcp; fcp = fcp->chain.le_next) { + LIST_FOREACH(fcp, chainptr, chain) { if (fcp->rule->fw_number != (u_short)-1) nbr = fcp->rule->fw_number; else @@ -881,7 +881,7 @@ add_entry6(struct ip6_fw_head *chainptr, struct ip6_fw *frwl) } /* Got a valid number; now insert it, keeping the list ordered */ - for (fcp = chainptr->lh_first; fcp; fcp = fcp->chain.le_next) { + LIST_FOREACH(fcp, chainptr, chain) { if (fcp->rule->fw_number > ftmp->fw_number) { if (fcpl) { LIST_INSERT_AFTER(fcpl, fwc, chain); diff --git a/sys/vfs/nfs/nfs_node.c b/sys/vfs/nfs/nfs_node.c index 5b36ed473a..4520a2c2c9 100644 --- a/sys/vfs/nfs/nfs_node.c +++ b/sys/vfs/nfs/nfs_node.c @@ -112,7 +112,7 @@ nfs_nget(struct mount *mntp, nfsfh_t *fhp, int fhsize, struct nfsnode **npp) retry: nhpp = NFSNOHASH(fnv_32_buf(fhp->fh_bytes, fhsize, FNV1_32_INIT)); loop: - for (np = nhpp->lh_first; np; np = np->n_hash.le_next) { + LIST_FOREACH(np, nhpp, n_hash) { if (mntp != NFSTOV(np)->v_mount || np->n_fhsize != fhsize || bcmp((caddr_t)fhp, (caddr_t)np->n_fhp, fhsize)) { continue; @@ -120,7 +120,7 @@ loop: vp = NFSTOV(np); if (vget(vp, LK_EXCLUSIVE)) goto loop; - for (np = nhpp->lh_first; np; np = np->n_hash.le_next) { + LIST_FOREACH(np, nhpp, n_hash) { if (mntp == NFSTOV(np)->v_mount && np->n_fhsize == fhsize && bcmp((caddr_t)fhp, (caddr_t)np->n_fhp, fhsize) == 0 @@ -239,7 +239,7 @@ nfs_nget_nonblock(struct mount *mntp, nfsfh_t *fhp, int fhsize, retry: nhpp = NFSNOHASH(fnv_32_buf(fhp->fh_bytes, fhsize, FNV1_32_INIT)); loop: - for (np = nhpp->lh_first; np; np = np->n_hash.le_next) { + LIST_FOREACH(np, nhpp, n_hash) { if (mntp != NFSTOV(np)->v_mount || np->n_fhsize != fhsize || bcmp((caddr_t)fhp, (caddr_t)np->n_fhp, fhsize)) { continue; diff --git a/sys/vfs/ufs/ufs_quota.c b/sys/vfs/ufs/ufs_quota.c index faf6af2648..b730198a4b 100644 --- a/sys/vfs/ufs/ufs_quota.c +++ b/sys/vfs/ufs/ufs_quota.c @@ -35,7 +35,6 @@ * * @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95 * $FreeBSD: src/sys/ufs/ufs/ufs_quota.c,v 1.27.2.3 2002/01/15 10:33:32 phk Exp $ - * $DragonFly: src/sys/vfs/ufs/ufs_quota.c,v 1.27 2008/01/05 14:02:41 swildner Exp $ */ #include @@ -769,7 +768,7 @@ ufs_dqget(struct vnode *vp, u_long id, struct ufsmount *ump, int type, * 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; -- 2.41.0