summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2005-10-12 07:25:14 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2005-10-12 07:25:14 +0000
commitfeb09f6dffc3e0e68f2a0a1d3c894ce5c3f38d6a (patch)
tree9dc402aed31d5eabfc6a08d411c3be45943d9705
parentc5297396302f305c000dbd5b57355c092a5194a5 (diff)
Use queue macros instead of directly accessing fields. ok millert@
-rw-r--r--lib/libc/db/mpool/mpool.c13
-rw-r--r--lib/libkvm/kvm_file.c10
-rw-r--r--lib/libkvm/kvm_proc.c6
3 files changed, 13 insertions, 16 deletions
diff --git a/lib/libc/db/mpool/mpool.c b/lib/libc/db/mpool/mpool.c
index 83791ee37a2..e78c3082478 100644
--- a/lib/libc/db/mpool/mpool.c
+++ b/lib/libc/db/mpool/mpool.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpool.c,v 1.15 2005/10/10 19:23:41 otto Exp $ */
+/* $OpenBSD: mpool.c,v 1.16 2005/10/12 07:25:13 otto Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -309,8 +309,7 @@ mpool_sync(MPOOL *mp)
BKT *bp;
/* Walk the lru chain, flushing any dirty pages to disk. */
- for (bp = mp->lqh.cqh_first;
- bp != (void *)&mp->lqh; bp = bp->q.cqe_next)
+ CIRCLEQ_FOREACH(bp, &mp->lqh, q)
if (bp->flags & MPOOL_DIRTY &&
mpool_write(mp, bp) == RET_ERROR)
return (RET_ERROR);
@@ -339,8 +338,7 @@ mpool_bkt(MPOOL *mp)
* off any lists. If we don't find anything we grow the cache anyway.
* The cache never shrinks.
*/
- for (bp = mp->lqh.cqh_first;
- bp != (void *)&mp->lqh; bp = bp->q.cqe_next)
+ CIRCLEQ_FOREACH(bp, &mp->lqh, q)
if (!(bp->flags & MPOOL_PINNED)) {
/* Flush if dirty. */
if (bp->flags & MPOOL_DIRTY &&
@@ -421,7 +419,7 @@ mpool_look(MPOOL *mp, pgno_t pgno)
BKT *bp;
head = &mp->hqh[HASHKEY(pgno)];
- for (bp = head->cqh_first; bp != (void *)head; bp = bp->hq.cqe_next)
+ CIRCLEQ_FOREACH(bp, head, hq)
if ((bp->pgno == pgno) &&
((bp->flags & MPOOL_INUSE) == MPOOL_INUSE)) {
#ifdef STATISTICS
@@ -465,8 +463,7 @@ mpool_stat(MPOOL *mp)
sep = "";
cnt = 0;
- for (bp = mp->lqh.cqh_first;
- bp != (void *)&mp->lqh; bp = bp->q.cqe_next) {
+ CIRCLEQ_FOREACH(bp, &mp->lqh, q) {
(void)fprintf(stderr, "%s%d", sep, bp->pgno);
if (bp->flags & MPOOL_DIRTY)
(void)fprintf(stderr, "d");
diff --git a/lib/libkvm/kvm_file.c b/lib/libkvm/kvm_file.c
index 023b28039cd..aeada10d1d3 100644
--- a/lib/libkvm/kvm_file.c
+++ b/lib/libkvm/kvm_file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm_file.c,v 1.12 2004/09/15 19:31:31 miod Exp $ */
+/* $OpenBSD: kvm_file.c,v 1.13 2005/10/12 07:24:28 otto Exp $ */
/* $NetBSD: kvm_file.c,v 1.5 1996/03/18 22:33:18 thorpej Exp $ */
/*-
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)kvm_file.c 8.1 (Berkeley) 6/4/93";
#else
-static char *rcsid = "$OpenBSD: kvm_file.c,v 1.12 2004/09/15 19:31:31 miod Exp $";
+static char *rcsid = "$OpenBSD: kvm_file.c,v 1.13 2005/10/12 07:24:28 otto Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -98,7 +98,7 @@ kvm_deadfiles(kvm_t *kd, int op, int arg, long filehead_o, int nfiles)
/*
* followed by an array of file structures
*/
- for (fp = filehead.lh_first; fp != 0; fp = fp->f_list.le_next) {
+ LIST_FOREACH(fp, &filehead, f_list) {
if (buflen > sizeof (struct file)) {
if (KREAD(kd, (long)fp, ((struct file *)where))) {
_kvm_err(kd, kd->program, "can't read kfp");
@@ -149,9 +149,9 @@ kvm_getfiles(kvm_t *kd, int op, int arg, int *cnt)
filehead = *(struct filelist *)kd->argspc;
fp = (struct file *)(kd->argspc + sizeof (filehead));
fplim = (struct file *)(kd->argspc + size);
- for (nfiles = 0; filehead.lh_first && (fp < fplim);
+ for (nfiles = 0; LIST_FIRST(&filehead) && (fp < fplim);
nfiles++, fp++)
- filehead.lh_first = fp->f_list.le_next;
+ LIST_FIRST(&filehead) = LIST_NEXT(fp, f_list);
} else {
struct nlist nl[3], *p;
diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c
index 9ca4a9a4076..d4d43e19c25 100644
--- a/lib/libkvm/kvm_proc.c
+++ b/lib/libkvm/kvm_proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm_proc.c,v 1.26 2004/06/24 21:06:47 millert Exp $ */
+/* $OpenBSD: kvm_proc.c,v 1.27 2005/10/12 07:24:28 otto Exp $ */
/* $NetBSD: kvm_proc.c,v 1.30 1999/03/24 05:50:50 mrg Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
#if 0
static char sccsid[] = "@(#)kvm_proc.c 8.3 (Berkeley) 9/23/93";
#else
-static char *rcsid = "$OpenBSD: kvm_proc.c,v 1.26 2004/06/24 21:06:47 millert Exp $";
+static char *rcsid = "$OpenBSD: kvm_proc.c,v 1.27 2005/10/12 07:24:28 otto Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -273,7 +273,7 @@ kvm_proclist(kvm_t *kd, int what, int arg, struct proc *p,
struct tty tty;
int cnt = 0;
- for (; cnt < maxcnt && p != NULL; p = proc.p_list.le_next) {
+ for (; cnt < maxcnt && p != NULL; p = LIST_NEXT(&proc, p_list)) {
if (KREAD(kd, (u_long)p, &proc)) {
_kvm_err(kd, kd->program, "can't read proc at %x", p);
return (-1);