diff options
author | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2007-05-28 22:17:22 +0000 |
---|---|---|
committer | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2007-05-28 22:17:22 +0000 |
commit | a13a7e762ef3dc8ab0824ee1ffac2c9aac6ef5ec (patch) | |
tree | 05e0320ae1cb708df822ccf57fee458dacf84036 /sys/arch/sparc64 | |
parent | a66c971a33649b54c477de18433901a9fa704860 (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')
-rw-r--r-- | sys/arch/sparc64/dev/fd.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/alloc.c | 16 |
2 files changed, 9 insertions, 11 deletions
diff --git a/sys/arch/sparc64/dev/fd.c b/sys/arch/sparc64/dev/fd.c index f57073d9238..e2c4413ec1e 100644 --- a/sys/arch/sparc64/dev/fd.c +++ b/sys/arch/sparc64/dev/fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fd.c,v 1.10 2007/04/27 22:20:01 krw Exp $ */ +/* $OpenBSD: fd.c,v 1.11 2007/05/28 22:17:21 pyr Exp $ */ /* $NetBSD: fd.c,v 1.112 2003/08/07 16:29:35 agc Exp $ */ /*- @@ -1078,7 +1078,7 @@ fdcstatus(fdc, s) struct fdc_softc *fdc; char *s; { - struct fd_softc *fd = fdc->sc_drives.tqh_first; + struct fd_softc *fd = TAILQ_FIRST(&fdc->sc_drives); int n; /* Just print last status */ 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); } |