diff options
| author | Jafar Al-Gharaibeh <jafar@atcorp.com> | 2024-08-29 11:51:53 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-29 11:51:53 -0400 |
| commit | 77e1a26faa3c153abf6a8abb858f435914b62625 (patch) | |
| tree | 1dd71e3d2cdb29b7c406b6a21351b2e89cb50831 /pbrd/pbr_debug.c | |
| parent | f1e4ef461d5bd39a9ad96c4116c2c869e4f37737 (diff) | |
| parent | 830972cab211a2f7ad82d7635ad9111afac8f47b (diff) | |
Merge pull request #16664 from mjstapp/igor_debug_simplify
*: simplify frrlib debug
Diffstat (limited to 'pbrd/pbr_debug.c')
| -rw-r--r-- | pbrd/pbr_debug.c | 55 |
1 files changed, 9 insertions, 46 deletions
diff --git a/pbrd/pbr_debug.c b/pbrd/pbr_debug.c index b30b54b7f0..6b0d1d5a81 100644 --- a/pbrd/pbr_debug.c +++ b/pbrd/pbr_debug.c @@ -13,53 +13,16 @@ #include "pbrd/pbr_debug_clippy.c" #include "pbrd/pbr_debug.h" -struct debug pbr_dbg_map = {0, "PBR map"}; -struct debug pbr_dbg_zebra = {0, "PBR Zebra communications"}; -struct debug pbr_dbg_nht = {0, "PBR nexthop tracking"}; -struct debug pbr_dbg_event = {0, "PBR events"}; - -struct debug *pbr_debugs[] = {&pbr_dbg_map, &pbr_dbg_zebra, &pbr_dbg_nht, - &pbr_dbg_event}; - -const char *pbr_debugs_conflines[] = { - "debug pbr map", - "debug pbr zebra", - "debug pbr nht", - "debug pbr events", -}; - -void pbr_debug_set_all(uint32_t flags, bool set) -{ - for (unsigned int i = 0; i < array_size(pbr_debugs); i++) { - DEBUG_FLAGS_SET(pbr_debugs[i], flags, set); - - /* if all modes have been turned off, don't preserve options */ - if (!DEBUG_MODE_CHECK(pbr_debugs[i], DEBUG_MODE_ALL)) - DEBUG_CLEAR(pbr_debugs[i]); - } -} - -int pbr_debug_config_write_helper(struct vty *vty, bool config) -{ - uint32_t mode = DEBUG_MODE_ALL; - - if (config) - mode = DEBUG_MODE_CONF; - - for (unsigned int i = 0; i < array_size(pbr_debugs); i++) - if (DEBUG_MODE_CHECK(pbr_debugs[i], mode)) - vty_out(vty, "%s\n", pbr_debugs_conflines[i]); - return 0; -} - -int pbr_debug_config_write(struct vty *vty) -{ - return pbr_debug_config_write_helper(vty, true); -} - -struct debug_callbacks pbr_dbg_cbs = {.debug_set_all = pbr_debug_set_all}; +struct debug pbr_dbg_map = { 0, "debug pbr map", "PBR map" }; +struct debug pbr_dbg_zebra = { 0, "debug pbr zebra", + "PBR Zebra communications" }; +struct debug pbr_dbg_nht = { 0, "debug pbr nht", "PBR nexthop tracking" }; +struct debug pbr_dbg_event = { 0, "debug pbr events", "PBR events" }; void pbr_debug_init(void) { - debug_init(&pbr_dbg_cbs); + debug_install(&pbr_dbg_map); + debug_install(&pbr_dbg_zebra); + debug_install(&pbr_dbg_nht); + debug_install(&pbr_dbg_event); } |
