mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
node: add new option to skip loading of default hooks
This commit is contained in:
parent
05d37fabda
commit
759fb0072e
2 changed files with 18 additions and 13 deletions
|
@ -47,6 +47,7 @@ struct node
|
|||
char *_name; /**< Singleton: A string used to print to screen. */
|
||||
char *_name_long; /**< Singleton: A string used to print to screen. */
|
||||
|
||||
int no_builtin;
|
||||
int vectorize; /**< Number of messages to send / recv at once (scatter / gather) */
|
||||
int affinity; /**< CPU Affinity of this node */
|
||||
int samplelen; /**< The maximum number of values this node can receive. */
|
||||
|
|
30
lib/node.c
30
lib/node.c
|
@ -50,6 +50,7 @@ int node_init(struct node *n, struct node_type *vt)
|
|||
|
||||
/* Default values */
|
||||
n->vectorize = 1;
|
||||
n->no_builtin = 0;
|
||||
n->samplelen = DEFAULT_SAMPLELEN;
|
||||
|
||||
list_push(&vt->instances, n);
|
||||
|
@ -57,22 +58,24 @@ int node_init(struct node *n, struct node_type *vt)
|
|||
list_init(&n->hooks);
|
||||
|
||||
/* Add internal hooks if they are not already in the list */
|
||||
for (size_t i = 0; i < list_length(&plugins); i++) {
|
||||
struct plugin *q = (struct plugin *) list_at(&plugins, i);
|
||||
if (!n->no_builtin) {
|
||||
for (size_t i = 0; i < list_length(&plugins); i++) {
|
||||
struct plugin *q = (struct plugin *) list_at(&plugins, i);
|
||||
|
||||
if (q->type != PLUGIN_TYPE_HOOK)
|
||||
continue;
|
||||
if (q->type != PLUGIN_TYPE_HOOK)
|
||||
continue;
|
||||
|
||||
struct hook_type *vt = &q->hook;
|
||||
struct hook_type *vt = &q->hook;
|
||||
|
||||
if ((vt->flags & HOOK_NODE) && (vt->flags & HOOK_BUILTIN)) {
|
||||
struct hook *h = (struct hook *) alloc(sizeof(struct hook));
|
||||
if ((vt->flags & HOOK_NODE) && (vt->flags & HOOK_BUILTIN)) {
|
||||
struct hook *h = (struct hook *) alloc(sizeof(struct hook));
|
||||
|
||||
ret = hook_init(h, vt, NULL, n);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = hook_init(h, vt, NULL, n);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
list_push(&n->hooks, h);
|
||||
list_push(&n->hooks, h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,11 +104,12 @@ int node_parse(struct node *n, json_t *cfg, const char *name)
|
|||
|
||||
n->name = strdup(name);
|
||||
|
||||
ret = json_unpack_ex(cfg, &err, 0, "{ s: s, s?: i, s?: i, s?: o }",
|
||||
ret = json_unpack_ex(cfg, &err, 0, "{ s: s, s?: i, s?: i, s?: o, s?: b }",
|
||||
"type", &type,
|
||||
"vectorize", &n->vectorize,
|
||||
"samplelen", &n->samplelen,
|
||||
"hooks", &json_hooks
|
||||
"hooks", &json_hooks,
|
||||
"no_builtin", &n->no_builtin
|
||||
);
|
||||
if (ret)
|
||||
jerror(&err, "Failed to parse node '%s'", node_name(n));
|
||||
|
|
Loading…
Add table
Reference in a new issue