summaryrefslogtreecommitdiff
path: root/staticd
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2024-03-26 16:54:54 +0200
committerMark Stapp <mjs@cisco.com>2024-08-27 09:53:02 -0400
commit5dac6961540422a1ca139fae8c5ea9e5a437c4ba (patch)
tree3ff27afc04b9605f832c747b82449b58d5aa5455 /staticd
parent1797b7eefc730bb4f5aec08f130861650c61dd97 (diff)
lib: rework debug init
The debug library allows to register a `debug_set_all` callback which should enable all debugs in a daemon. This callback is implemented exactly the same in each daemon. Instead of duplicating the code, rework the lib to allow registration of each debug type, and implement the common code only once in the lib. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'staticd')
-rw-r--r--staticd/static_debug.c29
1 files changed, 3 insertions, 26 deletions
diff --git a/staticd/static_debug.c b/staticd/static_debug.c
index a65752c958..045c0d5b05 100644
--- a/staticd/static_debug.c
+++ b/staticd/static_debug.c
@@ -36,27 +36,6 @@ const char *static_debugs_conflines[] = {
};
/* clang-format on */
-
-/*
- * Set or unset all staticd debugs
- *
- * flags
- * The flags to set
- *
- * set
- * Whether to set or unset the specified flags
- */
-static void static_debug_set_all(uint32_t flags, bool set)
-{
- for (unsigned int i = 0; i < array_size(static_debug_arr); i++) {
- DEBUG_FLAGS_SET(static_debug_arr[i], flags, set);
-
- /* if all modes have been turned off, don't preserve options */
- if (!DEBUG_MODE_CHECK(static_debug_arr[i], DEBUG_MODE_ALL))
- DEBUG_CLEAR(static_debug_arr[i]);
- }
-}
-
static int static_debug_config_write_helper(struct vty *vty, bool config)
{
uint32_t mode = DEBUG_MODE_ALL;
@@ -113,11 +92,9 @@ void static_debug_set(int vtynode, bool onoff, bool events, bool route,
* Debug lib initialization
*/
-struct debug_callbacks static_dbg_cbs = {
- .debug_set_all = static_debug_set_all
-};
-
void static_debug_init(void)
{
- debug_init(&static_dbg_cbs);
+ debug_install(&static_dbg_events);
+ debug_install(&static_dbg_route);
+ debug_install(&static_dbg_bfd);
}