1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

make use of INDENT macro consistent

This commit is contained in:
Steffen Vogel 2015-12-11 17:56:14 +01:00
parent 9003465aba
commit 8e9bca3dde
5 changed files with 43 additions and 29 deletions

View file

@ -30,14 +30,15 @@ int node_write(struct node *n, struct msg *p, int ps, int f, int c)
return n->_vt->write ? n->_vt->write(n, p, ps, f, c) : -1;
}
int node_init(int argc, char *argv[], struct settings *set)
{ INDENT
int node_init(int argc, char *argv[], config_setting_t *cfg)
{
list_foreach(const struct node_type *vt, &node_types) {
if (list_length(&vt->instances) > 0) {
info("Initializing " YEL("%s") " node type", vt->name);
if (vt->init)
vt->init(argc, argv, set);
if (vt->init) { INDENT
vt->init(argc, argv, cfg);
}
}
else
warn("No node is using the " YEL("%s") " node type. Skipping...", vt->name);
@ -47,14 +48,15 @@ int node_init(int argc, char *argv[], struct settings *set)
}
int node_deinit()
{ INDENT
{
/* De-initialize node types */
list_foreach(const struct node_type *vt, &node_types) {
if (list_length(&vt->instances) > 0) {
info("De-initializing " YEL("%s") " node type", vt->name);
if (vt->deinit)
if (vt->deinit) { INDENT
vt->deinit();
}
}
}
@ -62,7 +64,7 @@ int node_deinit()
}
int node_start(struct node *n)
{ INDENT
{
int ret;
info("Starting node %s", node_name_long(n));
@ -77,7 +79,7 @@ int node_start(struct node *n)
}
int node_stop(struct node *n)
{ INDENT
{
int ret;
if (n->state != NODE_RUNNING)
@ -106,7 +108,7 @@ const char * node_name(struct node *n)
const char * node_name_long(struct node *n)
{
if (!n->_name_long)
n->_name_long = n->_vt->print ? n->_vt->print(n) : "";
n->_name_long = n->_vt->print ? n->_vt->print(n) : node_name(n);
return n->_name_long;
}

View file

@ -17,8 +17,8 @@
/** Global OPAL specific settings */
static struct opal_global *og = NULL;
int opal_init(int argc, char *argv[], struct settings *set)
{ INDENT
int opal_init(int argc, char *argv[], config_setting_t *cfg)
{
int err;
if (argc != 4)
@ -74,7 +74,7 @@ int opal_init(int argc, char *argv[], struct settings *set)
}
int opal_deinit()
{ INDENT
{
int err;
if (!og)
@ -102,7 +102,7 @@ int opal_deinit()
}
int opal_print_global(struct opal_global *g)
{ INDENT
{
debug(2, "Controller ID: %u", og->params.controllerID);
char *sbuf = alloc(og->send_icons * 5);

View file

@ -38,8 +38,8 @@ extern struct list interfaces;
/* Forward declartions */
static struct node_type vt;
int socket_init(int argc, char * argv[], struct settings *set)
{ INDENT
int socket_init(int argc, char * argv[], config_setting_t *cfg)
{
if (check_root())
error("The 'socket' node-type requires superuser privileges!");
@ -78,7 +78,7 @@ int socket_init(int argc, char * argv[], struct settings *set)
}
int socket_deinit()
{ INDENT
{
list_foreach(struct interface *i, &interfaces)
if_stop(i);

View file

@ -138,7 +138,7 @@ static void * path_run(void *arg)
}
int path_start(struct path *p)
{ INDENT
{
info("Starting path: %s (poolsize=%u, msgsize=%u, #hooks=%zu, rate=%.1f)",
path_name(p), p->poolsize, p->msgsize, list_length(&p->hooks), p->rate);
@ -173,7 +173,7 @@ int path_start(struct path *p)
}
int path_stop(struct path *p)
{ INDENT
{
info("Stopping path: %s", path_name(p));
pthread_cancel(p->recv_tid);

View file

@ -33,15 +33,19 @@ static config_t config; /**< libconfig handle */
static void quit()
{
info("Stopping paths");
list_foreach(struct path *p, &paths)
list_foreach(struct path *p, &paths) { INDENT
path_stop(p);
}
info("Stopping nodes");
list_foreach(struct node *n, &nodes)
list_foreach(struct node *n, &nodes) { INDENT
node_stop(n);
}
info("De-initializing node types");
node_deinit();
{ INDENT
node_deinit();
}
/* Freeing dynamically allocated memory */
list_destroy(&paths);
@ -54,7 +58,7 @@ static void quit()
}
static void realtime_init()
{ INDENT
{
if (check_kernel_cmdline())
warn("You should reserve some cores for the server (see 'isolcpus')");
if (check_kernel_rt())
@ -143,20 +147,28 @@ int main(int argc, char *argv[])
list_init(&paths, (dtor_cb_t) path_destroy);
info("Initialize real-time system");
realtime_init();
{ INDENT
realtime_init();
}
info("Initialize signals");
signals_init();
{ INDENT
signals_init();
}
info("Parsing configuration");
config_init(&config);
config_parse(configfile, &config, &settings, &nodes, &paths);
{ INDENT
config_init(&config);
config_parse(configfile, &config, &settings, &nodes, &paths);
}
info("Initialize node types");
{ INDENT
node_init(argc, argv, config_root_setting(&config));
}
info("Starting nodes");
list_foreach(struct node *n, &nodes) {
list_foreach(struct node *n, &nodes) { INDENT
int used_by_path(struct path *p, struct node *n) {
return (p->in == n) || list_contains(&p->destinations, n);
}
@ -165,11 +177,11 @@ int main(int argc, char *argv[])
if (refs > 0)
node_start(n);
else
warn("Node %s is unused. Skipping...", node_name(n));
warn("No path is using the node %s. Skipping...", node_name(n));
}
info("Starting paths");
list_foreach(struct path *p, &paths) {
list_foreach(struct path *p, &paths) { INDENT
if (p->enabled)
path_start(p);
else