summaryrefslogtreecommitdiff
path: root/name.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-19 00:22:34 +0100
committerLennart Poettering <lennart@poettering.net>2010-01-19 00:22:34 +0100
commita66d02c3290008d50b2b52f84cfbf46a546ba831 (patch)
treeba2c64f260e8a256c93f5b722dc926d2343b15ca /name.c
parent4609154d5513108478f603ff1589e486c001daa9 (diff)
add functions for dumping server state
Diffstat (limited to 'name.c')
-rw-r--r--name.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/name.c b/name.c
index f29ce2298b..80ce5d5b36 100644
--- a/name.c
+++ b/name.c
@@ -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);
+ }
+}