diff options
author | Allan Stephens <allan.stephens@windriver.com> | 2008-05-05 04:24:06 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-05-05 04:24:06 -0400 |
commit | 48c971394626173eaf1c33441ea1d900c88b21a3 (patch) | |
tree | ff4e128177139f56e861dae01bb5ab77f1f7554d | |
parent | 6063da9d74d4da812ae0d8f233b7e320e15765e3 (diff) |
tipc: Exclude debug-only print buffer code when not debugging
This patch modifies TIPC to only exclude debug-related print buffer
routines when debugging capabilities are not required. It also
fixes up some related #defines that exceed 80 characters.
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/tipc/core.h | 12 | ||||
-rw-r--r-- | net/tipc/dbg.c | 8 | ||||
-rw-r--r-- | net/tipc/link.c | 20 | ||||
-rw-r--r-- | net/tipc/msg.c | 10 |
4 files changed, 37 insertions, 13 deletions
diff --git a/net/tipc/core.h b/net/tipc/core.h index d7f3b3c96b97..0d783bcc6f9a 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h | |||
@@ -85,8 +85,6 @@ extern struct print_buf *const TIPC_CONS; | |||
85 | extern struct print_buf *const TIPC_LOG; | 85 | extern struct print_buf *const TIPC_LOG; |
86 | 86 | ||
87 | void tipc_printf(struct print_buf *, const char *fmt, ...); | 87 | void tipc_printf(struct print_buf *, const char *fmt, ...); |
88 | void tipc_msg_print(struct print_buf *, struct tipc_msg *, const char *); | ||
89 | void tipc_dump(struct print_buf *, const char *fmt, ...); | ||
90 | 88 | ||
91 | /* | 89 | /* |
92 | * TIPC_OUTPUT is the destination print buffer for system messages. | 90 | * TIPC_OUTPUT is the destination print buffer for system messages. |
@@ -144,20 +142,26 @@ void tipc_dump(struct print_buf *, const char *fmt, ...); | |||
144 | #define msg_dbg(msg, txt) \ | 142 | #define msg_dbg(msg, txt) \ |
145 | do { \ | 143 | do { \ |
146 | if (DBG_OUTPUT != TIPC_NULL) \ | 144 | if (DBG_OUTPUT != TIPC_NULL) \ |
147 | tipc_msg_print(DBG_OUTPUT, msg, txt); \ | 145 | tipc_msg_dbg(DBG_OUTPUT, msg, txt); \ |
148 | } while (0) | 146 | } while (0) |
149 | #define dump(fmt, arg...) \ | 147 | #define dump(fmt, arg...) \ |
150 | do { \ | 148 | do { \ |
151 | if (DBG_OUTPUT != TIPC_NULL) \ | 149 | if (DBG_OUTPUT != TIPC_NULL) \ |
152 | tipc_dump(DBG_OUTPUT, fmt, ##arg); \ | 150 | tipc_dump_dbg(DBG_OUTPUT, fmt, ##arg); \ |
153 | } while (0) | 151 | } while (0) |
154 | 152 | ||
153 | void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *); | ||
154 | void tipc_dump_dbg(struct print_buf *, const char *fmt, ...); | ||
155 | |||
155 | #else | 156 | #else |
156 | 157 | ||
157 | #define dbg(fmt, arg...) do {} while (0) | 158 | #define dbg(fmt, arg...) do {} while (0) |
158 | #define msg_dbg(msg, txt) do {} while (0) | 159 | #define msg_dbg(msg, txt) do {} while (0) |
159 | #define dump(fmt, arg...) do {} while (0) | 160 | #define dump(fmt, arg...) do {} while (0) |
160 | 161 | ||
162 | #define tipc_msg_dbg(...) do {} while (0) | ||
163 | #define tipc_dump_dbg(...) do {} while (0) | ||
164 | |||
161 | #endif | 165 | #endif |
162 | 166 | ||
163 | 167 | ||
diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c index cda496815a05..29ecae851668 100644 --- a/net/tipc/dbg.c +++ b/net/tipc/dbg.c | |||
@@ -263,6 +263,8 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...) | |||
263 | spin_unlock_bh(&print_lock); | 263 | spin_unlock_bh(&print_lock); |
264 | } | 264 | } |
265 | 265 | ||
266 | #ifdef CONFIG_TIPC_DEBUG | ||
267 | |||
266 | /** | 268 | /** |
267 | * print_to_console - write string of bytes to console in multiple chunks | 269 | * print_to_console - write string of bytes to console in multiple chunks |
268 | */ | 270 | */ |
@@ -309,11 +311,11 @@ static void printbuf_dump(struct print_buf *pb) | |||
309 | } | 311 | } |
310 | 312 | ||
311 | /** | 313 | /** |
312 | * tipc_dump - dump (non-console) print buffer to console | 314 | * tipc_dump_dbg - dump (non-console) print buffer to console |
313 | * @pb: pointer to print buffer | 315 | * @pb: pointer to print buffer |
314 | */ | 316 | */ |
315 | 317 | ||
316 | void tipc_dump(struct print_buf *pb, const char *fmt, ...) | 318 | void tipc_dump_dbg(struct print_buf *pb, const char *fmt, ...) |
317 | { | 319 | { |
318 | int len; | 320 | int len; |
319 | 321 | ||
@@ -334,6 +336,8 @@ void tipc_dump(struct print_buf *pb, const char *fmt, ...) | |||
334 | spin_unlock_bh(&print_lock); | 336 | spin_unlock_bh(&print_lock); |
335 | } | 337 | } |
336 | 338 | ||
339 | #endif | ||
340 | |||
337 | /** | 341 | /** |
338 | * tipc_log_resize - change the size of the TIPC log buffer | 342 | * tipc_log_resize - change the size of the TIPC log buffer |
339 | * @log_size: print buffer size to use | 343 | * @log_size: print buffer size to use |
diff --git a/net/tipc/link.c b/net/tipc/link.c index 2a26a16e269f..bd206ebe4eea 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -147,9 +147,21 @@ static void link_print(struct link *l_ptr, struct print_buf *buf, | |||
147 | 147 | ||
148 | #define LINK_LOG_BUF_SIZE 0 | 148 | #define LINK_LOG_BUF_SIZE 0 |
149 | 149 | ||
150 | #define dbg_link(fmt, arg...) do {if (LINK_LOG_BUF_SIZE) tipc_printf(&l_ptr->print_buf, fmt, ## arg); } while(0) | 150 | #define dbg_link(fmt, arg...) \ |
151 | #define dbg_link_msg(msg, txt) do {if (LINK_LOG_BUF_SIZE) tipc_msg_print(&l_ptr->print_buf, msg, txt); } while(0) | 151 | do { \ |
152 | #define dbg_link_state(txt) do {if (LINK_LOG_BUF_SIZE) link_print(l_ptr, &l_ptr->print_buf, txt); } while(0) | 152 | if (LINK_LOG_BUF_SIZE) \ |
153 | tipc_printf(&l_ptr->print_buf, fmt, ## arg); \ | ||
154 | } while (0) | ||
155 | #define dbg_link_msg(msg, txt) \ | ||
156 | do { \ | ||
157 | if (LINK_LOG_BUF_SIZE) \ | ||
158 | tipc_msg_dbg(&l_ptr->print_buf, msg, txt); \ | ||
159 | } while (0) | ||
160 | #define dbg_link_state(txt) \ | ||
161 | do { \ | ||
162 | if (LINK_LOG_BUF_SIZE) \ | ||
163 | link_print(l_ptr, &l_ptr->print_buf, txt); \ | ||
164 | } while (0) | ||
153 | #define dbg_link_dump() do { \ | 165 | #define dbg_link_dump() do { \ |
154 | if (LINK_LOG_BUF_SIZE) { \ | 166 | if (LINK_LOG_BUF_SIZE) { \ |
155 | tipc_printf(LOG, "\n\nDumping link <%s>:\n", l_ptr->name); \ | 167 | tipc_printf(LOG, "\n\nDumping link <%s>:\n", l_ptr->name); \ |
@@ -1651,7 +1663,7 @@ static void link_retransmit_failure(struct link *l_ptr, struct sk_buff *buf) | |||
1651 | struct tipc_msg *msg = buf_msg(buf); | 1663 | struct tipc_msg *msg = buf_msg(buf); |
1652 | 1664 | ||
1653 | warn("Retransmission failure on link <%s>\n", l_ptr->name); | 1665 | warn("Retransmission failure on link <%s>\n", l_ptr->name); |
1654 | tipc_msg_print(TIPC_OUTPUT, msg, ">RETR-FAIL>"); | 1666 | tipc_msg_dbg(TIPC_OUTPUT, msg, ">RETR-FAIL>"); |
1655 | 1667 | ||
1656 | if (l_ptr->addr) { | 1668 | if (l_ptr->addr) { |
1657 | 1669 | ||
diff --git a/net/tipc/msg.c b/net/tipc/msg.c index 696a8633df75..38abebaae889 100644 --- a/net/tipc/msg.c +++ b/net/tipc/msg.c | |||
@@ -41,7 +41,9 @@ | |||
41 | #include "bearer.h" | 41 | #include "bearer.h" |
42 | 42 | ||
43 | 43 | ||
44 | void tipc_msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str) | 44 | #ifdef CONFIG_TIPC_DEBUG |
45 | |||
46 | void tipc_msg_dbg(struct print_buf *buf, struct tipc_msg *msg, const char *str) | ||
45 | { | 47 | { |
46 | u32 usr = msg_user(msg); | 48 | u32 usr = msg_user(msg); |
47 | tipc_printf(buf, str); | 49 | tipc_printf(buf, str); |
@@ -315,9 +317,11 @@ void tipc_msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str | |||
315 | } | 317 | } |
316 | tipc_printf(buf, "\n"); | 318 | tipc_printf(buf, "\n"); |
317 | if ((usr == CHANGEOVER_PROTOCOL) && (msg_msgcnt(msg))) { | 319 | if ((usr == CHANGEOVER_PROTOCOL) && (msg_msgcnt(msg))) { |
318 | tipc_msg_print(buf,msg_get_wrapped(msg)," /"); | 320 | tipc_msg_dbg(buf, msg_get_wrapped(msg), " /"); |
319 | } | 321 | } |
320 | if ((usr == MSG_FRAGMENTER) && (msg_type(msg) == FIRST_FRAGMENT)) { | 322 | if ((usr == MSG_FRAGMENTER) && (msg_type(msg) == FIRST_FRAGMENT)) { |
321 | tipc_msg_print(buf,msg_get_wrapped(msg)," /"); | 323 | tipc_msg_dbg(buf, msg_get_wrapped(msg), " /"); |
322 | } | 324 | } |
323 | } | 325 | } |
326 | |||
327 | #endif | ||