diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2000-02-15 16:30:29 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2000-02-15 16:30:29 +0000 |
commit | 0d402694135fa414d334ec22295c382c25ee8f72 (patch) | |
tree | 8f434d3a74892e61e099ce12ada7608530dfecf0 /sys/kern | |
parent | dd5f1dca527e2276ac398b262639478ab50764b6 (diff) |
Add another argument to extent_alloc_subregion to allow specifing an offset
to the alignment. rename the function to extent_alloc_subregion1 and add
compatibility macros.
From NetBSD.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/subr_extent.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/kern/subr_extent.c b/sys/kern/subr_extent.c index 5333ede58a1..33e778911c1 100644 --- a/sys/kern/subr_extent.c +++ b/sys/kern/subr_extent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_extent.c,v 1.7 1999/02/17 13:15:46 fgsch Exp $ */ +/* $OpenBSD: subr_extent.c,v 1.8 2000/02/15 16:30:28 art Exp $ */ /* $NetBSD: subr_extent.c,v 1.7 1996/11/21 18:46:34 cgd Exp $ */ /*- @@ -79,8 +79,9 @@ static void extent_register __P((struct extent *)); /* * Macro to align to an arbitrary power-of-two boundary. */ -#define EXTENT_ALIGN(_start, _align) \ - (((_start) + ((_align) - 1)) & (-(_align))) +#define EXTENT_ALIGN(_start, _align, _skew) \ + (((((_start) - (_skew)) + ((_align) - 1)) & (-(_align))) + (_skew)) + /* * Register the extent on a doubly linked list. @@ -504,10 +505,10 @@ extent_alloc_region(ex, start, size, flags) * a power of 2. */ int -extent_alloc_subregion(ex, substart, subend, size, alignment, boundary, +extent_alloc_subregion1(ex, substart, subend, size, alignment, skew, boundary, flags, result) struct extent *ex; - u_long substart, subend, size, alignment, boundary; + u_long substart, subend, size, alignment, skew, boundary; int flags; u_long *result; { @@ -605,7 +606,7 @@ extent_alloc_subregion(ex, substart, subend, size, alignment, boundary, * check is the area from the beginning of the subregion * to the first allocated region. */ - newstart = EXTENT_ALIGN(substart, alignment); + newstart = EXTENT_ALIGN(substart, alignment, skew); if (newstart < ex->ex_start) { #ifdef DIAGNOSTIC printf( @@ -636,7 +637,7 @@ extent_alloc_subregion(ex, substart, subend, size, alignment, boundary, * the last allocated region (if there was one). */ if (rp == NULL && last != NULL) - newstart = EXTENT_ALIGN((last->er_end + 1), alignment); + newstart = EXTENT_ALIGN((last->er_end + 1), alignment, skew); for (; rp != NULL; rp = rp->er_link.le_next) { /* @@ -712,7 +713,7 @@ extent_alloc_subregion(ex, substart, subend, size, alignment, boundary, /* * Skip past the current region and check again. */ - newstart = EXTENT_ALIGN((rp->er_end + 1), alignment); + newstart = EXTENT_ALIGN((rp->er_end + 1), alignment, skew); if (newstart < rp->er_end) { /* * Overflow condition. Don't error out, since |