mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
fix: proper usage of static scope
This commit is contained in:
parent
5aa1530baf
commit
e2458e899d
8 changed files with 39 additions and 31 deletions
|
@ -44,9 +44,6 @@ struct node_vtable vtables[] = {
|
|||
VTABLE(TCPD, "tcpd", socket)
|
||||
};
|
||||
|
||||
/** Linked list of nodes. */
|
||||
struct list nodes;
|
||||
|
||||
int node_init(int argc, char *argv[], struct settings *set)
|
||||
{ INDENT
|
||||
for (int i=0; i<ARRAY_LEN(vtables); i++) {
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include "utils.h"
|
||||
|
||||
static struct opal_global *og = NULL;
|
||||
|
||||
/** List of all opal nodes */
|
||||
static struct list opals;
|
||||
|
||||
int opal_init(int argc, char *argv[], struct settings *set)
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
#include "path.h"
|
||||
#include "socket.h"
|
||||
#include "timing.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifndef sigev_notify_thread_id
|
||||
#define sigev_notify_thread_id _sigev_un._tid
|
||||
#endif
|
||||
|
||||
/** Linked list of paths. */
|
||||
struct list paths;
|
||||
extern struct settings settings;
|
||||
|
||||
static void path_write(struct path *p)
|
||||
{
|
||||
|
|
|
@ -29,13 +29,16 @@
|
|||
#include "msg.h"
|
||||
#include "socket.h"
|
||||
|
||||
/** Linked list of nodes */
|
||||
struct list nodes;
|
||||
/** The global configuration */
|
||||
struct settings settings;
|
||||
|
||||
static struct settings set;
|
||||
static struct msg *pool;
|
||||
static struct node *node;
|
||||
|
||||
extern struct list nodes;
|
||||
|
||||
void quit(int sig, siginfo_t *si, void *ptr)
|
||||
static void quit(int sig, siginfo_t *si, void *ptr)
|
||||
{
|
||||
node_stop(node);
|
||||
node_deinit();
|
||||
|
@ -46,7 +49,7 @@ void quit(int sig, siginfo_t *si, void *ptr)
|
|||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
void usage(char *name)
|
||||
static void usage(char *name)
|
||||
{
|
||||
printf("Usage: %s [-r] CONFIG NODE\n", name);
|
||||
printf(" -r swap local / remote address of socket based nodes)\n\n");
|
||||
|
@ -82,6 +85,7 @@ int main(int argc, char *argv[])
|
|||
usage(argv[0]);
|
||||
|
||||
/* Setup signals */
|
||||
struct timespec ts;
|
||||
struct sigaction sa_quit = {
|
||||
.sa_flags = SA_SIGINFO,
|
||||
.sa_sigaction = quit
|
||||
|
|
|
@ -30,14 +30,17 @@
|
|||
#include "msg.h"
|
||||
#include "socket.h"
|
||||
|
||||
/** Linked list of nodes */
|
||||
struct list nodes;
|
||||
/** The global configuration */
|
||||
struct settings settings;
|
||||
|
||||
static struct config_t config;
|
||||
static struct settings set;
|
||||
static struct msg *pool;
|
||||
static struct node *node;
|
||||
|
||||
extern struct list nodes;
|
||||
|
||||
void quit(int sig, siginfo_t *si, void *ptr)
|
||||
static void quit()
|
||||
{
|
||||
node_stop(node);
|
||||
node_deinit();
|
||||
|
@ -49,7 +52,7 @@ void quit(int sig, siginfo_t *si, void *ptr)
|
|||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
void usage(char *name)
|
||||
static void usage(char *name)
|
||||
{
|
||||
printf("Usage: %s [-r] CONFIG NODE\n", name);
|
||||
printf(" -r swap local / remote address of socket based nodes)\n\n");
|
||||
|
|
|
@ -27,12 +27,12 @@
|
|||
#endif
|
||||
|
||||
/** Linked list of nodes */
|
||||
extern struct list nodes;
|
||||
struct list nodes;
|
||||
/** Linked list of paths */
|
||||
extern struct list paths;
|
||||
|
||||
struct list paths;
|
||||
/** The global configuration */
|
||||
static struct settings settings;
|
||||
struct settings settings;
|
||||
/** libconfig handle */
|
||||
static config_t config;
|
||||
|
||||
static void quit()
|
||||
|
@ -57,7 +57,7 @@ static void quit()
|
|||
_exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
void realtime_init()
|
||||
static void realtime_init()
|
||||
{ INDENT
|
||||
/* Use FIFO scheduler with real time priority */
|
||||
if (settings.priority) {
|
||||
|
@ -79,7 +79,7 @@ void realtime_init()
|
|||
}
|
||||
|
||||
/* Setup exit handler */
|
||||
void signals_init()
|
||||
static void signals_init()
|
||||
{
|
||||
struct sigaction sa_quit = {
|
||||
.sa_flags = SA_SIGINFO,
|
||||
|
@ -92,7 +92,7 @@ void signals_init()
|
|||
sigaction(SIGINT, &sa_quit, NULL);
|
||||
}
|
||||
|
||||
void usage(const char *name)
|
||||
static void usage(const char *name)
|
||||
{
|
||||
printf("Usage: %s CONFIG\n", name);
|
||||
printf(" CONFIG is a required path to a configuration file\n\n");
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
/** Linked list of interfaces */
|
||||
extern struct list interfaces;
|
||||
|
||||
/** Linked list of sockets */
|
||||
struct list sockets;
|
||||
/** Linked list of all sockets nodes */
|
||||
static struct list sockets;
|
||||
|
||||
int socket_init(int argc, char * argv[], struct settings *set)
|
||||
{ INDENT
|
||||
|
|
|
@ -25,30 +25,32 @@
|
|||
#include "node.h"
|
||||
#include "utils.h"
|
||||
#include "hist.h"
|
||||
/** Linked list of nodes */
|
||||
struct list nodes;
|
||||
/** The global configuration */
|
||||
struct settings settings;
|
||||
|
||||
static struct settings set;
|
||||
static struct node *node;
|
||||
extern struct list nodes;
|
||||
|
||||
/* Test options */
|
||||
int running = 1;
|
||||
static int running = 1;
|
||||
|
||||
/** Amount of messages which should be sent (default: -1 for unlimited) */
|
||||
int count = -1;
|
||||
static int count = -1;
|
||||
|
||||
/** File descriptor for Matlab results.
|
||||
* This allows you to write Matlab results in a seperate log file:
|
||||
*
|
||||
* ./test etc/example.conf rtt -f 3 3>> measurement_results.m
|
||||
*/
|
||||
int fd = STDOUT_FILENO;
|
||||
static int fd = STDOUT_FILENO;
|
||||
|
||||
/** Lowest value in histogram. */
|
||||
double low = 0;
|
||||
static double low = 0;
|
||||
/** Highest value in histogram. */
|
||||
double high = 2e-4;
|
||||
static double high = 2e-4;
|
||||
/** Histogram resolution. */
|
||||
double res = 1e-5;
|
||||
static double res = 1e-5;
|
||||
|
||||
#define CLOCK_ID CLOCK_MONOTONIC
|
||||
|
||||
|
@ -91,7 +93,7 @@ int main(int argc, char *argv[])
|
|||
sigaction(SIGINT, &sa_quit, NULL);
|
||||
|
||||
config_init(&config);
|
||||
config_parse(argv[1], &config, &set, &nodes, NULL);
|
||||
config_parse(argv[1], &config, &settings, &nodes, NULL);
|
||||
|
||||
node = node_lookup_name(argv[3], &nodes);
|
||||
if (!node)
|
||||
|
|
Loading…
Add table
Reference in a new issue