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 <tomasz.zawadzki@intel.com> Change-Id: If281fa8b7ae027500b980766d90513f8c3ee187a Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4494 Reviewed-by: Mellanox Build Bot Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jacek Kalwas <jacek.kalwas@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
849aa41d71
commit
1121797b7e
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user