diff --git a/include/villas/node.h b/include/villas/node.h index 06c0dcc09..29c312124 100644 --- a/include/villas/node.h +++ b/include/villas/node.h @@ -158,4 +158,7 @@ int node_write(struct node *n, struct sample *smps[], unsigned cnt); int node_fd(struct node *n); +struct memtype * node_memtype(struct node *n, struct memtype *parent); + + /** @} */ diff --git a/include/villas/node_type.h b/include/villas/node_type.h index 5e6a47d4f..6de269f52 100644 --- a/include/villas/node_type.h +++ b/include/villas/node_type.h @@ -30,6 +30,7 @@ #include "list.h" #include "common.h" +#include "memory.h" /* Forward declarations */ struct node; @@ -149,6 +150,9 @@ struct node_type { /** Return a file descriptor which can be used by poll / select to detect the availability of new data. */ int (*fd)(struct node *n); + + /** */ + struct memtype * (*memtype)(struct node *n, struct memtype *parent); }; /** Initialize all registered node type subsystems. diff --git a/lib/node.c b/lib/node.c index 7a8c02f99..eae2583e9 100644 --- a/lib/node.c +++ b/lib/node.c @@ -544,6 +544,11 @@ int node_fd(struct node *n) return n->_vt->fd ? n->_vt->fd(n) : -1; } +struct memtype * node_memtype(struct node *n, struct memtype *parent) +{ + return n->_vt->memtype ? n->_vt->memtype(n) : &memtype_huge; +} + int node_parse_list(struct list *list, json_t *cfg, struct list *all) { struct node *node;