diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2024-03-26 16:38:45 +0200 | 
|---|---|---|
| committer | Mark Stapp <mjs@cisco.com> | 2024-08-20 11:07:45 -0400 | 
| commit | 1797b7eefc730bb4f5aec08f130861650c61dd97 (patch) | |
| tree | 6b97f5357cb86c73b2ed9b24f893d8296688a66c /pathd/path_ted.h | |
| parent | d9775c690cb6f3d5fcc91805c3ada83aaa8f4835 (diff) | |
pathd: rework debugs
Pathd uses a single debug struct with additional option flags to
configure different types of debug messages. This is not how debug
library is supposed to be used. The idea of option flags is to allow
more granular control of a single type, not to represent multiple types.
This commit adds a separate debug struct for each type which greatly
simplifies the code.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'pathd/path_ted.h')
| -rw-r--r-- | pathd/path_ted.h | 23 | 
1 files changed, 6 insertions, 17 deletions
diff --git a/pathd/path_ted.h b/pathd/path_ted.h index a1bc784b7f..449e62f84f 100644 --- a/pathd/path_ted.h +++ b/pathd/path_ted.h @@ -59,28 +59,17 @@ struct ted_state {  	struct debug dbg;  };  /* Debug flags. */ -#define PATH_TED_DEBUG_BASIC   0x01  #define PATH_TED_DEBUG(fmt, ...)                                               \ -	do {                                                                   \ -		if (DEBUG_FLAGS_CHECK(&ted_state_g.dbg, PATH_TED_DEBUG_BASIC))  \ -			DEBUGD(&ted_state_g.dbg, "mpls-te: " fmt, ##__VA_ARGS__); \ -	} while (0) +	DEBUGD(&ted_state_g.dbg, "mpls-te: " fmt, ##__VA_ARGS__)  #define PATH_TED_ERROR(fmt, ...)                                               \ -	do {                                                                   \ -		if (DEBUG_FLAGS_CHECK(&ted_state_g.dbg, PATH_TED_DEBUG_BASIC)) \ -			DEBUGE(&ted_state_g.dbg, "mpls-te: " fmt, ##__VA_ARGS__); \ -	} while (0) +	DEBUGE(&ted_state_g.dbg, "mpls-te: " fmt, ##__VA_ARGS__) +  #define PATH_TED_WARN(fmt, ...)                                                \ -	do {                                                                   \ -		if (DEBUG_FLAGS_CHECK(&ted_state_g.dbg, PATH_TED_DEBUG_BASIC))  \ -			DEBUGW(&ted_state_g.dbg, "mpls-te: " fmt, ##__VA_ARGS__); \ -	} while (0) +	DEBUGW(&ted_state_g.dbg, "mpls-te: " fmt, ##__VA_ARGS__) +  #define PATH_TED_INFO(fmt, ...)                                                \ -	do {                                                                   \ -		if (DEBUG_FLAGS_CHECK(&ted_state_g.dbg, PATH_TED_DEBUG_BASIC)) \ -			DEBUGI(&ted_state_g.dbg, "mpls-te: " fmt, ##__VA_ARGS__); \ -	} while (0) +	DEBUGI(&ted_state_g.dbg, "mpls-te: " fmt, ##__VA_ARGS__)  /* TED management functions */  bool path_ted_is_initialized(void);  | 
