mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
hooks: use unsigned instead of size_t to count samples
This commit is contained in:
parent
5a21d05c40
commit
3519c9b2c8
17 changed files with 28 additions and 28 deletions
|
@ -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);
|
||||
|
|
|
@ -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. */
|
||||
};
|
||||
|
|
16
lib/hook.c
16
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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue