diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-01-19 00:22:34 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-01-19 00:22:34 +0100 |
commit | a66d02c3290008d50b2b52f84cfbf46a546ba831 (patch) | |
tree | ba2c64f260e8a256c93f5b722dc926d2343b15ca /name.c | |
parent | 4609154d5513108478f603ff1589e486c001daa9 (diff) |
add functions for dumping server state
Diffstat (limited to 'name.c')
-rw-r--r-- | name.c | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -112,7 +112,6 @@ static void bidi_set_free(Name *name, Set *s) { Name *other; assert(name); - assert(s); /* Frees the set and makes sure we are dropped from the * inverse pointers */ @@ -360,3 +359,31 @@ int name_merge(Name *name, Name *other) { return 0; } + +const char* name_id(Name *n) { + assert(n); + + return set_first(n->meta.names); +} + +void name_dump(Name *n, FILE *f) { + + static const char* const state_table[_NAME_STATE_MAX] = { + [NAME_STUB] = "STUB", + [NAME_LOADED] = "LOADED", + [NAME_FAILED] = "FAILED" + }; + + assert(n); + + fprintf(stderr, + "Name %s (%s), state %s\n", + name_id(n), + n->meta.description ? n->meta.description : name_id(n), + state_table[n->meta.state]); + + if (n->meta.job) { + fprintf(f, "\tâ–¶ "); + job_dump(n->meta.job, f); + } +} |