diff --git a/include/villas/hook.h b/include/villas/hook.h index 6856a9684..ac6132de2 100644 --- a/include/villas/hook.h +++ b/include/villas/hook.h @@ -97,6 +97,7 @@ struct hook_type { enum hook_when when; /**< The type of the hook as a bitfield */ hook_cb_t cb; /**< The hook callback function as a function pointer. */ int priority; /**< Default priority of this hook type. */ + size_t size; /**< Size of allocation for struct hook::_vd */ }; /** Descriptor for user defined hooks. See hooks[]. */ @@ -133,17 +134,6 @@ int hook_destroy(struct hook *h); /** Compare two hook functions with their priority. Used by list_sort() */ int hook_cmp_priority(const void *a, const void *b); -/** Allocate & deallocate private memory per hook. - * - * Hooks which use this function must be flagged with HOOL_STORAGE. - * - * @param h A pointer to the hook structure. - * @param when Which event cause the hook to be executed? - * @param len The size of hook prvate memory allocation. - * @return A pointer to the allocated memory region or NULL after it was released. - */ -void * hook_storage(struct hook *h, int when, size_t len, ctor_cb_t ctor, dtor_cb_t dtor); - /** Parses an object of hooks * * Example: diff --git a/lib/hooks/convert.c b/lib/hooks/convert.c index a5bd9ad76..5116ab710 100644 --- a/lib/hooks/convert.c +++ b/lib/hooks/convert.c @@ -48,7 +48,7 @@ static int hook_convert(struct hook *h, int when, struct hook_info *j) } } - return j->count; + break; } return 0; diff --git a/lib/hooks/fix_ts.c b/lib/hooks/fix_ts.c index ee56a3fa7..0b597daa4 100644 --- a/lib/hooks/fix_ts.c +++ b/lib/hooks/fix_ts.c @@ -34,7 +34,7 @@ int hook_fix_ts(struct hook *h, int when, struct hook_info *j) j->samples[i]->ts.origin = now; } - return j->count; + return 0; } static struct plugin p = { diff --git a/lib/hooks/print.c b/lib/hooks/print.c index c73378d31..0ef957cff 100644 --- a/lib/hooks/print.c +++ b/lib/hooks/print.c @@ -52,7 +52,7 @@ static int hook_print(struct hook *h, int when, struct hook_info *j) break; } - return j->count; + return 0; } static struct plugin p = { diff --git a/lib/hooks/restart.c b/lib/hooks/restart.c index 05c8c6105..941bddaae 100644 --- a/lib/hooks/restart.c +++ b/lib/hooks/restart.c @@ -33,7 +33,7 @@ static int hook_restart(struct hook *h, int when, struct hook_info *j) h->prev = h->last; } - return j->count; + return 0; } static struct plugin p = { diff --git a/lib/hooks/shift.c b/lib/hooks/shift.c index aeaf32658..b61f1b302 100644 --- a/lib/hooks/shift.c +++ b/lib/hooks/shift.c @@ -95,7 +95,7 @@ static int hook_shift(struct hook *h, int when, struct hook_info *j) } } - return j->count; + break; } return 0; diff --git a/lib/hooks/skip_first.c b/lib/hooks/skip_first.c index 6fca7b883..8597d423c 100644 --- a/lib/hooks/skip_first.c +++ b/lib/hooks/skip_first.c @@ -111,8 +111,8 @@ static int hook_skip_first(struct hook *h, int when, struct hook_info *j) * only the first 'ok' samples in 'smps[]' are accepted and further processed. */ } - - return ok; + + j->count = ok; } return 0; diff --git a/lib/hooks/stats.c b/lib/hooks/stats.c index 2e03c48d3..0d65350ed 100644 --- a/lib/hooks/stats.c +++ b/lib/hooks/stats.c @@ -102,7 +102,7 @@ static int hook_stats(struct hook *h, int when, struct hook_info *j) break; } - return j->count; + return 0; } struct stats_send { diff --git a/lib/hooks/ts.c b/lib/hooks/ts.c index 3b2d41758..bac2f5e2b 100644 --- a/lib/hooks/ts.c +++ b/lib/hooks/ts.c @@ -19,7 +19,7 @@ static int hook_ts(struct hook *h, int when, struct hook_info *j) for (int i = 0; i < j->count; i++) j->samples[i]->ts.origin = j->samples[i]->ts.received; - return j->count; + return 0; } static struct plugin p = {