mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
change function signature of node_type_start()
This commit is contained in:
parent
16efe4878e
commit
053b43fb9f
14 changed files with 29 additions and 27 deletions
|
@ -17,6 +17,7 @@
|
|||
|
||||
/* Forward declarations */
|
||||
struct node;
|
||||
struct super_node;
|
||||
struct sample;
|
||||
|
||||
/** C++ like vtable construct for node_types */
|
||||
|
@ -32,13 +33,10 @@ struct node_type {
|
|||
*
|
||||
* This callback is invoked once per node-type.
|
||||
*
|
||||
* @param argc Number of arguments passed to the server executable (see main()).
|
||||
* @param argv Array of arguments passed to the server executable (see main()).
|
||||
* @param cfg Root libconfig object of global configuration file.
|
||||
* @retval 0 Success. Everything went well.
|
||||
* @retval <0 Error. Something went wrong.
|
||||
*/
|
||||
int (*init)(int argc, char *argv[], config_setting_t *cfg);
|
||||
int (*init)(struct super_node *sn);
|
||||
|
||||
/** Global de-initialization per node type.
|
||||
*
|
||||
|
@ -135,7 +133,7 @@ struct node_type {
|
|||
*
|
||||
* @see node_type::init
|
||||
*/
|
||||
int node_type_start(struct node_type *vt, int argc, char *argv[], config_setting_t *cfg);
|
||||
int node_type_start(struct node_type *vt, struct super_node *sn);
|
||||
|
||||
/** De-initialize node type subsystems.
|
||||
*
|
||||
|
|
|
@ -38,7 +38,7 @@ struct fpga {
|
|||
};
|
||||
|
||||
/** @see node_vtable::init */
|
||||
int fpga_init(int argc, char *argv[], config_setting_t *cfg);
|
||||
int fpga_init(struct super_node *sn);
|
||||
|
||||
/** @see node_vtable::deinit */
|
||||
int fpga_deinit();
|
||||
|
|
|
@ -52,7 +52,7 @@ struct ngsi {
|
|||
*
|
||||
* @see node_vtable::init
|
||||
*/
|
||||
int ngsi_init(int argc, char *argv[], config_setting_t *cfg);
|
||||
int ngsi_init(struct super_node *sn);
|
||||
|
||||
/** Free global NGSI settings and unmaps shared memory regions.
|
||||
*
|
||||
|
|
|
@ -42,7 +42,7 @@ struct opal {
|
|||
*
|
||||
* @see node_vtable::init
|
||||
*/
|
||||
int opal_init(int argc, char *argv[], config_setting_t *cfg);
|
||||
int opal_init(struct super_node *sn);
|
||||
|
||||
/** Free global OPAL settings and unmaps shared memory regions.
|
||||
*
|
||||
|
|
|
@ -58,7 +58,7 @@ struct socket {
|
|||
|
||||
|
||||
/** @see node_vtable::init */
|
||||
int socket_init(int argc, char *argv[], config_setting_t *cfg);
|
||||
int socket_init(struct super_node *sn);
|
||||
|
||||
/** @see node_vtable::deinit */
|
||||
int socket_deinit();
|
||||
|
|
|
@ -64,7 +64,7 @@ struct websocket_destination {
|
|||
int websocket_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len);
|
||||
|
||||
/** @see node_vtable::init */
|
||||
int websocket_init(int argc, char *argv[], config_setting_t *cfg);
|
||||
int websocket_init(struct super_node *sn);
|
||||
|
||||
/** @see node_vtable::deinit */
|
||||
int websocket_deinit();
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*********************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <libconfig.h>
|
||||
|
||||
#include "sample.h"
|
||||
#include "node.h"
|
||||
|
@ -14,7 +13,7 @@
|
|||
#include "config.h"
|
||||
#include "plugin.h"
|
||||
|
||||
int node_type_start(struct node_type *vt, int argc, char *argv[], config_setting_t *cfg)
|
||||
int node_type_start(struct node_type *vt, struct super_node *sn)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -23,7 +22,7 @@ int node_type_start(struct node_type *vt, int argc, char *argv[], config_setting
|
|||
|
||||
info("Initializing " YEL("%s") " node type which is used by %zu nodes", plugin_name(vt), list_length(&vt->instances));
|
||||
{ INDENT
|
||||
ret = vt->init ? vt->init(argc, argv, cfg) : 0;
|
||||
ret = vt->init ? vt->init(sn) : 0;
|
||||
}
|
||||
|
||||
if (ret == 0)
|
||||
|
|
|
@ -30,20 +30,21 @@ void fpga_dump(struct fpga *f)
|
|||
fpga_card_dump(c);
|
||||
}
|
||||
|
||||
int fpga_init(int argc, char *argv[], config_setting_t *cfg)
|
||||
int fpga_init(struct super_node *sn)
|
||||
{
|
||||
int ret;
|
||||
config_setting_t *cfg_fpgas;
|
||||
config_setting_t *cfg, *cfg_fpgas;
|
||||
|
||||
ret = pci_init(&pci);
|
||||
if (ret)
|
||||
cerror(cfg, "Failed to initialize PCI sub-system");
|
||||
error("Failed to initialize PCI sub-system");
|
||||
|
||||
ret = vfio_init(&vc);
|
||||
if (ret)
|
||||
cerror(cfg, "Failed to initiliaze VFIO sub-system");
|
||||
error("Failed to initiliaze VFIO sub-system");
|
||||
|
||||
/* Parse FPGA configuration */
|
||||
cfg = config_root_setting(&sn->cfg);
|
||||
cfg_fpgas = config_setting_lookup(cfg, "fpgas");
|
||||
if (!cfg_fpgas)
|
||||
cerror(cfg, "Config file is missing 'fpgas' section");
|
||||
|
|
|
@ -368,8 +368,12 @@ out: json_decref(request);
|
|||
return ret;
|
||||
}
|
||||
|
||||
int ngsi_init(int argc, char *argv[], config_setting_t *cfg)
|
||||
int ngsi_init(struct super_node *sn)
|
||||
{
|
||||
config_setting_t *cfg;
|
||||
|
||||
cfg = config_root_setting(&sn->cfg);
|
||||
|
||||
const char *tname;
|
||||
if (config_setting_lookup_string(cfg, "name", &tname)) {
|
||||
name = strdup(tname);
|
||||
|
|
|
@ -25,18 +25,18 @@ static Opal_GenAsyncParam_Ctrl params; /** String and Float parameters, provided
|
|||
|
||||
static pthread_mutex_t lock; /** Big Global Lock for libOpalAsync API */
|
||||
|
||||
int opal_init(int argc, char *argv[], config_setting_t *cfg)
|
||||
int opal_init(struct super_node *sn)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (argc != 4)
|
||||
if (sn->cli.argc != 4)
|
||||
return -1;
|
||||
|
||||
pthread_mutex_init(&lock, NULL);
|
||||
|
||||
async_shmem_name = argv[1];
|
||||
async_shmem_size = atoi(argv[2]);
|
||||
print_shmem_name = argv[3];
|
||||
async_shmem_name = sn->cli.argv[1];
|
||||
async_shmem_size = atoi(sn->cli.argv[2]);
|
||||
print_shmem_name = sn->cli.argv[3];
|
||||
|
||||
/* Enable the OpalPrint function. This prints to the OpalDisplay. */
|
||||
err = OpalSystemCtrl_Register(print_shmem_name);
|
||||
|
|
|
@ -36,7 +36,7 @@ static struct plugin p;
|
|||
/* Private static storage */
|
||||
struct list interfaces;
|
||||
|
||||
int socket_init(int argc, char *argv[], config_setting_t *cfg)
|
||||
int socket_init(struct super_node *sn)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ int main(int argc, char *argv[])
|
|||
memory_init(sn.hugepages);
|
||||
|
||||
/* Initialize VILLASfpga card */
|
||||
ret = fpga_init(argc, argv, config_root_setting(&sn.cfg));
|
||||
ret = fpga_init(&sn);
|
||||
if (ret)
|
||||
error("Failed to initialize FPGA card");
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ int main(int argc, char *argv[])
|
|||
if (reverse)
|
||||
node_reverse(node);
|
||||
|
||||
ret = node_type_start(node->_vt, argc, argv, config_root_setting(&sn.cfg));
|
||||
ret = node_type_start(node->_vt, &sn);
|
||||
if (ret)
|
||||
error("Failed to intialize node type: %s", node_name(node));
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ int main(int argc, char *argv[])
|
|||
if (!node)
|
||||
error("There's no node with the name '%s'", argv[3]);
|
||||
|
||||
node_type_start(node->_vt, argc-3, argv+3, config_root_setting(&sn.cfg));
|
||||
node_type_start(node->_vt, &sn);
|
||||
node_start(node);
|
||||
|
||||
/* Parse Arguments */
|
||||
|
|
Loading…
Add table
Reference in a new issue