From c470a43c5e25398b6444f681d22e5717f6dbd4b4 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Thu, 18 Aug 2011 00:39:13 +0000 Subject: [PATCH] The implementation of many tracing macros in scst_debug.h (like TRACE_DBG) requires that at least one more argument must be provided in addition to format which in some cases is an overkill. This patch fixes the issue and also unifies macro signatures for the cases when CONFIG_SCST_DEBUG is either on or off. Signed-off-by: Sergey Myasnikov git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3820 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/scst_debug.h | 52 ++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/scst/include/scst_debug.h b/scst/include/scst_debug.h index 33f1be51c..40ff28f02 100644 --- a/scst/include/scst_debug.h +++ b/scst/include/scst_debug.h @@ -141,7 +141,7 @@ do { \ if (___unlikely(trace_flag & (trace))) { \ debug_print_prefix(trace_flag, __LOG_PREFIX, \ __func__, __LINE__); \ - PRINT(KERN_CONT, format, args); \ + PRINT(KERN_CONT, format, ## args); \ } \ } while (0) @@ -176,7 +176,7 @@ do { \ #define TRACING_MINOR() (false) -#define TRACE(trace, args...) do {} while (0) +#define TRACE(trace, format, args...) do {} while (0) #define PRINT_BUFFER(message, buff, len) do {} while (0) #define PRINT_BUFF_FLAG(flag, message, buff, len) do {} while (0) @@ -188,18 +188,24 @@ do { \ do { \ if (trace_flag & (trace)) { \ debug_print_prefix(trace_flag, NULL, __func__, __LINE__);\ - PRINT(KERN_CONT, format, args); \ + PRINT(KERN_CONT, format, ## args); \ } \ } while (0) -#define TRACE_MEM(args...) TRACE_DBG_FLAG(TRACE_MEMORY, args) -#define TRACE_SG(args...) TRACE_DBG_FLAG(TRACE_SG_OP, args) -#define TRACE_DBG(args...) TRACE_DBG_FLAG(TRACE_DEBUG, args) -#define TRACE_DBG_SPECIAL(args...) TRACE_DBG_FLAG(TRACE_DEBUG|TRACE_SPECIAL, args) -#define TRACE_MGMT_DBG(args...) TRACE_DBG_FLAG(TRACE_MGMT_DEBUG, args) +#define TRACE_MEM(format, args...) \ + TRACE_DBG_FLAG(TRACE_MEMORY, format, ## args) +#define TRACE_SG(format, args...) \ + TRACE_DBG_FLAG(TRACE_SG_OP, format, ## args) +#define TRACE_DBG(format, args...) \ + TRACE_DBG_FLAG(TRACE_DEBUG, format, ## args) +#define TRACE_DBG_SPECIAL(format, args...) \ + TRACE_DBG_FLAG(TRACE_DEBUG|TRACE_SPECIAL, format, ## args) +#define TRACE_MGMT_DBG(format, args...) \ + TRACE_DBG_FLAG(TRACE_MGMT_DEBUG, format, ## args) #define TRACE_MGMT_DBG_SPECIAL(args...) \ - TRACE_DBG_FLAG(TRACE_MGMT_DEBUG|TRACE_SPECIAL, args) -#define TRACE_PR(args...) TRACE_DBG_FLAG(TRACE_PRES, args) + TRACE_DBG_FLAG(TRACE_MGMT_DEBUG|TRACE_SPECIAL, format, ## args) +#define TRACE_PR(format, args...) \ + TRACE_DBG_FLAG(TRACE_PRES, format, ## args) #define TRACE_BUFFER(message, buff, len) \ do { \ @@ -222,31 +228,31 @@ do { \ #define PRINT_LOG_FLAG(log_flag, format, args...) \ do { \ debug_print_prefix(trace_flag, __LOG_PREFIX, __func__, __LINE__);\ - PRINT(KERN_CONT, format, args); \ + PRINT(KERN_CONT, format, ## args); \ } while (0) #define PRINT_WARNING(format, args...) \ do { \ debug_print_prefix(trace_flag, __LOG_PREFIX, __func__, __LINE__);\ - PRINT(KERN_CONT, "***WARNING***: " format, args); \ + PRINT(KERN_CONT, "***WARNING***: " format, ## args); \ } while (0) #define PRINT_ERROR(format, args...) \ do { \ debug_print_prefix(trace_flag, __LOG_PREFIX, __func__, __LINE__);\ - PRINT(KERN_CONT, "***ERROR***: " format, args); \ + PRINT(KERN_CONT, "***ERROR***: " format, ## args); \ } while (0) #define PRINT_CRIT_ERROR(format, args...) \ do { \ debug_print_prefix(trace_flag, __LOG_PREFIX, __func__, __LINE__);\ - PRINT(KERN_CONT, "***CRITICAL ERROR***: " format, args); \ + PRINT(KERN_CONT, "***CRITICAL ERROR***: " format, ## args); \ } while (0) #define PRINT_INFO(format, args...) \ do { \ debug_print_prefix(trace_flag, __LOG_PREFIX, __func__, __LINE__);\ - PRINT(KERN_CONT, format, args); \ + PRINT(KERN_CONT, format, ## args); \ } while (0) #ifndef GENERATING_UPSTREAM_PATCH @@ -329,50 +335,50 @@ do { \ #define PRINT_INFO(format, args...) \ do { \ - PRINT(KERN_INFO, "%s: " format, LOG_PREFIX, args); \ + PRINT(KERN_INFO, "%s: " format, LOG_PREFIX, ## args); \ } while (0) #define PRINT_WARNING(format, args...) \ do { \ PRINT(KERN_INFO, "%s: ***WARNING***: " \ - format, LOG_PREFIX, args); \ + format, LOG_PREFIX, ## args); \ } while (0) #define PRINT_ERROR(format, args...) \ do { \ PRINT(KERN_INFO, "%s: ***ERROR***: " \ - format, LOG_PREFIX, args); \ + format, LOG_PREFIX, ## args); \ } while (0) #define PRINT_CRIT_ERROR(format, args...) \ do { \ PRINT(KERN_INFO, "%s: ***CRITICAL ERROR***: " \ - format, LOG_PREFIX, args); \ + format, LOG_PREFIX, ## args); \ } while (0) #else #define PRINT_INFO(format, args...) \ do { \ - PRINT(KERN_INFO, format, args); \ + PRINT(KERN_INFO, format, ## args); \ } while (0) #define PRINT_WARNING(format, args...) \ do { \ PRINT(KERN_INFO, "***WARNING***: " \ - format, args); \ + format, ## args); \ } while (0) #define PRINT_ERROR(format, args...) \ do { \ PRINT(KERN_ERR, "***ERROR***: " \ - format, args); \ + format, ## args); \ } while (0) #define PRINT_CRIT_ERROR(format, args...) \ do { \ PRINT(KERN_CRIT, "***CRITICAL ERROR***: " \ - format, args); \ + format, ## args); \ } while (0) #endif /* LOG_PREFIX */