From 2421d9082d5fea3239bd2345bcf30cde44067151 Mon Sep 17 00:00:00 2001 From: Mateo Cindric Date: Tue, 3 Jan 2023 14:46:28 +0000 Subject: [PATCH] system-plugin: refactor plugin library linkage --- CMakeLists.txt | 1 + src/main.c | 8 ++++---- src/plugin/common.c | 3 +++ src/plugin/common.h | 5 +++-- 4 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 src/plugin/common.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 854c752..5b6461c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,7 @@ set( SOURCES src/plugin.c + src/plugin/common.c src/plugin/ly_tree.c # startup diff --git a/src/main.c b/src/main.c index 4ac96a2..4b70f23 100644 --- a/src/main.c +++ b/src/main.c @@ -10,16 +10,16 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -#include "sysrepo_types.h" #include #include #include -#include "plugin.h" -#include "plugin/common.h" - volatile int exit_application = 0; +extern const char *PLUGIN_NAME; +extern int sr_plugin_init_cb(sr_session_ctx_t *session, void **private_data); +extern void sr_plugin_cleanup_cb(sr_session_ctx_t *session, void *private_data); + static void sigint_handler(__attribute__((unused)) int signum); int main(void) diff --git a/src/plugin/common.c b/src/plugin/common.c new file mode 100644 index 0000000..cacc561 --- /dev/null +++ b/src/plugin/common.c @@ -0,0 +1,3 @@ +#include "common.h" + +const char *const PLUGIN_NAME = "ietf-system-plugin"; diff --git a/src/plugin/common.h b/src/plugin/common.h index 5b3bf56..4bbde90 100644 --- a/src/plugin/common.h +++ b/src/plugin/common.h @@ -13,7 +13,8 @@ #ifndef SYSTEM_PLUGIN_COMMON_H #define SYSTEM_PLUGIN_COMMON_H -#define PLUGIN_NAME "system-plugin" +// #define PLUGIN_NAME "system-plugin" +extern const char *const PLUGIN_NAME; #define BASE_YANG_MODULE "ietf-system" @@ -79,4 +80,4 @@ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) -#endif // SYSTEM_PLUGIN_COMMON_H \ No newline at end of file +#endif // SYSTEM_PLUGIN_COMMON_H