}
static void
-ev_dump(resource *r)
+ev_dump(resource *r, unsigned indent UNUSED)
{
event *e = (event *) r;
};
static void lp_free(resource *);
-static void lp_dump(resource *);
+static void lp_dump(resource *, unsigned);
static resource *lp_lookup(resource *, unsigned long);
static struct resmem lp_memsize(resource *r);
}
static void
-lp_dump(resource *r)
+lp_dump(resource *r, unsigned indent)
{
linpool *m = (linpool *) r;
struct lp_chunk *c;
int cnt, cntl;
+ char x[32];
for(cnt=0, c=m->first; c; c=c->next, cnt++)
;
cntl,
m->total,
m->total_large);
+
+ bsprintf(x, "%%%dschunk %%p\n", indent + 2);
+ for (c=m->first; c; c=c->next)
+ debug(x, "", c);
+
+ bsprintf(x, "%%%dslarge %%p\n", indent + 2);
+ for (c=m->first_large; c; c=c->next)
+ debug(x, "", c);
}
static struct resmem
* is freed upon shutdown of the module.
*/
-static void pool_dump(resource *);
+static void pool_dump(resource *, unsigned);
static void pool_free(resource *);
static resource *pool_lookup(resource *, unsigned long);
static struct resmem pool_memsize(resource *P);
pool root_pool;
-static int indent;
-
/**
* rp_new - create a resource pool
* @p: parent pool
}
static void
-pool_dump(resource *P)
+pool_dump(resource *P, unsigned indent)
{
pool *p = (pool *) P;
resource *r;
debug("%s\n", p->name);
- indent += 3;
WALK_LIST(r, p->inside)
- rdump(r);
- indent -= 3;
+ rdump(r, indent + 3);
}
static struct resmem
* It works by calling a class-specific dump function.
*/
void
-rdump(void *res)
+rdump(void *res, unsigned indent)
{
char x[16];
resource *r = res;
if (r)
{
debug("%s ", r->class->name);
- r->class->dump(r);
+ r->class->dump(r, indent);
}
else
debug("NULL\n");
debug("Looking up %08lx\n", a);
if (r = pool_lookup(&root_pool.r, a))
- rdump(r);
+ rdump(r, 3);
else
debug("Not found.\n");
}
{
}
-static void mbl_debug(resource *r)
+static void mbl_debug(resource *r, unsigned indent UNUSED)
{
struct mblock *m = (struct mblock *) r;
char *name; /* Resource class name */
unsigned size; /* Standard size of single resource */
void (*free)(resource *); /* Freeing function */
- void (*dump)(resource *); /* Dump to debug output */
+ void (*dump)(resource *, unsigned indent); /* Dump to debug output */
resource *(*lookup)(resource *, unsigned long); /* Look up address (only for debugging) */
struct resmem (*memsize)(resource *); /* Return size of memory used by the resource, may be NULL */
};
pool *rp_new(pool *, const char *); /* Create new pool */
pool *rp_newf(pool *, const char *, ...); /* Create a new pool with a formatted string as its name */
void rfree(void *); /* Free single resource */
-void rdump(void *); /* Dump to debug output */
+void rdump(void *, unsigned indent); /* Dump to debug output */
struct resmem rmemsize(void *res); /* Return size of memory used by the resource */
void rlookup(unsigned long); /* Look up address (only for debugging) */
void rmove(void *, pool *); /* Move to a different pool */
#endif
static void slab_free(resource *r);
-static void slab_dump(resource *r);
+static void slab_dump(resource *r, unsigned indent);
static resource *slab_lookup(resource *r, unsigned long addr);
static struct resmem slab_memsize(resource *r);
}
static void
-slab_dump(resource *r)
+slab_dump(resource *r, unsigned indent UNUSED)
{
slab *s = (slab *) r;
int cnt = 0;
}
static void
-slab_dump(resource *r)
+slab_dump(resource *r, unsigned indent UNUSED)
{
slab *s = (slab *) r;
int ec=0, pc=0, fc=0;
WALK_TLIST(sl_head, h, &s->full_heads)
fc++;
debug("(%de+%dp+%df blocks per %d objs per %d bytes)\n", ec, pc, fc, s->objs_per_slab, s->obj_size);
+
+ char x[16];
+ bsprintf(x, "%%%ds%%s %%p\n", indent + 2);
+ WALK_TLIST(sl_head, h, &s->full_heads)
+ debug(x, "", "full", h);
+ WALK_TLIST(sl_head, h, &s->partial_heads)
+ debug(x, "", "partial", h);
+ WALK_TLIST(sl_head, h, &s->empty_heads)
+ debug(x, "", "empty", h);
}
static struct resmem
}
static void
-tm_dump(resource *r)
+tm_dump(resource *r, unsigned indent UNUSED)
{
timer *t = (void *) r;
CF_CLI_HELP(DUMP, ..., [[Dump debugging information]])
CF_CLI(DUMP RESOURCES,,, [[Dump all allocated resource]])
-{ rdump(&root_pool); cli_msg(0, ""); } ;
+{ rdump(&root_pool, 0); cli_msg(0, ""); } ;
CF_CLI(DUMP SOCKETS,,, [[Dump open sockets]])
{ sk_dump_all(); cli_msg(0, ""); } ;
CF_CLI(DUMP EVENTS,,, [[Dump event log]])
}
static void
-olock_dump(resource *r)
+olock_dump(resource *r, unsigned indent UNUSED)
{
struct object_lock *l = (struct object_lock *) r;
static char *olock_states[] = { "free", "locked", "waiting", "event" };
}
static void
-ea_class_ref_dump(resource *r)
+ea_class_ref_dump(resource *r, unsigned indent UNUSED)
{
struct ea_class_ref *ref = SKIP_BACK(struct ea_class_ref, r, r);
debug("name \"%s\", type=%d\n", ref->class->name, ref->class->type);
}
static void
-rt_res_dump(resource *_r)
+rt_res_dump(resource *_r, unsigned indent)
{
struct rtable_private *r = SKIP_BACK(struct rtable_private, r, _r);
debug("name \"%s\", addr_type=%s, rt_count=%u, use_count=%d\n",
r->name, net_label[r->addr_type], r->rt_count, r->use_count);
+
+ char x[32];
+ bsprintf(x, "%%%dspending export %%p\n", indent + 2);
+
+ node *n;
+ WALK_LIST(n, r->exporter.pending)
+ debug(x, "", n);
}
static struct resclass rt_class = {
}
static void
-bfd_request_dump(resource *r)
+bfd_request_dump(resource *r, unsigned indent UNUSED)
{
struct bfd_request *req = (struct bfd_request *) r;
HASH_WALK_END;
}
-static void bgp_pending_tx_dump(resource *r UNUSED) { debug("\n"); }
+static void bgp_pending_tx_dump(resource *r UNUSED, unsigned indent UNUSED) { debug("\n"); }
static struct resclass bgp_pending_tx_class = {
.name = "BGP Pending TX",
}
static void
-rf_dump(resource *r)
+rf_dump(resource *r, unsigned indent UNUSED)
{
struct rfile *a = (struct rfile *) r;
}
static void
-sk_dump(resource *r)
+sk_dump(resource *r, unsigned indent UNUSED)
{
sock *s = (sock *) r;
static char *sk_type_names[] = { "TCP<", "TCP>", "TCP", "UDP", NULL, "IP", NULL, "MAGIC", "UNIX<", "UNIX", "SSH>", "SSH", "DEL!" };
{
s = SKIP_BACK(sock, n, n);
debug("%p ", s);
- sk_dump(&s->r);
+ sk_dump(&s->r, 3);
}
debug("\n");
}
{
debug("INTERNAL STATE DUMP\n\n");
- rdump(&root_pool);
+ rdump(&root_pool, 0);
sk_dump_all();
// XXXX tm_dump_all();
if_dump_all();