diff --git a/include/villas/hooks.h b/include/villas/hooks.h index e26d4e8e0..4dee690a8 100644 --- a/include/villas/hooks.h +++ b/include/villas/hooks.h @@ -27,12 +27,14 @@ #include "list.h" /* The configuration of hook parameters is done in "config.h" */ +#include "cfg.h" + /* Forward declarations */ struct path; struct hook; struct sample; -struct settings; +struct cfg; /** This is a list of hooks which can be used in the configuration file. */ extern struct list hooks; @@ -99,7 +101,7 @@ struct hook { }; /** Save references to global nodes, paths and settings */ -void hook_init(struct list *nodes, struct list *paths, struct settings *set); +void hook_init(struct cfg *cfg); /** Sort hook list according to the their priority. See hook::priority. */ int hooks_sort_priority(const void *a, const void *b); diff --git a/include/villas/node.h b/include/villas/node.h index 19111cec4..639ef3c35 100644 --- a/include/villas/node.h +++ b/include/villas/node.h @@ -23,7 +23,6 @@ extern struct list node_types; /**< Vtable for virtual node sub types */ /* Forward declarations */ -struct config_setting_t cfg; struct node_type; /** The data structure for a node. diff --git a/include/villas/utils.h b/include/villas/utils.h index ee5b5c43c..6f9f9b357 100644 --- a/include/villas/utils.h +++ b/include/villas/utils.h @@ -99,7 +99,7 @@ #define BIT(nr) (1UL << (nr)) /* Forward declarations */ -struct settings; +struct cfg; struct timespec; /** Print copyright message to screen. */ diff --git a/lib/hooks.c b/lib/hooks.c index 2e88e2813..7f642f520 100644 --- a/lib/hooks.c +++ b/lib/hooks.c @@ -16,19 +16,15 @@ #include "path.h" #include "utils.h" #include "node.h" +#include "cfg.h" struct list hooks; -/* Those references can be used inside the hook callbacks after initializing them with hook_init() */ -struct list *hook_nodes = NULL; -struct list *hook_paths = NULL; -struct settings *hook_settings = NULL; +struct cfg *cfg = NULL; -void hook_init(struct list *nodes, struct list *paths, struct settings *set) +void hook_init(struct cfg *c) { - hook_nodes = nodes; - hook_paths = paths; - hook_settings = set; + cfg = c; } int hooks_sort_priority(const void *a, const void *b) {