summaryrefslogtreecommitdiffstats
path: root/lib/slab.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-05-09 00:33:38 +0200
committerMartin Mares <mj@ucw.cz>2000-05-09 00:33:38 +0200
commitc976342828d5de3d16b59d623f4f7fb03f52acc9 (patch)
tree4c36b20465c2d7d65e248c14e718e778a5efef60 /lib/slab.c
parent0521e4f68490d5ef5cc6ba6b2b4e4edf7cf6aa1a (diff)
downloadbird-c976342828d5de3d16b59d623f4f7fb03f52acc9.tar
bird-c976342828d5de3d16b59d623f4f7fb03f52acc9.zip
Implemented debugging function rlookup() which you can call from gdb
to see what resource does the address given as a parameter belong to.
Diffstat (limited to 'lib/slab.c')
-rw-r--r--lib/slab.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/slab.c b/lib/slab.c
index e2e741c..0a3455f 100644
--- a/lib/slab.c
+++ b/lib/slab.c
@@ -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