From f817c58ea799274eb832d25dc61acb5955f9b2d9 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Sat, 25 Dec 2004 23:02:27 +0000 Subject: Use list and queue macros where applicable to make the code easier to read; no functional change. --- sys/arch/i386/i386/dkcsum.c | 4 ++-- sys/arch/i386/i386/pmap.c | 20 +++++++++----------- sys/arch/i386/isa/ahc_isa.c | 5 ++--- 3 files changed, 13 insertions(+), 16 deletions(-) (limited to 'sys/arch/i386') diff --git a/sys/arch/i386/i386/dkcsum.c b/sys/arch/i386/i386/dkcsum.c index 7071689ad1f..792ced92910 100644 --- a/sys/arch/i386/i386/dkcsum.c +++ b/sys/arch/i386/i386/dkcsum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dkcsum.c,v 1.12 2004/08/11 18:51:03 millert Exp $ */ +/* $OpenBSD: dkcsum.c,v 1.13 2004/12/25 23:02:24 miod Exp $ */ /*- * Copyright (c) 1997 Niklas Hallqvist. All rights reserved. @@ -76,7 +76,7 @@ dkcsumattach() */ bp = geteblk(bios_cksumlen * DEV_BSIZE); /* XXX error check? */ - for (dv = alldevs.tqh_first; dv; dv = dv->dv_list.tqe_next) { + TAILQ_FOREACH(dv, &alldevs, dv_list) { if (dv->dv_class != DV_DISK) continue; bp->b_dev = dev = dev_rawpart(dv); diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c index baa3b4c34b0..76aff1121fc 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.79 2004/07/20 20:18:13 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.80 2004/12/25 23:02:24 miod Exp $ */ /* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */ /* @@ -1220,8 +1220,8 @@ pmap_alloc_pv(pmap, mode) simple_lock(&pvalloc_lock); - if (pv_freepages.tqh_first != NULL) { - pvpage = pv_freepages.tqh_first; + if (!TAILQ_EMPTY(&pv_freepages)) { + pvpage = TAILQ_FIRST(&pv_freepages); pvpage->pvinfo.pvpi_nfree--; if (pvpage->pvinfo.pvpi_nfree == 0) { /* nothing left in this one? */ @@ -1281,10 +1281,10 @@ pmap_alloc_pvpage(pmap, mode) * if we need_entry and we've got unused pv_pages, allocate from there */ - if (mode != ALLOCPV_NONEED && pv_unusedpgs.tqh_first != NULL) { + if (mode != ALLOCPV_NONEED && !TAILQ_EMPTY(&pv_unusedpgs)) { /* move it to pv_freepages list */ - pvpage = pv_unusedpgs.tqh_first; + pvpage = TAILQ_FIRST(&pv_unusedpgs); TAILQ_REMOVE(&pv_unusedpgs, pvpage, pvinfo.pvpi_list); TAILQ_INSERT_HEAD(&pv_freepages, pvpage, pvinfo.pvpi_list); @@ -1799,8 +1799,7 @@ pmap_steal_ptp(obj, offset) we_locked = simple_lock_try(&curobj->vmobjlock); } if (caller_locked || we_locked) { - ptp = curobj->memq.tqh_first; - for (/*null*/; ptp != NULL; ptp = ptp->listq.tqe_next) { + TAILQ_FOREACH(ptp, &curobj->memq, listq) { /* * might have found a PTP we can steal @@ -2041,8 +2040,8 @@ pmap_release(pmap) * free any remaining PTPs */ - while (pmap->pm_obj.memq.tqh_first != NULL) { - pg = pmap->pm_obj.memq.tqh_first; + while (!TAILQ_EMPTY(&pmap->pm_obj.memq)) { + pg = TAILQ_FIRST(&pmap->pm_obj.memq); #ifdef DIAGNOSTIC if (pg->flags & PG_BUSY) panic("pmap_release: busy page table page"); @@ -3407,8 +3406,7 @@ pmap_growkernel(maxkvaddr) /* distribute new kernel PTP to all active pmaps */ simple_lock(&pmaps_lock); - for (pm = pmaps.lh_first; pm != NULL; - pm = pm->pm_list.le_next) { + LIST_FOREACH(pm, &pmaps, pm_list) { pm->pm_pdir[PDSLOT_KERN + nkpde] = kpm->pm_pdir[PDSLOT_KERN + nkpde]; } diff --git a/sys/arch/i386/isa/ahc_isa.c b/sys/arch/i386/isa/ahc_isa.c index c385c554cf6..c2c0ad8a608 100644 --- a/sys/arch/i386/isa/ahc_isa.c +++ b/sys/arch/i386/isa/ahc_isa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ahc_isa.c,v 1.13 2004/08/01 01:36:23 krw Exp $ */ +/* $OpenBSD: ahc_isa.c,v 1.14 2004/12/25 23:02:24 miod Exp $ */ /* $NetBSD: ahc_isa.c,v 1.5 1996/10/21 22:27:39 thorpej Exp $ */ /* @@ -309,8 +309,7 @@ ahc_isa_probe(parent, match, aux) * Find this bus's state. If we don't yet have a slot * marker, allocate and initialize one. */ - for (as = ahc_isa_all_slots.lh_first; as != NULL; - as = as->link.le_next) + LIST_FOREACH(as, &ahc_isa_all_slots, link) if (as->bus == parent->dv_unit) goto found_slot_marker; -- cgit v1.2.3