mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-30 00:00:11 +01:00
node: add new function node_memtype() to get node specific memory allocators
This commit is contained in:
parent
1e2d4158f0
commit
9ecdb54832
3 changed files with 12 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue