summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64/stand
diff options
context:
space:
mode:
authorPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-05-28 22:17:22 +0000
committerPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-05-28 22:17:22 +0000
commita13a7e762ef3dc8ab0824ee1ffac2c9aac6ef5ec (patch)
tree05e0320ae1cb708df822ccf57fee458dacf84036 /sys/arch/sparc64/stand
parenta66c971a33649b54c477de18433901a9fa704860 (diff)
avoid bypassing sys/queue.h in many places in the kernel.
many assumptions were made about the way the various list types are implemented. lots of suggestions and help from otto and miod. ok otto@
Diffstat (limited to 'sys/arch/sparc64/stand')
-rw-r--r--sys/arch/sparc64/stand/ofwboot/alloc.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/sys/arch/sparc64/stand/ofwboot/alloc.c b/sys/arch/sparc64/stand/ofwboot/alloc.c
index 7fd70b4e2a0..84852829d83 100644
--- a/sys/arch/sparc64/stand/ofwboot/alloc.c
+++ b/sys/arch/sparc64/stand/ofwboot/alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alloc.c,v 1.3 2002/03/14 03:16:01 millert Exp $ */
+/* $OpenBSD: alloc.c,v 1.4 2007/05/28 22:17:21 pyr Exp $ */
/* $NetBSD: alloc.c,v 1.1 2000/08/20 14:58:37 mrg Exp $ */
/*
@@ -112,15 +112,14 @@ alloc(size)
#ifdef ALLOC_FIRST_FIT
/* scan freelist */
- for (f = freelist.lh_first; f != NULL && f->size < size;
- f = f->list.le_next)
- /* noop */ ;
+ LIST_FOREACH(f, &freelist, list)
+ if (f->size >= size)
+ break;
bestf = f;
failed = (bestf == (struct fl *)0);
#else
/* scan freelist */
- f = freelist.lh_first;
- while (f != NULL) {
+ LIST_FOREACH(f, &freelist, list) {
if (f->size >= size) {
if (f->size == size) /* exact match */
goto found;
@@ -131,7 +130,6 @@ alloc(size)
bestsize = f->size;
}
}
- f = f->list.le_next;
}
/* no match in freelist if bestsize unchanged */
@@ -201,13 +199,13 @@ freeall()
struct ml *m;
/* Release chunks on freelist... */
- while ((m = freelist.lh_first) != NULL) {
+ while ((m = TAILQ_FIRST(&freelist)) != NULL)) {
LIST_REMOVE(m, list);
OF_release(m, m->size);
}
/* ...and allocated list. */
- while ((m = allocatedlist.lh_first) != NULL) {
+ while ((m = TAILQ_FIRST(&allocatedlist)) != NULL)) {
LIST_REMOVE(m, list);
OF_release(m, m->size);
}