From 1121797b7e467bc30c3371825171c23f582d059a Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Thu, 1 Oct 2020 07:02:46 -0400 Subject: [PATCH] log: avoid name conflict with log flags structure Patch further out the series will be removing "SPDK_LOG_" portion of the literal. They will be made much shorter and have potential to conflict with some other structures. Add SPDK_LOG to the structure itself which will make sure there is no conflict as is now. For couple patches the structures will have longer than nessecary names. Signed-off-by: Tomasz Zawadzki Change-Id: If281fa8b7ae027500b980766d90513f8c3ee187a Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4494 Reviewed-by: Mellanox Build Bot Reviewed-by: Ben Walker Reviewed-by: Aleksey Marchuk Reviewed-by: Shuhei Matsumoto Reviewed-by: Jacek Kalwas Tested-by: SPDK CI Jenkins --- include/spdk_internal/log.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/spdk_internal/log.h b/include/spdk_internal/log.h index 3a14ec652..64946f966 100644 --- a/include/spdk_internal/log.h +++ b/include/spdk_internal/log.h @@ -56,20 +56,20 @@ void spdk_log_register_flag(const char *name, struct spdk_log_flag *flag); struct spdk_log_flag *spdk_log_get_first_flag(void); struct spdk_log_flag *spdk_log_get_next_flag(struct spdk_log_flag *flag); -#define SPDK_LOG_REGISTER_COMPONENT(str, flag) \ -struct spdk_log_flag flag = { \ +#define SPDK_LOG_REGISTER_COMPONENT(str, FLAG) \ +struct spdk_log_flag SPDK_LOG_##FLAG = { \ .enabled = false, \ .name = str, \ }; \ -__attribute__((constructor)) static void register_flag_##flag(void) \ +__attribute__((constructor)) static void register_flag_##FLAG(void) \ { \ - spdk_log_register_flag(str, &flag); \ + spdk_log_register_flag(str, &SPDK_LOG_##FLAG); \ } #define SPDK_INFOLOG(FLAG, ...) \ do { \ - extern struct spdk_log_flag FLAG; \ - if (FLAG.enabled) { \ + extern struct spdk_log_flag SPDK_LOG_##FLAG; \ + if (SPDK_LOG_##FLAG.enabled) { \ spdk_log(SPDK_LOG_INFO, __FILE__, __LINE__, __func__, __VA_ARGS__); \ } \ } while (0) @@ -78,16 +78,16 @@ __attribute__((constructor)) static void register_flag_##flag(void) \ #define SPDK_DEBUGLOG(FLAG, ...) \ do { \ - extern struct spdk_log_flag FLAG; \ - if (FLAG.enabled) { \ + extern struct spdk_log_flag SPDK_LOG_##FLAG; \ + if (SPDK_LOG_##FLAG.enabled) { \ spdk_log(SPDK_LOG_DEBUG, __FILE__, __LINE__, __func__, __VA_ARGS__); \ } \ } while (0) #define SPDK_LOGDUMP(FLAG, LABEL, BUF, LEN) \ do { \ - extern struct spdk_log_flag FLAG; \ - if ((FLAG.enabled) && (LEN)) { \ + extern struct spdk_log_flag SPDK_LOG_##FLAG; \ + if ((SPDK_LOG_##FLAG.enabled) && (LEN)) { \ spdk_log_dump(stderr, (LABEL), (BUF), (LEN)); \ } \ } while (0)