Hi
comments inline
On 25/10/17 17:59, Pierre Lebleu wrote:
It gives the ability to create data within the service itself.
Change since v1:
- dump the data inside the service rather than in a "*" instance.
Signed-off-by: Pierre Lebleu <pme.leb...@gmail.com>
---
service/service.c | 44 +++++++++++++++++++++++++++++++++++++++++---
service/service.h | 3 +++
2 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/service/service.c b/service/service.c
index ce730bc..45cb9aa 100644
--- a/service/service.c
+++ b/service/service.c
@@ -84,6 +84,7 @@ service_alloc(const char *name)
s->name = new_name;
s->avl.key = s->name;
INIT_LIST_HEAD(&s->validators);
+ blobmsg_list_simple_init(&s->firewall);
return s;
}
[ ...]
@@ -266,7 +285,7 @@ service_handle_set(struct ubus_context *ctx, struct
ubus_object *obj,
bool add = !strcmp(method, "add");
int ret;
- blobmsg_parse(service_set_attrs, __SERVICE_SET_MAX, tb, blob_data(msg), blob_len(msg));
+ blobmsg_parse(service_set_attrs, __SERVICE_SET_MAX, tb,
blobmsg_data(msg), blobmsg_data_len(msg));
this looks like a bug fix not related to the actual patch ?
cur = tb[SERVICE_SET_NAME];
if (!cur)
return UBUS_STATUS_INVALID_ARGUMENT;
@@ -306,6 +325,14 @@ service_dump(struct service *s, bool verbose)
if (!s->autostart)
blobmsg_add_u8(&b, "autostart", false);
+ if (!avl_is_empty(&s->firewall.avl)) {
+ struct blobmsg_list_node *var;
+ i = blobmsg_open_table(&b, "data");
+ blobmsg_list_for_each(&s->firewall, var)
+ blobmsg_add_blob(&b, var->data);
+ blobmsg_close_table(&b, i);
+ }
+
if (!avl_is_empty(&s->instances.avl)) {
i = blobmsg_open_table(&b, "instances");
vlist_for_each_element(&s->instances, in, node)
[,,,]
diff --git a/service/service.h b/service/service.h
index a433c9f..2202a9e 100644
--- a/service/service.h
+++ b/service/service.h
@@ -18,6 +18,7 @@
#include <libubox/avl.h>
#include <libubox/vlist.h>
#include <libubox/list.h>
+#include "../utils/utils.h"
extern struct avl_tree services;
@@ -46,6 +47,8 @@ struct service {
struct blob_attr *trigger;
struct vlist_tree instances;
struct list_head validators;
+ struct blob_attr *data;
+ struct blobmsg_list firewall;
can we name this different than firewall ?
John
};
void service_validate_add(struct service *s, struct blob_attr *attr);
_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev