summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-04-28 23:31:03 +0000
committerMiles Bader <miles@gnu.org>1995-04-28 23:31:03 +0000
commitddc9cf48e16cc0e7fb80a20a9ab24be9b40e38de (patch)
treeb2828eba22f6a8fe79dd5a89f5bf788c8a0d1689
parentbe295320f9ca9d6b01455c24a83495b07ece1057 (diff)
Formerly pokel.c.~6~
-rw-r--r--ext2fs/pokel.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/ext2fs/pokel.c b/ext2fs/pokel.c
index 140e6f76..3131bc63 100644
--- a/ext2fs/pokel.c
+++ b/ext2fs/pokel.c
@@ -35,12 +35,11 @@ void
pokel_add (struct pokel *pokel, void *loc, vm_size_t length)
{
struct poke *pl;
- vm_offset_t offset, end;
-
- offset = loc - pokel->image;
- offset = trunc_page (offset);
- length = round_page (offset + length) - offset;
- end = length - offset;
+ vm_offset_t offset = trunc_page (loc - pokel->image);
+ vm_offset_t end = round_page (loc + length - pokel->image);
+
+ printf ("pokel_add (%p, %p, %lu) [%lu, %lu]\n",
+ pokel, loc, length, offset, end);
spin_lock (&pokel->lock);
@@ -50,7 +49,9 @@ pokel_add (struct pokel *pokel, void *loc, vm_size_t length)
vm_offset_t p_offs = pl->offset;
vm_size_t p_end = p_offs + pl->length;
- if (p_end >= offset && end >= p_offs)
+ if (p_offs == offset && p_end == end)
+ break;
+ else if (p_end >= offset && end >= p_offs)
{
pl->offset = offset < p_offs ? offset : p_offs;
pl->length = (end > p_end ? end : p_end) - pl->offset;
@@ -70,10 +71,10 @@ pokel_add (struct pokel *pokel, void *loc, vm_size_t length)
else
pokel->free_pokes = pl->next;
pl->offset = offset;
- pl->length = length;
+ pl->length = end - offset;
pl->next = pokel->pokes;
pokel->pokes = pl;
- printf ("Added %d[%d] to pokel %p\n", offset, length, pokel);
+ printf ("Added %d[%d] to pokel %p\n", offset, end - offset, pokel);
}
spin_unlock (&pokel->lock);