aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/core.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/core.h')
-rw-r--r--net/tipc/core.h76
1 files changed, 19 insertions, 57 deletions
diff --git a/net/tipc/core.h b/net/tipc/core.h
index e19389e57227..997158546e25 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -39,10 +39,6 @@
39 39
40#include <linux/tipc.h> 40#include <linux/tipc.h>
41#include <linux/tipc_config.h> 41#include <linux/tipc_config.h>
42#include <net/tipc/tipc_msg.h>
43#include <net/tipc/tipc_port.h>
44#include <net/tipc/tipc_bearer.h>
45#include <net/tipc/tipc.h>
46#include <linux/types.h> 42#include <linux/types.h>
47#include <linux/kernel.h> 43#include <linux/kernel.h>
48#include <linux/errno.h> 44#include <linux/errno.h>
@@ -62,6 +58,9 @@
62 58
63#define TIPC_MOD_VER "2.0.0" 59#define TIPC_MOD_VER "2.0.0"
64 60
61struct tipc_msg; /* msg.h */
62struct print_buf; /* log.h */
63
65/* 64/*
66 * TIPC sanity test macros 65 * TIPC sanity test macros
67 */ 66 */
@@ -84,6 +83,7 @@
84 * user-defined buffers can be configured to do the same thing. 83 * user-defined buffers can be configured to do the same thing.
85 */ 84 */
86extern struct print_buf *const TIPC_NULL; 85extern struct print_buf *const TIPC_NULL;
86extern struct print_buf *const TIPC_CONS;
87extern struct print_buf *const TIPC_LOG; 87extern struct print_buf *const TIPC_LOG;
88 88
89void tipc_printf(struct print_buf *, const char *fmt, ...); 89void tipc_printf(struct print_buf *, const char *fmt, ...);
@@ -96,73 +96,35 @@ void tipc_printf(struct print_buf *, const char *fmt, ...);
96#define TIPC_OUTPUT TIPC_LOG 96#define TIPC_OUTPUT TIPC_LOG
97#endif 97#endif
98 98
99/*
100 * TIPC can be configured to send system messages to TIPC_OUTPUT
101 * or to the system console only.
102 */
103
104#ifdef CONFIG_TIPC_DEBUG
105
106#define err(fmt, arg...) tipc_printf(TIPC_OUTPUT, \ 99#define err(fmt, arg...) tipc_printf(TIPC_OUTPUT, \
107 KERN_ERR "TIPC: " fmt, ## arg) 100 KERN_ERR "TIPC: " fmt, ## arg)
108#define warn(fmt, arg...) tipc_printf(TIPC_OUTPUT, \ 101#define warn(fmt, arg...) tipc_printf(TIPC_OUTPUT, \
109 KERN_WARNING "TIPC: " fmt, ## arg) 102 KERN_WARNING "TIPC: " fmt, ## arg)
110#define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, \ 103#define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, \
111 KERN_NOTICE "TIPC: " fmt, ## arg) 104 KERN_NOTICE "TIPC: " fmt, ## arg)
112
113#else
114
115#define err(fmt, arg...) printk(KERN_ERR "TIPC: " fmt , ## arg)
116#define info(fmt, arg...) printk(KERN_INFO "TIPC: " fmt , ## arg)
117#define warn(fmt, arg...) printk(KERN_WARNING "TIPC: " fmt , ## arg)
118 105
119#endif 106#ifdef CONFIG_TIPC_DEBUG
120 107
121/* 108/*
122 * DBG_OUTPUT is the destination print buffer for debug messages. 109 * 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 */ 110 */
127 111
128#ifndef DBG_OUTPUT 112#ifndef DBG_OUTPUT
129#define DBG_OUTPUT TIPC_NULL 113#define DBG_OUTPUT TIPC_LOG
130#endif 114#endif
131 115
132/* 116#define dbg(fmt, arg...) tipc_printf(DBG_OUTPUT, KERN_DEBUG fmt, ## arg);
133 * TIPC can be configured to send debug messages to the specified print buffer
134 * (typically DBG_OUTPUT) or to suppress them entirely.
135 */
136 117
137#ifdef CONFIG_TIPC_DEBUG 118#define msg_dbg(msg, txt) tipc_msg_dbg(DBG_OUTPUT, msg, txt);
138
139#define dbg(fmt, arg...) \
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_dbg(DBG_OUTPUT, msg, txt); \
148 } while (0)
149#define dump(fmt, arg...) \
150 do { \
151 if (DBG_OUTPUT != TIPC_NULL) \
152 tipc_dump_dbg(DBG_OUTPUT, fmt, ##arg); \
153 } while (0)
154 119
155void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *); 120void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *);
156void tipc_dump_dbg(struct print_buf *, const char *fmt, ...);
157 121
158#else 122#else
159 123
160#define dbg(fmt, arg...) do {} while (0) 124#define dbg(fmt, arg...) do {} while (0)
161#define msg_dbg(msg, txt) do {} while (0) 125#define msg_dbg(msg, txt) do {} while (0)
162#define dump(fmt, arg...) do {} while (0)
163 126
164#define tipc_msg_dbg(...) do {} while (0) 127#define tipc_msg_dbg(buf, msg, txt) do {} while (0)
165#define tipc_dump_dbg(...) do {} while (0)
166 128
167#endif 129#endif
168 130
@@ -174,14 +136,18 @@ void tipc_dump_dbg(struct print_buf *, const char *fmt, ...);
174#define ELINKCONG EAGAIN /* link congestion <=> resource unavailable */ 136#define ELINKCONG EAGAIN /* link congestion <=> resource unavailable */
175 137
176/* 138/*
139 * TIPC operating mode routines
140 */
141#define TIPC_NOT_RUNNING 0
142#define TIPC_NODE_MODE 1
143#define TIPC_NET_MODE 2
144
145/*
177 * Global configuration variables 146 * Global configuration variables
178 */ 147 */
179 148
180extern u32 tipc_own_addr; 149extern u32 tipc_own_addr;
181extern int tipc_max_zones;
182extern int tipc_max_clusters;
183extern int tipc_max_nodes; 150extern int tipc_max_nodes;
184extern int tipc_max_slaves;
185extern int tipc_max_ports; 151extern int tipc_max_ports;
186extern int tipc_max_subscriptions; 152extern int tipc_max_subscriptions;
187extern int tipc_max_publications; 153extern int tipc_max_publications;
@@ -240,7 +206,6 @@ u32 tipc_k_signal(Handler routine, unsigned long argument);
240static inline void k_init_timer(struct timer_list *timer, Handler routine, 206static inline void k_init_timer(struct timer_list *timer, Handler routine,
241 unsigned long argument) 207 unsigned long argument)
242{ 208{
243 dbg("initializing timer %p\n", timer);
244 setup_timer(timer, routine, argument); 209 setup_timer(timer, routine, argument);
245} 210}
246 211
@@ -260,7 +225,6 @@ static inline void k_init_timer(struct timer_list *timer, Handler routine,
260 225
261static inline void k_start_timer(struct timer_list *timer, unsigned long msec) 226static inline void k_start_timer(struct timer_list *timer, unsigned long msec)
262{ 227{
263 dbg("starting timer %p for %u\n", timer, msec);
264 mod_timer(timer, jiffies + msecs_to_jiffies(msec) + 1); 228 mod_timer(timer, jiffies + msecs_to_jiffies(msec) + 1);
265} 229}
266 230
@@ -277,7 +241,6 @@ static inline void k_start_timer(struct timer_list *timer, unsigned long msec)
277 241
278static inline void k_cancel_timer(struct timer_list *timer) 242static inline void k_cancel_timer(struct timer_list *timer)
279{ 243{
280 dbg("cancelling timer %p\n", timer);
281 del_timer_sync(timer); 244 del_timer_sync(timer);
282} 245}
283 246
@@ -295,7 +258,6 @@ static inline void k_cancel_timer(struct timer_list *timer)
295 258
296static inline void k_term_timer(struct timer_list *timer) 259static inline void k_term_timer(struct timer_list *timer)
297{ 260{
298 dbg("terminating timer %p\n", timer);
299} 261}
300 262
301 263