From 208fc1843ad385aad582212ea023c55867b209c2 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 8 Jul 2020 13:32:08 +0200 Subject: [PATCH] can: remove unused callbacks --- include/villas/nodes/can.hpp | 18 ------ lib/nodes/can.cpp | 114 ++++++++++------------------------- 2 files changed, 31 insertions(+), 101 deletions(-) diff --git a/include/villas/nodes/can.hpp b/include/villas/nodes/can.hpp index c5788f3a6..bd6b64dc0 100644 --- a/include/villas/nodes/can.hpp +++ b/include/villas/nodes/can.hpp @@ -55,12 +55,6 @@ struct can { struct timespec start_time; }; -/** @see node_vtable::type_start */ -int can_type_start(villas::node::SuperNode *sn); - -/** @see node_type::type_stop */ -int can_type_stop(); - /** @see node_type::init */ int can_init(struct node *n); @@ -85,25 +79,13 @@ int can_start(struct node *n); /** @see node_type::stop */ int can_stop(struct node *n); -/** @see node_type::pause */ -int can_pause(struct node *n); - -/** @see node_type::resume */ -int can_resume(struct node *n); - /** @see node_type::write */ int can_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned *release); /** @see node_type::read */ int can_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *release); -/** @see node_type::reverse */ -int can_reverse(struct node *n); - /** @see node_type::poll_fds */ int can_poll_fds(struct node *n, int fds[]); -/** @see node_type::netem_fds */ -int can_netem_fds(struct node *n, int fds[]); - /** @} */ diff --git a/lib/nodes/can.cpp b/lib/nodes/can.cpp index 6e959ae79..b472d6f49 100644 --- a/lib/nodes/can.cpp +++ b/lib/nodes/can.cpp @@ -41,28 +41,16 @@ #include #include #include -#include +#include +#include -/* Forward declartions */ + +/* Forward declarations */ static struct plugin p; using namespace villas::node; using namespace villas::utils; -int can_type_start(villas::node::SuperNode *sn) -{ - /* TODO: Add implementation here */ - - return 0; -} - -int can_type_stop() -{ - /* TODO: Add implementation here */ - - return 0; -} - int can_init(struct node *n) { struct can *c = (struct can *) n->_vd; @@ -267,25 +255,6 @@ int can_stop(struct node *n) close(c->socket); c->socket = 0; } - //TODO: do we need to free c->interface_name here? - - return 0; -} - -int can_pause(struct node *n) -{ - //struct can *c = (struct can *) n->_vd; - - /* TODO: Add implementation here. */ - - return 0; -} - -int can_resume(struct node *n) -{ - //struct can *c = (struct can *) n->_vd; - - /* TODO: Add implementation here. */ return 0; } @@ -542,13 +511,7 @@ int can_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned *rel return nwrite; } -int can_reverse(struct node *n) -{ - //struct can *c = (struct can *) n->_vd; - - /* TODO: Add implementation here. */ - - return 0; + return nwrite; } int can_poll_fds(struct node *n, int fds[]) @@ -559,49 +522,34 @@ int can_poll_fds(struct node *n, int fds[]) return 1; /* The number of file descriptors which have been set in fds */ } -int can_netem_fds(struct node *n, int fds[]) -{ - //struct can *c = (struct can *) n->_vd; +__attribute__((constructor(110))) +static void register_plugin() { + if (plugins.state == State::DESTROYED) + vlist_init(&plugins); - /* TODO: Add implementation here. */ + p.name = "can"; + p.description = "Receive CAN messages using the socketCAN driver"; + p.node.instances.state = State::DESTROYED; + p.node.vectorize = 0; + p.node.size = sizeof(struct can); + p.node.init = can_init; + p.node.destroy = can_destroy; + p.node.prepare = can_prepare; + p.node.parse = can_parse; + p.node.print = can_print; + p.node.check = can_check; + p.node.start = can_start; + p.node.stop = can_stop; + p.node.read = can_read; + p.node.write = can_write; + p.node.poll_fds = can_poll_fds; - return 0; /* The number of file descriptors which have been set in fds */ + vlist_init(&p.node.instances); + vlist_push(&plugins, &p); } -__attribute__((constructor(110))) - static void register_plugin() { - if (plugins.state == State::DESTROYED) - vlist_init(&plugins); - - p.name = "can"; - p.description = "Receive CAN messages using the socketCAN driver"; - p.node.instances.state = State::DESTROYED; - p.node.vectorize = 0; - p.node.size = sizeof(struct can); - p.node.type.start = can_type_start; - p.node.type.stop = can_type_stop; - p.node.init = can_init; - p.node.destroy = can_destroy; - p.node.prepare = can_prepare; - p.node.parse = can_parse; - p.node.print = can_print; - p.node.check = can_check; - p.node.start = can_start; - p.node.stop = can_stop; - p.node.pause = can_pause; - p.node.resume = can_resume; - p.node.read = can_read; - p.node.write = can_write; - p.node.reverse = can_reverse; - p.node.poll_fds = can_poll_fds; - p.node.netem_fds = can_netem_fds; - - vlist_init(&p.node.instances); - vlist_push(&plugins, &p); - } - __attribute__((destructor(110))) - static void deregister_plugin() { - if (plugins.state != State::DESTROYED) - vlist_remove_all(&plugins, &p); - } +static void deregister_plugin() { + if (plugins.state != State::DESTROYED) + vlist_remove_all(&plugins, &p); +}