summaryrefslogtreecommitdiff
path: root/sys/uvm
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-12-26 21:22:15 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-12-26 21:22:15 +0000
commitc5af0812e5d7d60d182addc4594c42baf2e8b591 (patch)
treef3b7e8064fa2dac88f6df9c7c5bda683a4ee96fe /sys/uvm
parentfa70810cdbb843b66175fff83a47dc871a8c2780 (diff)
Use list and queue macros where applicable to make the code easier to read;
no change in compiler assembly output.
Diffstat (limited to 'sys/uvm')
-rw-r--r--sys/uvm/uvm_aobj.c4
-rw-r--r--sys/uvm/uvm_page.c4
-rw-r--r--sys/uvm/uvm_swap.c9
-rw-r--r--sys/uvm/uvm_vnode.c31
4 files changed, 21 insertions, 27 deletions
diff --git a/sys/uvm/uvm_aobj.c b/sys/uvm/uvm_aobj.c
index 56e50f7f577..b0ec463b8e3 100644
--- a/sys/uvm/uvm_aobj.c
+++ b/sys/uvm/uvm_aobj.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_aobj.c,v 1.26 2002/03/14 01:27:18 millert Exp $ */
+/* $OpenBSD: uvm_aobj.c,v 1.27 2004/12/26 21:22:14 miod Exp $ */
/* $NetBSD: uvm_aobj.c,v 1.39 2001/02/18 21:19:08 chs Exp $ */
/*
@@ -833,7 +833,7 @@ uao_flush(uobj, start, stop, flags)
*/
if (by_list) {
- pp = uobj->memq.tqh_first;
+ pp = TAILQ_FIRST(&uobj->memq);
} else {
curoff = start;
pp = uvm_pagelookup(uobj, curoff);
diff --git a/sys/uvm/uvm_page.c b/sys/uvm/uvm_page.c
index 3e949be6409..f7716dcfe9e 100644
--- a/sys/uvm/uvm_page.c
+++ b/sys/uvm/uvm_page.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_page.c,v 1.49 2004/02/23 06:19:32 drahn Exp $ */
+/* $OpenBSD: uvm_page.c,v 1.50 2004/12/26 21:22:14 miod Exp $ */
/* $NetBSD: uvm_page.c,v 1.44 2000/11/27 08:40:04 chs Exp $ */
/*
@@ -812,7 +812,7 @@ uvm_page_rehash()
/* ... and rehash */
for (lcv = 0 ; lcv < oldcount ; lcv++) {
- while ((pg = oldbuckets[lcv].tqh_first) != NULL) {
+ while ((pg = TAILQ_FIRST(&oldbuckets[lcv])) != NULL) {
TAILQ_REMOVE(&oldbuckets[lcv], pg, hashq);
TAILQ_INSERT_TAIL(
&uvm.page_hash[uvm_pagehash(pg->uobject, pg->offset)],
diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c
index ecbb9f6086a..a0c0d55f1c6 100644
--- a/sys/uvm/uvm_swap.c
+++ b/sys/uvm/uvm_swap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_swap.c,v 1.59 2004/09/23 06:31:35 tedu Exp $ */
+/* $OpenBSD: uvm_swap.c,v 1.60 2004/12/26 21:22:14 miod Exp $ */
/* $NetBSD: uvm_swap.c,v 1.40 2000/11/17 11:39:39 mrg Exp $ */
/*
@@ -327,11 +327,8 @@ uvm_swap_initcrypt_all(void)
simple_lock(&uvm.swap_data_lock);
- for (spp = swap_priority.lh_first; spp != NULL;
- spp = spp->spi_swappri.le_next) {
- for (sdp = spp->spi_swapdev.cqh_first;
- sdp != (void *)&spp->spi_swapdev;
- sdp = sdp->swd_next.cqe_next)
+ LIST_FOREACH(spp, &swap_priority, spi_swappri) {
+ CIRCLEQ_FOREACH(sdp, &spp->spi_swapdev, swd_next)
if (sdp->swd_decrypt == NULL)
uvm_swap_initcrypt(sdp, sdp->swd_npages);
}
diff --git a/sys/uvm/uvm_vnode.c b/sys/uvm/uvm_vnode.c
index c1c2286cdde..83f7c85f544 100644
--- a/sys/uvm/uvm_vnode.c
+++ b/sys/uvm/uvm_vnode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_vnode.c,v 1.38 2004/06/06 13:44:07 grange Exp $ */
+/* $OpenBSD: uvm_vnode.c,v 1.39 2004/12/26 21:22:14 miod Exp $ */
/* $NetBSD: uvm_vnode.c,v 1.36 2000/11/24 20:34:01 chs Exp $ */
/*
@@ -467,7 +467,7 @@ uvn_detach(uobj)
simple_unlock(&uvn_wl_lock);
}
#ifdef DIAGNOSTIC
- if (uobj->memq.tqh_first != NULL)
+ if (!TAILQ_EMPTY(&uobj->memq))
panic("uvn_deref: vnode VM object still has pages afer "
"syncio/free flush");
#endif
@@ -590,8 +590,7 @@ uvm_vnp_terminate(vp)
while (uvn->u_obj.uo_npages) {
#ifdef DEBUG
struct vm_page *pp;
- for (pp = uvn->u_obj.memq.tqh_first ; pp != NULL ;
- pp = pp->listq.tqe_next) {
+ TAILQ_FOREACH(pp, &uvn->u_obj.memq, listq) {
if ((pp->flags & PG_BUSY) == 0)
panic("uvm_vnp_terminate: detected unbusy pg");
}
@@ -686,7 +685,7 @@ uvn_releasepg(pg, nextpgp)
pmap_page_protect(pg, VM_PROT_NONE);
uvm_lock_pageq();
if (nextpgp)
- *nextpgp = pg->pageq.tqe_next; /* next page for daemon */
+ *nextpgp = TAILQ_NEXT(pg, pageq); /* next page for daemon */
uvm_pagefree(pg);
if (!nextpgp)
uvm_unlock_pageq();
@@ -705,7 +704,7 @@ uvn_releasepg(pg, nextpgp)
simple_unlock(&uvn_wl_lock);
}
#ifdef DIAGNOSTIC
- if (uvn->u_obj.memq.tqh_first)
+ if (!TAILQ_EMPTY(&uvn->u_obj.memq))
panic("uvn_releasepg: pages in object with npages == 0");
#endif
if (uvn->u_flags & UVM_VNODE_WANTED)
@@ -870,8 +869,7 @@ uvn_flush(uobj, start, stop, flags)
if ((flags & PGO_CLEANIT) != 0 &&
uobj->pgops->pgo_mk_pcluster != NULL) {
if (by_list) {
- for (pp = uobj->memq.tqh_first ; pp != NULL ;
- pp = pp->listq.tqe_next) {
+ TAILQ_FOREACH(pp, &uobj->memq, listq) {
if (!all &&
(pp->offset < start || pp->offset >= stop))
continue;
@@ -895,7 +893,7 @@ uvn_flush(uobj, start, stop, flags)
*/
if (by_list) {
- pp = uobj->memq.tqh_first;
+ pp = TAILQ_FIRST(&uobj->memq);
} else {
curoff = start;
pp = uvm_pagelookup(uobj, curoff);
@@ -917,7 +915,7 @@ uvn_flush(uobj, start, stop, flags)
if (!all &&
(pp->offset < start || pp->offset >= stop)) {
- ppnext = pp->listq.tqe_next;
+ ppnext = TAILQ_NEXT(pp, listq);
continue;
}
@@ -976,7 +974,7 @@ uvn_flush(uobj, start, stop, flags)
if (!needs_clean) {
/* load ppnext */
if (by_list)
- ppnext = pp->listq.tqe_next;
+ ppnext = TAILQ_NEXT(pp, listq);
else {
if (curoff < stop)
ppnext = uvm_pagelookup(uobj, curoff);
@@ -1081,10 +1079,10 @@ ReTry:
*/
if (by_list) {
if (pp->version == pp_version)
- ppnext = pp->listq.tqe_next;
+ ppnext = TAILQ_NEXT(pp, listq);
else
/* reset */
- ppnext = uobj->memq.tqh_first;
+ ppnext = TAILQ_FIRST(&uobj->memq);
} else {
if (curoff < stop)
ppnext = uvm_pagelookup(uobj,
@@ -1120,10 +1118,10 @@ ReTry:
/* set up next page for outer loop */
if (by_list) {
if (pp->version == pp_version)
- ppnext = pp->listq.tqe_next;
+ ppnext = TAILQ_NEXT(pp, listq);
else
/* reset */
- ppnext = uobj->memq.tqh_first;
+ ppnext = TAILQ_FIRST(&uobj->memq);
} else {
if (curoff < stop)
ppnext = uvm_pagelookup(uobj, curoff);
@@ -1942,8 +1940,7 @@ uvm_vnp_sync(mp)
*/
SIMPLEQ_INIT(&uvn_sync_q);
simple_lock(&uvn_wl_lock);
- for (uvn = uvn_wlist.lh_first ; uvn != NULL ;
- uvn = uvn->u_wlist.le_next) {
+ LIST_FOREACH(uvn, &uvn_wlist, u_wlist) {
vp = (struct vnode *) uvn;
if (mp && vp->v_mount != mp)