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

node: make struct vnode::enabled a boolean

This commit is contained in:
Steffen Vogel 2020-09-10 11:19:51 +02:00
parent 88ef85844d
commit 13b7b6cc2f
2 changed files with 6 additions and 5 deletions

View file

@ -60,7 +60,7 @@
*/
struct vnode {
char *name; /**< A short identifier of the node, only used for configuration and logging */
int enabled;
bool enabled;
enum State state;

View file

@ -68,7 +68,7 @@ int node_init(struct vnode *n, struct vnode_type *vt)
n->name = nullptr;
n->_name = nullptr;
n->_name_long = nullptr;
n->enabled = 1;
n->enabled = true;
n->affinity = -1; /* all cores */
#ifdef __linux__
@ -125,8 +125,7 @@ int node_prepare(struct vnode *n)
int node_parse(struct vnode *n, json_t *json, const char *name)
{
struct vnode_type *nt;
int ret;
int ret, enabled = n->enabled;
json_error_t err;
json_t *json_netem = nullptr;
@ -138,11 +137,13 @@ int node_parse(struct vnode *n, json_t *json, const char *name)
ret = json_unpack_ex(json, &err, 0, "{ s: s, s?: s, s?: b }",
"type", &type,
"uuid", &uuid,
"enabled", &n->enabled
"enabled", &enabled
);
if (ret)
return ret;
n->enabled = enabled;
#ifdef __linux__
ret = json_unpack_ex(json, &err, 0, "{ s?: { s?: o, s?: i } }",
"out",