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.h87
1 files changed, 21 insertions, 66 deletions
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 188799017abd..436dda1159d2 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -2,7 +2,7 @@
2 * net/tipc/core.h: Include file for TIPC global declarations 2 * net/tipc/core.h: Include file for TIPC global declarations
3 * 3 *
4 * Copyright (c) 2005-2006, Ericsson AB 4 * Copyright (c) 2005-2006, Ericsson AB
5 * Copyright (c) 2005-2007, Wind River Systems 5 * Copyright (c) 2005-2007, 2010-2011, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -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 */
@@ -83,7 +82,6 @@
83 * Note: TIPC_LOG is configured to echo its output to the system console; 82 * Note: TIPC_LOG is configured to echo its output to the system console;
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 */
86
87extern struct print_buf *const TIPC_NULL; 85extern struct print_buf *const TIPC_NULL;
88extern struct print_buf *const TIPC_CONS; 86extern struct print_buf *const TIPC_CONS;
89extern struct print_buf *const TIPC_LOG; 87extern struct print_buf *const TIPC_LOG;
@@ -98,73 +96,35 @@ void tipc_printf(struct print_buf *, const char *fmt, ...);
98#define TIPC_OUTPUT TIPC_LOG 96#define TIPC_OUTPUT TIPC_LOG
99#endif 97#endif
100 98
101/*
102 * TIPC can be configured to send system messages to TIPC_OUTPUT
103 * or to the system console only.
104 */
105
106#ifdef CONFIG_TIPC_DEBUG
107
108#define err(fmt, arg...) tipc_printf(TIPC_OUTPUT, \ 99#define err(fmt, arg...) tipc_printf(TIPC_OUTPUT, \
109 KERN_ERR "TIPC: " fmt, ## arg) 100 KERN_ERR "TIPC: " fmt, ## arg)
110#define warn(fmt, arg...) tipc_printf(TIPC_OUTPUT, \ 101#define warn(fmt, arg...) tipc_printf(TIPC_OUTPUT, \
111 KERN_WARNING "TIPC: " fmt, ## arg) 102 KERN_WARNING "TIPC: " fmt, ## arg)
112#define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, \ 103#define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, \
113 KERN_NOTICE "TIPC: " fmt, ## arg) 104 KERN_NOTICE "TIPC: " fmt, ## arg)
114
115#else
116
117#define err(fmt, arg...) printk(KERN_ERR "TIPC: " fmt , ## arg)
118#define info(fmt, arg...) printk(KERN_INFO "TIPC: " fmt , ## arg)
119#define warn(fmt, arg...) printk(KERN_WARNING "TIPC: " fmt , ## arg)
120 105
121#endif 106#ifdef CONFIG_TIPC_DEBUG
122 107
123/* 108/*
124 * DBG_OUTPUT is the destination print buffer for debug messages. 109 * DBG_OUTPUT is the destination print buffer for debug messages.
125 * It defaults to the the null print buffer, but can be redefined
126 * (typically in the individual .c files being debugged) to allow
127 * selected debug messages to be generated where needed.
128 */ 110 */
129 111
130#ifndef DBG_OUTPUT 112#ifndef DBG_OUTPUT
131#define DBG_OUTPUT TIPC_NULL 113#define DBG_OUTPUT TIPC_LOG
132#endif 114#endif
133 115
134/* 116#define dbg(fmt, arg...) tipc_printf(DBG_OUTPUT, KERN_DEBUG fmt, ## arg);
135 * TIPC can be configured to send debug messages to the specified print buffer
136 * (typically DBG_OUTPUT) or to suppress them entirely.
137 */
138 117
139#ifdef CONFIG_TIPC_DEBUG 118#define msg_dbg(msg, txt) tipc_msg_dbg(DBG_OUTPUT, msg, txt);
140
141#define dbg(fmt, arg...) \
142 do { \
143 if (DBG_OUTPUT != TIPC_NULL) \
144 tipc_printf(DBG_OUTPUT, fmt, ## arg); \
145 } while (0)
146#define msg_dbg(msg, txt) \
147 do { \
148 if (DBG_OUTPUT != TIPC_NULL) \
149 tipc_msg_dbg(DBG_OUTPUT, msg, txt); \
150 } while (0)
151#define dump(fmt, arg...) \
152 do { \
153 if (DBG_OUTPUT != TIPC_NULL) \
154 tipc_dump_dbg(DBG_OUTPUT, fmt, ##arg); \
155 } while (0)
156 119
157void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *); 120void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *);
158void tipc_dump_dbg(struct print_buf *, const char *fmt, ...);
159 121
160#else 122#else
161 123
162#define dbg(fmt, arg...) do {} while (0) 124#define dbg(fmt, arg...) do {} while (0)
163#define msg_dbg(msg, txt) do {} while (0) 125#define msg_dbg(msg, txt) do {} while (0)
164#define dump(fmt, arg...) do {} while (0)
165 126
166#define tipc_msg_dbg(...) do {} while (0) 127#define tipc_msg_dbg(buf, msg, txt) do {} while (0)
167#define tipc_dump_dbg(...) do {} while (0)
168 128
169#endif 129#endif
170 130
@@ -176,14 +136,17 @@ void tipc_dump_dbg(struct print_buf *, const char *fmt, ...);
176#define ELINKCONG EAGAIN /* link congestion <=> resource unavailable */ 136#define ELINKCONG EAGAIN /* link congestion <=> resource unavailable */
177 137
178/* 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/*
179 * Global configuration variables 146 * Global configuration variables
180 */ 147 */
181 148
182extern u32 tipc_own_addr; 149extern u32 tipc_own_addr;
183extern int tipc_max_zones;
184extern int tipc_max_clusters;
185extern int tipc_max_nodes;
186extern int tipc_max_slaves;
187extern int tipc_max_ports; 150extern int tipc_max_ports;
188extern int tipc_max_subscriptions; 151extern int tipc_max_subscriptions;
189extern int tipc_max_publications; 152extern int tipc_max_publications;
@@ -197,17 +160,13 @@ extern int tipc_remote_management;
197extern int tipc_mode; 160extern int tipc_mode;
198extern int tipc_random; 161extern int tipc_random;
199extern const char tipc_alphabet[]; 162extern const char tipc_alphabet[];
200extern atomic_t tipc_user_count;
201 163
202 164
203/* 165/*
204 * Routines available to privileged subsystems 166 * Routines available to privileged subsystems
205 */ 167 */
206 168
207extern int tipc_core_start(void); 169extern int tipc_core_start_net(unsigned long);
208extern void tipc_core_stop(void);
209extern int tipc_core_start_net(unsigned long addr);
210extern void tipc_core_stop_net(void);
211extern int tipc_handler_start(void); 170extern int tipc_handler_start(void);
212extern void tipc_handler_stop(void); 171extern void tipc_handler_stop(void);
213extern int tipc_netlink_start(void); 172extern int tipc_netlink_start(void);
@@ -245,7 +204,6 @@ u32 tipc_k_signal(Handler routine, unsigned long argument);
245static inline void k_init_timer(struct timer_list *timer, Handler routine, 204static inline void k_init_timer(struct timer_list *timer, Handler routine,
246 unsigned long argument) 205 unsigned long argument)
247{ 206{
248 dbg("initializing timer %p\n", timer);
249 setup_timer(timer, routine, argument); 207 setup_timer(timer, routine, argument);
250} 208}
251 209
@@ -265,7 +223,6 @@ static inline void k_init_timer(struct timer_list *timer, Handler routine,
265 223
266static inline void k_start_timer(struct timer_list *timer, unsigned long msec) 224static inline void k_start_timer(struct timer_list *timer, unsigned long msec)
267{ 225{
268 dbg("starting timer %p for %u\n", timer, msec);
269 mod_timer(timer, jiffies + msecs_to_jiffies(msec) + 1); 226 mod_timer(timer, jiffies + msecs_to_jiffies(msec) + 1);
270} 227}
271 228
@@ -282,7 +239,6 @@ static inline void k_start_timer(struct timer_list *timer, unsigned long msec)
282 239
283static inline void k_cancel_timer(struct timer_list *timer) 240static inline void k_cancel_timer(struct timer_list *timer)
284{ 241{
285 dbg("cancelling timer %p\n", timer);
286 del_timer_sync(timer); 242 del_timer_sync(timer);
287} 243}
288 244
@@ -300,7 +256,6 @@ static inline void k_cancel_timer(struct timer_list *timer)
300 256
301static inline void k_term_timer(struct timer_list *timer) 257static inline void k_term_timer(struct timer_list *timer)
302{ 258{
303 dbg("terminating timer %p\n", timer);
304} 259}
305 260
306 261
@@ -328,7 +283,7 @@ static inline struct tipc_msg *buf_msg(struct sk_buff *skb)
328 return (struct tipc_msg *)skb->data; 283 return (struct tipc_msg *)skb->data;
329} 284}
330 285
331extern struct sk_buff *buf_acquire(u32 size); 286extern struct sk_buff *tipc_buf_acquire(u32 size);
332 287
333/** 288/**
334 * buf_discard - frees a TIPC message buffer 289 * buf_discard - frees a TIPC message buffer