diff options
Diffstat (limited to 'lib/slab.c')
-rw-r--r-- | lib/slab.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -18,6 +18,7 @@ static void slab_free(resource *r); static void slab_dump(resource *r); +static resource *slab_lookup(resource *r, unsigned long addr); #ifdef FAKE_SLAB @@ -111,7 +112,8 @@ static struct resclass sl_class = { "Slab", sizeof(struct slab), slab_free, - slab_dump + slab_dump, + slab_lookup }; struct sl_head { @@ -269,4 +271,19 @@ slab_dump(resource *r) debug("(%de+%dp+%df blocks per %d objs per %d bytes)\n", ec, pc, fc, s->objs_per_slab, s->obj_size); } +static resource * +slab_lookup(resource *r, unsigned long a) +{ + slab *s = (slab *) r; + struct sl_head *h; + + WALK_LIST(h, s->partial_heads) + if ((unsigned long) h < a && (unsigned long) h + SLAB_SIZE < a) + return r; + WALK_LIST(h, s->full_heads) + if ((unsigned long) h < a && (unsigned long) h + SLAB_SIZE < a) + return r; + return NULL; +} + #endif |