From a9f5b782f676a69c571664e5fb355cca9ce58530 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 6 Feb 2019 15:11:08 +0100 Subject: [PATCH] fixups for separation of in/out signals --- lib/hooks/cast.c | 2 +- lib/hooks/print.c | 2 +- lib/nodes/iec61850_sv.c | 6 +++--- lib/nodes/websocket.c | 2 +- lib/path.c | 4 ++-- src/villas-signal.cpp | 4 ++-- tests/unit/mapping.cpp | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/hooks/cast.c b/lib/hooks/cast.c index a9327294c..c74b41563 100644 --- a/lib/hooks/cast.c +++ b/lib/hooks/cast.c @@ -46,7 +46,7 @@ static int cast_init(struct hook *h) struct vlist *orig_signals; if (h->node) - orig_signals = &h->node->signals; + orig_signals = &h->node->in.signals; else if (h->path) orig_signals = &h->path->signals; else diff --git a/lib/hooks/print.c b/lib/hooks/print.c index a8df079bd..ce930ff00 100644 --- a/lib/hooks/print.c +++ b/lib/hooks/print.c @@ -59,7 +59,7 @@ static int print_start(struct hook *h) struct vlist *signals; if (h->node) - signals = &h->node->signals; + signals = &h->node->in.signals; else if (h->path) signals = &h->path->signals; else diff --git a/lib/nodes/iec61850_sv.c b/lib/nodes/iec61850_sv.c index 20b70acae..9cf2e193c 100644 --- a/lib/nodes/iec61850_sv.c +++ b/lib/nodes/iec61850_sv.c @@ -207,7 +207,7 @@ int iec61850_sv_parse(struct node *n, json_t *json) if (ret) jerror(&err, "Failed to parse configuration of node %s", node_name(n)); - ret = iec61850_parse_signals(json_signals, &i->in.signals, &n->signals); + ret = iec61850_parse_signals(json_signals, &i->in.signals, &n->in.signals); if (ret <= 0) error("Failed to parse setting 'signals' of node %s", node_name(n)); @@ -290,7 +290,7 @@ int iec61850_sv_start(struct node *n) SVReceiver_addSubscriber(i->in.receiver, i->in.subscriber); /* Initialize pool and queue to pass samples between threads */ - ret = pool_init(&i->in.pool, 1024, SAMPLE_LENGTH(vlist_length(&n->signals)), &memory_hugepage); + ret = pool_init(&i->in.pool, 1024, SAMPLE_LENGTH(vlist_length(&n->in.signals)), &memory_hugepage); if (ret) return ret; @@ -300,7 +300,7 @@ int iec61850_sv_start(struct node *n) for (unsigned k = 0; k < vlist_length(&i->in.signals); k++) { struct iec61850_type_descriptor *m = (struct iec61850_type_descriptor *) vlist_at(&i->in.signals, k); - struct signal *sig = (struct signal *) vlist_at(&n->signals, k); + struct signal *sig = (struct signal *) vlist_at(&n->in.signals, k); if (sig->type == SIGNAL_TYPE_AUTO) sig->type = m->format; diff --git a/lib/nodes/websocket.c b/lib/nodes/websocket.c index 80ec10f7a..308e7e16d 100644 --- a/lib/nodes/websocket.c +++ b/lib/nodes/websocket.c @@ -88,7 +88,7 @@ static int websocket_connection_init(struct websocket_connection *c) if (ret) return ret; - ret = io_init(&c->io, c->format, &c->node->signals, SAMPLE_HAS_ALL & ~SAMPLE_HAS_OFFSET); + ret = io_init(&c->io, c->format, &c->node->in.signals, SAMPLE_HAS_ALL & ~SAMPLE_HAS_OFFSET); if (ret) return ret; diff --git a/lib/path.c b/lib/path.c index 41872b98e..aaa90ee72 100644 --- a/lib/path.c +++ b/lib/path.c @@ -51,7 +51,7 @@ static int path_source_init(struct path_source *ps) if (ps->node->_vt->pool_size) pool_size = ps->node->_vt->pool_size; - ret = pool_init(&ps->pool, pool_size, SAMPLE_LENGTH(vlist_length(&ps->node->signals)), node_memory_type(ps->node, &memory_hugepage)); + ret = pool_init(&ps->pool, pool_size, SAMPLE_LENGTH(vlist_length(&ps->node->in.signals)), node_memory_type(ps->node, &memory_hugepage)); if (ret) return ret; @@ -453,7 +453,7 @@ int path_init2(struct path *p) /* For data mappings we simple refer to the existing * signal descriptors of the source node. */ if (me->type == MAPPING_TYPE_DATA) { - sig = (struct signal *) vlist_at_safe(&me->node->signals, me->data.offset + j); + sig = (struct signal *) vlist_at_safe(&me->node->in.signals, me->data.offset + j); if (!sig) { warning("Failed to create signal description for path %s", path_name(p)); continue; diff --git a/src/villas-signal.cpp b/src/villas-signal.cpp index 6a323c0e3..9270e1beb 100644 --- a/src/villas-signal.cpp +++ b/src/villas-signal.cpp @@ -222,7 +222,7 @@ int main(int argc, char *argv[]) if (ret) throw RuntimeError("Failed to verify node configuration"); - ret = pool_init(&q, 16, SAMPLE_LENGTH(vlist_length(&n.signals)), &memory_heap); + ret = pool_init(&q, 16, SAMPLE_LENGTH(vlist_length(&n.in.signals)), &memory_heap); if (ret) throw RuntimeError("Failed to initialize pool"); @@ -234,7 +234,7 @@ int main(int argc, char *argv[]) if (ret) throw RuntimeError("Failed to start node {}: reason={}", node_name(&n), ret); - ret = io_init(&io, ft, &n.signals, IO_FLUSH | (SAMPLE_HAS_ALL & ~SAMPLE_HAS_OFFSET)); + ret = io_init(&io, ft, &n.in.signals, IO_FLUSH | (SAMPLE_HAS_ALL & ~SAMPLE_HAS_OFFSET)); if (ret) throw RuntimeError("Failed to initialize output"); diff --git a/tests/unit/mapping.cpp b/tests/unit/mapping.cpp index 982f5ca37..91d2a290c 100644 --- a/tests/unit/mapping.cpp +++ b/tests/unit/mapping.cpp @@ -88,7 +88,7 @@ Test(mapping, parse_nodes) cr_assert_eq(m.node, vlist_lookup(&nodes, "carrot")); cr_assert_eq(m.type, MAPPING_TYPE_DATA); cr_assert_eq(m.data.offset, 0); - cr_assert_eq(m.length, vlist_length(&m.node->signals)); + cr_assert_eq(m.length, vlist_length(&m.node->in.signals)); ret = mapping_parse_str(&m, "carrot.data[sole]", &nodes); cr_assert_eq(ret, 0);