From 02f68ff5ccc637b2177f832a4f7ddf4f9f737d22 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 21 Jan 2024 10:59:17 +0100 Subject: include: Use common definition between lib and IRMd Some definitions/enums were different between the library and IRMd (flow_state, ipcp_state). This moves them to common ground. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/irmd/main.c | 24 +++++++++++++----------- src/irmd/reg/flow.c | 1 + src/irmd/reg/flow.h | 9 --------- src/irmd/reg/ipcp.c | 2 +- src/irmd/reg/ipcp.h | 6 ------ src/irmd/tests/CMakeLists.txt | 4 ++-- 6 files changed, 17 insertions(+), 29 deletions(-) (limited to 'src/irmd') diff --git a/src/irmd/main.c b/src/irmd/main.c index 20b70a60..31ac5edc 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -30,23 +30,23 @@ #define OUROBOROS_PREFIX "irmd" +#include #include -#include #include -#include -#include -#include +#include +#include #include +#include #include +#include +#include #include #include -#include -#include +#include #include #include -#include +#include #include -#include #include "irmd.h" #include "ipcp.h" @@ -586,7 +586,9 @@ static int create_ipcp_r(pid_t pid, list_for_each(p, &irmd.ipcps) { struct reg_ipcp * e = list_entry(p, struct reg_ipcp, next); if (e->pid == pid) { - reg_ipcp_set_state(e, result ? IPCP_NULL : IPCP_LIVE); + enum ipcp_state state; + state = result ? IPCP_NULL : IPCP_OPERATIONAL; + reg_ipcp_set_state(e, state); break; } } @@ -660,7 +662,7 @@ int bootstrap_ipcp(pid_t pid, return -ENOMEM; } - ipcp->dir_hash_algo = info.dir_hash_algo; + ipcp->dir_hash_algo = (enum hash_algo) info.dir_hash_algo; pthread_rwlock_unlock(&irmd.reg_lock); @@ -714,7 +716,7 @@ int enroll_ipcp(pid_t pid, return -ENOMEM; } - ipcp->dir_hash_algo = info.dir_hash_algo; + ipcp->dir_hash_algo = (enum hash_algo) info.dir_hash_algo; pthread_rwlock_unlock(&irmd.reg_lock); diff --git a/src/irmd/reg/flow.c b/src/irmd/reg/flow.c index 43d6cb3a..66bd25a3 100644 --- a/src/irmd/reg/flow.c +++ b/src/irmd/reg/flow.c @@ -27,6 +27,7 @@ #define OUROBOROS_PREFIX "reg-flow" #include +#include #include #include #include diff --git a/src/irmd/reg/flow.h b/src/irmd/reg/flow.h index 76266228..22e191be 100644 --- a/src/irmd/reg/flow.h +++ b/src/irmd/reg/flow.h @@ -32,15 +32,6 @@ #include #include -enum flow_state { - FLOW_NULL = 0, - FLOW_ALLOC_PENDING, - FLOW_ALLOC_REQ_PENDING, - FLOW_ALLOCATED, - FLOW_DEALLOC_PENDING, - FLOW_DESTROY -}; - struct reg_flow { struct list_head next; diff --git a/src/irmd/reg/ipcp.c b/src/irmd/reg/ipcp.c index de4b2f1e..c1d06d94 100644 --- a/src/irmd/reg/ipcp.c +++ b/src/irmd/reg/ipcp.c @@ -134,7 +134,7 @@ int reg_ipcp_wait_boot(struct reg_ipcp * ipcp) pthread_cond_signal(&ipcp->cond); } - if (ipcp->state != IPCP_LIVE) { + if (ipcp->state != IPCP_OPERATIONAL) { pthread_mutex_unlock(&ipcp->mtx); return -1; } diff --git a/src/irmd/reg/ipcp.h b/src/irmd/reg/ipcp.h index c669a0e1..6dfdfb6b 100644 --- a/src/irmd/reg/ipcp.h +++ b/src/irmd/reg/ipcp.h @@ -25,12 +25,6 @@ #include -enum ipcp_state { - IPCP_NULL = 0, - IPCP_BOOT, - IPCP_LIVE -}; - struct reg_ipcp { struct list_head next; diff --git a/src/irmd/tests/CMakeLists.txt b/src/irmd/tests/CMakeLists.txt index 68bd762d..e1fd2f21 100644 --- a/src/irmd/tests/CMakeLists.txt +++ b/src/irmd/tests/CMakeLists.txt @@ -2,11 +2,11 @@ get_filename_component(tmp ".." ABSOLUTE) get_filename_component(src_folder "${tmp}" NAME) create_test_sourcelist(${src_folder}_tests test_suite.c - # Add new tests here + # Add new tests here ) add_executable(${src_folder}_test EXCLUDE_FROM_ALL ${${src_folder}_tests}) -target_link_libraries(${src_folder}_test ouroboros) +target_link_libraries(${src_folder}_test ouroboros-common) add_dependencies(check ${src_folder}_test) -- cgit v1.2.3