diff options
author | Allan Stephens <Allan.Stephens@windriver.com> | 2010-12-31 13:59:28 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-01 16:57:54 -0500 |
commit | 6e7e309c62ab584348e0fef90c8e3e48f634dba1 (patch) | |
tree | feb74fd531cc6244e706bb6ee76403590cb1cdc4 /net/tipc/core.h | |
parent | 8d64a5ba58157dedc61f3f1f51e1c5d66f32a484 (diff) |
tipc: Finish streamlining of debugging code
Completes the simplification of TIPC's debugging capabilities. By default
TIPC includes no debugging code, and any debugging code added by developers
that calls the dbg() and dbg_macros() is compiled out. If debugging support
is enabled, TIPC prints out some additional data about its internal state
when certain abnormal conditions occur, and any developer-added calls to the
TIPC debug macros are compiled in.
Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/core.h')
-rw-r--r-- | net/tipc/core.h | 47 |
1 files changed, 9 insertions, 38 deletions
diff --git a/net/tipc/core.h b/net/tipc/core.h index 3af0b36e3f1a..997158546e25 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h | |||
@@ -83,6 +83,7 @@ struct print_buf; /* log.h */ | |||
83 | * user-defined buffers can be configured to do the same thing. | 83 | * user-defined buffers can be configured to do the same thing. |
84 | */ | 84 | */ |
85 | extern struct print_buf *const TIPC_NULL; | 85 | extern struct print_buf *const TIPC_NULL; |
86 | extern struct print_buf *const TIPC_CONS; | ||
86 | extern struct print_buf *const TIPC_LOG; | 87 | extern struct print_buf *const TIPC_LOG; |
87 | 88 | ||
88 | void tipc_printf(struct print_buf *, const char *fmt, ...); | 89 | void tipc_printf(struct print_buf *, const char *fmt, ...); |
@@ -95,56 +96,26 @@ void tipc_printf(struct print_buf *, const char *fmt, ...); | |||
95 | #define TIPC_OUTPUT TIPC_LOG | 96 | #define TIPC_OUTPUT TIPC_LOG |
96 | #endif | 97 | #endif |
97 | 98 | ||
98 | /* | ||
99 | * TIPC can be configured to send system messages to TIPC_OUTPUT | ||
100 | * or to the system console only. | ||
101 | */ | ||
102 | |||
103 | #ifdef CONFIG_TIPC_DEBUG | ||
104 | |||
105 | #define err(fmt, arg...) tipc_printf(TIPC_OUTPUT, \ | 99 | #define err(fmt, arg...) tipc_printf(TIPC_OUTPUT, \ |
106 | KERN_ERR "TIPC: " fmt, ## arg) | 100 | KERN_ERR "TIPC: " fmt, ## arg) |
107 | #define warn(fmt, arg...) tipc_printf(TIPC_OUTPUT, \ | 101 | #define warn(fmt, arg...) tipc_printf(TIPC_OUTPUT, \ |
108 | KERN_WARNING "TIPC: " fmt, ## arg) | 102 | KERN_WARNING "TIPC: " fmt, ## arg) |
109 | #define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, \ | 103 | #define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, \ |
110 | KERN_NOTICE "TIPC: " fmt, ## arg) | 104 | KERN_NOTICE "TIPC: " fmt, ## arg) |
111 | |||
112 | #else | ||
113 | 105 | ||
114 | #define err(fmt, arg...) printk(KERN_ERR "TIPC: " fmt , ## arg) | 106 | #ifdef CONFIG_TIPC_DEBUG |
115 | #define info(fmt, arg...) printk(KERN_INFO "TIPC: " fmt , ## arg) | ||
116 | #define warn(fmt, arg...) printk(KERN_WARNING "TIPC: " fmt , ## arg) | ||
117 | |||
118 | #endif | ||
119 | 107 | ||
120 | /* | 108 | /* |
121 | * DBG_OUTPUT is the destination print buffer for debug messages. | 109 | * DBG_OUTPUT is the destination print buffer for debug messages. |
122 | * It defaults to the the null print buffer, but can be redefined | ||
123 | * (typically in the individual .c files being debugged) to allow | ||
124 | * selected debug messages to be generated where needed. | ||
125 | */ | 110 | */ |
126 | 111 | ||
127 | #ifndef DBG_OUTPUT | 112 | #ifndef DBG_OUTPUT |
128 | #define DBG_OUTPUT TIPC_NULL | 113 | #define DBG_OUTPUT TIPC_LOG |
129 | #endif | 114 | #endif |
130 | 115 | ||
131 | /* | 116 | #define dbg(fmt, arg...) tipc_printf(DBG_OUTPUT, KERN_DEBUG fmt, ## arg); |
132 | * TIPC can be configured to send debug messages to the specified print buffer | ||
133 | * (typically DBG_OUTPUT) or to suppress them entirely. | ||
134 | */ | ||
135 | |||
136 | #ifdef CONFIG_TIPC_DEBUG | ||
137 | 117 | ||
138 | #define dbg(fmt, arg...) \ | 118 | #define msg_dbg(msg, txt) tipc_msg_dbg(DBG_OUTPUT, msg, txt); |
139 | do { \ | ||
140 | if (DBG_OUTPUT != TIPC_NULL) \ | ||
141 | tipc_printf(DBG_OUTPUT, fmt, ## arg); \ | ||
142 | } while (0) | ||
143 | #define msg_dbg(msg, txt) \ | ||
144 | do { \ | ||
145 | if (DBG_OUTPUT != TIPC_NULL) \ | ||
146 | tipc_msg_dbg(DBG_OUTPUT, msg, txt); \ | ||
147 | } while (0) | ||
148 | 119 | ||
149 | void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *); | 120 | void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *); |
150 | 121 | ||
@@ -153,7 +124,7 @@ void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *); | |||
153 | #define dbg(fmt, arg...) do {} while (0) | 124 | #define dbg(fmt, arg...) do {} while (0) |
154 | #define msg_dbg(msg, txt) do {} while (0) | 125 | #define msg_dbg(msg, txt) do {} while (0) |
155 | 126 | ||
156 | #define tipc_msg_dbg(...) do {} while (0) | 127 | #define tipc_msg_dbg(buf, msg, txt) do {} while (0) |
157 | 128 | ||
158 | #endif | 129 | #endif |
159 | 130 | ||