diff --git a/include/villas/hook.h b/include/villas/hook.h index ac938847e..05606064c 100644 --- a/include/villas/hook.h +++ b/include/villas/hook.h @@ -69,11 +69,11 @@ int hook_stop(struct hook *h); int hook_periodic(struct hook *h); int hook_restart(struct hook *h); -int hook_read(struct hook *h, struct sample *smps[], size_t *cnt); -int hook_write(struct hook *h, struct sample *smps[], size_t *cnt); +int hook_read(struct hook *h, struct sample *smps[], unsigned *cnt); +int hook_write(struct hook *h, struct sample *smps[], unsigned *cnt); -size_t hook_read_list(struct list *hs, struct sample *smps[], size_t cnt); -size_t hook_write_list(struct list *hs, struct sample *smps[], size_t cnt); +int hook_read_list(struct list *hs, struct sample *smps[], unsigned cnt); +int hook_write_list(struct list *hs, struct sample *smps[], unsigned cnt); /** Compare two hook functions with their priority. Used by list_sort() */ int hook_cmp_priority(const void *a, const void *b); diff --git a/include/villas/hook_type.h b/include/villas/hook_type.h index 400e42b50..edebde0a5 100644 --- a/include/villas/hook_type.h +++ b/include/villas/hook_type.h @@ -61,6 +61,6 @@ struct hook_type { int (*periodic)(struct hook *h);/**< Called periodically. Period is set by global 'stats' option in the configuration file. */ int (*restart)(struct hook *h); /**< Called whenever a new simulation case is started. This is detected by a sequence no equal to zero. */ - int (*read)(struct hook *h, struct sample *smps[], size_t *cnt); /**< Called for every single received samples. */ - int (*write)(struct hook *h, struct sample *smps[], size_t *cnt); /**< Called for every single sample which will be sent. */ + int (*read)(struct hook *h, struct sample *smps[], unsigned *cnt); /**< Called for every single received samples. */ + int (*write)(struct hook *h, struct sample *smps[], unsigned *cnt); /**< Called for every single sample which will be sent. */ }; diff --git a/lib/hook.c b/lib/hook.c index 7f261666d..31efa38a0 100644 --- a/lib/hook.c +++ b/lib/hook.c @@ -144,23 +144,23 @@ int hook_restart(struct hook *h) return h->_vt->restart ? h->_vt->restart(h) : 0; } -int hook_read(struct hook *h, struct sample *smps[], size_t *cnt) +int hook_read(struct hook *h, struct sample *smps[], unsigned *cnt) { - debug(LOG_HOOK | 10, "Running hook %s: type=read, priority=%d, cnt=%zu", plugin_name(h->_vt), h->priority, *cnt); + debug(LOG_HOOK | 10, "Running hook %s: type=read, priority=%d, cnt=%u", plugin_name(h->_vt), h->priority, *cnt); return h->_vt->read ? h->_vt->read(h, smps, cnt) : 0; } -int hook_write(struct hook *h, struct sample *smps[], size_t *cnt) +int hook_write(struct hook *h, struct sample *smps[], unsigned *cnt) { - debug(LOG_HOOK | 10, "Running hook %s: type=write, priority=%d, cnt=%zu", plugin_name(h->_vt), h->priority, *cnt); + debug(LOG_HOOK | 10, "Running hook %s: type=write, priority=%d, cnt=%u", plugin_name(h->_vt), h->priority, *cnt); return h->_vt->write ? h->_vt->write(h, smps, cnt) : 0; } -size_t hook_read_list(struct list *hs, struct sample *smps[], size_t cnt) +int hook_read_list(struct list *hs, struct sample *smps[], unsigned cnt) { - size_t ret; + unsigned ret; for (size_t i = 0; i < list_length(hs); i++) { struct hook *h = list_at(hs, i); @@ -175,9 +175,9 @@ size_t hook_read_list(struct list *hs, struct sample *smps[], size_t cnt) return cnt; } -size_t hook_write_list(struct list *hs, struct sample *smps[], size_t cnt) +int hook_write_list(struct list *hs, struct sample *smps[], unsigned cnt) { - size_t ret; + unsigned ret; for (size_t i = 0; i < list_length(hs); i++) { struct hook *h = list_at(hs, i); diff --git a/lib/hooks/convert.c b/lib/hooks/convert.c index 399759d1e..853e1815e 100644 --- a/lib/hooks/convert.c +++ b/lib/hooks/convert.c @@ -75,7 +75,7 @@ static int convert_parse(struct hook *h, json_t *cfg) return 0; } -static int convert_read(struct hook *h, struct sample *smps[], size_t *cnt) +static int convert_read(struct hook *h, struct sample *smps[], unsigned *cnt) { struct convert *p = h->_vd; diff --git a/lib/hooks/decimate.c b/lib/hooks/decimate.c index adc321f31..58a74df80 100644 --- a/lib/hooks/decimate.c +++ b/lib/hooks/decimate.c @@ -57,7 +57,7 @@ static int decimate_parse(struct hook *h, json_t *cfg) return 0; } -static int decimate_read(struct hook *h, struct sample *smps[], size_t *cnt) +static int decimate_read(struct hook *h, struct sample *smps[], unsigned *cnt) { struct decimate *p = h->_vd; diff --git a/lib/hooks/drop.c b/lib/hooks/drop.c index 844bb620d..531927f63 100644 --- a/lib/hooks/drop.c +++ b/lib/hooks/drop.c @@ -53,7 +53,7 @@ static int drop_stop(struct hook *h) return 0; } -static int drop_read(struct hook *h, struct sample *smps[], size_t *cnt) +static int drop_read(struct hook *h, struct sample *smps[], unsigned *cnt) { int i, ok, dist; diff --git a/lib/hooks/fix_ts.c b/lib/hooks/fix_ts.c index 8fa2190f6..8c016dd58 100644 --- a/lib/hooks/fix_ts.c +++ b/lib/hooks/fix_ts.c @@ -29,7 +29,7 @@ #include "timing.h" #include "sample.h" -int fix_ts_read(struct hook *h, struct sample *smps[], size_t *cnt) +int fix_ts_read(struct hook *h, struct sample *smps[], unsigned *cnt) { struct timespec now; diff --git a/lib/hooks/jitter_calc.c b/lib/hooks/jitter_calc.c index d4444bb46..de7f3d947 100644 --- a/lib/hooks/jitter_calc.c +++ b/lib/hooks/jitter_calc.c @@ -86,7 +86,7 @@ int jitter_calc_deinit(struct hook *h) * is high (i.e. several mins depending on GPS_NTP_DELAY_WIN_SIZE), * the variance value will overrun the 64bit value. */ -int jitter_calc_read(struct hook *h, struct sample *smps[], size_t *cnt) +int jitter_calc_read(struct hook *h, struct sample *smps[], unsigned *cnt) { struct jitter_calc *j = h->_vd; diff --git a/lib/hooks/map.c b/lib/hooks/map.c index b5766805c..7b75f02d7 100644 --- a/lib/hooks/map.c +++ b/lib/hooks/map.c @@ -71,7 +71,7 @@ static int map_parse(struct hook *h, json_t *cfg) return 0; } -static int map_read(struct hook *h, struct sample *smps[], size_t *cnt) +static int map_read(struct hook *h, struct sample *smps[], unsigned *cnt) { int ret; struct map *p = h->_vd; diff --git a/lib/hooks/print.c b/lib/hooks/print.c index 51f31efde..95e6db77a 100644 --- a/lib/hooks/print.c +++ b/lib/hooks/print.c @@ -109,7 +109,7 @@ static int print_parse(struct hook *h, json_t *cfg) return 0; } -static int print_read(struct hook *h, struct sample *smps[], size_t *cnt) +static int print_read(struct hook *h, struct sample *smps[], unsigned *cnt) { struct print *p = h->_vd; diff --git a/lib/hooks/restart.c b/lib/hooks/restart.c index e83acff5a..76ce49fd8 100644 --- a/lib/hooks/restart.c +++ b/lib/hooks/restart.c @@ -52,7 +52,7 @@ static int restart_stop(struct hook *h) return 0; } -static int restart_read(struct hook *h, struct sample *smps[], size_t *cnt) +static int restart_read(struct hook *h, struct sample *smps[], unsigned *cnt) { int i; struct restart *r = h->_vd; diff --git a/lib/hooks/shift_seq.c b/lib/hooks/shift_seq.c index 153a2e721..459fed9a1 100644 --- a/lib/hooks/shift_seq.c +++ b/lib/hooks/shift_seq.c @@ -48,7 +48,7 @@ static int shift_seq_parse(struct hook *h, json_t *cfg) return 0; } -static int shift_seq_read(struct hook *h, struct sample *smps[], size_t *cnt) +static int shift_seq_read(struct hook *h, struct sample *smps[], unsigned *cnt) { struct shift *p = h->_vd; diff --git a/lib/hooks/shift_ts.c b/lib/hooks/shift_ts.c index 9f1acb5fe..9c815279c 100644 --- a/lib/hooks/shift_ts.c +++ b/lib/hooks/shift_ts.c @@ -78,7 +78,7 @@ static int shift_ts_parse(struct hook *h, json_t *cfg) return 0; } -static int shift_ts_read(struct hook *h, struct sample *smps[], size_t *cnt) +static int shift_ts_read(struct hook *h, struct sample *smps[], unsigned *cnt) { struct shift_ts *p = h->_vd; diff --git a/lib/hooks/skip_first.c b/lib/hooks/skip_first.c index 231aa1b1b..c908da62d 100644 --- a/lib/hooks/skip_first.c +++ b/lib/hooks/skip_first.c @@ -89,7 +89,7 @@ static int skip_first_restart(struct hook *h) return 0; } -static int skip_first_read(struct hook *h, struct sample *smps[], size_t *cnt) +static int skip_first_read(struct hook *h, struct sample *smps[], unsigned *cnt) { struct skip_first *p = h->_vd; diff --git a/lib/hooks/stats_collect.c b/lib/hooks/stats_collect.c index 362d4e4f1..538c7cb9c 100644 --- a/lib/hooks/stats_collect.c +++ b/lib/hooks/stats_collect.c @@ -150,7 +150,7 @@ static int stats_collect_parse(struct hook *h, json_t *cfg) return 0; } -static int stats_collect_read(struct hook *h, struct sample *smps[], size_t *cnt) +static int stats_collect_read(struct hook *h, struct sample *smps[], unsigned *cnt) { struct stats_collect *p = h->_vd; diff --git a/lib/hooks/stats_send.c b/lib/hooks/stats_send.c index bd9ace84b..4bfc72241 100644 --- a/lib/hooks/stats_send.c +++ b/lib/hooks/stats_send.c @@ -125,7 +125,7 @@ static int stats_send_periodic(struct hook *h) return 0; } -static int stats_send_read(struct hook *h, struct sample *smps[], size_t *cnt) +static int stats_send_read(struct hook *h, struct sample *smps[], unsigned *cnt) { struct stats_send *p = h->_vd; diff --git a/lib/hooks/ts.c b/lib/hooks/ts.c index c9eb7f0c4..3f078b4de 100644 --- a/lib/hooks/ts.c +++ b/lib/hooks/ts.c @@ -29,7 +29,7 @@ #include "timing.h" #include "sample.h" -static int ts_read(struct hook *h, struct sample *smps[], size_t *cnt) +static int ts_read(struct hook *h, struct sample *smps[], unsigned *cnt) { for (int i = 0; i < *cnt; i++) smps[i]->ts.origin = smps[i]->ts.received;