mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
path: add dedicated functions for path_{source,destination}_prepare()
This commit is contained in:
parent
3c13f67930
commit
33ceb2f46c
5 changed files with 25 additions and 6 deletions
|
@ -41,7 +41,9 @@ struct vpath_destination {
|
|||
struct queue queue;
|
||||
};
|
||||
|
||||
int path_destination_init(struct vpath_destination *pd, int queuelen);
|
||||
int path_destination_init(struct vpath_destination *pd);
|
||||
|
||||
int path_destination_prepare(struct vpath_destination *pd, int queuelen);
|
||||
|
||||
int path_destination_destroy(struct vpath_destination *pd);
|
||||
|
||||
|
|
|
@ -47,6 +47,8 @@ struct vpath_source {
|
|||
|
||||
int path_source_init(struct vpath_source *ps);
|
||||
|
||||
int path_source_prepare(struct vpath_source *ps);
|
||||
|
||||
int path_source_destroy(struct vpath_source *ps);
|
||||
|
||||
int path_source_read(struct vpath_source *ps, struct vpath *p, int i);
|
||||
|
|
|
@ -236,7 +236,7 @@ int path_prepare(struct vpath *p)
|
|||
if (node_type(pd->node)->memory_type)
|
||||
pool_mt = node_memory_type(pd->node);
|
||||
|
||||
ret = path_destination_init(pd, p->queuelen);
|
||||
ret = path_destination_prepare(pd, p->queuelen);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ int path_prepare(struct vpath *p)
|
|||
for (size_t i = 0; i < vlist_length(&p->sources); i++) {
|
||||
struct vpath_source *ps = (struct vpath_source *) vlist_at(&p->sources, i);
|
||||
|
||||
ret = path_source_init(ps);
|
||||
ret = path_source_prepare(ps);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -433,8 +433,8 @@ int path_parse(struct vpath *p, json_t *cfg, struct vlist *nodes)
|
|||
if (!pd)
|
||||
throw MemoryAllocationError();
|
||||
|
||||
pd->node = n;
|
||||
pd->node->output_path = p;
|
||||
path_destination_init(pd);
|
||||
|
||||
|
||||
if (!node_is_enabled(pd->node)) {
|
||||
p->logger->error("Destination {} of path {} is not enabled", node_name(pd->node), path_name(p));
|
||||
|
|
|
@ -27,7 +27,13 @@
|
|||
#include <villas/path.h>
|
||||
#include <villas/path_destination.h>
|
||||
|
||||
int path_destination_init(struct vpath_destination *pd, int queuelen)
|
||||
int path_destination_init(struct vpath_destination *pd)
|
||||
{
|
||||
pd->node = n;
|
||||
pd->node->output_path = p;
|
||||
}
|
||||
|
||||
int path_destination_prepare(struct vpath_destination *pd, int queuelen)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -30,6 +30,15 @@
|
|||
#include <villas/path_source.h>
|
||||
|
||||
int path_source_init(struct vpath_source *ps)
|
||||
{
|
||||
ps->node = me->node;
|
||||
ps->masked = false;
|
||||
|
||||
vlist_init(&ps->mappings);
|
||||
vlist_init(&ps->secondaries);
|
||||
}
|
||||
|
||||
int path_source_prepare(struct vpath_source *ps)
|
||||
{
|
||||
int ret;
|
||||
int pool_size = MAX(DEFAULT_QUEUE_LENGTH, ps->node->in.vectorize);
|
||||
|
|
Loading…
Add table
Reference in a new issue