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

porting executables to C++

This commit is contained in:
Steffen Vogel 2018-07-03 20:42:37 +02:00
parent e3dacf3e01
commit 446876fd94
9 changed files with 29 additions and 29 deletions

View file

@ -23,9 +23,9 @@
# All executables link against libvillas
link_libraries(villas)
add_executable(villas-node villas-node.c)
add_executable(villas-test-rtt villas-test-rtt.c)
add_executable(villas-test-shmem villas-test-shmem.c)
add_executable(villas-node villas-node.cpp)
add_executable(villas-test-rtt villas-test-rtt.cpp)
add_executable(villas-test-shmem villas-test-shmem.cpp)
install(
TARGETS villas-node villas-test-rtt villas-test-shmem
@ -34,10 +34,10 @@ install(
)
if(WITH_IO)
add_executable(villas-test-cmp villas-test-cmp.c)
add_executable(villas-convert villas-convert.c)
add_executable(villas-pipe villas-pipe.c)
add_executable(villas-signal villas-signal.c)
add_executable(villas-test-cmp villas-test-cmp.cpp)
add_executable(villas-convert villas-convert.cpp)
add_executable(villas-pipe villas-pipe.cpp)
add_executable(villas-signal villas-signal.cpp)
target_link_libraries(villas-pipe PUBLIC Threads::Threads)
@ -49,7 +49,7 @@ if(WITH_IO)
endif()
if(WITH_IO AND WITH_HOOKS)
add_executable(villas-hook villas-hook.c)
add_executable(villas-hook villas-hook.cpp)
install(
TARGETS villas-hook

View file

@ -45,8 +45,8 @@ static void usage()
int main(int argc, char *argv[])
{
int ret, level = V;
char *input_format = "villas.human";
char *output_format = "villas.human";
const char *input_format = "villas.human";
const char *output_format = "villas.human";
char c, *endptr;
while ((c = getopt(argc, argv, "Vhd:i:o:")) != -1) {
@ -94,14 +94,14 @@ check: if (optarg == endptr)
error("Failed to start log");
struct {
char *name;
const char *name;
struct io *io;
} dirs[] = {
{ input_format, &input },
{ output_format, &output },
};
for (int i = 0; i < ARRAY_LEN(dirs); i++) {
for (unsigned i = 0; i < ARRAY_LEN(dirs); i++) {
fmt = format_type_lookup(dirs[i].name);
if (!fmt)
error("Invalid format: %s", dirs[i].name);
@ -127,7 +127,7 @@ check: if (optarg == endptr)
io_print(&output, &smp, 1);
}
for (int i = 0; i < ARRAY_LEN(dirs); i++) {
for (unsigned i = 0; i < ARRAY_LEN(dirs); i++) {
ret = io_close(dirs[i].io);
if (ret)
error("Failed to close IO");

View file

@ -111,7 +111,7 @@ static void usage()
int main(int argc, char *argv[])
{
int ret, recv, sent;
char *format = "villas.human";
const char *format = "villas.human";
struct format_type *ft;
struct hook_type *ht;
@ -180,7 +180,7 @@ check: if (optarg == endptr)
if (ret)
error("Failed to initialize memory");
smps = alloc(cnt * sizeof(struct sample *));
smps = (struct sample **) alloc(cnt * sizeof(struct sample *));
ret = pool_init(&q, 10 * cnt, SAMPLE_LEN(DEFAULT_SAMPLELEN), &memtype_hugepage);
if (ret)

View file

@ -113,7 +113,7 @@ int main(int argc, char *argv[])
opal_register_region(argc, argv);
char *uri = "opal-shmem.conf";
const char *uri = "opal-shmem.conf";
#else
char c;
while ((c = getopt(argc, argv, "hV")) != -1) {

View file

@ -232,12 +232,13 @@ int main(int argc, char *argv[])
{
int ret, level = V, timeout = 0;
bool reverse = false;
char *format = "villas.human";
const char *format = "villas.human";
sendd = recvv = (struct dir) {
.enabled = true,
.limit = -1
};
sendd.enabled = true;
sendd.limit = -1;
recvv.enabled = true;
recvv.limit = -1;
json_t *cfg_cli = json_object();
@ -337,7 +338,7 @@ check: if (optarg == endptr)
if (ret)
error("Failed to open IO");
node = list_lookup(&sn.nodes, nodestr);
node = (struct node *) list_lookup(&sn.nodes, nodestr);
if (!node)
error("Node '%s' does not exist!", nodestr);

View file

@ -42,7 +42,6 @@ struct node n;
struct log l;
struct io io;
struct pool q;
struct sample *t;
void usage()
@ -111,7 +110,7 @@ int main(int argc, char *argv[])
struct node_type *nt;
struct format_type *ft;
char *format = "villas.human"; /** @todo hardcoded for now */
const char *format = "villas.human"; /** @todo hardcoded for now */
ret = log_init(&l, l.level, LOG_ALL);
if (ret)

View file

@ -35,7 +35,7 @@
struct side {
char *path;
char *format;
const char *format;
struct sample *sample;
@ -75,7 +75,7 @@ int main(int argc, char *argv[])
/* Default values */
double epsilon = 1e-9;
char *format = "villas.human";
const char *format = "villas.human";
int flags = SAMPLE_HAS_SEQUENCE | SAMPLE_HAS_VALUES | SAMPLE_HAS_ORIGIN;
struct pool pool = { .state = STATE_DESTROYED };

View file

@ -131,7 +131,7 @@ check: if (optarg == endptr)
rt_init(sn.priority, sn.affinity);
memory_init(sn.hugepages);
node = list_lookup(&sn.nodes, nodestr);
node = (struct node *) list_lookup(&sn.nodes, nodestr);
if (!node)
error("There's no node with the name '%s'", nodestr);

View file

@ -55,9 +55,9 @@ int main(int argc, char* argv[])
struct log log;
int readcnt, writecnt, avail;
struct shmem_conf conf = {
.queuelen = DEFAULT_SHMEM_QUEUELEN,
.samplelen = DEFAULT_SHMEM_SAMPLELEN,
.polling = 0,
.queuelen = DEFAULT_SHMEM_QUEUELEN,
.samplelen = DEFAULT_SHMEM_SAMPLELEN
};
log_init(&log, V, LOG_ALL);