diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-06-24 21:32:39 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-06-24 21:32:39 +0200 |
commit | 2c6b282d4b4a22e511e8cced48263fd0bc9cc6da (patch) | |
tree | 8676f387bde84ac09326bc8960e537428349f714 /service.c | |
parent | b17d66a55a8ed4124d98f8c80e7a3b7122650c5a (diff) | |
download | unitd-2c6b282d4b4a22e511e8cced48263fd0bc9cc6da.tar unitd-2c6b282d4b4a22e511e8cced48263fd0bc9cc6da.zip |
dump status info
Diffstat (limited to 'service.c')
-rw-r--r-- | service.c | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -148,6 +148,20 @@ free: return ret; } +static void +service_dump(struct service *s) +{ + struct service_instance *in; + void *c, *i; + + c = blobmsg_open_table(&b, s->name); + i = blobmsg_open_table(&b, "instances"); + vlist_for_each_element(&s->instances, in, node) + instance_dump(&b, in); + blobmsg_close_table(&b, i); + blobmsg_close_table(&b, c); +} + static int service_handle_list(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, @@ -156,12 +170,8 @@ service_handle_list(struct ubus_context *ctx, struct ubus_object *obj, struct service *s; blob_buf_init(&b, 0); - avl_for_each_element(&services, s, avl) { - void *c; - - c = blobmsg_open_table(&b, s->name); - blobmsg_close_table(&b, c); - } + avl_for_each_element(&services, s, avl) + service_dump(s); ubus_send_reply(ctx, req, b.head); |