mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
c++: add proper casts from void *
This commit is contained in:
parent
8bb2c740f6
commit
702dc34052
57 changed files with 315 additions and 315 deletions
|
@ -322,7 +322,7 @@ int api_stop(struct api *a)
|
|||
return 0;
|
||||
|
||||
for (int i = 0; i < list_length(&a->sessions); i++) {
|
||||
struct api_session *s = list_at(&a->sessions, i);
|
||||
struct api_session *s = (struct api_session *) list_at(&a->sessions, i);
|
||||
|
||||
s->state = API_SESSION_STATE_SHUTDOWN;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ static int api_capabilities(struct api_action *h, json_t *args, json_t **resp, s
|
|||
json_t *json_name;
|
||||
|
||||
for (size_t i = 0; i < list_length(&plugins); i++) {
|
||||
struct plugin *p = list_at(&plugins, i);
|
||||
struct plugin *p = (struct plugin *) list_at(&plugins, i);
|
||||
|
||||
json_name = json_string(p->name);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ static int api_nodes(struct api_action *r, json_t *args, json_t **resp, struct a
|
|||
json_t *json_nodes = json_array();
|
||||
|
||||
for (size_t i = 0; i < list_length(&s->api->super_node->nodes); i++) {
|
||||
struct node *n = list_at(&s->api->super_node->nodes, i);
|
||||
struct node *n = (struct node *) list_at(&s->api->super_node->nodes, i);
|
||||
|
||||
json_t *json_node = json_pack("{ s: s, s: i, s: i, s: i, s: i }",
|
||||
"name", node_name_short(n),
|
||||
|
|
|
@ -34,7 +34,7 @@ static int api_paths(struct api_action *r, json_t *args, json_t **resp, struct a
|
|||
json_t *json_paths = json_array();
|
||||
|
||||
for (size_t i = 0; i < list_length(&s->api->super_node->paths); i++) {
|
||||
struct path *p = list_at(&s->api->super_node->paths, i);
|
||||
struct path *p = (struct path *) list_at(&s->api->super_node->paths, i);
|
||||
|
||||
json_t *json_path = json_pack("{ s: i }",
|
||||
"state", p->state
|
||||
|
|
|
@ -111,7 +111,7 @@ int fpga_card_parse(struct fpga_card *c, json_t *cfg, const char *name)
|
|||
const char *vlnv;
|
||||
|
||||
struct fpga_ip_type *vt;
|
||||
struct fpga_ip *ip = alloc(sizeof(struct fpga_ip));
|
||||
struct fpga_ip *ip = (struct fpga_ip *) alloc(sizeof(struct fpga_ip));
|
||||
|
||||
ip->card = c;
|
||||
|
||||
|
@ -149,7 +149,7 @@ int fpga_card_parse_list(struct list *cards, json_t *cfg)
|
|||
const char *name;
|
||||
json_t *json_fpga;
|
||||
json_object_foreach(cfg, name, json_fpga) {
|
||||
struct fpga_card *c = alloc(sizeof(struct fpga_card));
|
||||
struct fpga_card *c = (struct fpga_card *) alloc(sizeof(struct fpga_card));
|
||||
|
||||
ret = fpga_card_parse(c, json_fpga, name);
|
||||
if (ret)
|
||||
|
@ -203,7 +203,7 @@ int fpga_card_start(struct fpga_card *c)
|
|||
|
||||
/* Initialize IP cores */
|
||||
for (size_t j = 0; j < list_length(&c->ips); j++) {
|
||||
struct fpga_ip *i = list_at(&c->ips, j);
|
||||
struct fpga_ip *i = (struct fpga_ip *) list_at(&c->ips, j);
|
||||
|
||||
ret = fpga_ip_start(i);
|
||||
if (ret)
|
||||
|
@ -222,7 +222,7 @@ int fpga_card_stop(struct fpga_card *c)
|
|||
assert(c->state == STATE_STOPPED);
|
||||
|
||||
for (size_t j = 0; j < list_length(&c->ips); j++) {
|
||||
struct fpga_ip *i = list_at(&c->ips, j);
|
||||
struct fpga_ip *i = (struct fpga_ip *) list_at(&c->ips, j);
|
||||
|
||||
ret = fpga_ip_stop(i);
|
||||
if (ret)
|
||||
|
@ -247,7 +247,7 @@ void fpga_card_dump(struct fpga_card *c)
|
|||
|
||||
info("IP blocks:");
|
||||
for (size_t j = 0; j < list_length(&c->ips); j++) { INDENT
|
||||
struct fpga_ip *i = list_at(&c->ips, j);
|
||||
struct fpga_ip *i = (struct fpga_ip *) list_at(&c->ips, j);
|
||||
|
||||
fpga_ip_dump(i);
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ struct fpga_ip_type * fpga_ip_type_lookup(const char *vstr)
|
|||
|
||||
/* Try to find matching IP type */
|
||||
for (size_t i = 0; i < list_length(&plugins); i++) {
|
||||
struct plugin *p = list_at(&plugins, i);
|
||||
struct plugin *p = (struct plugin *) list_at(&plugins, i);
|
||||
|
||||
if (p->type == PLUGIN_TYPE_FPGA_IP && !fpga_vlnv_cmp(&vlnv, &p->ip.vlnv))
|
||||
return &p->ip;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
int dft_parse(struct fpga_ip *c, json_t *cfg)
|
||||
{
|
||||
struct dft *dft = c->_vd;
|
||||
struct dft *dft = (struct dft *) c->_vd;
|
||||
|
||||
int ret;
|
||||
|
||||
|
@ -56,7 +56,7 @@ int dft_start(struct fpga_ip *c)
|
|||
int ret;
|
||||
|
||||
struct fpga_card *f = c->card;
|
||||
struct dft *dft = c->_vd;
|
||||
struct dft *dft = (struct dft *) c->_vd;
|
||||
|
||||
XHls_dft *xdft = &dft->inst;
|
||||
XHls_dft_Config xdft_cfg = {
|
||||
|
@ -86,7 +86,7 @@ int dft_start(struct fpga_ip *c)
|
|||
|
||||
int dft_stop(struct fpga_ip *c)
|
||||
{
|
||||
struct dft *dft = c->_vd;
|
||||
struct dft *dft = (struct dft *) c->_vd;
|
||||
|
||||
XHls_dft *xdft = &dft->inst;
|
||||
|
||||
|
@ -97,7 +97,7 @@ int dft_stop(struct fpga_ip *c)
|
|||
|
||||
int dft_destroy(struct fpga_ip *c)
|
||||
{
|
||||
struct dft *dft = c->_vd;
|
||||
struct dft *dft = (struct dft *) c->_vd;
|
||||
|
||||
if (dft->fharmonics) {
|
||||
free(dft->fharmonics);
|
||||
|
|
|
@ -100,7 +100,7 @@ int dma_ping_pong(struct fpga_ip *c, char *src, char *dst, size_t len)
|
|||
|
||||
int dma_write(struct fpga_ip *c, char *buf, size_t len)
|
||||
{
|
||||
struct dma *dma = c->_vd;
|
||||
struct dma *dma = (struct dma *) c->_vd;
|
||||
|
||||
XAxiDma *xdma = &dma->inst;
|
||||
|
||||
|
@ -113,7 +113,7 @@ int dma_write(struct fpga_ip *c, char *buf, size_t len)
|
|||
|
||||
int dma_read(struct fpga_ip *c, char *buf, size_t len)
|
||||
{
|
||||
struct dma *dma = c->_vd;
|
||||
struct dma *dma = (struct dma *) c->_vd;
|
||||
|
||||
XAxiDma *xdma = &dma->inst;
|
||||
|
||||
|
@ -126,7 +126,7 @@ int dma_read(struct fpga_ip *c, char *buf, size_t len)
|
|||
|
||||
int dma_read_complete(struct fpga_ip *c, char **buf, size_t *len)
|
||||
{
|
||||
struct dma *dma = c->_vd;
|
||||
struct dma *dma = (struct dma *) c->_vd;
|
||||
|
||||
XAxiDma *xdma = &dma->inst;
|
||||
|
||||
|
@ -139,7 +139,7 @@ int dma_read_complete(struct fpga_ip *c, char **buf, size_t *len)
|
|||
|
||||
int dma_write_complete(struct fpga_ip *c, char **buf, size_t *len)
|
||||
{
|
||||
struct dma *dma = c->_vd;
|
||||
struct dma *dma = (struct dma *) c->_vd;
|
||||
|
||||
XAxiDma *xdma = &dma->inst;
|
||||
|
||||
|
@ -154,7 +154,7 @@ int dma_sg_write(struct fpga_ip *c, char *buf, size_t len)
|
|||
{
|
||||
int ret, bdcnt;
|
||||
|
||||
struct dma *dma = c->_vd;
|
||||
struct dma *dma = (struct dma *) c->_vd;
|
||||
|
||||
XAxiDma *xdma = &dma->inst;
|
||||
XAxiDma_BdRing *ring = XAxiDma_GetTxRing(xdma);
|
||||
|
@ -231,7 +231,7 @@ int dma_sg_read(struct fpga_ip *c, char *buf, size_t len)
|
|||
{
|
||||
int ret, bdcnt;
|
||||
|
||||
struct dma *dma = c->_vd;
|
||||
struct dma *dma = (struct dma *) c->_vd;
|
||||
|
||||
XAxiDma *xdma = &dma->inst;
|
||||
XAxiDma_BdRing *ring = XAxiDma_GetRxRing(xdma);
|
||||
|
@ -299,7 +299,7 @@ out:
|
|||
|
||||
int dma_sg_write_complete(struct fpga_ip *c, char **buf, size_t *len)
|
||||
{
|
||||
struct dma *dma = c->_vd;
|
||||
struct dma *dma = (struct dma *) c->_vd;
|
||||
|
||||
XAxiDma *xdma = &dma->inst;
|
||||
XAxiDma_BdRing *ring = XAxiDma_GetTxRing(xdma);
|
||||
|
@ -330,7 +330,7 @@ int dma_sg_write_complete(struct fpga_ip *c, char **buf, size_t *len)
|
|||
|
||||
int dma_sg_read_complete(struct fpga_ip *c, char **buf, size_t *len)
|
||||
{
|
||||
struct dma *dma = c->_vd;
|
||||
struct dma *dma = (struct dma *) c->_vd;
|
||||
|
||||
XAxiDma *xdma = &dma->inst;
|
||||
XAxiDma_BdRing *ring = XAxiDma_GetRxRing(xdma);
|
||||
|
@ -384,7 +384,7 @@ int dma_sg_read_complete(struct fpga_ip *c, char **buf, size_t *len)
|
|||
|
||||
int dma_simple_read(struct fpga_ip *c, char *buf, size_t len)
|
||||
{
|
||||
struct dma *dma = c->_vd;
|
||||
struct dma *dma = (struct dma *) c->_vd;
|
||||
|
||||
XAxiDma *xdma = &dma->inst;
|
||||
XAxiDma_BdRing *ring = XAxiDma_GetRxRing(xdma);
|
||||
|
@ -422,7 +422,7 @@ int dma_simple_read(struct fpga_ip *c, char *buf, size_t len)
|
|||
|
||||
int dma_simple_write(struct fpga_ip *c, char *buf, size_t len)
|
||||
{
|
||||
struct dma *dma = c->_vd;
|
||||
struct dma *dma = (struct dma *) c->_vd;
|
||||
|
||||
XAxiDma *xdma = &dma->inst;
|
||||
XAxiDma_BdRing *ring = XAxiDma_GetTxRing(xdma);
|
||||
|
@ -461,7 +461,7 @@ int dma_simple_write(struct fpga_ip *c, char *buf, size_t len)
|
|||
|
||||
int dma_simple_read_complete(struct fpga_ip *c, char **buf, size_t *len)
|
||||
{
|
||||
struct dma *dma = c->_vd;
|
||||
struct dma *dma = (struct dma *) c->_vd;
|
||||
|
||||
XAxiDma *xdma = &dma->inst;
|
||||
XAxiDma_BdRing *ring = XAxiDma_GetRxRing(xdma);
|
||||
|
@ -484,7 +484,7 @@ int dma_simple_read_complete(struct fpga_ip *c, char **buf, size_t *len)
|
|||
|
||||
int dma_simple_write_complete(struct fpga_ip *c, char **buf, size_t *len)
|
||||
{
|
||||
struct dma *dma = c->_vd;
|
||||
struct dma *dma = (struct dma *) c->_vd;
|
||||
|
||||
XAxiDma *xdma = &dma->inst;
|
||||
XAxiDma_BdRing *ring = XAxiDma_GetTxRing(xdma);
|
||||
|
@ -563,7 +563,7 @@ static int dma_init_rings(XAxiDma *xdma, struct dma_mem *bd)
|
|||
int dma_start(struct fpga_ip *c)
|
||||
{
|
||||
int ret, sg;
|
||||
struct dma *dma = c->_vd;
|
||||
struct dma *dma = (struct dma *) c->_vd;
|
||||
|
||||
XAxiDma *xdma = &dma->inst;
|
||||
|
||||
|
@ -618,7 +618,7 @@ int dma_start(struct fpga_ip *c)
|
|||
|
||||
int dma_reset(struct fpga_ip *c)
|
||||
{
|
||||
struct dma *dma = c->_vd;
|
||||
struct dma *dma = (struct dma *) c->_vd;
|
||||
|
||||
XAxiDma_Reset(&dma->inst);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ int fifo_start(struct fpga_ip *c)
|
|||
int ret;
|
||||
|
||||
struct fpga_card *f = c->card;
|
||||
struct fifo *fifo = c->_vd;
|
||||
struct fifo *fifo = (struct fifo *) c->_vd;
|
||||
|
||||
XLlFifo *xfifo = &fifo->inst;
|
||||
XLlFifo_Config fifo_cfg = {
|
||||
|
@ -41,7 +41,7 @@ int fifo_start(struct fpga_ip *c)
|
|||
|
||||
int fifo_stop(struct fpga_ip *c)
|
||||
{
|
||||
struct fifo *fifo = c->_vd;
|
||||
struct fifo *fifo = (struct fifo *) c->_vd;
|
||||
|
||||
XLlFifo *xfifo = &fifo->inst;
|
||||
|
||||
|
@ -52,7 +52,7 @@ int fifo_stop(struct fpga_ip *c)
|
|||
|
||||
ssize_t fifo_write(struct fpga_ip *c, char *buf, size_t len)
|
||||
{
|
||||
struct fifo *fifo = c->_vd;
|
||||
struct fifo *fifo = (struct fifo *) c->_vd;
|
||||
|
||||
XLlFifo *xllfifo = &fifo->inst;
|
||||
|
||||
|
@ -70,7 +70,7 @@ ssize_t fifo_write(struct fpga_ip *c, char *buf, size_t len)
|
|||
|
||||
ssize_t fifo_read(struct fpga_ip *c, char *buf, size_t len)
|
||||
{
|
||||
struct fifo *fifo = c->_vd;
|
||||
struct fifo *fifo = (struct fifo *) c->_vd;
|
||||
|
||||
XLlFifo *xllfifo = &fifo->inst;
|
||||
|
||||
|
@ -93,7 +93,7 @@ ssize_t fifo_read(struct fpga_ip *c, char *buf, size_t len)
|
|||
|
||||
int fifo_parse(struct fpga_ip *c, json_t *cfg)
|
||||
{
|
||||
struct fifo *fifo = c->_vd;
|
||||
struct fifo *fifo = (struct fifo *) c->_vd;
|
||||
|
||||
int baseaddr_axi4 = -1, ret;
|
||||
|
||||
|
@ -112,7 +112,7 @@ int fifo_parse(struct fpga_ip *c, json_t *cfg)
|
|||
|
||||
int fifo_reset(struct fpga_ip *c)
|
||||
{
|
||||
struct fifo *fifo = c->_vd;
|
||||
struct fifo *fifo = (struct fifo *) c->_vd;
|
||||
|
||||
XLlFifo_Reset(&fifo->inst);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ int intc_start(struct fpga_ip *c)
|
|||
int ret;
|
||||
|
||||
struct fpga_card *f = c->card;
|
||||
struct intc *intc = c->_vd;
|
||||
struct intc *intc = (struct intc *) c->_vd;
|
||||
|
||||
uintptr_t base = (uintptr_t) f->map + c->baseaddr;
|
||||
|
||||
|
@ -64,7 +64,7 @@ int intc_start(struct fpga_ip *c)
|
|||
int intc_destroy(struct fpga_ip *c)
|
||||
{
|
||||
struct fpga_card *f = c->card;
|
||||
struct intc *intc = c->_vd;
|
||||
struct intc *intc = (struct intc *) c->_vd;
|
||||
|
||||
vfio_pci_msi_deinit(&f->vfio_device, intc->efds);
|
||||
|
||||
|
@ -74,7 +74,7 @@ int intc_destroy(struct fpga_ip *c)
|
|||
int intc_enable(struct fpga_ip *c, uint32_t mask, int flags)
|
||||
{
|
||||
struct fpga_card *f = c->card;
|
||||
struct intc *intc = c->_vd;
|
||||
struct intc *intc = (struct intc *) c->_vd;
|
||||
|
||||
uint32_t ier, imr;
|
||||
uintptr_t base = (uintptr_t) f->map + c->baseaddr;
|
||||
|
@ -124,7 +124,7 @@ int intc_disable(struct fpga_ip *c, uint32_t mask)
|
|||
uint64_t intc_wait(struct fpga_ip *c, int irq)
|
||||
{
|
||||
struct fpga_card *f = c->card;
|
||||
struct intc *intc = c->_vd;
|
||||
struct intc *intc = (struct intc *) c->_vd;
|
||||
|
||||
uintptr_t base = (uintptr_t) f->map + c->baseaddr;
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ static int model_xsg_map_parse(uint32_t *map, size_t len, struct list *parameter
|
|||
if (length < 4)
|
||||
break; /* block is to small to describe a gateway */
|
||||
|
||||
struct model_parameter *e, *p = alloc(sizeof(struct model_parameter));
|
||||
struct model_parameter *e, *p = (struct model_parameter *) alloc(sizeof(struct model_parameter));
|
||||
|
||||
p->name = copy_string(3);
|
||||
p->default_value.flt = *((float *) &data[1]);
|
||||
|
@ -135,7 +135,7 @@ static int model_xsg_map_read(uint32_t *map, size_t len, void *baseaddr)
|
|||
|
||||
int model_parse(struct fpga_ip *c, json_t *cfg)
|
||||
{
|
||||
struct model *m = c->_vd;
|
||||
struct model *m = (struct model *) c->_vd;
|
||||
|
||||
int ret;
|
||||
|
||||
|
@ -163,7 +163,7 @@ int model_parse(struct fpga_ip *c, json_t *cfg)
|
|||
if (!json_is_real(value))
|
||||
error("Parameters of FPGA IP '%s' must be of type floating point", c->name);
|
||||
|
||||
struct model_parameter *p = alloc(sizeof(struct model_parameter));
|
||||
struct model_parameter *p = (struct model_parameter *) alloc(sizeof(struct model_parameter));
|
||||
|
||||
p->name = strdup(name);
|
||||
p->default_value.flt = json_real_value(value);
|
||||
|
@ -206,7 +206,7 @@ int model_init(struct fpga_ip *c)
|
|||
{
|
||||
int ret;
|
||||
|
||||
struct model *m = c->_vd;
|
||||
struct model *m = (struct model *) c->_vd;
|
||||
|
||||
list_init(&m->parameters);
|
||||
list_init(&m->infos);
|
||||
|
@ -218,7 +218,7 @@ int model_init(struct fpga_ip *c)
|
|||
|
||||
/* Set default values for parameters */
|
||||
for (size_t i = 0; i < list_length(&m->parameters); i++) {
|
||||
struct model_parameter *p = list_at(&m->parameters, i);
|
||||
struct model_parameter *p = (struct model_parameter *) list_at(&m->parameters, i);
|
||||
|
||||
p->ip = c;
|
||||
|
||||
|
@ -236,7 +236,7 @@ int model_init(struct fpga_ip *c)
|
|||
|
||||
int model_destroy(struct fpga_ip *c)
|
||||
{
|
||||
struct model *m = c->_vd;
|
||||
struct model *m = (struct model *) c->_vd;
|
||||
|
||||
list_destroy(&m->parameters, (dtor_cb_t) model_parameter_destroy, true);
|
||||
list_destroy(&m->infos, (dtor_cb_t) model_info_destroy, true);
|
||||
|
@ -249,7 +249,7 @@ int model_destroy(struct fpga_ip *c)
|
|||
|
||||
void model_dump(struct fpga_ip *c)
|
||||
{
|
||||
struct model *m = c->_vd;
|
||||
struct model *m = (struct model *) c->_vd;
|
||||
|
||||
const char *param_type[] = { "UFix", "Fix", "Float", "Boolean" };
|
||||
const char *parameter_dirs[] = { "In", "Out", "In/Out" };
|
||||
|
@ -257,7 +257,7 @@ void model_dump(struct fpga_ip *c)
|
|||
{ INDENT
|
||||
info("Parameters:");
|
||||
for (size_t i = 0; i < list_length(&m->parameters); i++) { INDENT
|
||||
struct model_parameter *p = list_at(&m->parameters, i);
|
||||
struct model_parameter *p = (struct model_parameter *) list_at(&m->parameters, i);
|
||||
|
||||
if (p->direction == MODEL_PARAMETER_IN)
|
||||
info("%#jx: %s (%s) = %.3f %s %u",
|
||||
|
@ -278,7 +278,7 @@ void model_dump(struct fpga_ip *c)
|
|||
|
||||
info("Infos:");
|
||||
for (size_t j = 0; j < list_length(&m->infos); j++) { INDENT
|
||||
struct model_info *i = list_at(&m->infos, j);
|
||||
struct model_info *i = (struct model_info *) list_at(&m->infos, j);
|
||||
|
||||
info("%s: %s", i->field, i->value);
|
||||
}
|
||||
|
@ -340,8 +340,8 @@ int model_parameter_write(struct model_parameter *p, double v)
|
|||
|
||||
void model_parameter_add(struct fpga_ip *c, const char *name, enum model_parameter_direction dir, enum model_parameter_type type)
|
||||
{
|
||||
struct model *m = c->_vd;
|
||||
struct model_parameter *p = alloc(sizeof(struct model_parameter));
|
||||
struct model *m = (struct model *) c->_vd;
|
||||
struct model_parameter *p = (struct model_parameter *) alloc(sizeof(struct model_parameter));
|
||||
|
||||
p->name = strdup(name);
|
||||
p->type = type;
|
||||
|
@ -352,7 +352,7 @@ void model_parameter_add(struct fpga_ip *c, const char *name, enum model_paramet
|
|||
|
||||
int model_parameter_remove(struct fpga_ip *c, const char *name)
|
||||
{
|
||||
struct model *m = c->_vd;
|
||||
struct model *m = (struct model *) c->_vd;
|
||||
struct model_parameter *p;
|
||||
|
||||
p = list_lookup(&m->parameters, name);
|
||||
|
|
|
@ -20,7 +20,7 @@ int switch_start(struct fpga_ip *c)
|
|||
int ret;
|
||||
|
||||
struct fpga_card *f = c->card;
|
||||
struct sw *sw = c->_vd;
|
||||
struct sw *sw = (struct sw *) c->_vd;
|
||||
|
||||
XAxis_Switch *xsw = &sw->inst;
|
||||
|
||||
|
@ -52,7 +52,7 @@ int switch_start(struct fpga_ip *c)
|
|||
int switch_init_paths(struct fpga_ip *c)
|
||||
{
|
||||
int ret;
|
||||
struct sw *sw = c->_vd;
|
||||
struct sw *sw = (struct sw *) c->_vd;
|
||||
|
||||
XAxis_Switch *xsw = &sw->inst;
|
||||
|
||||
|
@ -60,7 +60,7 @@ int switch_init_paths(struct fpga_ip *c)
|
|||
XAxisScr_MiPortDisableAll(xsw);
|
||||
|
||||
for (size_t i = 0; i < list_length(&sw->paths); i++) {
|
||||
struct sw_path *p = list_at(&sw->paths, i);
|
||||
struct sw_path *p = (struct sw_path *) list_at(&sw->paths, i);
|
||||
struct fpga_ip *mi, *si;
|
||||
|
||||
mi = list_lookup(&c->card->ips, p->out);
|
||||
|
@ -81,7 +81,7 @@ int switch_init_paths(struct fpga_ip *c)
|
|||
|
||||
int switch_destroy(struct fpga_ip *c)
|
||||
{
|
||||
struct sw *sw = c->_vd;
|
||||
struct sw *sw = (struct sw *) c->_vd;
|
||||
|
||||
list_destroy(&sw->paths, NULL, true);
|
||||
|
||||
|
@ -90,7 +90,7 @@ int switch_destroy(struct fpga_ip *c)
|
|||
|
||||
int switch_parse(struct fpga_ip *c, json_t *cfg)
|
||||
{
|
||||
struct sw *sw = c->_vd;
|
||||
struct sw *sw = (struct sw *) c->_vd;
|
||||
|
||||
int ret;
|
||||
size_t index;
|
||||
|
@ -113,7 +113,7 @@ int switch_parse(struct fpga_ip *c, json_t *cfg)
|
|||
error("Setting 'paths' of FPGA IP '%s' should be an array of JSON objects", c->name);
|
||||
|
||||
json_array_foreach(json_paths, index, json_path) {
|
||||
struct sw_path *p = alloc(sizeof(struct sw_path));
|
||||
struct sw_path *p = (struct sw_path *) alloc(sizeof(struct sw_path));
|
||||
int reverse = 0;
|
||||
|
||||
ret = json_unpack_ex(json_path, &err, 0, "{ s?: b, s: s, s: s }",
|
||||
|
@ -141,7 +141,7 @@ int switch_parse(struct fpga_ip *c, json_t *cfg)
|
|||
|
||||
int switch_connect(struct fpga_ip *c, struct fpga_ip *mi, struct fpga_ip *si)
|
||||
{
|
||||
struct sw *sw = c->_vd;
|
||||
struct sw *sw = (struct sw *) c->_vd;
|
||||
XAxis_Switch *xsw = &sw->inst;
|
||||
|
||||
uint32_t mux, port;
|
||||
|
@ -177,7 +177,7 @@ int switch_connect(struct fpga_ip *c, struct fpga_ip *mi, struct fpga_ip *si)
|
|||
|
||||
int switch_disconnect(struct fpga_ip *c, struct fpga_ip *mi, struct fpga_ip *si)
|
||||
{
|
||||
struct sw *sw = c->_vd;
|
||||
struct sw *sw = (struct sw *) c->_vd;
|
||||
XAxis_Switch *xsw = &sw->inst;
|
||||
|
||||
if (!XAxisScr_IsMiPortEnabled(xsw, mi->port, si->port))
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
int timer_start(struct fpga_ip *c)
|
||||
{
|
||||
struct fpga_card *f = c->card;
|
||||
struct timer *tmr = c->_vd;
|
||||
struct timer *tmr = (struct timer *) c->_vd;
|
||||
|
||||
XTmrCtr *xtmr = &tmr->inst;
|
||||
XTmrCtr_Config xtmr_cfg = {
|
||||
|
|
|
@ -205,7 +205,7 @@ static int hook_run_list(struct list *hs, struct sample *smps[], unsigned cnt, i
|
|||
unsigned ret;
|
||||
|
||||
for (size_t i = 0; i < list_length(hs); i++) {
|
||||
struct hook *h = list_at(hs, i);
|
||||
struct hook *h = (struct hook *) list_at(hs, i);
|
||||
|
||||
ret = func(h, smps, &cnt);
|
||||
if (ret || !cnt)
|
||||
|
@ -261,7 +261,7 @@ int hook_parse_list(struct list *list, json_t *cfg, struct path *o, struct node
|
|||
if (!p)
|
||||
jerror(&err, "Unkown hook type '%s'", type);
|
||||
|
||||
struct hook *h = alloc(sizeof(struct hook));
|
||||
struct hook *h = (struct hook *) alloc(sizeof(struct hook));
|
||||
|
||||
ret = hook_init(h, &p->hook, o, n);
|
||||
if (ret)
|
||||
|
|
|
@ -41,7 +41,7 @@ struct convert {
|
|||
|
||||
static int convert_init(struct hook *h)
|
||||
{
|
||||
struct convert *p = h->_vd;
|
||||
struct convert *p = (struct convert *) h->_vd;
|
||||
|
||||
p->scale = 1;
|
||||
p->mask = -1;
|
||||
|
@ -51,7 +51,7 @@ static int convert_init(struct hook *h)
|
|||
|
||||
static int convert_parse(struct hook *h, json_t *cfg)
|
||||
{
|
||||
struct convert *p = h->_vd;
|
||||
struct convert *p = (struct convert *) h->_vd;
|
||||
|
||||
int ret;
|
||||
json_error_t err;
|
||||
|
@ -77,7 +77,7 @@ static int convert_parse(struct hook *h, json_t *cfg)
|
|||
|
||||
static int convert_read(struct hook *h, struct sample *smps[], unsigned *cnt)
|
||||
{
|
||||
struct convert *p = h->_vd;
|
||||
struct convert *p = (struct convert *) h->_vd;
|
||||
|
||||
for (int i = 0; i < *cnt; i++) {
|
||||
for (int k = 0; k < smps[i]->length; k++) {
|
||||
|
|
|
@ -34,7 +34,7 @@ struct decimate {
|
|||
|
||||
static int decimate_init(struct hook *h)
|
||||
{
|
||||
struct decimate *p = h->_vd;
|
||||
struct decimate *p = (struct decimate *) h->_vd;
|
||||
|
||||
p->counter = 0;
|
||||
|
||||
|
@ -43,7 +43,7 @@ static int decimate_init(struct hook *h)
|
|||
|
||||
static int decimate_parse(struct hook *h, json_t *cfg)
|
||||
{
|
||||
struct decimate *p = h->_vd;
|
||||
struct decimate *p = (struct decimate *) h->_vd;
|
||||
|
||||
int ret;
|
||||
json_error_t err;
|
||||
|
@ -59,7 +59,7 @@ static int decimate_parse(struct hook *h, json_t *cfg)
|
|||
|
||||
static int decimate_read(struct hook *h, struct sample *smps[], unsigned *cnt)
|
||||
{
|
||||
struct decimate *p = h->_vd;
|
||||
struct decimate *p = (struct decimate *) h->_vd;
|
||||
|
||||
int i, ok;
|
||||
for (i = 0, ok = 0; i < *cnt; i++) {
|
||||
|
|
|
@ -36,7 +36,7 @@ struct drop {
|
|||
|
||||
static int drop_start(struct hook *h)
|
||||
{
|
||||
struct drop *d = h->_vd;
|
||||
struct drop *d = (struct drop *) h->_vd;
|
||||
|
||||
d->prev = NULL;
|
||||
|
||||
|
@ -45,7 +45,7 @@ static int drop_start(struct hook *h)
|
|||
|
||||
static int drop_stop(struct hook *h)
|
||||
{
|
||||
struct drop *d = h->_vd;
|
||||
struct drop *d = (struct drop *) h->_vd;
|
||||
|
||||
if (d->prev)
|
||||
sample_put(d->prev);
|
||||
|
@ -57,7 +57,7 @@ static int drop_read(struct hook *h, struct sample *smps[], unsigned *cnt)
|
|||
{
|
||||
int i, ok, dist;
|
||||
|
||||
struct drop *d = h->_vd;
|
||||
struct drop *d = (struct drop *) h->_vd;
|
||||
struct sample *prev, *cur = NULL;
|
||||
|
||||
for (i = 0, ok = 0, prev = d->prev; i < *cnt; i++, prev = cur) {
|
||||
|
@ -104,7 +104,7 @@ ok: /* To discard the first X samples in 'smps[]' we must
|
|||
|
||||
static int drop_restart(struct hook *h)
|
||||
{
|
||||
struct drop *d = h->_vd;
|
||||
struct drop *d = (struct drop *) h->_vd;
|
||||
|
||||
if (d->prev) {
|
||||
sample_put(d->prev);
|
||||
|
|
|
@ -45,7 +45,7 @@ struct jitter_calc {
|
|||
|
||||
int jitter_calc_init(struct hook *h)
|
||||
{
|
||||
struct jitter_calc *j = h->_vd;
|
||||
struct jitter_calc *j = (struct jitter_calc *) h->_vd;
|
||||
|
||||
size_t sz = GPS_NTP_DELAY_WIN_SIZE * sizeof(int64_t);
|
||||
|
||||
|
@ -68,7 +68,7 @@ int jitter_calc_init(struct hook *h)
|
|||
|
||||
int jitter_calc_deinit(struct hook *h)
|
||||
{
|
||||
struct jitter_calc *j = h->_vd;
|
||||
struct jitter_calc *j = (struct jitter_calc *) h->_vd;
|
||||
|
||||
free(j->jitter_val);
|
||||
free(j->delay_series);
|
||||
|
@ -88,7 +88,7 @@ int jitter_calc_deinit(struct hook *h)
|
|||
*/
|
||||
int jitter_calc_read(struct hook *h, struct sample *smps[], unsigned *cnt)
|
||||
{
|
||||
struct jitter_calc *j = h->_vd;
|
||||
struct jitter_calc *j = (struct jitter_calc *) h->_vd;
|
||||
|
||||
struct timespec now = time_now();
|
||||
int64_t delay_sec, delay_nsec, curr_delay_us;
|
||||
|
|
|
@ -40,7 +40,7 @@ struct map {
|
|||
|
||||
static int map_init(struct hook *h)
|
||||
{
|
||||
struct map *m = h->_vd;
|
||||
struct map *m = (struct map *) h->_vd;
|
||||
|
||||
m->stats = NULL; /** @todo */
|
||||
|
||||
|
@ -49,7 +49,7 @@ static int map_init(struct hook *h)
|
|||
|
||||
static int map_destroy(struct hook *h)
|
||||
{
|
||||
struct map *m = h->_vd;
|
||||
struct map *m = (struct map *) h->_vd;
|
||||
|
||||
return list_destroy(&m->mapping, NULL, true);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ static int map_destroy(struct hook *h)
|
|||
static int map_parse(struct hook *h, json_t *cfg)
|
||||
{
|
||||
int ret;
|
||||
struct map *m = h->_vd;
|
||||
struct map *m = (struct map *) h->_vd;
|
||||
json_error_t err;
|
||||
json_t *json_mapping;
|
||||
|
||||
|
@ -77,7 +77,7 @@ static int map_parse(struct hook *h, json_t *cfg)
|
|||
static int map_process(struct hook *h, struct sample *smps[], unsigned *cnt)
|
||||
{
|
||||
int ret;
|
||||
struct map *m = h->_vd;
|
||||
struct map *m = (struct map *) h->_vd;
|
||||
struct sample *tmp[*cnt];
|
||||
struct pool *p;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ struct print {
|
|||
|
||||
static int print_init(struct hook *h)
|
||||
{
|
||||
struct print *p = h->_vd;
|
||||
struct print *p = (struct print *) h->_vd;
|
||||
|
||||
p->uri = NULL;
|
||||
p->format = io_format_lookup("villas-human");
|
||||
|
@ -48,7 +48,7 @@ static int print_init(struct hook *h)
|
|||
|
||||
static int print_start(struct hook *h)
|
||||
{
|
||||
struct print *p = h->_vd;
|
||||
struct print *p = (struct print *) h->_vd;
|
||||
int ret;
|
||||
|
||||
ret = io_init(&p->io, p->format, SAMPLE_HAS_ALL);
|
||||
|
@ -64,7 +64,7 @@ static int print_start(struct hook *h)
|
|||
|
||||
static int print_stop(struct hook *h)
|
||||
{
|
||||
struct print *p = h->_vd;
|
||||
struct print *p = (struct print *) h->_vd;
|
||||
int ret;
|
||||
|
||||
ret = io_close(&p->io);
|
||||
|
@ -80,7 +80,7 @@ static int print_stop(struct hook *h)
|
|||
|
||||
static int print_parse(struct hook *h, json_t *cfg)
|
||||
{
|
||||
struct print *p = h->_vd;
|
||||
struct print *p = (struct print *) h->_vd;
|
||||
const char *format = NULL;
|
||||
int ret;
|
||||
json_error_t err;
|
||||
|
@ -103,7 +103,7 @@ static int print_parse(struct hook *h, json_t *cfg)
|
|||
|
||||
static int print_process(struct hook *h, struct sample *smps[], unsigned *cnt)
|
||||
{
|
||||
struct print *p = h->_vd;
|
||||
struct print *p = (struct print *) h->_vd;
|
||||
|
||||
io_print(&p->io, smps, *cnt);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ struct restart {
|
|||
|
||||
static int restart_start(struct hook *h)
|
||||
{
|
||||
struct restart *r = h->_vd;
|
||||
struct restart *r = (struct restart *) h->_vd;
|
||||
|
||||
r->prev = NULL;
|
||||
|
||||
|
@ -44,7 +44,7 @@ static int restart_start(struct hook *h)
|
|||
|
||||
static int restart_stop(struct hook *h)
|
||||
{
|
||||
struct restart *r = h->_vd;
|
||||
struct restart *r = (struct restart *) h->_vd;
|
||||
|
||||
if (r->prev)
|
||||
sample_put(r->prev);
|
||||
|
@ -55,7 +55,7 @@ static int restart_stop(struct hook *h)
|
|||
static int restart_read(struct hook *h, struct sample *smps[], unsigned *cnt)
|
||||
{
|
||||
int i;
|
||||
struct restart *r = h->_vd;
|
||||
struct restart *r = (struct restart *) h->_vd;
|
||||
struct sample *prev, *cur = NULL;
|
||||
|
||||
assert(h->node);
|
||||
|
@ -73,7 +73,7 @@ static int restart_read(struct hook *h, struct sample *smps[], unsigned *cnt)
|
|||
|
||||
/* Run restart hooks */
|
||||
for (size_t i = 0; i < list_length(&h->node->hooks); i++) {
|
||||
struct hook *k = list_at(&h->node->hooks, i);
|
||||
struct hook *k = (struct hook *) list_at(&h->node->hooks, i);
|
||||
|
||||
hook_restart(k);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ struct shift {
|
|||
|
||||
static int shift_seq_parse(struct hook *h, json_t *cfg)
|
||||
{
|
||||
struct shift *p = h->_vd;
|
||||
struct shift *p = (struct shift *) h->_vd;
|
||||
|
||||
json_error_t err;
|
||||
int ret;
|
||||
|
@ -50,7 +50,7 @@ static int shift_seq_parse(struct hook *h, json_t *cfg)
|
|||
|
||||
static int shift_seq_read(struct hook *h, struct sample *smps[], unsigned *cnt)
|
||||
{
|
||||
struct shift *p = h->_vd;
|
||||
struct shift *p = (struct shift *) h->_vd;
|
||||
|
||||
for (int i = 0; i < *cnt; i++)
|
||||
smps[i]->sequence += p->offset;
|
||||
|
|
|
@ -40,7 +40,7 @@ struct shift_ts {
|
|||
|
||||
static int shift_ts_init(struct hook *h)
|
||||
{
|
||||
struct shift_ts *p = h->_vd;
|
||||
struct shift_ts *p = (struct shift_ts *) h->_vd;
|
||||
|
||||
p->mode = SHIFT_ORIGIN; /* Default mode */
|
||||
|
||||
|
@ -49,7 +49,7 @@ static int shift_ts_init(struct hook *h)
|
|||
|
||||
static int shift_ts_parse(struct hook *h, json_t *cfg)
|
||||
{
|
||||
struct shift_ts *p = h->_vd;
|
||||
struct shift_ts *p = (struct shift_ts *) h->_vd;
|
||||
double offset;
|
||||
const char *mode = NULL;
|
||||
int ret;
|
||||
|
@ -80,7 +80,7 @@ static int shift_ts_parse(struct hook *h, json_t *cfg)
|
|||
|
||||
static int shift_ts_read(struct hook *h, struct sample *smps[], unsigned *cnt)
|
||||
{
|
||||
struct shift_ts *p = h->_vd;
|
||||
struct shift_ts *p = (struct shift_ts *) h->_vd;
|
||||
|
||||
for (int i = 0; i < *cnt; i++) {
|
||||
struct sample *s = smps[i];
|
||||
|
|
|
@ -53,7 +53,7 @@ struct skip_first {
|
|||
|
||||
static int skip_first_parse(struct hook *h, json_t *cfg)
|
||||
{
|
||||
struct skip_first *p = h->_vd;
|
||||
struct skip_first *p = (struct skip_first *) h->_vd;
|
||||
|
||||
double seconds;
|
||||
|
||||
|
@ -82,7 +82,7 @@ static int skip_first_parse(struct hook *h, json_t *cfg)
|
|||
|
||||
static int skip_first_restart(struct hook *h)
|
||||
{
|
||||
struct skip_first *p = h->_vd;
|
||||
struct skip_first *p = (struct skip_first *) h->_vd;
|
||||
|
||||
p->state = HOOK_SKIP_FIRST_STATE_STARTED;
|
||||
|
||||
|
@ -91,7 +91,7 @@ static int skip_first_restart(struct hook *h)
|
|||
|
||||
static int skip_first_read(struct hook *h, struct sample *smps[], unsigned *cnt)
|
||||
{
|
||||
struct skip_first *p = h->_vd;
|
||||
struct skip_first *p = (struct skip_first *) h->_vd;
|
||||
|
||||
/* Remember sequence no or timestamp of first sample. */
|
||||
if (p->state == HOOK_SKIP_FIRST_STATE_STARTED) {
|
||||
|
|
|
@ -48,7 +48,7 @@ struct stats_collect {
|
|||
|
||||
static int stats_collect_init(struct hook *h)
|
||||
{
|
||||
struct stats_collect *p = h->_vd;
|
||||
struct stats_collect *p = (struct stats_collect *) h->_vd;
|
||||
|
||||
/* Register statistic object to path.
|
||||
*
|
||||
|
@ -67,7 +67,7 @@ static int stats_collect_init(struct hook *h)
|
|||
|
||||
static int stats_collect_destroy(struct hook *h)
|
||||
{
|
||||
struct stats_collect *p = h->_vd;
|
||||
struct stats_collect *p = (struct stats_collect *) h->_vd;
|
||||
|
||||
if (p->uri)
|
||||
free(p->uri);
|
||||
|
@ -77,7 +77,7 @@ static int stats_collect_destroy(struct hook *h)
|
|||
|
||||
static int stats_collect_start(struct hook *h)
|
||||
{
|
||||
struct stats_collect *p = h->_vd;
|
||||
struct stats_collect *p = (struct stats_collect *) h->_vd;
|
||||
|
||||
if (p->uri) {
|
||||
p->output = afopen(p->uri, "w+");
|
||||
|
@ -90,7 +90,7 @@ static int stats_collect_start(struct hook *h)
|
|||
|
||||
static int stats_collect_stop(struct hook *h)
|
||||
{
|
||||
struct stats_collect *p = h->_vd;
|
||||
struct stats_collect *p = (struct stats_collect *) h->_vd;
|
||||
|
||||
stats_print(&p->stats, p->uri ? p->output->file : stdout, p->format, p->verbose);
|
||||
|
||||
|
@ -102,7 +102,7 @@ static int stats_collect_stop(struct hook *h)
|
|||
|
||||
static int stats_collect_restart(struct hook *h)
|
||||
{
|
||||
struct stats_collect *p = h->_vd;
|
||||
struct stats_collect *p = (struct stats_collect *) h->_vd;
|
||||
|
||||
stats_reset(&p->stats);
|
||||
|
||||
|
@ -111,7 +111,7 @@ static int stats_collect_restart(struct hook *h)
|
|||
|
||||
static int stats_collect_periodic(struct hook *h)
|
||||
{
|
||||
struct stats_collect *p = h->_vd;
|
||||
struct stats_collect *p = (struct stats_collect *) h->_vd;
|
||||
|
||||
stats_print_periodic(&p->stats, p->uri ? p->output->file : stdout, p->format, p->verbose, h->node);
|
||||
|
||||
|
@ -120,7 +120,7 @@ static int stats_collect_periodic(struct hook *h)
|
|||
|
||||
static int stats_collect_parse(struct hook *h, json_t *cfg)
|
||||
{
|
||||
struct stats_collect *p = h->_vd;
|
||||
struct stats_collect *p = (struct stats_collect *) h->_vd;
|
||||
|
||||
int ret, fmt;
|
||||
json_error_t err;
|
||||
|
@ -154,7 +154,7 @@ static int stats_collect_parse(struct hook *h, json_t *cfg)
|
|||
|
||||
static int stats_collect_read(struct hook *h, struct sample *smps[], unsigned *cnt)
|
||||
{
|
||||
struct stats_collect *p = h->_vd;
|
||||
struct stats_collect *p = (struct stats_collect *) h->_vd;
|
||||
struct stats *s = &p->stats;
|
||||
|
||||
int dist;
|
||||
|
@ -189,7 +189,7 @@ static int stats_collect_read(struct hook *h, struct sample *smps[], unsigned *c
|
|||
|
||||
static int stats_collect_write(struct hook *h, struct sample *smps[], unsigned *cnt)
|
||||
{
|
||||
struct stats_collect *p = h->_vd;
|
||||
struct stats_collect *p = (struct stats_collect *) h->_vd;
|
||||
|
||||
struct timespec ts_sent = time_now();
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ int villas_human_fprint(FILE *f, struct sample *smps[], unsigned cnt, int flags)
|
|||
|
||||
int villas_human_print(struct io *io, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
struct villas_human *h = io->_vd;
|
||||
struct villas_human *h = (struct villas_human *) io->_vd;
|
||||
|
||||
FILE *f = io->mode == IO_MODE_ADVIO
|
||||
? io->advio.output->file
|
||||
|
@ -268,7 +268,7 @@ int villas_human_fscan(FILE *f, struct sample *smps[], unsigned cnt, int flags)
|
|||
|
||||
int villas_human_open(struct io *io, const char *uri)
|
||||
{
|
||||
struct villas_human *h = io->_vd;
|
||||
struct villas_human *h = (struct villas_human *) io->_vd;
|
||||
int ret;
|
||||
|
||||
ret = io_stream_open(io, uri);
|
||||
|
@ -282,7 +282,7 @@ int villas_human_open(struct io *io, const char *uri)
|
|||
|
||||
void villas_human_rewind(struct io *io)
|
||||
{
|
||||
struct villas_human *h = io->_vd;
|
||||
struct villas_human *h = (struct villas_human *) io->_vd;
|
||||
|
||||
h->header_written = false;
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ int if_start(struct interface *i)
|
|||
/* Assign fwmark's to socket nodes which have netem options */
|
||||
int ret, mark = 0;
|
||||
for (size_t j = 0; j < list_length(&i->sockets); j++) {
|
||||
struct socket *s = list_at(&i->sockets, j);
|
||||
struct socket *s = (struct socket *) list_at(&i->sockets, j);
|
||||
|
||||
if (s->tc_qdisc)
|
||||
s->mark = 1 + mark++;
|
||||
|
@ -96,7 +96,7 @@ int if_start(struct interface *i)
|
|||
|
||||
/* Create netem qdisks and appropriate filter per netem node */
|
||||
for (size_t j = 0; j < list_length(&i->sockets); j++) {
|
||||
struct socket *s = list_at(&i->sockets, j);
|
||||
struct socket *s = (struct socket *) list_at(&i->sockets, j);
|
||||
|
||||
if (s->tc_qdisc) {
|
||||
ret = tc_mark(i, &s->tc_classifier, TC_HANDLE(1, s->mark), s->mark);
|
||||
|
|
|
@ -33,7 +33,7 @@ int pci_init(struct pci *p)
|
|||
}
|
||||
|
||||
while ((e = readdir(dp))) {
|
||||
struct pci_device *d = alloc(sizeof(struct pci_device));
|
||||
struct pci_device *d = (struct pci_device *) alloc(sizeof(struct pci_device));
|
||||
|
||||
struct { const char *s; int *p; } map[] = {
|
||||
{ "vendor", &d->id.vendor },
|
||||
|
|
|
@ -248,7 +248,7 @@ int vfio_device_attach(struct vfio_device *d, struct vfio_container *c, const ch
|
|||
|
||||
/* Check if group already exists */
|
||||
for (size_t i = 0; i < list_length(&c->groups); i++) {
|
||||
struct vfio_group *h = list_at(&c->groups, i);
|
||||
struct vfio_group *h = (struct vfio_group *) list_at(&c->groups, i);
|
||||
|
||||
if (h->index == index)
|
||||
g = h;
|
||||
|
@ -324,8 +324,8 @@ int vfio_pci_reset(struct vfio_device *d)
|
|||
size_t reset_infolen = sizeof(struct vfio_pci_hot_reset_info) + sizeof(struct vfio_pci_dependent_device) * 64;
|
||||
size_t resetlen = sizeof(struct vfio_pci_hot_reset) + sizeof(int32_t) * 1;
|
||||
|
||||
struct vfio_pci_hot_reset_info *reset_info = alloc(reset_infolen);
|
||||
struct vfio_pci_hot_reset *reset = alloc(resetlen);
|
||||
struct vfio_pci_hot_reset_info *reset_info = (struct vfio_pci_hot_reset_info *) alloc(reset_infolen);
|
||||
struct vfio_pci_hot_reset *reset = (struct vfio_pci_hot_reset *) alloc(resetlen);
|
||||
|
||||
reset_info->argsz = reset_infolen;
|
||||
reset->argsz = resetlen;
|
||||
|
@ -500,7 +500,7 @@ void vfio_dump(struct vfio_container *v)
|
|||
info("VFIO Extensions: %#x", v->extensions);
|
||||
|
||||
for (size_t i = 0; i < list_length(&v->groups); i++) {
|
||||
struct vfio_group *g = list_at(&v->groups, i);
|
||||
struct vfio_group *g = (struct vfio_group *) list_at(&v->groups, i);
|
||||
|
||||
info("VFIO Group %u, viable=%u, container=%d", g->index,
|
||||
(g->status.flags & VFIO_GROUP_FLAGS_VIABLE) > 0,
|
||||
|
@ -509,7 +509,7 @@ void vfio_dump(struct vfio_container *v)
|
|||
|
||||
|
||||
for (size_t i = 0; i < list_length(&g->devices); i++) { INDENT
|
||||
struct vfio_device *d = list_at(&g->devices, i);
|
||||
struct vfio_device *d = (struct vfio_device *) list_at(&g->devices, i);
|
||||
|
||||
info("Device %s: regions=%u, irqs=%u, flags=%#x", d->name,
|
||||
d->info.num_regions,
|
||||
|
|
|
@ -58,7 +58,7 @@ int list_init(struct list *l)
|
|||
l->array = NULL;
|
||||
|
||||
l->state = STATE_INITIALIZED;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ int mapping_parse_list(struct list *l, json_t *cfg, struct list *nodes)
|
|||
|
||||
off = 0;
|
||||
json_array_foreach(json_mapping, i, json_entry) {
|
||||
struct mapping_entry *e = alloc(sizeof(struct mapping_entry));
|
||||
struct mapping_entry *e = (struct mapping_entry *) alloc(sizeof(struct mapping_entry));
|
||||
|
||||
ret = mapping_parse(e, json_entry, nodes);
|
||||
if (ret)
|
||||
|
@ -352,7 +352,7 @@ int mapping_remap(struct list *m, struct sample *remapped, struct sample *origin
|
|||
remapped->id = original->id;
|
||||
|
||||
for (size_t i = 0; i < list_length(m); i++) {
|
||||
struct mapping_entry *me = list_at(m, i);
|
||||
struct mapping_entry *me = (struct mapping_entry *) list_at(m, i);
|
||||
|
||||
ret = mapping_update(me, remapped, original, s);
|
||||
if (ret)
|
||||
|
|
|
@ -155,7 +155,7 @@ static int memory_hugepage_free(struct memtype *m, void *ptr, size_t len)
|
|||
void* memory_managed_alloc(struct memtype *m, size_t len, size_t alignment)
|
||||
{
|
||||
/* Simple first-fit allocation */
|
||||
struct memblock *first = m->_vd;
|
||||
struct memblock *first = (struct memblock *) m->_vd;
|
||||
struct memblock *block;
|
||||
|
||||
for (block = first; block != NULL; block = block->next) {
|
||||
|
@ -230,7 +230,7 @@ void* memory_managed_alloc(struct memtype *m, size_t len, size_t alignment)
|
|||
|
||||
int memory_managed_free(struct memtype *m, void *ptr, size_t len)
|
||||
{
|
||||
struct memblock *first = m->_vd;
|
||||
struct memblock *first = (struct memblock *) m->_vd;
|
||||
struct memblock *block;
|
||||
char *cptr = ptr;
|
||||
|
||||
|
|
10
lib/node.c
10
lib/node.c
|
@ -58,7 +58,7 @@ int node_init(struct node *n, struct node_type *vt)
|
|||
|
||||
/* Add internal hooks if they are not already in the list */
|
||||
for (size_t i = 0; i < list_length(&plugins); i++) {
|
||||
struct plugin *q = list_at(&plugins, i);
|
||||
struct plugin *q = (struct plugin *) list_at(&plugins, i);
|
||||
|
||||
if (q->type != PLUGIN_TYPE_HOOK)
|
||||
continue;
|
||||
|
@ -66,7 +66,7 @@ int node_init(struct node *n, struct node_type *vt)
|
|||
struct hook_type *vt = &q->hook;
|
||||
|
||||
if ((vt->flags & HOOK_NODE) && (vt->flags & HOOK_BUILTIN)) {
|
||||
struct hook *h = alloc(sizeof(struct hook));
|
||||
struct hook *h = (struct hook *) alloc(sizeof(struct hook));
|
||||
|
||||
ret = hook_init(h, vt, NULL, n);
|
||||
if (ret)
|
||||
|
@ -180,7 +180,7 @@ int node_start(struct node *n)
|
|||
info("Starting node %s", node_name_long(n));
|
||||
{ INDENT
|
||||
for (size_t i = 0; i < list_length(&n->hooks); i++) {
|
||||
struct hook *h = list_at(&n->hooks, i);
|
||||
struct hook *h = (struct hook *) list_at(&n->hooks, i);
|
||||
|
||||
ret = hook_start(h);
|
||||
if (ret)
|
||||
|
@ -209,7 +209,7 @@ int node_stop(struct node *n)
|
|||
info("Stopping node %s", node_name(n));
|
||||
{ INDENT
|
||||
for (size_t i = 0; i < list_length(&n->hooks); i++) {
|
||||
struct hook *h = list_at(&n->hooks, i);
|
||||
struct hook *h = (struct hook *) list_at(&n->hooks, i);
|
||||
|
||||
ret = hook_stop(h);
|
||||
if (ret)
|
||||
|
@ -431,7 +431,7 @@ invalid:
|
|||
|
||||
invalid2:
|
||||
for (size_t i = 0; i < list_length(all); i++) {
|
||||
struct node *n = list_at(all, i);
|
||||
struct node *n = (struct node *) list_at(all, i);
|
||||
|
||||
strcatf(&allstr, " %s", node_name_short(n));
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
int cbuilder_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
struct cbuilder *cb = n->_vd;
|
||||
struct cbuilder *cb = (struct cbuilder *) n->_vd;
|
||||
json_t *json_param, *json_params = NULL;
|
||||
|
||||
const char *model;
|
||||
|
@ -58,7 +58,7 @@ int cbuilder_parse(struct node *n, json_t *cfg)
|
|||
int cbuilder_start(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct cbuilder *cb = n->_vd;
|
||||
struct cbuilder *cb = (struct cbuilder *) n->_vd;
|
||||
|
||||
/* Initialize mutex and cv */
|
||||
pthread_mutex_init(&cb->mtx, NULL);
|
||||
|
@ -83,7 +83,7 @@ int cbuilder_start(struct node *n)
|
|||
int cbuilder_stop(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct cbuilder *cb = n->_vd;
|
||||
struct cbuilder *cb = (struct cbuilder *) n->_vd;
|
||||
|
||||
ret = close(cb->eventfd);
|
||||
if (ret)
|
||||
|
@ -96,7 +96,7 @@ int cbuilder_stop(struct node *n)
|
|||
|
||||
int cbuilder_read(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
struct cbuilder *cb = n->_vd;
|
||||
struct cbuilder *cb = (struct cbuilder *) n->_vd;
|
||||
struct sample *smp = smps[0];
|
||||
|
||||
uint64_t cntr;
|
||||
|
@ -125,7 +125,7 @@ int cbuilder_read(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
|
||||
int cbuilder_write(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
struct cbuilder *cb = n->_vd;
|
||||
struct cbuilder *cb = (struct cbuilder *) n->_vd;
|
||||
struct sample *smp = smps[0];
|
||||
|
||||
pthread_mutex_lock(&cb->mtx);
|
||||
|
@ -147,7 +147,7 @@ int cbuilder_write(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
|
||||
int cbuilder_fd(struct node *n)
|
||||
{
|
||||
struct cbuilder *cb = n->_vd;
|
||||
struct cbuilder *cb = (struct cbuilder *) n->_vd;
|
||||
|
||||
return cb->eventfd;
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ int file_parse(struct node *n, json_t *cfg)
|
|||
|
||||
char * file_print(struct node *n)
|
||||
{
|
||||
struct file *f = n->_vd;
|
||||
struct file *f = (struct file *) n->_vd;
|
||||
char *buf = NULL;
|
||||
|
||||
const char *epoch_str = NULL;
|
||||
|
@ -196,7 +196,7 @@ char * file_print(struct node *n)
|
|||
|
||||
int file_start(struct node *n)
|
||||
{
|
||||
struct file *f = n->_vd;
|
||||
struct file *f = (struct file *) n->_vd;
|
||||
|
||||
struct timespec now = time_now();
|
||||
int ret, flags;
|
||||
|
@ -250,7 +250,7 @@ int file_start(struct node *n)
|
|||
|
||||
int file_stop(struct node *n)
|
||||
{
|
||||
struct file *f = n->_vd;
|
||||
struct file *f = (struct file *) n->_vd;
|
||||
int ret;
|
||||
|
||||
task_destroy(&f->task);
|
||||
|
@ -270,7 +270,7 @@ int file_stop(struct node *n)
|
|||
|
||||
int file_read(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
struct file *f = n->_vd;
|
||||
struct file *f = (struct file *) n->_vd;
|
||||
int ret;
|
||||
uint64_t steps;
|
||||
|
||||
|
@ -337,7 +337,7 @@ retry: ret = io_scan(&f->io, smps, cnt);
|
|||
|
||||
int file_write(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
struct file *f = n->_vd;
|
||||
struct file *f = (struct file *) n->_vd;
|
||||
|
||||
assert(cnt == 1);
|
||||
|
||||
|
@ -348,7 +348,7 @@ int file_write(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
|
||||
int file_fd(struct node *n)
|
||||
{
|
||||
struct file *f = n->_vd;
|
||||
struct file *f = (struct file *) n->_vd;
|
||||
|
||||
if (f->rate)
|
||||
return task_fd(&f->task);
|
||||
|
|
|
@ -80,7 +80,7 @@ int fpga_deinit()
|
|||
|
||||
int fpga_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
struct fpga *f = n->_vd;
|
||||
struct fpga *f = (struct fpga *) n->_vd;
|
||||
struct fpga_card *card;
|
||||
struct fpga_ip *ip;
|
||||
|
||||
|
@ -124,7 +124,7 @@ int fpga_parse(struct node *n, json_t *cfg)
|
|||
|
||||
char * fpga_print(struct node *n)
|
||||
{
|
||||
struct fpga *f = n->_vd;
|
||||
struct fpga *f = (struct fpga *) n->_vd;
|
||||
struct fpga_card *c = f->ip->card;
|
||||
|
||||
if (f->ip)
|
||||
|
@ -141,7 +141,7 @@ int fpga_start(struct node *n)
|
|||
{
|
||||
int ret;
|
||||
|
||||
struct fpga *f = n->_vd;
|
||||
struct fpga *f = (struct fpga *) n->_vd;
|
||||
struct fpga_card *c = f->ip->card;
|
||||
|
||||
fpga_card_init(c, f->pci, f->vfio_container);
|
||||
|
@ -176,7 +176,7 @@ int fpga_stop(struct node *n)
|
|||
{
|
||||
int ret;
|
||||
|
||||
struct fpga *f = n->_vd;
|
||||
struct fpga *f = (struct fpga *) n->_vd;
|
||||
struct fpga_card *c = f->ip->card;
|
||||
|
||||
switch (f->ip->_vt->type) {
|
||||
|
@ -202,7 +202,7 @@ int fpga_read(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
{
|
||||
int ret;
|
||||
|
||||
struct fpga *f = n->_vd;
|
||||
struct fpga *f = (struct fpga *) n->_vd;
|
||||
struct sample *smp = smps[0];
|
||||
|
||||
size_t recvlen;
|
||||
|
@ -243,7 +243,7 @@ int fpga_read(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
int fpga_write(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
int ret;
|
||||
struct fpga *f = n->_vd;
|
||||
struct fpga *f = (struct fpga *) n->_vd;
|
||||
struct sample *smp = smps[0];
|
||||
|
||||
size_t sentlen;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
int influxdb_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
struct influxdb *i = n->_vd;
|
||||
struct influxdb *i = (struct influxdb *) n->_vd;
|
||||
|
||||
json_t *json_fields = NULL;
|
||||
json_error_t err;
|
||||
|
@ -83,7 +83,7 @@ int influxdb_parse(struct node *n, json_t *cfg)
|
|||
int influxdb_open(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct influxdb *i = n->_vd;
|
||||
struct influxdb *i = (struct influxdb *) n->_vd;
|
||||
|
||||
struct addrinfo hints, *servinfo, *p;
|
||||
|
||||
|
@ -119,7 +119,7 @@ int influxdb_open(struct node *n)
|
|||
|
||||
int influxdb_close(struct node *n)
|
||||
{
|
||||
struct influxdb *i= n->_vd;
|
||||
struct influxdb *i = (struct influxdb *) n->_vd;
|
||||
|
||||
close(i->sd);
|
||||
|
||||
|
@ -134,7 +134,7 @@ int influxdb_close(struct node *n)
|
|||
|
||||
int influxdb_write(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
struct influxdb *i = n->_vd;
|
||||
struct influxdb *i = (struct influxdb *) n->_vd;
|
||||
|
||||
char *buf = NULL;
|
||||
ssize_t sentlen, buflen;
|
||||
|
@ -148,7 +148,7 @@ int influxdb_write(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
strcatf(&buf, "%c", j == 0 ? ' ' : ',');
|
||||
|
||||
if (j < list_length(&i->fields)) {
|
||||
char *field = list_at(&i->fields, j);
|
||||
char *field = (char *) list_at(&i->fields, j);
|
||||
|
||||
strcatf(&buf, "%s=", field);
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ int influxdb_write(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
|
||||
char * influxdb_print(struct node *n)
|
||||
{
|
||||
struct influxdb *i = n->_vd;
|
||||
struct influxdb *i = (struct influxdb *) n->_vd;
|
||||
char *buf = NULL;
|
||||
|
||||
strcatf(&buf, "host=%s, port=%s, key=%s, #fields=%zu", i->host, i->port, i->key, list_length(&i->fields));
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
int loopback_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
struct loopback *l = n->_vd;
|
||||
struct loopback *l = (struct loopback *) n->_vd;
|
||||
|
||||
json_error_t err;
|
||||
int ret;
|
||||
|
@ -48,7 +48,7 @@ int loopback_parse(struct node *n, json_t *cfg)
|
|||
int loopback_open(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct loopback *l = n->_vd;
|
||||
struct loopback *l = (struct loopback *) n->_vd;
|
||||
|
||||
ret = pool_init(&l->pool, l->queuelen, SAMPLE_LEN(n->samplelen), &memtype_hugepage);
|
||||
if (ret)
|
||||
|
@ -60,7 +60,7 @@ int loopback_open(struct node *n)
|
|||
int loopback_close(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct loopback *l= n->_vd;
|
||||
struct loopback *l= (struct loopback *) n->_vd;
|
||||
|
||||
ret = pool_destroy(&l->pool);
|
||||
if (ret)
|
||||
|
@ -73,7 +73,7 @@ int loopback_read(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
{
|
||||
int avail;
|
||||
|
||||
struct loopback *l = n->_vd;
|
||||
struct loopback *l = (struct loopback *) n->_vd;
|
||||
struct sample *cpys[cnt];
|
||||
|
||||
avail = queue_signalled_pull_many(&l->queue, (void **) cpys, cnt);
|
||||
|
@ -90,7 +90,7 @@ int loopback_write(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
{
|
||||
int copied;
|
||||
|
||||
struct loopback *l = n->_vd;
|
||||
struct loopback *l = (struct loopback *) n->_vd;
|
||||
struct sample *copies[cnt];
|
||||
|
||||
copied = sample_alloc_many(&l->pool, copies, cnt);
|
||||
|
@ -104,7 +104,7 @@ int loopback_write(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
|
||||
char * loopback_print(struct node *n)
|
||||
{
|
||||
struct loopback *l = n->_vd;
|
||||
struct loopback *l = (struct loopback *) n->_vd;
|
||||
char *buf = NULL;
|
||||
|
||||
strcatf(&buf, "queuelen=%d", l->queuelen);
|
||||
|
@ -114,7 +114,7 @@ char * loopback_print(struct node *n)
|
|||
|
||||
int loopback_fd(struct node *n)
|
||||
{
|
||||
struct loopback *l = n->_vd;
|
||||
struct loopback *l = (struct loopback *) n->_vd;
|
||||
|
||||
return queue_signalled_fd(&l->queue);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
int nanomsg_reverse(struct node *n)
|
||||
{
|
||||
struct nanomsg *m = n->_vd;
|
||||
struct nanomsg *m = (struct nanomsg *) n->_vd;
|
||||
|
||||
if (list_length(&m->publisher.endpoints) != 1 ||
|
||||
list_length(&m->subscriber.endpoints) != 1)
|
||||
|
@ -80,7 +80,7 @@ static int nanomsg_parse_endpoints(struct list *l, json_t *cfg)
|
|||
int nanomsg_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
int ret;
|
||||
struct nanomsg *m = n->_vd;
|
||||
struct nanomsg *m = (struct nanomsg *) n->_vd;
|
||||
|
||||
const char *format = "villas-human";
|
||||
|
||||
|
@ -121,14 +121,14 @@ int nanomsg_parse(struct node *n, json_t *cfg)
|
|||
|
||||
char * nanomsg_print(struct node *n)
|
||||
{
|
||||
struct nanomsg *m = n->_vd;
|
||||
struct nanomsg *m = (struct nanomsg *) n->_vd;
|
||||
|
||||
char *buf = NULL;
|
||||
|
||||
strcatf(&buf, "format=%s, subscribe=[ ", plugin_name(m->format));
|
||||
|
||||
for (size_t i = 0; i < list_length(&m->subscriber.endpoints); i++) {
|
||||
char *ep = list_at(&m->subscriber.endpoints, i);
|
||||
char *ep = (char *) list_at(&m->subscriber.endpoints, i);
|
||||
|
||||
strcatf(&buf, "%s ", ep);
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ char * nanomsg_print(struct node *n)
|
|||
strcatf(&buf, "], publish=[ ");
|
||||
|
||||
for (size_t i = 0; i < list_length(&m->publisher.endpoints); i++) {
|
||||
char *ep = list_at(&m->publisher.endpoints, i);
|
||||
char *ep = (char *) list_at(&m->publisher.endpoints, i);
|
||||
|
||||
strcatf(&buf, "%s ", ep);
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ char * nanomsg_print(struct node *n)
|
|||
int nanomsg_start(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct nanomsg *m = n->_vd;
|
||||
struct nanomsg *m = (struct nanomsg *) n->_vd;
|
||||
|
||||
ret = m->subscriber.socket = nn_socket(AF_SP, NN_SUB);
|
||||
if (ret < 0)
|
||||
|
@ -166,7 +166,7 @@ int nanomsg_start(struct node *n)
|
|||
|
||||
/* Bind publisher to socket */
|
||||
for (size_t i = 0; i < list_length(&m->publisher.endpoints); i++) {
|
||||
char *ep = list_at(&m->publisher.endpoints, i);
|
||||
char *ep = (char *) list_at(&m->publisher.endpoints, i);
|
||||
|
||||
ret = nn_bind(m->publisher.socket, ep);
|
||||
if (ret < 0) {
|
||||
|
@ -177,7 +177,7 @@ int nanomsg_start(struct node *n)
|
|||
|
||||
/* Sonnect subscribers socket */
|
||||
for (size_t i = 0; i < list_length(&m->subscriber.endpoints); i++) {
|
||||
char *ep = list_at(&m->subscriber.endpoints, i);
|
||||
char *ep = (char *) list_at(&m->subscriber.endpoints, i);
|
||||
|
||||
ret = nn_connect(m->subscriber.socket, ep);
|
||||
if (ret < 0) {
|
||||
|
@ -192,7 +192,7 @@ int nanomsg_start(struct node *n)
|
|||
int nanomsg_stop(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct nanomsg *m = n->_vd;
|
||||
struct nanomsg *m = (struct nanomsg *) n->_vd;
|
||||
|
||||
ret = nn_close(m->subscriber.socket);
|
||||
if (ret < 0)
|
||||
|
@ -214,7 +214,7 @@ int nanomsg_deinit()
|
|||
|
||||
int nanomsg_read(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
struct nanomsg *m = n->_vd;
|
||||
struct nanomsg *m = (struct nanomsg *) n->_vd;
|
||||
int bytes;
|
||||
char data[NANOMSG_MAX_PACKET_LEN];
|
||||
|
||||
|
@ -229,7 +229,7 @@ int nanomsg_read(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
int nanomsg_write(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
int ret;
|
||||
struct nanomsg *m = n->_vd;
|
||||
struct nanomsg *m = (struct nanomsg *) n->_vd;
|
||||
|
||||
size_t wbytes;
|
||||
|
||||
|
@ -249,7 +249,7 @@ int nanomsg_write(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
int nanomsg_fd(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct nanomsg *m = n->_vd;
|
||||
struct nanomsg *m = (struct nanomsg *) n->_vd;
|
||||
|
||||
int fd;
|
||||
size_t len = sizeof(fd);
|
||||
|
|
|
@ -75,7 +75,7 @@ static json_t* ngsi_build_entity(struct ngsi *i, struct sample *smps[], unsigned
|
|||
json_t *attributes = json_array();
|
||||
|
||||
for (size_t j = 0; j < list_length(&i->mapping); j++) {
|
||||
struct ngsi_attribute *map = list_at(&i->mapping, j);
|
||||
struct ngsi_attribute *map = (struct ngsi_attribute *) list_at(&i->mapping, j);
|
||||
|
||||
json_t *attribute = json_pack("{ s: s, s: s }",
|
||||
"name", map->name,
|
||||
|
@ -99,7 +99,7 @@ static json_t* ngsi_build_entity(struct ngsi *i, struct sample *smps[], unsigned
|
|||
json_t *metadatas = json_array();
|
||||
|
||||
for (size_t i = 0; i < list_length(&map->metadata); i++) {
|
||||
struct ngsi_metadata *meta = list_at(&map->metadata, i);
|
||||
struct ngsi_metadata *meta = (struct ngsi_metadata *) list_at(&map->metadata, i);
|
||||
|
||||
json_array_append_new(metadatas, json_pack("{ s: s, s: s, s: s }",
|
||||
"name", meta->name,
|
||||
|
@ -214,7 +214,7 @@ static int ngsi_parse_mapping(struct list *mapping, json_t *cfg)
|
|||
if (!token)
|
||||
return -2;
|
||||
|
||||
struct ngsi_attribute *a = alloc(sizeof(struct ngsi_attribute));
|
||||
struct ngsi_attribute *a = (struct ngsi_attribute *) alloc(sizeof(struct ngsi_attribute));
|
||||
|
||||
a->index = index;
|
||||
|
||||
|
@ -406,7 +406,7 @@ int ngsi_deinit()
|
|||
|
||||
int ngsi_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
struct ngsi *i = n->_vd;
|
||||
struct ngsi *i = (struct ngsi *) n->_vd;
|
||||
|
||||
int ret;
|
||||
json_error_t err;
|
||||
|
@ -440,7 +440,7 @@ int ngsi_parse(struct node *n, json_t *cfg)
|
|||
|
||||
char * ngsi_print(struct node *n)
|
||||
{
|
||||
struct ngsi *i = n->_vd;
|
||||
struct ngsi *i = (struct ngsi *) n->_vd;
|
||||
|
||||
return strf("endpoint=%s, timeout=%.3f secs, #mappings=%zu",
|
||||
i->endpoint, i->timeout, list_length(&i->mapping));
|
||||
|
@ -467,7 +467,7 @@ static int ngsi_attribute_destroy(struct ngsi_attribute *attr)
|
|||
|
||||
int ngsi_destroy(struct node *n)
|
||||
{
|
||||
struct ngsi *i = n->_vd;
|
||||
struct ngsi *i = (struct ngsi *) n->_vd;
|
||||
|
||||
list_destroy(&i->mapping, (dtor_cb_t) ngsi_attribute_destroy, true);
|
||||
|
||||
|
@ -476,7 +476,7 @@ int ngsi_destroy(struct node *n)
|
|||
|
||||
int ngsi_start(struct node *n)
|
||||
{
|
||||
struct ngsi *i = n->_vd;
|
||||
struct ngsi *i = (struct ngsi *) n->_vd;
|
||||
int ret;
|
||||
|
||||
i->curl = curl_easy_init();
|
||||
|
@ -518,7 +518,7 @@ int ngsi_start(struct node *n)
|
|||
|
||||
int ngsi_stop(struct node *n)
|
||||
{
|
||||
struct ngsi *i = n->_vd;
|
||||
struct ngsi *i = (struct ngsi *) n->_vd;
|
||||
int ret;
|
||||
|
||||
/* Delete complete entity (not just attributes) */
|
||||
|
@ -536,7 +536,7 @@ int ngsi_stop(struct node *n)
|
|||
|
||||
int ngsi_read(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
struct ngsi *i = n->_vd;
|
||||
struct ngsi *i = (struct ngsi *) n->_vd;
|
||||
int ret;
|
||||
|
||||
if (task_wait(&i->task) == 0)
|
||||
|
@ -561,7 +561,7 @@ out: json_decref(entity);
|
|||
|
||||
int ngsi_write(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
struct ngsi *i = n->_vd;
|
||||
struct ngsi *i = (struct ngsi *) n->_vd;
|
||||
int ret;
|
||||
|
||||
json_t *entity = ngsi_build_entity(i, smps, cnt, NGSI_ENTITY_VALUES);
|
||||
|
@ -575,7 +575,7 @@ int ngsi_write(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
|
||||
int ngsi_fd(struct node *n)
|
||||
{
|
||||
struct ngsi *i = n->_vd;
|
||||
struct ngsi *i = (struct ngsi *) n->_vd;
|
||||
|
||||
return task_fd(&i->task);
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ int opal_print_global()
|
|||
|
||||
int opal_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
struct opal *o = n->_vd;
|
||||
struct opal *o = (struct opal *) n->_vd;
|
||||
|
||||
int ret;
|
||||
json_error_t err;
|
||||
|
@ -167,7 +167,7 @@ int opal_parse(struct node *n, json_t *cfg)
|
|||
|
||||
char * opal_print(struct node *n)
|
||||
{
|
||||
struct opal *o = n->_vd;
|
||||
struct opal *o = (struct opal *) n->_vd;
|
||||
|
||||
/** @todo: Print send_params, recv_params */
|
||||
|
||||
|
@ -177,7 +177,7 @@ char * opal_print(struct node *n)
|
|||
|
||||
int opal_start(struct node *n)
|
||||
{
|
||||
struct opal *o = n->_vd;
|
||||
struct opal *o = (struct opal *) n->_vd;
|
||||
|
||||
/* Search for valid send and recv ids */
|
||||
int sfound = 0, rfound = 0;
|
||||
|
@ -206,7 +206,7 @@ int opal_stop(struct node *n)
|
|||
|
||||
int opal_read(struct node *n, struct pool *pool, unsigned cnt)
|
||||
{
|
||||
struct opal *o = n->_vd;
|
||||
struct opal *o = (struct opal *) n->_vd;
|
||||
|
||||
int state, len, ret;
|
||||
unsigned id;
|
||||
|
@ -271,7 +271,7 @@ int opal_read(struct node *n, struct pool *pool, unsigned cnt)
|
|||
|
||||
int opal_write(struct node *n, struct pool *pool, unsigned cnt)
|
||||
{
|
||||
struct opal *o = n->_vd;
|
||||
struct opal *o = (struct opal *) n->_vd;
|
||||
|
||||
struct msg *m = &pool[first % poolsize];
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
int shmem_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
struct shmem *shm = n->_vd;
|
||||
struct shmem *shm = (struct shmem *) n->_vd;
|
||||
const char *val;
|
||||
|
||||
int ret;
|
||||
|
@ -85,7 +85,7 @@ int shmem_parse(struct node *n, json_t *cfg)
|
|||
|
||||
int shmem_open(struct node *n)
|
||||
{
|
||||
struct shmem *shm = n->_vd;
|
||||
struct shmem *shm = (struct shmem *) n->_vd;
|
||||
int ret;
|
||||
|
||||
if (shm->exec) {
|
||||
|
@ -103,14 +103,14 @@ int shmem_open(struct node *n)
|
|||
|
||||
int shmem_close(struct node *n)
|
||||
{
|
||||
struct shmem* shm = n->_vd;
|
||||
struct shmem* shm = (struct shmem *) n->_vd;
|
||||
|
||||
return shmem_int_close(&shm->intf);
|
||||
}
|
||||
|
||||
int shmem_read(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
struct shmem *shm = n->_vd;
|
||||
struct shmem *shm = (struct shmem *) n->_vd;
|
||||
int recv;
|
||||
struct sample *shared_smps[cnt];
|
||||
|
||||
|
@ -133,7 +133,7 @@ int shmem_read(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
|
||||
int shmem_write(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
struct shmem *shm = n->_vd;
|
||||
struct shmem *shm = (struct shmem *) n->_vd;
|
||||
struct sample *shared_smps[cnt]; /* Samples need to be copied to the shared pool first */
|
||||
int avail, pushed, copied;
|
||||
|
||||
|
@ -158,7 +158,7 @@ int shmem_write(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
|
||||
char * shmem_print(struct node *n)
|
||||
{
|
||||
struct shmem *shm = n->_vd;
|
||||
struct shmem *shm = (struct shmem *) n->_vd;
|
||||
char *buf = NULL;
|
||||
|
||||
strcatf(&buf, "out_name=%s, in_name=%s, queuelen=%d, polling=%s",
|
||||
|
|
|
@ -51,7 +51,7 @@ enum signal_type signal_lookup_type(const char *type)
|
|||
|
||||
int signal_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
struct signal *s = n->_vd;
|
||||
struct signal *s = (struct signal *) n->_vd;
|
||||
|
||||
int ret;
|
||||
const char *type = NULL;
|
||||
|
@ -101,7 +101,7 @@ int signal_parse_cli(struct node *n, int argc, char *argv[])
|
|||
{
|
||||
char *type;
|
||||
|
||||
struct signal *s = n->_vd;
|
||||
struct signal *s = (struct signal *) n->_vd;
|
||||
|
||||
/* Default values */
|
||||
s->rate = 10;
|
||||
|
@ -172,7 +172,7 @@ check: if (optarg == endptr)
|
|||
int signal_open(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct signal *s = n->_vd;
|
||||
struct signal *s = (struct signal *) n->_vd;
|
||||
|
||||
s->counter = 0;
|
||||
s->started = time_now();
|
||||
|
@ -194,7 +194,7 @@ int signal_open(struct node *n)
|
|||
int signal_close(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct signal* s = n->_vd;
|
||||
struct signal* s = (struct signal *) n->_vd;
|
||||
|
||||
if (s->rt) {
|
||||
ret = task_destroy(&s->task);
|
||||
|
@ -209,7 +209,7 @@ int signal_close(struct node *n)
|
|||
|
||||
int signal_read(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
struct signal *s = n->_vd;
|
||||
struct signal *s = (struct signal *) n->_vd;
|
||||
struct sample *t = smps[0];
|
||||
|
||||
struct timespec ts;
|
||||
|
@ -270,7 +270,7 @@ int signal_read(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
|
||||
char * signal_print(struct node *n)
|
||||
{
|
||||
struct signal *s = n->_vd;
|
||||
struct signal *s = (struct signal *) n->_vd;
|
||||
char *type, *buf = NULL;
|
||||
|
||||
switch (s->type) {
|
||||
|
@ -296,7 +296,7 @@ char * signal_print(struct node *n)
|
|||
|
||||
int signal_fd(struct node *n)
|
||||
{
|
||||
struct signal *s = n->_vd;
|
||||
struct signal *s = (struct signal *) n->_vd;
|
||||
|
||||
return task_fd(&s->task);
|
||||
}
|
||||
|
|
|
@ -62,8 +62,8 @@ int socket_init(struct super_node *sn)
|
|||
|
||||
/* Gather list of used network interfaces */
|
||||
for (size_t i = 0; i < list_length(&p.node.instances); i++) {
|
||||
struct node *n = list_at(&p.node.instances, i);
|
||||
struct socket *s = n->_vd;
|
||||
struct node *n = (struct node *) list_at(&p.node.instances, i);
|
||||
struct socket *s = (struct socket *) n->_vd;
|
||||
struct rtnl_link *link;
|
||||
|
||||
/* Determine outgoing interface */
|
||||
|
@ -78,7 +78,7 @@ int socket_init(struct super_node *sn)
|
|||
struct interface *i;
|
||||
|
||||
for (size_t k = 0; k < list_length(&interfaces); k++) {
|
||||
i = list_at(&interfaces, k);
|
||||
i = (struct interface *) list_at(&interfaces, k);
|
||||
|
||||
if (rtnl_link_get_ifindex(i->nl_link) == rtnl_link_get_ifindex(link))
|
||||
goto found;
|
||||
|
@ -97,7 +97,7 @@ found: list_push(&i->sockets, s);
|
|||
}
|
||||
|
||||
for (size_t j = 0; j < list_length(&interfaces); j++) {
|
||||
struct interface *i = list_at(&interfaces, j);
|
||||
struct interface *i = (struct interface *) list_at(&interfaces, j);
|
||||
|
||||
if_start(i);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ int socket_deinit()
|
|||
{
|
||||
#ifdef WITH_NETEM
|
||||
for (size_t j = 0; j < list_length(&interfaces); j++) {
|
||||
struct interface *i = list_at(&interfaces, j);
|
||||
struct interface *i = (struct interface *) list_at(&interfaces, j);
|
||||
|
||||
if_stop(i);
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ int socket_deinit()
|
|||
|
||||
char * socket_print(struct node *n)
|
||||
{
|
||||
struct socket *s = n->_vd;
|
||||
struct socket *s = (struct socket *) n->_vd;
|
||||
char *layer = NULL, *buf;
|
||||
|
||||
switch (s->layer) {
|
||||
|
@ -159,7 +159,7 @@ char * socket_print(struct node *n)
|
|||
|
||||
int socket_start(struct node *n)
|
||||
{
|
||||
struct socket *s = n->_vd;
|
||||
struct socket *s = (struct socket *) n->_vd;
|
||||
int ret;
|
||||
|
||||
/* Some checks on the addresses */
|
||||
|
@ -263,7 +263,7 @@ int socket_start(struct node *n)
|
|||
|
||||
int socket_reverse(struct node *n)
|
||||
{
|
||||
struct socket *s = n->_vd;
|
||||
struct socket *s = (struct socket *) n->_vd;
|
||||
union sockaddr_union tmp;
|
||||
|
||||
tmp = s->local;
|
||||
|
@ -276,7 +276,7 @@ int socket_reverse(struct node *n)
|
|||
int socket_stop(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct socket *s = n->_vd;
|
||||
struct socket *s = (struct socket *) n->_vd;
|
||||
|
||||
if (s->multicast.enabled) {
|
||||
ret = setsockopt(s->sd, IPPROTO_IP, IP_DROP_MEMBERSHIP, &s->multicast.mreq, sizeof(s->multicast.mreq));
|
||||
|
@ -293,7 +293,7 @@ int socket_stop(struct node *n)
|
|||
int socket_destroy(struct node *n)
|
||||
{
|
||||
#ifdef WITH_NETEM
|
||||
struct socket *s = n->_vd;
|
||||
struct socket *s = (struct socket *) n->_vd;
|
||||
|
||||
rtnl_qdisc_put(s->tc_qdisc);
|
||||
rtnl_cls_put(s->tc_classifier);
|
||||
|
@ -305,7 +305,7 @@ int socket_destroy(struct node *n)
|
|||
int socket_read(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
int ret;
|
||||
struct socket *s = n->_vd;
|
||||
struct socket *s = (struct socket *) n->_vd;
|
||||
|
||||
char buf[SOCKET_MAX_PACKET_LEN];
|
||||
char *bufptr = buf;
|
||||
|
@ -355,7 +355,7 @@ int socket_read(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
|
||||
int socket_write(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
struct socket *s = n->_vd;
|
||||
struct socket *s = (struct socket *) n->_vd;
|
||||
|
||||
char data[SOCKET_MAX_PACKET_LEN];
|
||||
int ret;
|
||||
|
@ -386,7 +386,7 @@ int socket_write(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
|
||||
int socket_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
struct socket *s = n->_vd;
|
||||
struct socket *s = (struct socket *) n->_vd;
|
||||
|
||||
const char *local, *remote;
|
||||
const char *layer = NULL;
|
||||
|
@ -685,7 +685,7 @@ int socket_compare_addr(struct sockaddr *x, struct sockaddr *y)
|
|||
|
||||
int socket_fd(struct node *n)
|
||||
{
|
||||
struct socket *s = n->_vd;
|
||||
struct socket *s = (struct socket *) n->_vd;
|
||||
|
||||
return s->sd;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ int stats_node_init(struct super_node *sn)
|
|||
|
||||
int stats_node_start(struct node *n)
|
||||
{
|
||||
struct stats_node *s = n->_vd;
|
||||
struct stats_node *s = (struct stats_node *) n->_vd;
|
||||
int ret;
|
||||
|
||||
ret = task_init(&s->task, s->rate, CLOCK_MONOTONIC);
|
||||
|
@ -64,7 +64,7 @@ int stats_node_start(struct node *n)
|
|||
|
||||
int stats_node_stop(struct node *n)
|
||||
{
|
||||
struct stats_node *s = n->_vd;
|
||||
struct stats_node *s = (struct stats_node *) n->_vd;
|
||||
int ret;
|
||||
|
||||
ret = task_destroy(&s->task);
|
||||
|
@ -76,14 +76,14 @@ int stats_node_stop(struct node *n)
|
|||
|
||||
char * stats_node_print(struct node *n)
|
||||
{
|
||||
struct stats_node *s = n->_vd;
|
||||
struct stats_node *s = (struct stats_node *) n->_vd;
|
||||
|
||||
return strf("node=%s, rate=%f", s->node_str, s->rate);
|
||||
}
|
||||
|
||||
int stats_node_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
struct stats_node *s = n->_vd;
|
||||
struct stats_node *s = (struct stats_node *) n->_vd;
|
||||
|
||||
int ret;
|
||||
json_error_t err;
|
||||
|
@ -109,7 +109,7 @@ int stats_node_parse(struct node *n, json_t *cfg)
|
|||
|
||||
int stats_node_destroy(struct node *n)
|
||||
{
|
||||
struct stats_node *s = n->_vd;
|
||||
struct stats_node *s = (struct stats_node *) n->_vd;
|
||||
|
||||
if (s->node_str)
|
||||
free(s->node_str);
|
||||
|
@ -119,7 +119,7 @@ int stats_node_destroy(struct node *n)
|
|||
|
||||
int stats_node_read(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
struct stats_node *sn = n->_vd;
|
||||
struct stats_node *sn = (struct stats_node *) n->_vd;
|
||||
struct stats *s = sn->node->stats;
|
||||
|
||||
if (!cnt)
|
||||
|
@ -149,7 +149,7 @@ int stats_node_read(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
|
||||
int stats_node_fd(struct node *n)
|
||||
{
|
||||
struct stats_node *s = n->_vd;
|
||||
struct stats_node *s = (struct stats_node *) n->_vd;
|
||||
|
||||
return task_fd(&s->task);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
static int test_rtt_case_start(struct test_rtt *t, int id)
|
||||
{
|
||||
int ret;
|
||||
struct test_rtt_case *c = list_at(&t->cases, id);
|
||||
struct test_rtt_case *c = (struct test_rtt_case *) list_at(&t->cases, id);
|
||||
|
||||
/* Open file */
|
||||
ret = io_open(&t->io, c->filename);
|
||||
|
@ -70,7 +70,7 @@ static int test_rtt_case_stop(struct test_rtt *t, int id)
|
|||
int test_rtt_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
int ret;
|
||||
struct test_rtt *t = n->_vd;
|
||||
struct test_rtt *t = (struct test_rtt *) n->_vd;
|
||||
|
||||
const char *format = "villas-human";
|
||||
const char *output = ".";
|
||||
|
@ -175,7 +175,7 @@ int test_rtt_parse(struct node *n, json_t *cfg)
|
|||
|
||||
for (int i = 0; i < numrates; i++) {
|
||||
for (int j = 0; j < numvalues; j++) {
|
||||
struct test_rtt_case *c = alloc(sizeof(struct test_rtt_case));
|
||||
struct test_rtt_case *c = (struct test_rtt_case *) alloc(sizeof(struct test_rtt_case));
|
||||
|
||||
c->rate = rates[i];
|
||||
c->values = values[j];
|
||||
|
@ -203,7 +203,7 @@ int test_rtt_parse(struct node *n, json_t *cfg)
|
|||
int test_rtt_destroy(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct test_rtt *t = n->_vd;
|
||||
struct test_rtt *t = (struct test_rtt *) n->_vd;
|
||||
|
||||
ret = list_destroy(&t->cases, NULL, true);
|
||||
if (ret)
|
||||
|
@ -228,7 +228,7 @@ int test_rtt_destroy(struct node *n)
|
|||
|
||||
char * test_rtt_print(struct node *n)
|
||||
{
|
||||
struct test_rtt *t = n->_vd;
|
||||
struct test_rtt *t = (struct test_rtt *) n->_vd;
|
||||
|
||||
return strf("output=%s, prefix=%s, cooldown=%f, #cases=%zu", t->output, t->prefix, t->cooldown, list_length(&t->cases));
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ int test_rtt_start(struct node *n)
|
|||
{
|
||||
int ret;
|
||||
struct stat st;
|
||||
struct test_rtt *t = n->_vd;
|
||||
struct test_rtt *t = (struct test_rtt *) n->_vd;
|
||||
struct test_rtt_case *c = list_first(&t->cases);
|
||||
|
||||
/* Create folder for results if not present */
|
||||
|
@ -265,7 +265,7 @@ int test_rtt_start(struct node *n)
|
|||
int test_rtt_stop(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct test_rtt *t = n->_vd;
|
||||
struct test_rtt *t = (struct test_rtt *) n->_vd;
|
||||
|
||||
if (t->counter != -1) {
|
||||
ret = test_rtt_case_stop(t, t->current);
|
||||
|
@ -281,7 +281,7 @@ int test_rtt_read(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
int i, ret, values;
|
||||
uint64_t steps;
|
||||
|
||||
struct test_rtt *t = n->_vd;
|
||||
struct test_rtt *t = (struct test_rtt *) n->_vd;
|
||||
|
||||
if (t->counter == -1) {
|
||||
if (t->current == -1) {
|
||||
|
@ -301,7 +301,7 @@ int test_rtt_read(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
pause();
|
||||
}
|
||||
else {
|
||||
struct test_rtt_case *c = list_at(&t->cases, t->current);
|
||||
struct test_rtt_case *c = (struct test_rtt_case *) list_at(&t->cases, t->current);
|
||||
info("Starting case #%d: filename=%s, rate=%f, values=%d, limit=%d", t->current, c->filename, c->rate, c->values, c->limit);
|
||||
ret = test_rtt_case_start(t, t->current);
|
||||
if (ret)
|
||||
|
@ -309,7 +309,7 @@ int test_rtt_read(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
}
|
||||
}
|
||||
|
||||
struct test_rtt_case *c = list_at(&t->cases, t->current);
|
||||
struct test_rtt_case *c = (struct test_rtt_case *) list_at(&t->cases, t->current);
|
||||
|
||||
/* Wait */
|
||||
steps = task_wait(&t->task);
|
||||
|
@ -349,8 +349,8 @@ int test_rtt_read(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
|
||||
int test_rtt_write(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
struct test_rtt *t = n->_vd;
|
||||
struct test_rtt_case *c = list_at(&t->cases, t->current);
|
||||
struct test_rtt *t = (struct test_rtt *) n->_vd;
|
||||
struct test_rtt_case *c = (struct test_rtt_case *) list_at(&t->cases, t->current);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < cnt; i++) {
|
||||
|
@ -367,7 +367,7 @@ int test_rtt_write(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
|
||||
int test_rtt_fd(struct node *n)
|
||||
{
|
||||
struct test_rtt *t = n->_vd;
|
||||
struct test_rtt *t = (struct test_rtt *) n->_vd;
|
||||
|
||||
return task_fd(&t->task);
|
||||
}
|
||||
|
|
|
@ -265,7 +265,7 @@ int websocket_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, voi
|
|||
if (lws_is_final_fragment(wsi)) {
|
||||
struct timespec ts_recv = time_now();
|
||||
|
||||
struct websocket *w = c->node->_vd;
|
||||
struct websocket *w = (struct websocket *) c->node->_vd;
|
||||
struct sample **smps = alloca(cnt * sizeof(struct sample *));
|
||||
|
||||
ret = sample_alloc_many(&w->pool, smps, cnt);
|
||||
|
@ -322,7 +322,7 @@ int websocket_init(struct super_node *sn)
|
|||
int websocket_deinit()
|
||||
{
|
||||
for (size_t i = 0; i < list_length(&connections); i++) {
|
||||
struct websocket_connection *c = list_at(&connections, i);
|
||||
struct websocket_connection *c = (struct websocket_connection *) list_at(&connections, i);
|
||||
|
||||
c->state = STATE_SHUTDOWN;
|
||||
|
||||
|
@ -343,7 +343,7 @@ int websocket_deinit()
|
|||
int websocket_start(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct websocket *w = n->_vd;
|
||||
struct websocket *w = (struct websocket *) n->_vd;
|
||||
|
||||
ret = pool_init(&w->pool, DEFAULT_WEBSOCKET_QUEUELEN, SAMPLE_LEN(DEFAULT_WEBSOCKET_SAMPLELEN), &memtype_hugepage);
|
||||
if (ret)
|
||||
|
@ -354,8 +354,8 @@ int websocket_start(struct node *n)
|
|||
return ret;
|
||||
|
||||
for (int i = 0; i < list_length(&w->destinations); i++) {
|
||||
struct websocket_destination *d = list_at(&w->destinations, i);
|
||||
struct websocket_connection *c = alloc(sizeof(struct websocket_connection));
|
||||
struct websocket_destination *d = (struct websocket_destination *) list_at(&w->destinations, i);
|
||||
struct websocket_connection *c = (struct websocket_connection *) alloc(sizeof(struct websocket_connection));
|
||||
|
||||
c->state = STATE_CONNECTING;
|
||||
c->mode = WEBSOCKET_MODE_CLIENT;
|
||||
|
@ -384,14 +384,14 @@ int websocket_start(struct node *n)
|
|||
int websocket_stop(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct websocket *w = n->_vd;
|
||||
struct websocket *w = (struct websocket *) n->_vd;
|
||||
|
||||
/* Wait for all connections to be closed */
|
||||
for (;;) {
|
||||
int connecting = 0;
|
||||
|
||||
for (int i = 0; i < list_length(&w->destinations); i++) {
|
||||
struct websocket_destination *d = list_at(&w->destinations, i);
|
||||
struct websocket_destination *d = (struct websocket_destination *) list_at(&w->destinations, i);
|
||||
struct websocket_connection *c = d->info.userdata;
|
||||
|
||||
if (c->state == STATE_CONNECTING)
|
||||
|
@ -406,7 +406,7 @@ int websocket_stop(struct node *n)
|
|||
}
|
||||
|
||||
for (size_t i = 0; i < list_length(&connections); i++) {
|
||||
struct websocket_connection *c = list_at(&connections, i);
|
||||
struct websocket_connection *c = (struct websocket_connection *) list_at(&connections, i);
|
||||
|
||||
if (c->node != n)
|
||||
continue;
|
||||
|
@ -430,7 +430,7 @@ int websocket_stop(struct node *n)
|
|||
|
||||
int websocket_destroy(struct node *n)
|
||||
{
|
||||
struct websocket *w = n->_vd;
|
||||
struct websocket *w = (struct websocket *) n->_vd;
|
||||
|
||||
list_destroy(&w->destinations, (dtor_cb_t) websocket_destination_destroy, true);
|
||||
|
||||
|
@ -441,7 +441,7 @@ int websocket_read(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
{
|
||||
int avail;
|
||||
|
||||
struct websocket *w = n->_vd;
|
||||
struct websocket *w = (struct websocket *) n->_vd;
|
||||
struct sample *cpys[cnt];
|
||||
|
||||
avail = queue_signalled_pull_many(&w->queue, (void **) cpys, cnt);
|
||||
|
@ -460,7 +460,7 @@ int websocket_write(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
{
|
||||
int avail;
|
||||
|
||||
struct websocket *w = n->_vd;
|
||||
struct websocket *w = (struct websocket *) n->_vd;
|
||||
struct sample *cpys[cnt];
|
||||
|
||||
/* Make copies of all samples */
|
||||
|
@ -476,7 +476,7 @@ int websocket_write(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
}
|
||||
|
||||
for (size_t i = 0; i < list_length(&connections); i++) {
|
||||
struct websocket_connection *c = list_at(&connections, i);
|
||||
struct websocket_connection *c = (struct websocket_connection *) list_at(&connections, i);
|
||||
|
||||
if (c->node == n || c->node == NULL)
|
||||
websocket_connection_write(c, cpys, cnt);
|
||||
|
@ -489,7 +489,7 @@ int websocket_write(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
|
||||
int websocket_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
struct websocket *w = n->_vd;
|
||||
struct websocket *w = (struct websocket *) n->_vd;
|
||||
int ret;
|
||||
|
||||
size_t index;
|
||||
|
@ -514,7 +514,7 @@ int websocket_parse(struct node *n, json_t *cfg)
|
|||
if (!uri)
|
||||
error("The 'destinations' setting of node %s must be an array of URLs", node_name(n));
|
||||
|
||||
struct websocket_destination *d = alloc(sizeof(struct websocket_destination));
|
||||
struct websocket_destination *d = (struct websocket_destination *) alloc(sizeof(struct websocket_destination));
|
||||
|
||||
d->uri = strdup(uri);
|
||||
|
||||
|
@ -539,14 +539,14 @@ int websocket_parse(struct node *n, json_t *cfg)
|
|||
|
||||
char * websocket_print(struct node *n)
|
||||
{
|
||||
struct websocket *w = n->_vd;
|
||||
struct websocket *w = (struct websocket *) n->_vd;
|
||||
|
||||
char *buf = NULL;
|
||||
|
||||
buf = strcatf(&buf, "destinations=[ ");
|
||||
|
||||
for (size_t i = 0; i < list_length(&w->destinations); i++) {
|
||||
struct websocket_destination *d = list_at(&w->destinations, i);
|
||||
struct websocket_destination *d = (struct websocket_destination *) list_at(&w->destinations, i);
|
||||
|
||||
buf = strcatf(&buf, "%s://%s:%d/%s ",
|
||||
d->info.ssl_connection ? "wss" : "ws",
|
||||
|
@ -563,7 +563,7 @@ char * websocket_print(struct node *n)
|
|||
|
||||
int websocket_fd(struct node *n)
|
||||
{
|
||||
struct websocket *w = n->_vd;
|
||||
struct websocket *w = (struct websocket *) n->_vd;
|
||||
|
||||
return queue_signalled_fd(&w->queue);
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ static int get_monitor_event(void *monitor, int *value, char **address)
|
|||
|
||||
int zeromq_reverse(struct node *n)
|
||||
{
|
||||
struct zeromq *z = n->_vd;
|
||||
struct zeromq *z = (struct zeromq *) n->_vd;
|
||||
|
||||
if (list_length(&z->publisher.endpoints) != 1)
|
||||
return -1;
|
||||
|
@ -92,7 +92,7 @@ int zeromq_reverse(struct node *n)
|
|||
|
||||
int zeromq_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
struct zeromq *z = n->_vd;
|
||||
struct zeromq *z = (struct zeromq *) n->_vd;
|
||||
|
||||
int ret;
|
||||
const char *ep = NULL;
|
||||
|
@ -197,7 +197,7 @@ int zeromq_parse(struct node *n, json_t *cfg)
|
|||
|
||||
char * zeromq_print(struct node *n)
|
||||
{
|
||||
struct zeromq *z = n->_vd;
|
||||
struct zeromq *z = (struct zeromq *) n->_vd;
|
||||
|
||||
char *buf = NULL;
|
||||
char *pattern = NULL;
|
||||
|
@ -218,7 +218,7 @@ char * zeromq_print(struct node *n)
|
|||
);
|
||||
|
||||
for (size_t i = 0; i < list_length(&z->publisher.endpoints); i++) {
|
||||
char *ep = list_at(&z->publisher.endpoints, i);
|
||||
char *ep = (char *) list_at(&z->publisher.endpoints, i);
|
||||
|
||||
strcatf(&buf, "%s ", ep);
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ int zeromq_deinit()
|
|||
int zeromq_start(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct zeromq *z = n->_vd;
|
||||
struct zeromq *z = (struct zeromq *) n->_vd;
|
||||
|
||||
switch (z->pattern) {
|
||||
#ifdef ZMQ_BUILD_DISH
|
||||
|
@ -351,7 +351,7 @@ int zeromq_start(struct node *n)
|
|||
|
||||
/* Spawn server for publisher */
|
||||
for (size_t i = 0; i < list_length(&z->publisher.endpoints); i++) {
|
||||
char *ep = list_at(&z->publisher.endpoints, i);
|
||||
char *ep = (char *) list_at(&z->publisher.endpoints, i);
|
||||
|
||||
ret = zmq_bind(z->publisher.socket, ep);
|
||||
if (ret < 0)
|
||||
|
@ -387,7 +387,7 @@ fail:
|
|||
int zeromq_stop(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct zeromq *z = n->_vd;
|
||||
struct zeromq *z = (struct zeromq *) n->_vd;
|
||||
|
||||
ret = zmq_close(z->subscriber.socket);
|
||||
if (ret)
|
||||
|
@ -405,7 +405,7 @@ int zeromq_stop(struct node *n)
|
|||
int zeromq_read(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
int recv, ret;
|
||||
struct zeromq *z = n->_vd;
|
||||
struct zeromq *z = (struct zeromq *) n->_vd;
|
||||
|
||||
zmq_msg_t m;
|
||||
|
||||
|
@ -441,7 +441,7 @@ int zeromq_read(struct node *n, struct sample *smps[], unsigned cnt)
|
|||
int zeromq_write(struct node *n, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
int ret;
|
||||
struct zeromq *z = n->_vd;
|
||||
struct zeromq *z = (struct zeromq *) n->_vd;
|
||||
|
||||
size_t wbytes;
|
||||
zmq_msg_t m;
|
||||
|
@ -491,7 +491,7 @@ fail:
|
|||
int zeromq_fd(struct node *n)
|
||||
{
|
||||
int ret;
|
||||
struct zeromq *z = n->_vd;
|
||||
struct zeromq *z = (struct zeromq *) n->_vd;
|
||||
|
||||
int fd;
|
||||
size_t len = sizeof(fd);
|
||||
|
|
60
lib/path.c
60
lib/path.c
|
@ -98,7 +98,7 @@ static void path_destination_enqueue(struct path *p, struct sample *smps[], unsi
|
|||
warn("Pool underrun in path %s", path_name(p));
|
||||
|
||||
for (size_t i = 0; i < list_length(&p->destinations); i++) {
|
||||
struct path_destination *pd = list_at(&p->destinations, i);
|
||||
struct path_destination *pd = (struct path_destination *) list_at(&p->destinations, i);
|
||||
|
||||
enqueued = queue_push_many(&pd->queue, (void **) clones, cloned);
|
||||
if (enqueued != cnt)
|
||||
|
@ -125,7 +125,7 @@ static void * path_run(void *arg)
|
|||
serror("Failed to poll");
|
||||
|
||||
for (int i = 0; i < p->reader.nfds; i++) {
|
||||
struct path_source *ps = list_at(&p->sources, i);
|
||||
struct path_source *ps = (struct path_source *) list_at(&p->sources, i);
|
||||
|
||||
if (p->reader.pfds[i].revents & POLLIN) {
|
||||
/* Timeout: re-enqueue the last sample */
|
||||
|
@ -202,7 +202,7 @@ out2: sample_put_many(read_smps, ready);
|
|||
}
|
||||
|
||||
for (size_t i = 0; i < list_length(&p->destinations); i++) {
|
||||
struct path_destination *pd = list_at(&p->destinations, i);
|
||||
struct path_destination *pd = (struct path_destination *) list_at(&p->destinations, i);
|
||||
|
||||
int cnt = pd->node->vectorize;
|
||||
int sent;
|
||||
|
@ -259,7 +259,7 @@ int path_init(struct path *p)
|
|||
|
||||
/* Add internal hooks if they are not already in the list */
|
||||
for (size_t i = 0; i < list_length(&plugins); i++) {
|
||||
struct plugin *q = list_at(&plugins, i);
|
||||
struct plugin *q = (struct plugin *) list_at(&plugins, i);
|
||||
|
||||
if (q->type != PLUGIN_TYPE_HOOK)
|
||||
continue;
|
||||
|
@ -267,7 +267,7 @@ int path_init(struct path *p)
|
|||
struct hook_type *vt = &q->hook;
|
||||
|
||||
if ((vt->flags & HOOK_PATH) && (vt->flags & HOOK_BUILTIN)) {
|
||||
struct hook *h = alloc(sizeof(struct hook));
|
||||
struct hook *h = (struct hook *) alloc(sizeof(struct hook));
|
||||
|
||||
ret = hook_init(h, vt, p, NULL);
|
||||
if (ret)
|
||||
|
@ -293,7 +293,7 @@ int path_init2(struct path *p)
|
|||
|
||||
/* Initialize destinations */
|
||||
for (size_t i = 0; i < list_length(&p->destinations); i++) {
|
||||
struct path_destination *pd = list_at(&p->destinations, i);
|
||||
struct path_destination *pd = (struct path_destination *) list_at(&p->destinations, i);
|
||||
|
||||
ret = path_destination_init(pd, p->queuelen);
|
||||
if (ret)
|
||||
|
@ -302,7 +302,7 @@ int path_init2(struct path *p)
|
|||
|
||||
/* Initialize sources */
|
||||
for (size_t i = 0; i < list_length(&p->sources); i++) {
|
||||
struct path_source *ps = list_at(&p->sources, i);
|
||||
struct path_source *ps = (struct path_source *) list_at(&p->sources, i);
|
||||
|
||||
ret = path_source_init(ps);
|
||||
if (ret)
|
||||
|
@ -315,13 +315,13 @@ int path_init2(struct path *p)
|
|||
/* Calc sample length of path and initialize bitset */
|
||||
p->samplelen = 0;
|
||||
for (size_t i = 0; i < list_length(&p->sources); i++) {
|
||||
struct path_source *ps = list_at(&p->sources, i);
|
||||
struct path_source *ps = (struct path_source *) list_at(&p->sources, i);
|
||||
|
||||
if (ps->masked)
|
||||
bitset_set(&p->mask, i);
|
||||
|
||||
for (size_t i = 0; i < list_length(&ps->mappings); i++) {
|
||||
struct mapping_entry *me = list_at(&ps->mappings, i);
|
||||
struct mapping_entry *me = (struct mapping_entry *) list_at(&ps->mappings, i);
|
||||
|
||||
int len = me->length;
|
||||
int off = me->offset;
|
||||
|
@ -352,7 +352,7 @@ int path_init2(struct path *p)
|
|||
p->reader.pfds = alloc(sizeof(struct pollfd) * p->reader.nfds);
|
||||
|
||||
for (int i = 0; i < list_length(&p->sources); i++) {
|
||||
struct path_source *ps = list_at(&p->sources, i);
|
||||
struct path_source *ps = (struct path_source *) list_at(&p->sources, i);
|
||||
|
||||
/* This slot is only used if it is not masked */
|
||||
p->reader.pfds[i].events = POLLIN;
|
||||
|
@ -427,13 +427,13 @@ int path_parse(struct path *p, json_t *cfg, struct list *nodes)
|
|||
}
|
||||
|
||||
for (size_t i = 0; i < list_length(&sources); i++) {
|
||||
struct mapping_entry *me = list_at(&sources, i);
|
||||
struct mapping_entry *me = (struct mapping_entry *) list_at(&sources, i);
|
||||
|
||||
struct path_source *ps = NULL;
|
||||
|
||||
/* Check if there is already a path_source for this source */
|
||||
for (size_t j = 0; j < list_length(&p->sources); j++) {
|
||||
struct path_source *pt = list_at(&p->sources, j);
|
||||
struct path_source *pt = (struct path_source *) list_at(&p->sources, j);
|
||||
|
||||
if (pt->node == me->node) {
|
||||
ps = pt;
|
||||
|
@ -458,9 +458,9 @@ int path_parse(struct path *p, json_t *cfg, struct list *nodes)
|
|||
}
|
||||
|
||||
for (size_t i = 0; i < list_length(&destinations); i++) {
|
||||
struct node *n = list_at(&destinations, i);
|
||||
struct node *n = (struct node *) list_at(&destinations, i);
|
||||
|
||||
struct path_destination *pd = alloc(sizeof(struct path_destination));
|
||||
struct path_destination *pd = (struct path_destination *) alloc(sizeof(struct path_destination));
|
||||
|
||||
pd->node = n;
|
||||
|
||||
|
@ -489,7 +489,7 @@ int path_parse(struct path *p, json_t *cfg, struct list *nodes)
|
|||
|
||||
/* Search correspondending path_source to node */
|
||||
for (size_t i = 0; i < list_length(&p->sources); i++) {
|
||||
struct path_source *pt = list_at(&p->sources, i);
|
||||
struct path_source *pt = (struct path_source *) list_at(&p->sources, i);
|
||||
|
||||
if (pt->node == node) {
|
||||
ps = pt;
|
||||
|
@ -505,7 +505,7 @@ int path_parse(struct path *p, json_t *cfg, struct list *nodes)
|
|||
}
|
||||
else {/* Enable all by default */
|
||||
for (size_t i = 0; i < list_length(&p->sources); i++) {
|
||||
struct path_source *ps = list_at(&p->sources, i);
|
||||
struct path_source *ps = (struct path_source *) list_at(&p->sources, i);
|
||||
|
||||
ps->masked = true;
|
||||
}
|
||||
|
@ -534,14 +534,14 @@ int path_check(struct path *p)
|
|||
error("Setting 'rate' of path %s must be a positive number.", path_name(p));
|
||||
|
||||
for (size_t i = 0; i < list_length(&p->sources); i++) {
|
||||
struct path_source *ps = list_at(&p->sources, i);
|
||||
struct path_source *ps = (struct path_source *) list_at(&p->sources, i);
|
||||
|
||||
if (!ps->node->_vt->read)
|
||||
error("Source node '%s' is not supported as a source for path '%s'", node_name(ps->node), path_name(p));
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < list_length(&p->destinations); i++) {
|
||||
struct path_destination *pd = list_at(&p->destinations, i);
|
||||
struct path_destination *pd = (struct path_destination *) list_at(&p->destinations, i);
|
||||
|
||||
if (!pd->node->_vt->write)
|
||||
error("Destiation node '%s' is not supported as a sink for path '%s'", node_name(pd->node), path_name(p));
|
||||
|
@ -588,7 +588,7 @@ int path_start(struct path *p)
|
|||
free(mask);
|
||||
|
||||
for (size_t i = 0; i < list_length(&p->hooks); i++) {
|
||||
struct hook *h = list_at(&p->hooks, i);
|
||||
struct hook *h = (struct hook *) list_at(&p->hooks, i);
|
||||
|
||||
ret = hook_start(h);
|
||||
if (ret)
|
||||
|
@ -601,10 +601,10 @@ int path_start(struct path *p)
|
|||
|
||||
/* We initialize the intial sample with zeros */
|
||||
for (size_t i = 0; i < list_length(&p->sources); i++) {
|
||||
struct path_source *ps = list_at(&p->sources, i);
|
||||
struct path_source *ps = (struct path_source *) list_at(&p->sources, i);
|
||||
|
||||
for (size_t j = 0; j < list_length(&ps->mappings); j++) {
|
||||
struct mapping_entry *me = list_at(&ps->mappings, j);
|
||||
struct mapping_entry *me = (struct path_source *) list_at(&ps->mappings, j);
|
||||
|
||||
int len = me->length;
|
||||
int off = me->offset;
|
||||
|
@ -648,7 +648,7 @@ int path_stop(struct path *p)
|
|||
return ret;
|
||||
|
||||
for (size_t i = 0; i < list_length(&p->hooks); i++) {
|
||||
struct hook *h = list_at(&p->hooks, i);
|
||||
struct hook *h = (struct hook *) list_at(&p->hooks, i);
|
||||
|
||||
ret = hook_stop(h);
|
||||
if (ret)
|
||||
|
@ -691,7 +691,7 @@ const char * path_name(struct path *p)
|
|||
strcatf(&p->_name, "[");
|
||||
|
||||
for (size_t i = 0; i < list_length(&p->sources); i++) {
|
||||
struct path_source *ps = list_at(&p->sources, i);
|
||||
struct path_source *ps = (struct path_source *) list_at(&p->sources, i);
|
||||
|
||||
strcatf(&p->_name, " %s", node_name_short(ps->node));
|
||||
}
|
||||
|
@ -699,7 +699,7 @@ const char * path_name(struct path *p)
|
|||
strcatf(&p->_name, " ] " CLR_MAG("=>") " [");
|
||||
|
||||
for (size_t i = 0; i < list_length(&p->destinations); i++) {
|
||||
struct path_destination *pd = list_at(&p->destinations, i);
|
||||
struct path_destination *pd = (struct path_destination *) list_at(&p->destinations, i);
|
||||
|
||||
strcatf(&p->_name, " %s", node_name_short(pd->node));
|
||||
}
|
||||
|
@ -713,14 +713,14 @@ const char * path_name(struct path *p)
|
|||
int path_uses_node(struct path *p, struct node *n)
|
||||
{
|
||||
for (size_t i = 0; i < list_length(&p->destinations); i++) {
|
||||
struct path_destination *pd = list_at(&p->destinations, i);
|
||||
struct path_destination *pd = (struct path_destination *) list_at(&p->destinations, i);
|
||||
|
||||
if (pd->node == n)
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < list_length(&p->sources); i++) {
|
||||
struct path_source *ps = list_at(&p->sources, i);
|
||||
struct path_source *ps = (struct path_source *) list_at(&p->sources, i);
|
||||
|
||||
if (ps->node == n)
|
||||
return 0;
|
||||
|
@ -743,8 +743,8 @@ int path_reverse(struct path *p, struct path *r)
|
|||
struct path_destination *orig_pd = list_first(&p->destinations);
|
||||
struct path_source *orig_ps = list_first(&p->sources);
|
||||
|
||||
struct path_destination *new_pd = alloc(sizeof(struct path_destination));
|
||||
struct path_source *new_ps = alloc(sizeof(struct path_source));
|
||||
struct path_destination *new_pd = (struct path_destination *) alloc(sizeof(struct path_destination));
|
||||
struct path_source *new_ps = (struct path_source *) alloc(sizeof(struct path_source));
|
||||
|
||||
new_pd->node = orig_ps->node;
|
||||
|
||||
|
@ -754,8 +754,8 @@ int path_reverse(struct path *p, struct path *r)
|
|||
list_push(&r->sources, new_ps);
|
||||
|
||||
for (size_t i = 0; i < list_length(&p->hooks); i++) {
|
||||
struct hook *h = list_at(&p->hooks, i);
|
||||
struct hook *g = alloc(sizeof(struct hook));
|
||||
struct hook *h = (struct hook *) list_at(&p->hooks, i);
|
||||
struct hook *g = (struct hook *) alloc(sizeof(struct hook));
|
||||
|
||||
ret = hook_init(g, h->_vt, r, NULL);
|
||||
if (ret)
|
||||
|
|
|
@ -90,7 +90,7 @@ int plugin_destroy(struct plugin *p)
|
|||
struct plugin * plugin_lookup(enum plugin_type type, const char *name)
|
||||
{
|
||||
for (size_t i = 0; i < list_length(&plugins); i++) {
|
||||
struct plugin *p = list_at(&plugins, i);
|
||||
struct plugin *p = (struct plugin *) list_at(&plugins, i);
|
||||
|
||||
if (p->type == type && strcmp(p->name, name) == 0)
|
||||
return p;
|
||||
|
@ -102,7 +102,7 @@ struct plugin * plugin_lookup(enum plugin_type type, const char *name)
|
|||
void plugin_dump(enum plugin_type type)
|
||||
{
|
||||
for (size_t i = 0; i < list_length(&plugins); i++) {
|
||||
struct plugin *p = list_at(&plugins, i);
|
||||
struct plugin *p = (struct plugin *) list_at(&plugins, i);
|
||||
|
||||
if (p->type == type)
|
||||
printf(" - %-13s: %s\n", p->name, p->description);
|
||||
|
|
|
@ -49,7 +49,7 @@ int queue_init(struct queue *q, size_t size, struct memtype *mem)
|
|||
|
||||
q->mem = mem;
|
||||
q->buffer_mask = size - 1;
|
||||
struct queue_cell* buffer = memory_alloc(q->mem, sizeof(struct queue_cell) * size);
|
||||
struct queue_cell *buffer = (struct queue_cell *) memory_alloc(q->mem, sizeof(struct queue_cell) * size);
|
||||
if (!buffer)
|
||||
return -2;
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ int super_node_parse_json(struct super_node *sn, json_t *cfg)
|
|||
size_t index;
|
||||
json_t *json_plugin;
|
||||
json_array_foreach(json_plugins, index, json_plugin) {
|
||||
struct plugin *p = alloc(sizeof(struct plugin));
|
||||
struct plugin *p = (struct plugin *) alloc(sizeof(struct plugin));
|
||||
|
||||
ret = plugin_init(p);
|
||||
if (ret)
|
||||
|
@ -252,7 +252,7 @@ int super_node_parse_json(struct super_node *sn, json_t *cfg)
|
|||
if (!p)
|
||||
error("Invalid node type: %s", type);
|
||||
|
||||
struct node *n = alloc(sizeof(struct node));
|
||||
struct node *n = (struct node *) alloc(sizeof(struct node));
|
||||
|
||||
ret = node_init(n, &p->node);
|
||||
if (ret)
|
||||
|
@ -274,7 +274,7 @@ int super_node_parse_json(struct super_node *sn, json_t *cfg)
|
|||
size_t index;
|
||||
json_t *json_path;
|
||||
json_array_foreach(json_paths, index, json_path) {
|
||||
struct path *p = alloc(sizeof(struct path));
|
||||
struct path *p = (struct path *) alloc(sizeof(struct path));
|
||||
|
||||
ret = path_init(p);
|
||||
if (ret)
|
||||
|
@ -287,7 +287,7 @@ int super_node_parse_json(struct super_node *sn, json_t *cfg)
|
|||
list_push(&sn->paths, p);
|
||||
|
||||
if (p->reverse) {
|
||||
struct path *r = alloc(sizeof(struct path));
|
||||
struct path *r = (struct path *) alloc(sizeof(struct path));
|
||||
|
||||
ret = path_init(r);
|
||||
if (ret)
|
||||
|
@ -314,7 +314,7 @@ int super_node_check(struct super_node *sn)
|
|||
assert(sn->state != STATE_DESTROYED);
|
||||
|
||||
for (size_t i = 0; i < list_length(&sn->nodes); i++) {
|
||||
struct node *n = list_at(&sn->nodes, i);
|
||||
struct node *n = (struct node *) list_at(&sn->nodes, i);
|
||||
|
||||
ret = node_check(n);
|
||||
if (ret)
|
||||
|
@ -322,7 +322,7 @@ int super_node_check(struct super_node *sn)
|
|||
}
|
||||
|
||||
for (size_t i = 0; i < list_length(&sn->paths); i++) {
|
||||
struct path *p = list_at(&sn->paths, i);
|
||||
struct path *p = (struct path *) list_at(&sn->paths, i);
|
||||
|
||||
ret = path_check(p);
|
||||
if (ret)
|
||||
|
@ -353,7 +353,7 @@ int super_node_start(struct super_node *sn)
|
|||
|
||||
info("Starting node-types");
|
||||
for (size_t i = 0; i < list_length(&sn->nodes); i++) { INDENT
|
||||
struct node *n = list_at(&sn->nodes, i);
|
||||
struct node *n = (struct node *) list_at(&sn->nodes, i);
|
||||
|
||||
ret = node_type_start(n->_vt, sn);
|
||||
if (ret)
|
||||
|
@ -362,7 +362,7 @@ int super_node_start(struct super_node *sn)
|
|||
|
||||
info("Starting nodes");
|
||||
for (size_t i = 0; i < list_length(&sn->nodes); i++) { INDENT
|
||||
struct node *n = list_at(&sn->nodes, i);
|
||||
struct node *n = (struct node *) list_at(&sn->nodes, i);
|
||||
|
||||
int refs = list_count(&sn->paths, (cmp_cb_t) path_uses_node, n);
|
||||
if (refs > 0) { INDENT
|
||||
|
@ -380,7 +380,7 @@ int super_node_start(struct super_node *sn)
|
|||
|
||||
info("Starting paths");
|
||||
for (size_t i = 0; i < list_length(&sn->paths); i++) { INDENT
|
||||
struct path *p = list_at(&sn->paths, i);
|
||||
struct path *p = (struct path *) list_at(&sn->paths, i);
|
||||
|
||||
if (p->enabled) { INDENT
|
||||
ret = path_init2(p);
|
||||
|
@ -406,7 +406,7 @@ int super_node_stop(struct super_node *sn)
|
|||
|
||||
info("Stopping paths");
|
||||
for (size_t i = 0; i < list_length(&sn->paths); i++) { INDENT
|
||||
struct path *p = list_at(&sn->paths, i);
|
||||
struct path *p = (struct path *) list_at(&sn->paths, i);
|
||||
|
||||
ret = path_stop(p);
|
||||
if (ret)
|
||||
|
@ -415,7 +415,7 @@ int super_node_stop(struct super_node *sn)
|
|||
|
||||
info("Stopping nodes");
|
||||
for (size_t i = 0; i < list_length(&sn->nodes); i++) { INDENT
|
||||
struct node *n = list_at(&sn->nodes, i);
|
||||
struct node *n = (struct node *) list_at(&sn->nodes, i);
|
||||
|
||||
ret = node_stop(n);
|
||||
if (ret)
|
||||
|
@ -424,7 +424,7 @@ int super_node_stop(struct super_node *sn)
|
|||
|
||||
info("Stopping node-types");
|
||||
for (size_t i = 0; i < list_length(&plugins); i++) { INDENT
|
||||
struct plugin *p = list_at(&plugins, i);
|
||||
struct plugin *p = (struct plugin *) list_at(&plugins, i);
|
||||
|
||||
if (p->type == PLUGIN_TYPE_NODE) {
|
||||
ret = node_type_stop(&p->node);
|
||||
|
|
|
@ -98,7 +98,7 @@ int fpga_benchmark_jitter(struct fpga_card *c)
|
|||
if (!ip || !c->intc)
|
||||
return -1;
|
||||
|
||||
struct timer *tmr = ip->_vd;
|
||||
struct timer *tmr = (struct timer *) ip->_vd;
|
||||
|
||||
XTmrCtr *xtmr = &tmr->inst;
|
||||
|
||||
|
|
|
@ -174,26 +174,26 @@ int main(int argc, char *argv[])
|
|||
task_wait(&t);
|
||||
|
||||
for (size_t i = 0; i < list_length(&sn.paths); i++) {
|
||||
struct path *p = list_at(&sn.paths, i);
|
||||
struct path *p = (struct path *) list_at(&sn.paths, i);
|
||||
|
||||
if (p->state != STATE_STARTED)
|
||||
continue;
|
||||
|
||||
for (size_t j = 0; j < list_length(&p->hooks); j++) {
|
||||
struct hook *h = list_at(&p->hooks, j);
|
||||
struct hook *h = (struct hook *) list_at(&p->hooks, j);
|
||||
|
||||
hook_periodic(h);
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < list_length(&sn.nodes); i++) {
|
||||
struct node *n = list_at(&sn.nodes, i);
|
||||
struct node *n = (struct node *) list_at(&sn.nodes, i);
|
||||
|
||||
if (n->state != STATE_STARTED)
|
||||
continue;
|
||||
|
||||
for (size_t j = 0; j < list_length(&n->hooks); j++) {
|
||||
struct hook *h = list_at(&n->hooks, j);
|
||||
struct hook *h = (struct hook *) list_at(&n->hooks, j);
|
||||
|
||||
hook_periodic(h);
|
||||
}
|
||||
|
|
|
@ -148,8 +148,8 @@ void test_rtt() {
|
|||
|
||||
struct timespec send, recv;
|
||||
|
||||
struct sample *smp_send = alloc(SAMPLE_LEN(2));
|
||||
struct sample *smp_recv = alloc(SAMPLE_LEN(2));
|
||||
struct sample *smp_send = (struct sample *) alloc(SAMPLE_LEN(2));
|
||||
struct sample *smp_recv = (struct sample *) alloc(SAMPLE_LEN(2));
|
||||
|
||||
hist_init(&hist, 20, 100);
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ Test(advio, download_large)
|
|||
AFILE *af;
|
||||
int ret, len = 16;
|
||||
|
||||
struct sample *smp = alloc(SAMPLE_LEN(len));
|
||||
struct sample *smp = (struct sample *) alloc(SAMPLE_LEN(len));
|
||||
smp->capacity = len;
|
||||
|
||||
af = afopen(BASE_URI "/download-large" , "r");
|
||||
|
|
|
@ -125,7 +125,7 @@ Test(fpga, xsg, .description = "XSG: multiply_add")
|
|||
dma = fpga_vlnv_lookup(&card->ips, &(struct fpga_vlnv) { "xilinx.com", "ip", "axi_dma", NULL });
|
||||
cr_assert(dma);
|
||||
|
||||
struct model *model = ip->_vd;
|
||||
struct model *model = (struct model *) ip->_vd;
|
||||
|
||||
p = list_lookup(&model->parameters, "factor");
|
||||
if (!p)
|
||||
|
@ -265,12 +265,12 @@ Test(fpga, dma, .description = "DMA")
|
|||
struct dma_mem mem, src, dst;
|
||||
|
||||
for (size_t i = 0; i < list_length(&card->ips); i++) { INDENT
|
||||
struct fpga_ip *dm = list_at(&card->ips, i);
|
||||
struct fpga_ip *dm = (struct fpga_ip *) list_at(&card->ips, i);
|
||||
|
||||
if (fpga_vlnv_cmp(&dm->vlnv, &(struct fpga_vlnv) { "xilinx.com", "ip", "axi_dma", NULL }))
|
||||
continue; /* skip non DMA IP cores */
|
||||
|
||||
struct dma *dma = dm->_vd;
|
||||
struct dma *dma = (struct dma *) dm->_vd;
|
||||
|
||||
/* Simple DMA can only transfer up to 4 kb due to
|
||||
* PCIe page size burst limitation */
|
||||
|
@ -326,7 +326,7 @@ Test(fpga, timer, .description = "Timer Counter")
|
|||
ip = fpga_vlnv_lookup(&card->ips, &(struct fpga_vlnv) { "xilinx.com", "ip", "axi_timer", NULL });
|
||||
cr_assert(ip);
|
||||
|
||||
tmr = ip->_vd;
|
||||
tmr = (struct timer *) ip->_vd;
|
||||
|
||||
XTmrCtr *xtmr = &tmr->inst;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue