aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/core.h
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2008-05-05 04:23:34 -0400
committerDavid S. Miller <davem@davemloft.net>2008-05-05 04:23:34 -0400
commit6063da9d74d4da812ae0d8f233b7e320e15765e3 (patch)
tree9568bb88fd25a3a44c23a161773ad84ba4e1c61a /net/tipc/core.h
parent7d3aa71239f588215b5a7c359f05155b192d8081 (diff)
tipc: Cosmetic cleanup of system & debug output declarations
This patch contains changes to make TIPC's system & debug message declarations more readable. Declarations have been regrouped and recommented to make it easier to understand what output is generated in both standard and debugging modes. In addition, oversize lines have been fixed to respect the 80 character upper bound used in the kernel. Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/core.h')
-rw-r--r--net/tipc/core.h117
1 files changed, 67 insertions, 50 deletions
diff --git a/net/tipc/core.h b/net/tipc/core.h
index bc633552e9ff..d7f3b3c96b97 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -59,87 +59,104 @@
59#include <linux/vmalloc.h> 59#include <linux/vmalloc.h>
60 60
61/* 61/*
62 * TIPC debugging code 62 * TIPC sanity test macros
63 */ 63 */
64 64
65#define assert(i) BUG_ON(!(i)) 65#define assert(i) BUG_ON(!(i))
66 66
67struct tipc_msg;
68extern struct print_buf *const TIPC_NULL;
69extern struct print_buf *const TIPC_CONS;
70extern struct print_buf *const TIPC_LOG;
71void tipc_msg_print(struct print_buf*,struct tipc_msg *,const char*);
72void tipc_printf(struct print_buf *, const char *fmt, ...);
73void tipc_dump(struct print_buf*,const char *fmt, ...);
74
75#ifdef CONFIG_TIPC_DEBUG
76
77/* 67/*
78 * TIPC debug support included: 68 * TIPC system monitoring code
79 * - system messages are printed to TIPC_OUTPUT print buffer
80 * - debug messages are printed to DBG_OUTPUT print buffer
81 */ 69 */
82 70
83#define err(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_ERR "TIPC: " fmt, ## arg)
84#define warn(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_WARNING "TIPC: " fmt, ## arg)
85#define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_NOTICE "TIPC: " fmt, ## arg)
86
87#define dbg(fmt, arg...) do {if (DBG_OUTPUT != TIPC_NULL) tipc_printf(DBG_OUTPUT, fmt, ## arg);} while(0)
88#define msg_dbg(msg, txt) do {if (DBG_OUTPUT != TIPC_NULL) tipc_msg_print(DBG_OUTPUT, msg, txt);} while(0)
89#define dump(fmt, arg...) do {if (DBG_OUTPUT != TIPC_NULL) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0)
90
91
92/* 71/*
93 * By default, TIPC_OUTPUT is defined to be system console and TIPC log buffer, 72 * TIPC's print buffer subsystem supports the following print buffers:
94 * while DBG_OUTPUT is the null print buffer. These defaults can be changed
95 * here, or on a per .c file basis, by redefining these symbols. The following
96 * print buffer options are available:
97 * 73 *
98 * TIPC_NULL : null buffer (i.e. print nowhere) 74 * TIPC_NULL : null buffer (i.e. print nowhere)
99 * TIPC_CONS : system console 75 * TIPC_CONS : system console
100 * TIPC_LOG : TIPC log buffer 76 * TIPC_LOG : TIPC log buffer
101 * &buf : user-defined buffer (struct print_buf *) 77 * &buf : user-defined buffer (struct print_buf *)
102 * 78 *
103 * Note: TIPC_LOG is configured to echo its output to the system console; 79 * Note: TIPC_LOG is configured to echo its output to the system console;
104 * user-defined buffers can be configured to do the same thing. 80 * user-defined buffers can be configured to do the same thing.
105 */ 81 */
106 82
83extern struct print_buf *const TIPC_NULL;
84extern struct print_buf *const TIPC_CONS;
85extern struct print_buf *const TIPC_LOG;
86
87void tipc_printf(struct print_buf *, const char *fmt, ...);
88void tipc_msg_print(struct print_buf *, struct tipc_msg *, const char *);
89void tipc_dump(struct print_buf *, const char *fmt, ...);
90
91/*
92 * TIPC_OUTPUT is the destination print buffer for system messages.
93 */
94
107#ifndef TIPC_OUTPUT 95#ifndef TIPC_OUTPUT
108#define TIPC_OUTPUT TIPC_LOG 96#define TIPC_OUTPUT TIPC_LOG
109#endif 97#endif
110 98
111#ifndef DBG_OUTPUT
112#define DBG_OUTPUT TIPC_NULL
113#endif
114
115#else
116
117/* 99/*
118 * TIPC debug support not included: 100 * TIPC can be configured to send system messages to TIPC_OUTPUT
119 * - system messages are printed to system console 101 * or to the system console only.
120 * - debug messages are not printed
121 */ 102 */
122 103
104#ifdef CONFIG_TIPC_DEBUG
105
106#define err(fmt, arg...) tipc_printf(TIPC_OUTPUT, \
107 KERN_ERR "TIPC: " fmt, ## arg)
108#define warn(fmt, arg...) tipc_printf(TIPC_OUTPUT, \
109 KERN_WARNING "TIPC: " fmt, ## arg)
110#define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, \
111 KERN_NOTICE "TIPC: " fmt, ## arg)
112
113#else
114
123#define err(fmt, arg...) printk(KERN_ERR "TIPC: " fmt , ## arg) 115#define err(fmt, arg...) printk(KERN_ERR "TIPC: " fmt , ## arg)
124#define info(fmt, arg...) printk(KERN_INFO "TIPC: " fmt , ## arg) 116#define info(fmt, arg...) printk(KERN_INFO "TIPC: " fmt , ## arg)
125#define warn(fmt, arg...) printk(KERN_WARNING "TIPC: " fmt , ## arg) 117#define warn(fmt, arg...) printk(KERN_WARNING "TIPC: " fmt , ## arg)
126 118
127#define dbg(fmt, arg...) do {} while (0) 119#endif
128#define msg_dbg(msg,txt) do {} while (0)
129#define dump(fmt,arg...) do {} while (0)
130 120
121/*
122 * DBG_OUTPUT is the destination print buffer for debug messages.
123 * It defaults to the the null print buffer, but can be redefined
124 * (typically in the individual .c files being debugged) to allow
125 * selected debug messages to be generated where needed.
126 */
127
128#ifndef DBG_OUTPUT
129#define DBG_OUTPUT TIPC_NULL
130#endif
131 131
132/* 132/*
133 * TIPC_OUTPUT is defined to be the system console, while DBG_OUTPUT is 133 * TIPC can be configured to send debug messages to the specified print buffer
134 * the null print buffer. Thes ensures that any system or debug messages 134 * (typically DBG_OUTPUT) or to suppress them entirely.
135 * that are generated without using the above macros are handled correctly.
136 */ 135 */
137 136
138#undef TIPC_OUTPUT 137#ifdef CONFIG_TIPC_DEBUG
139#define TIPC_OUTPUT TIPC_CONS
140 138
141#undef DBG_OUTPUT 139#define dbg(fmt, arg...) \
142#define DBG_OUTPUT TIPC_NULL 140 do { \
141 if (DBG_OUTPUT != TIPC_NULL) \
142 tipc_printf(DBG_OUTPUT, fmt, ## arg); \
143 } while (0)
144#define msg_dbg(msg, txt) \
145 do { \
146 if (DBG_OUTPUT != TIPC_NULL) \
147 tipc_msg_print(DBG_OUTPUT, msg, txt); \
148 } while (0)
149#define dump(fmt, arg...) \
150 do { \
151 if (DBG_OUTPUT != TIPC_NULL) \
152 tipc_dump(DBG_OUTPUT, fmt, ##arg); \
153 } while (0)
154
155#else
156
157#define dbg(fmt, arg...) do {} while (0)
158#define msg_dbg(msg, txt) do {} while (0)
159#define dump(fmt, arg...) do {} while (0)
143 160
144#endif 161#endif
145 162