aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2010-10-13 09:20:35 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-16 14:13:24 -0400
commit31e3c3f6f1f9b154981a0e6620df700463db30ee (patch)
tree5ed74529c528cc9a09d6f8c9a5083aaf4849b62e /net/tipc
parent15419227f773b6c1b5fae44bde876078a9204caa (diff)
tipc: cleanup function namespace
Do some cleanups of TIPC based on make namespacecheck 1. Don't export unused symbols 2. Eliminate dead code 3. Make functions and variables local 4. Rename buf_acquire to tipc_buf_acquire since it is used in several files Compile tested only. This make break out of tree kernel modules that depend on TIPC routines. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: Jon Maloy <jon.maloy@ericsson.com> Acked-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/addr.c5
-rw-r--r--net/tipc/bcast.c10
-rw-r--r--net/tipc/bcast.h3
-rw-r--r--net/tipc/cluster.c21
-rw-r--r--net/tipc/cluster.h2
-rw-r--r--net/tipc/config.c7
-rw-r--r--net/tipc/config.h6
-rw-r--r--net/tipc/core.c28
-rw-r--r--net/tipc/core.h9
-rw-r--r--net/tipc/dbg.c13
-rw-r--r--net/tipc/dbg.h3
-rw-r--r--net/tipc/discover.c16
-rw-r--r--net/tipc/discover.h2
-rw-r--r--net/tipc/link.c45
-rw-r--r--net/tipc/link.h4
-rw-r--r--net/tipc/msg.c2
-rw-r--r--net/tipc/name_distr.c2
-rw-r--r--net/tipc/node.c19
-rw-r--r--net/tipc/node.h1
-rw-r--r--net/tipc/port.c234
-rw-r--r--net/tipc/port.h2
-rw-r--r--net/tipc/ref.c17
-rw-r--r--net/tipc/ref.h1
-rw-r--r--net/tipc/subscr.c9
-rw-r--r--net/tipc/zone.c11
-rw-r--r--net/tipc/zone.h1
26 files changed, 84 insertions, 389 deletions
diff --git a/net/tipc/addr.c b/net/tipc/addr.c
index 2ddc351b3be9..8a2e89bffde5 100644
--- a/net/tipc/addr.c
+++ b/net/tipc/addr.c
@@ -41,11 +41,6 @@
41#include "cluster.h" 41#include "cluster.h"
42#include "net.h" 42#include "net.h"
43 43
44u32 tipc_get_addr(void)
45{
46 return tipc_own_addr;
47}
48
49/** 44/**
50 * tipc_addr_domain_valid - validates a network domain address 45 * tipc_addr_domain_valid - validates a network domain address
51 * 46 *
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index ecfaac10d0b4..22a60fc98392 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -121,6 +121,9 @@ static DEFINE_SPINLOCK(bc_lock);
121 121
122const char tipc_bclink_name[] = "broadcast-link"; 122const char tipc_bclink_name[] = "broadcast-link";
123 123
124static void tipc_nmap_diff(struct tipc_node_map *nm_a,
125 struct tipc_node_map *nm_b,
126 struct tipc_node_map *nm_diff);
124 127
125static u32 buf_seqno(struct sk_buff *buf) 128static u32 buf_seqno(struct sk_buff *buf)
126{ 129{
@@ -287,7 +290,7 @@ static void bclink_send_nack(struct tipc_node *n_ptr)
287 if (!less(n_ptr->bclink.gap_after, n_ptr->bclink.gap_to)) 290 if (!less(n_ptr->bclink.gap_after, n_ptr->bclink.gap_to))
288 return; 291 return;
289 292
290 buf = buf_acquire(INT_H_SIZE); 293 buf = tipc_buf_acquire(INT_H_SIZE);
291 if (buf) { 294 if (buf) {
292 msg = buf_msg(buf); 295 msg = buf_msg(buf);
293 tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG, 296 tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG,
@@ -871,8 +874,9 @@ void tipc_nmap_remove(struct tipc_node_map *nm_ptr, u32 node)
871 * @nm_diff: output node map A-B (i.e. nodes of A that are not in B) 874 * @nm_diff: output node map A-B (i.e. nodes of A that are not in B)
872 */ 875 */
873 876
874void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b, 877static void tipc_nmap_diff(struct tipc_node_map *nm_a,
875 struct tipc_node_map *nm_diff) 878 struct tipc_node_map *nm_b,
879 struct tipc_node_map *nm_diff)
876{ 880{
877 int stop = ARRAY_SIZE(nm_a->map); 881 int stop = ARRAY_SIZE(nm_a->map);
878 int w; 882 int w;
diff --git a/net/tipc/bcast.h b/net/tipc/bcast.h
index e8c2b81658c7..011c03f0a4ab 100644
--- a/net/tipc/bcast.h
+++ b/net/tipc/bcast.h
@@ -84,9 +84,6 @@ static inline int tipc_nmap_equal(struct tipc_node_map *nm_a, struct tipc_node_m
84 return !memcmp(nm_a, nm_b, sizeof(*nm_a)); 84 return !memcmp(nm_a, nm_b, sizeof(*nm_a));
85} 85}
86 86
87void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b,
88 struct tipc_node_map *nm_diff);
89
90void tipc_port_list_add(struct port_list *pl_ptr, u32 port); 87void tipc_port_list_add(struct port_list *pl_ptr, u32 port);
91void tipc_port_list_free(struct port_list *pl_ptr); 88void tipc_port_list_free(struct port_list *pl_ptr);
92 89
diff --git a/net/tipc/cluster.c b/net/tipc/cluster.c
index e68f705381bc..7fea14b98b97 100644
--- a/net/tipc/cluster.c
+++ b/net/tipc/cluster.c
@@ -113,25 +113,6 @@ void tipc_cltr_delete(struct cluster *c_ptr)
113 kfree(c_ptr); 113 kfree(c_ptr);
114} 114}
115 115
116u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr)
117{
118 struct tipc_node *n_ptr;
119 u32 n_num = tipc_node(addr) + 1;
120
121 if (!c_ptr)
122 return addr;
123 for (; n_num <= c_ptr->highest_node; n_num++) {
124 n_ptr = c_ptr->nodes[n_num];
125 if (n_ptr && tipc_node_has_active_links(n_ptr))
126 return n_ptr->addr;
127 }
128 for (n_num = 1; n_num < tipc_node(addr); n_num++) {
129 n_ptr = c_ptr->nodes[n_num];
130 if (n_ptr && tipc_node_has_active_links(n_ptr))
131 return n_ptr->addr;
132 }
133 return 0;
134}
135 116
136void tipc_cltr_attach_node(struct cluster *c_ptr, struct tipc_node *n_ptr) 117void tipc_cltr_attach_node(struct cluster *c_ptr, struct tipc_node *n_ptr)
137{ 118{
@@ -232,7 +213,7 @@ struct tipc_node *tipc_cltr_select_node(struct cluster *c_ptr, u32 selector)
232static struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest) 213static struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest)
233{ 214{
234 u32 size = INT_H_SIZE + data_size; 215 u32 size = INT_H_SIZE + data_size;
235 struct sk_buff *buf = buf_acquire(size); 216 struct sk_buff *buf = tipc_buf_acquire(size);
236 struct tipc_msg *msg; 217 struct tipc_msg *msg;
237 218
238 if (buf) { 219 if (buf) {
diff --git a/net/tipc/cluster.h b/net/tipc/cluster.h
index 333efb0b9c44..32636d98c9c6 100644
--- a/net/tipc/cluster.h
+++ b/net/tipc/cluster.h
@@ -75,7 +75,7 @@ void tipc_cltr_attach_node(struct cluster *c_ptr, struct tipc_node *n_ptr);
75void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest); 75void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest);
76void tipc_cltr_broadcast(struct sk_buff *buf); 76void tipc_cltr_broadcast(struct sk_buff *buf);
77int tipc_cltr_init(void); 77int tipc_cltr_init(void);
78u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr); 78
79void tipc_cltr_bcast_new_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi); 79void tipc_cltr_bcast_new_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
80void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest); 80void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest);
81void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi); 81void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
diff --git a/net/tipc/config.c b/net/tipc/config.c
index c429b0d488a3..50a6133a3668 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -95,7 +95,7 @@ int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
95 return 1; 95 return 1;
96} 96}
97 97
98struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value) 98static struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
99{ 99{
100 struct sk_buff *buf; 100 struct sk_buff *buf;
101 __be32 value_net; 101 __be32 value_net;
@@ -109,6 +109,11 @@ struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
109 return buf; 109 return buf;
110} 110}
111 111
112static struct sk_buff *tipc_cfg_reply_unsigned(u32 value)
113{
114 return tipc_cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value);
115}
116
112struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string) 117struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string)
113{ 118{
114 struct sk_buff *buf; 119 struct sk_buff *buf;
diff --git a/net/tipc/config.h b/net/tipc/config.h
index 5cd7cc56c54d..481e12ece715 100644
--- a/net/tipc/config.h
+++ b/net/tipc/config.h
@@ -45,7 +45,6 @@
45struct sk_buff *tipc_cfg_reply_alloc(int payload_size); 45struct sk_buff *tipc_cfg_reply_alloc(int payload_size);
46int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type, 46int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
47 void *tlv_data, int tlv_data_size); 47 void *tlv_data, int tlv_data_size);
48struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value);
49struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string); 48struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string);
50 49
51static inline struct sk_buff *tipc_cfg_reply_none(void) 50static inline struct sk_buff *tipc_cfg_reply_none(void)
@@ -53,11 +52,6 @@ static inline struct sk_buff *tipc_cfg_reply_none(void)
53 return tipc_cfg_reply_alloc(0); 52 return tipc_cfg_reply_alloc(0);
54} 53}
55 54
56static inline struct sk_buff *tipc_cfg_reply_unsigned(u32 value)
57{
58 return tipc_cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value);
59}
60
61static inline struct sk_buff *tipc_cfg_reply_error_string(char *string) 55static inline struct sk_buff *tipc_cfg_reply_error_string(char *string)
62{ 56{
63 return tipc_cfg_reply_string_type(TIPC_TLV_ERROR_STRING, string); 57 return tipc_cfg_reply_string_type(TIPC_TLV_ERROR_STRING, string);
diff --git a/net/tipc/core.c b/net/tipc/core.c
index 466b861dab91..c00530386e3b 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -96,13 +96,13 @@ int tipc_net_id;
96int tipc_remote_management; 96int tipc_remote_management;
97 97
98 98
99int tipc_get_mode(void) 99static int tipc_get_mode(void)
100{ 100{
101 return tipc_mode; 101 return tipc_mode;
102} 102}
103 103
104/** 104/**
105 * buf_acquire - creates a TIPC message buffer 105 * tipc_buf_acquire - creates a TIPC message buffer
106 * @size: message size (including TIPC header) 106 * @size: message size (including TIPC header)
107 * 107 *
108 * Returns a new buffer with data pointers set to the specified size. 108 * Returns a new buffer with data pointers set to the specified size.
@@ -111,7 +111,7 @@ int tipc_get_mode(void)
111 * There may also be unrequested tailroom present at the buffer's end. 111 * There may also be unrequested tailroom present at the buffer's end.
112 */ 112 */
113 113
114struct sk_buff *buf_acquire(u32 size) 114struct sk_buff *tipc_buf_acquire(u32 size)
115{ 115{
116 struct sk_buff *skb; 116 struct sk_buff *skb;
117 unsigned int buf_size = (BUF_HEADROOM + size + 3) & ~3u; 117 unsigned int buf_size = (BUF_HEADROOM + size + 3) & ~3u;
@@ -129,7 +129,7 @@ struct sk_buff *buf_acquire(u32 size)
129 * tipc_core_stop_net - shut down TIPC networking sub-systems 129 * tipc_core_stop_net - shut down TIPC networking sub-systems
130 */ 130 */
131 131
132void tipc_core_stop_net(void) 132static void tipc_core_stop_net(void)
133{ 133{
134 tipc_eth_media_stop(); 134 tipc_eth_media_stop();
135 tipc_net_stop(); 135 tipc_net_stop();
@@ -154,7 +154,7 @@ int tipc_core_start_net(unsigned long addr)
154 * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode 154 * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode
155 */ 155 */
156 156
157void tipc_core_stop(void) 157static void tipc_core_stop(void)
158{ 158{
159 if (tipc_mode != TIPC_NODE_MODE) 159 if (tipc_mode != TIPC_NODE_MODE)
160 return; 160 return;
@@ -176,7 +176,7 @@ void tipc_core_stop(void)
176 * tipc_core_start - switch TIPC from NOT RUNNING to SINGLE NODE mode 176 * tipc_core_start - switch TIPC from NOT RUNNING to SINGLE NODE mode
177 */ 177 */
178 178
179int tipc_core_start(void) 179static int tipc_core_start(void)
180{ 180{
181 int res; 181 int res;
182 182
@@ -246,7 +246,6 @@ MODULE_VERSION(TIPC_MOD_VER);
246 246
247EXPORT_SYMBOL(tipc_attach); 247EXPORT_SYMBOL(tipc_attach);
248EXPORT_SYMBOL(tipc_detach); 248EXPORT_SYMBOL(tipc_detach);
249EXPORT_SYMBOL(tipc_get_addr);
250EXPORT_SYMBOL(tipc_get_mode); 249EXPORT_SYMBOL(tipc_get_mode);
251EXPORT_SYMBOL(tipc_createport); 250EXPORT_SYMBOL(tipc_createport);
252EXPORT_SYMBOL(tipc_deleteport); 251EXPORT_SYMBOL(tipc_deleteport);
@@ -262,23 +261,10 @@ EXPORT_SYMBOL(tipc_withdraw);
262EXPORT_SYMBOL(tipc_connect2port); 261EXPORT_SYMBOL(tipc_connect2port);
263EXPORT_SYMBOL(tipc_disconnect); 262EXPORT_SYMBOL(tipc_disconnect);
264EXPORT_SYMBOL(tipc_shutdown); 263EXPORT_SYMBOL(tipc_shutdown);
265EXPORT_SYMBOL(tipc_isconnected);
266EXPORT_SYMBOL(tipc_peer);
267EXPORT_SYMBOL(tipc_ref_valid);
268EXPORT_SYMBOL(tipc_send); 264EXPORT_SYMBOL(tipc_send);
269EXPORT_SYMBOL(tipc_send_buf);
270EXPORT_SYMBOL(tipc_send2name); 265EXPORT_SYMBOL(tipc_send2name);
271EXPORT_SYMBOL(tipc_forward2name);
272EXPORT_SYMBOL(tipc_send_buf2name);
273EXPORT_SYMBOL(tipc_forward_buf2name);
274EXPORT_SYMBOL(tipc_send2port); 266EXPORT_SYMBOL(tipc_send2port);
275EXPORT_SYMBOL(tipc_forward2port);
276EXPORT_SYMBOL(tipc_send_buf2port);
277EXPORT_SYMBOL(tipc_forward_buf2port);
278EXPORT_SYMBOL(tipc_multicast); 267EXPORT_SYMBOL(tipc_multicast);
279/* EXPORT_SYMBOL(tipc_multicast_buf); not available yet */
280EXPORT_SYMBOL(tipc_ispublished);
281EXPORT_SYMBOL(tipc_available_nodes);
282 268
283/* TIPC API for external bearers (see tipc_bearer.h) */ 269/* TIPC API for external bearers (see tipc_bearer.h) */
284 270
@@ -295,6 +281,4 @@ EXPORT_SYMBOL(tipc_createport_raw);
295EXPORT_SYMBOL(tipc_reject_msg); 281EXPORT_SYMBOL(tipc_reject_msg);
296EXPORT_SYMBOL(tipc_send_buf_fast); 282EXPORT_SYMBOL(tipc_send_buf_fast);
297EXPORT_SYMBOL(tipc_acknowledge); 283EXPORT_SYMBOL(tipc_acknowledge);
298EXPORT_SYMBOL(tipc_get_port);
299EXPORT_SYMBOL(tipc_get_handle);
300 284
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 188799017abd..e19389e57227 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -83,9 +83,7 @@
83 * Note: TIPC_LOG is configured to echo its output to the system console; 83 * 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. 84 * user-defined buffers can be configured to do the same thing.
85 */ 85 */
86
87extern struct print_buf *const TIPC_NULL; 86extern struct print_buf *const TIPC_NULL;
88extern struct print_buf *const TIPC_CONS;
89extern struct print_buf *const TIPC_LOG; 87extern struct print_buf *const TIPC_LOG;
90 88
91void tipc_printf(struct print_buf *, const char *fmt, ...); 89void tipc_printf(struct print_buf *, const char *fmt, ...);
@@ -204,10 +202,7 @@ extern atomic_t tipc_user_count;
204 * Routines available to privileged subsystems 202 * Routines available to privileged subsystems
205 */ 203 */
206 204
207extern int tipc_core_start(void); 205extern 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); 206extern int tipc_handler_start(void);
212extern void tipc_handler_stop(void); 207extern void tipc_handler_stop(void);
213extern int tipc_netlink_start(void); 208extern int tipc_netlink_start(void);
@@ -328,7 +323,7 @@ static inline struct tipc_msg *buf_msg(struct sk_buff *skb)
328 return (struct tipc_msg *)skb->data; 323 return (struct tipc_msg *)skb->data;
329} 324}
330 325
331extern struct sk_buff *buf_acquire(u32 size); 326extern struct sk_buff *tipc_buf_acquire(u32 size);
332 327
333/** 328/**
334 * buf_discard - frees a TIPC message buffer 329 * buf_discard - frees a TIPC message buffer
diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c
index 6569d45bfb9a..46f51d208e5e 100644
--- a/net/tipc/dbg.c
+++ b/net/tipc/dbg.c
@@ -52,7 +52,7 @@ static struct print_buf null_buf = { NULL, 0, NULL, 0 };
52struct print_buf *const TIPC_NULL = &null_buf; 52struct print_buf *const TIPC_NULL = &null_buf;
53 53
54static struct print_buf cons_buf = { NULL, 0, NULL, 1 }; 54static struct print_buf cons_buf = { NULL, 0, NULL, 1 };
55struct print_buf *const TIPC_CONS = &cons_buf; 55static struct print_buf *const TIPC_CONS = &cons_buf;
56 56
57static struct print_buf log_buf = { NULL, 0, NULL, 1 }; 57static struct print_buf log_buf = { NULL, 0, NULL, 1 };
58struct print_buf *const TIPC_LOG = &log_buf; 58struct print_buf *const TIPC_LOG = &log_buf;
@@ -76,6 +76,10 @@ struct print_buf *const TIPC_LOG = &log_buf;
76static char print_string[TIPC_PB_MAX_STR]; 76static char print_string[TIPC_PB_MAX_STR];
77static DEFINE_SPINLOCK(print_lock); 77static DEFINE_SPINLOCK(print_lock);
78 78
79static void tipc_printbuf_reset(struct print_buf *pb);
80static int tipc_printbuf_empty(struct print_buf *pb);
81static void tipc_printbuf_move(struct print_buf *pb_to,
82 struct print_buf *pb_from);
79 83
80#define FORMAT(PTR,LEN,FMT) \ 84#define FORMAT(PTR,LEN,FMT) \
81{\ 85{\
@@ -116,7 +120,7 @@ void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 size)
116 * @pb: pointer to print buffer structure 120 * @pb: pointer to print buffer structure
117 */ 121 */
118 122
119void tipc_printbuf_reset(struct print_buf *pb) 123static void tipc_printbuf_reset(struct print_buf *pb)
120{ 124{
121 if (pb->buf) { 125 if (pb->buf) {
122 pb->crs = pb->buf; 126 pb->crs = pb->buf;
@@ -132,7 +136,7 @@ void tipc_printbuf_reset(struct print_buf *pb)
132 * Returns non-zero if print buffer is empty. 136 * Returns non-zero if print buffer is empty.
133 */ 137 */
134 138
135int tipc_printbuf_empty(struct print_buf *pb) 139static int tipc_printbuf_empty(struct print_buf *pb)
136{ 140{
137 return !pb->buf || (pb->crs == pb->buf); 141 return !pb->buf || (pb->crs == pb->buf);
138} 142}
@@ -181,7 +185,8 @@ int tipc_printbuf_validate(struct print_buf *pb)
181 * Source print buffer becomes empty if a successful move occurs. 185 * Source print buffer becomes empty if a successful move occurs.
182 */ 186 */
183 187
184void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from) 188static void tipc_printbuf_move(struct print_buf *pb_to,
189 struct print_buf *pb_from)
185{ 190{
186 int len; 191 int len;
187 192
diff --git a/net/tipc/dbg.h b/net/tipc/dbg.h
index 5ef1bc8f64ef..3ba6ba8b434a 100644
--- a/net/tipc/dbg.h
+++ b/net/tipc/dbg.h
@@ -56,10 +56,7 @@ struct print_buf {
56#define TIPC_PB_MAX_STR 512 /* max printable string (with trailing NUL) */ 56#define TIPC_PB_MAX_STR 512 /* max printable string (with trailing NUL) */
57 57
58void tipc_printbuf_init(struct print_buf *pb, char *buf, u32 size); 58void tipc_printbuf_init(struct print_buf *pb, char *buf, u32 size);
59void tipc_printbuf_reset(struct print_buf *pb);
60int tipc_printbuf_empty(struct print_buf *pb);
61int tipc_printbuf_validate(struct print_buf *pb); 59int tipc_printbuf_validate(struct print_buf *pb);
62void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from);
63 60
64int tipc_log_resize(int log_size); 61int tipc_log_resize(int log_size);
65 62
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index dbd79c67d7c0..4a7cd3719b78 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -68,20 +68,6 @@ struct link_req {
68 unsigned int timer_intv; 68 unsigned int timer_intv;
69}; 69};
70 70
71
72/*
73 * disc_lost_link(): A link has lost contact
74 */
75
76void tipc_disc_link_event(u32 addr, char *name, int up)
77{
78 if (in_own_cluster(addr))
79 return;
80 /*
81 * Code for inter cluster link setup here
82 */
83}
84
85/** 71/**
86 * tipc_disc_init_msg - initialize a link setup message 72 * tipc_disc_init_msg - initialize a link setup message
87 * @type: message type (request or response) 73 * @type: message type (request or response)
@@ -95,7 +81,7 @@ static struct sk_buff *tipc_disc_init_msg(u32 type,
95 u32 dest_domain, 81 u32 dest_domain,
96 struct bearer *b_ptr) 82 struct bearer *b_ptr)
97{ 83{
98 struct sk_buff *buf = buf_acquire(DSC_H_SIZE); 84 struct sk_buff *buf = tipc_buf_acquire(DSC_H_SIZE);
99 struct tipc_msg *msg; 85 struct tipc_msg *msg;
100 86
101 if (buf) { 87 if (buf) {
diff --git a/net/tipc/discover.h b/net/tipc/discover.h
index 9d064c3639bf..f8e750636123 100644
--- a/net/tipc/discover.h
+++ b/net/tipc/discover.h
@@ -50,6 +50,4 @@ void tipc_disc_stop_link_req(struct link_req *req);
50 50
51void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr); 51void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr);
52 52
53void tipc_disc_link_event(u32 addr, char *name, int up);
54
55#endif 53#endif
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 4be78ecf4a67..b31992ccd5d3 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -112,6 +112,9 @@ static void link_state_event(struct link *l_ptr, u32 event);
112static void link_reset_statistics(struct link *l_ptr); 112static void link_reset_statistics(struct link *l_ptr);
113static void link_print(struct link *l_ptr, struct print_buf *buf, 113static void link_print(struct link *l_ptr, struct print_buf *buf,
114 const char *str); 114 const char *str);
115static void link_start(struct link *l_ptr);
116static int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf);
117
115 118
116/* 119/*
117 * Debugging code used by link routines only 120 * Debugging code used by link routines only
@@ -442,7 +445,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
442 445
443 k_init_timer(&l_ptr->timer, (Handler)link_timeout, (unsigned long)l_ptr); 446 k_init_timer(&l_ptr->timer, (Handler)link_timeout, (unsigned long)l_ptr);
444 list_add_tail(&l_ptr->link_list, &b_ptr->links); 447 list_add_tail(&l_ptr->link_list, &b_ptr->links);
445 tipc_k_signal((Handler)tipc_link_start, (unsigned long)l_ptr); 448 tipc_k_signal((Handler)link_start, (unsigned long)l_ptr);
446 449
447 dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n", 450 dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n",
448 l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit); 451 l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit);
@@ -482,9 +485,9 @@ void tipc_link_delete(struct link *l_ptr)
482 kfree(l_ptr); 485 kfree(l_ptr);
483} 486}
484 487
485void tipc_link_start(struct link *l_ptr) 488static void link_start(struct link *l_ptr)
486{ 489{
487 dbg("tipc_link_start %x\n", l_ptr); 490 dbg("link_start %x\n", l_ptr);
488 link_state_event(l_ptr, STARTING_EVT); 491 link_state_event(l_ptr, STARTING_EVT);
489} 492}
490 493
@@ -1000,7 +1003,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
1000 /* Fragmentation needed ? */ 1003 /* Fragmentation needed ? */
1001 1004
1002 if (size > max_packet) 1005 if (size > max_packet)
1003 return tipc_link_send_long_buf(l_ptr, buf); 1006 return link_send_long_buf(l_ptr, buf);
1004 1007
1005 /* Packet can be queued or sent: */ 1008 /* Packet can be queued or sent: */
1006 1009
@@ -1036,7 +1039,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
1036 /* Try creating a new bundle */ 1039 /* Try creating a new bundle */
1037 1040
1038 if (size <= max_packet * 2 / 3) { 1041 if (size <= max_packet * 2 / 3) {
1039 struct sk_buff *bundler = buf_acquire(max_packet); 1042 struct sk_buff *bundler = tipc_buf_acquire(max_packet);
1040 struct tipc_msg bundler_hdr; 1043 struct tipc_msg bundler_hdr;
1041 1044
1042 if (bundler) { 1045 if (bundler) {
@@ -1312,7 +1315,7 @@ again:
1312 1315
1313 /* Prepare header of first fragment: */ 1316 /* Prepare header of first fragment: */
1314 1317
1315 buf_chain = buf = buf_acquire(max_pkt); 1318 buf_chain = buf = tipc_buf_acquire(max_pkt);
1316 if (!buf) 1319 if (!buf)
1317 return -ENOMEM; 1320 return -ENOMEM;
1318 buf->next = NULL; 1321 buf->next = NULL;
@@ -1369,7 +1372,7 @@ error:
1369 msg_set_size(&fragm_hdr, fragm_sz + INT_H_SIZE); 1372 msg_set_size(&fragm_hdr, fragm_sz + INT_H_SIZE);
1370 msg_set_fragm_no(&fragm_hdr, ++fragm_no); 1373 msg_set_fragm_no(&fragm_hdr, ++fragm_no);
1371 prev = buf; 1374 prev = buf;
1372 buf = buf_acquire(fragm_sz + INT_H_SIZE); 1375 buf = tipc_buf_acquire(fragm_sz + INT_H_SIZE);
1373 if (!buf) 1376 if (!buf)
1374 goto error; 1377 goto error;
1375 1378
@@ -2145,7 +2148,7 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
2145 if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) { 2148 if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) {
2146 if (!l_ptr->proto_msg_queue) { 2149 if (!l_ptr->proto_msg_queue) {
2147 l_ptr->proto_msg_queue = 2150 l_ptr->proto_msg_queue =
2148 buf_acquire(sizeof(l_ptr->proto_msg)); 2151 tipc_buf_acquire(sizeof(l_ptr->proto_msg));
2149 } 2152 }
2150 buf = l_ptr->proto_msg_queue; 2153 buf = l_ptr->proto_msg_queue;
2151 if (!buf) 2154 if (!buf)
@@ -2159,7 +2162,7 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
2159 2162
2160 msg_dbg(msg, ">>"); 2163 msg_dbg(msg, ">>");
2161 2164
2162 buf = buf_acquire(msg_size); 2165 buf = tipc_buf_acquire(msg_size);
2163 if (!buf) 2166 if (!buf)
2164 return; 2167 return;
2165 2168
@@ -2318,10 +2321,10 @@ exit:
2318 * tipc_link_tunnel(): Send one message via a link belonging to 2321 * tipc_link_tunnel(): Send one message via a link belonging to
2319 * another bearer. Owner node is locked. 2322 * another bearer. Owner node is locked.
2320 */ 2323 */
2321void tipc_link_tunnel(struct link *l_ptr, 2324static void tipc_link_tunnel(struct link *l_ptr,
2322 struct tipc_msg *tunnel_hdr, 2325 struct tipc_msg *tunnel_hdr,
2323 struct tipc_msg *msg, 2326 struct tipc_msg *msg,
2324 u32 selector) 2327 u32 selector)
2325{ 2328{
2326 struct link *tunnel; 2329 struct link *tunnel;
2327 struct sk_buff *buf; 2330 struct sk_buff *buf;
@@ -2334,7 +2337,7 @@ void tipc_link_tunnel(struct link *l_ptr,
2334 return; 2337 return;
2335 } 2338 }
2336 msg_set_size(tunnel_hdr, length + INT_H_SIZE); 2339 msg_set_size(tunnel_hdr, length + INT_H_SIZE);
2337 buf = buf_acquire(length + INT_H_SIZE); 2340 buf = tipc_buf_acquire(length + INT_H_SIZE);
2338 if (!buf) { 2341 if (!buf) {
2339 warn("Link changeover error, " 2342 warn("Link changeover error, "
2340 "unable to send tunnel msg\n"); 2343 "unable to send tunnel msg\n");
@@ -2380,7 +2383,7 @@ void tipc_link_changeover(struct link *l_ptr)
2380 if (!l_ptr->first_out) { 2383 if (!l_ptr->first_out) {
2381 struct sk_buff *buf; 2384 struct sk_buff *buf;
2382 2385
2383 buf = buf_acquire(INT_H_SIZE); 2386 buf = tipc_buf_acquire(INT_H_SIZE);
2384 if (buf) { 2387 if (buf) {
2385 skb_copy_to_linear_data(buf, &tunnel_hdr, INT_H_SIZE); 2388 skb_copy_to_linear_data(buf, &tunnel_hdr, INT_H_SIZE);
2386 msg_set_size(&tunnel_hdr, INT_H_SIZE); 2389 msg_set_size(&tunnel_hdr, INT_H_SIZE);
@@ -2441,7 +2444,7 @@ void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel)
2441 msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); /* Update */ 2444 msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); /* Update */
2442 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); 2445 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
2443 msg_set_size(&tunnel_hdr, length + INT_H_SIZE); 2446 msg_set_size(&tunnel_hdr, length + INT_H_SIZE);
2444 outbuf = buf_acquire(length + INT_H_SIZE); 2447 outbuf = tipc_buf_acquire(length + INT_H_SIZE);
2445 if (outbuf == NULL) { 2448 if (outbuf == NULL) {
2446 warn("Link changeover error, " 2449 warn("Link changeover error, "
2447 "unable to send duplicate msg\n"); 2450 "unable to send duplicate msg\n");
@@ -2477,7 +2480,7 @@ static struct sk_buff *buf_extract(struct sk_buff *skb, u32 from_pos)
2477 u32 size = msg_size(msg); 2480 u32 size = msg_size(msg);
2478 struct sk_buff *eb; 2481 struct sk_buff *eb;
2479 2482
2480 eb = buf_acquire(size); 2483 eb = tipc_buf_acquire(size);
2481 if (eb) 2484 if (eb)
2482 skb_copy_to_linear_data(eb, msg, size); 2485 skb_copy_to_linear_data(eb, msg, size);
2483 return eb; 2486 return eb;
@@ -2605,11 +2608,11 @@ void tipc_link_recv_bundle(struct sk_buff *buf)
2605 2608
2606 2609
2607/* 2610/*
2608 * tipc_link_send_long_buf: Entry for buffers needing fragmentation. 2611 * link_send_long_buf: Entry for buffers needing fragmentation.
2609 * The buffer is complete, inclusive total message length. 2612 * The buffer is complete, inclusive total message length.
2610 * Returns user data length. 2613 * Returns user data length.
2611 */ 2614 */
2612int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf) 2615static int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
2613{ 2616{
2614 struct tipc_msg *inmsg = buf_msg(buf); 2617 struct tipc_msg *inmsg = buf_msg(buf);
2615 struct tipc_msg fragm_hdr; 2618 struct tipc_msg fragm_hdr;
@@ -2648,7 +2651,7 @@ int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
2648 fragm_sz = rest; 2651 fragm_sz = rest;
2649 msg_set_type(&fragm_hdr, LAST_FRAGMENT); 2652 msg_set_type(&fragm_hdr, LAST_FRAGMENT);
2650 } 2653 }
2651 fragm = buf_acquire(fragm_sz + INT_H_SIZE); 2654 fragm = tipc_buf_acquire(fragm_sz + INT_H_SIZE);
2652 if (fragm == NULL) { 2655 if (fragm == NULL) {
2653 warn("Link unable to fragment message\n"); 2656 warn("Link unable to fragment message\n");
2654 dsz = -ENOMEM; 2657 dsz = -ENOMEM;
@@ -2753,7 +2756,7 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2753 buf_discard(fbuf); 2756 buf_discard(fbuf);
2754 return 0; 2757 return 0;
2755 } 2758 }
2756 pbuf = buf_acquire(msg_size(imsg)); 2759 pbuf = tipc_buf_acquire(msg_size(imsg));
2757 if (pbuf != NULL) { 2760 if (pbuf != NULL) {
2758 pbuf->next = *pending; 2761 pbuf->next = *pending;
2759 *pending = pbuf; 2762 *pending = pbuf;
diff --git a/net/tipc/link.h b/net/tipc/link.h
index 4e944ef4a540..f98bc613de67 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -225,7 +225,6 @@ void tipc_link_send_duplicate(struct link *l_ptr, struct link *dest);
225void tipc_link_reset_fragments(struct link *l_ptr); 225void tipc_link_reset_fragments(struct link *l_ptr);
226int tipc_link_is_up(struct link *l_ptr); 226int tipc_link_is_up(struct link *l_ptr);
227int tipc_link_is_active(struct link *l_ptr); 227int tipc_link_is_active(struct link *l_ptr);
228void tipc_link_start(struct link *l_ptr);
229u32 tipc_link_push_packet(struct link *l_ptr); 228u32 tipc_link_push_packet(struct link *l_ptr);
230void tipc_link_stop(struct link *l_ptr); 229void tipc_link_stop(struct link *l_ptr);
231struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd); 230struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd);
@@ -239,9 +238,6 @@ int tipc_link_send_sections_fast(struct port* sender,
239 struct iovec const *msg_sect, 238 struct iovec const *msg_sect,
240 const u32 num_sect, 239 const u32 num_sect,
241 u32 destnode); 240 u32 destnode);
242int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf);
243void tipc_link_tunnel(struct link *l_ptr, struct tipc_msg *tnl_hdr,
244 struct tipc_msg *msg, u32 selector);
245void tipc_link_recv_bundle(struct sk_buff *buf); 241void tipc_link_recv_bundle(struct sk_buff *buf);
246int tipc_link_recv_fragment(struct sk_buff **pending, 242int tipc_link_recv_fragment(struct sk_buff **pending,
247 struct sk_buff **fb, 243 struct sk_buff **fb,
diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index 381063817b41..ecb532fb0351 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -112,7 +112,7 @@ int tipc_msg_build(struct tipc_msg *hdr,
112 return dsz; 112 return dsz;
113 } 113 }
114 114
115 *buf = buf_acquire(sz); 115 *buf = tipc_buf_acquire(sz);
116 if (!(*buf)) 116 if (!(*buf))
117 return -ENOMEM; 117 return -ENOMEM;
118 skb_copy_to_linear_data(*buf, hdr, hsz); 118 skb_copy_to_linear_data(*buf, hdr, hsz);
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 6ac3c543250b..7b907171f879 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -98,7 +98,7 @@ static void publ_to_item(struct distr_item *i, struct publication *p)
98 98
99static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest) 99static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest)
100{ 100{
101 struct sk_buff *buf = buf_acquire(LONG_H_SIZE + size); 101 struct sk_buff *buf = tipc_buf_acquire(LONG_H_SIZE + size);
102 struct tipc_msg *msg; 102 struct tipc_msg *msg;
103 103
104 if (buf != NULL) { 104 if (buf != NULL) {
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 823e9abb7ef5..b4d87eb2dc5d 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -50,7 +50,8 @@ void node_print(struct print_buf *buf, struct tipc_node *n_ptr, char *str);
50static void node_lost_contact(struct tipc_node *n_ptr); 50static void node_lost_contact(struct tipc_node *n_ptr);
51static void node_established_contact(struct tipc_node *n_ptr); 51static void node_established_contact(struct tipc_node *n_ptr);
52 52
53struct tipc_node *tipc_nodes = NULL; /* sorted list of nodes within cluster */ 53/* sorted list of nodes within cluster */
54static struct tipc_node *tipc_nodes = NULL;
54 55
55static DEFINE_SPINLOCK(node_create_lock); 56static DEFINE_SPINLOCK(node_create_lock);
56 57
@@ -587,22 +588,6 @@ void tipc_node_remove_router(struct tipc_node *n_ptr, u32 router)
587 node_lost_contact(n_ptr); 588 node_lost_contact(n_ptr);
588} 589}
589 590
590u32 tipc_available_nodes(const u32 domain)
591{
592 struct tipc_node *n_ptr;
593 u32 cnt = 0;
594
595 read_lock_bh(&tipc_net_lock);
596 for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
597 if (!tipc_in_scope(domain, n_ptr->addr))
598 continue;
599 if (tipc_node_is_up(n_ptr))
600 cnt++;
601 }
602 read_unlock_bh(&tipc_net_lock);
603 return cnt;
604}
605
606struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) 591struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
607{ 592{
608 u32 domain; 593 u32 domain;
diff --git a/net/tipc/node.h b/net/tipc/node.h
index 45f3db3a595d..fff331b2d26c 100644
--- a/net/tipc/node.h
+++ b/net/tipc/node.h
@@ -96,7 +96,6 @@ struct tipc_node {
96 } bclink; 96 } bclink;
97}; 97};
98 98
99extern struct tipc_node *tipc_nodes;
100extern u32 tipc_own_tag; 99extern u32 tipc_own_tag;
101 100
102struct tipc_node *tipc_node_create(u32 addr); 101struct tipc_node *tipc_node_create(u32 addr);
diff --git a/net/tipc/port.c b/net/tipc/port.c
index 5c4285b2d555..82092eaa1536 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -293,34 +293,6 @@ int tipc_deleteport(u32 ref)
293 return 0; 293 return 0;
294} 294}
295 295
296/**
297 * tipc_get_port() - return port associated with 'ref'
298 *
299 * Note: Port is not locked.
300 */
301
302struct tipc_port *tipc_get_port(const u32 ref)
303{
304 return (struct tipc_port *)tipc_ref_deref(ref);
305}
306
307/**
308 * tipc_get_handle - return user handle associated to port 'ref'
309 */
310
311void *tipc_get_handle(const u32 ref)
312{
313 struct port *p_ptr;
314 void * handle;
315
316 p_ptr = tipc_port_lock(ref);
317 if (!p_ptr)
318 return NULL;
319 handle = p_ptr->publ.usr_handle;
320 tipc_port_unlock(p_ptr);
321 return handle;
322}
323
324static int port_unreliable(struct port *p_ptr) 296static int port_unreliable(struct port *p_ptr)
325{ 297{
326 return msg_src_droppable(&p_ptr->publ.phdr); 298 return msg_src_droppable(&p_ptr->publ.phdr);
@@ -392,7 +364,7 @@ static struct sk_buff *port_build_proto_msg(u32 destport, u32 destnode,
392 struct sk_buff *buf; 364 struct sk_buff *buf;
393 struct tipc_msg *msg; 365 struct tipc_msg *msg;
394 366
395 buf = buf_acquire(LONG_H_SIZE); 367 buf = tipc_buf_acquire(LONG_H_SIZE);
396 if (buf) { 368 if (buf) {
397 msg = buf_msg(buf); 369 msg = buf_msg(buf);
398 tipc_msg_init(msg, usr, type, LONG_H_SIZE, destnode); 370 tipc_msg_init(msg, usr, type, LONG_H_SIZE, destnode);
@@ -433,7 +405,7 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
433 hdr_sz = MCAST_H_SIZE; 405 hdr_sz = MCAST_H_SIZE;
434 else 406 else
435 hdr_sz = LONG_H_SIZE; 407 hdr_sz = LONG_H_SIZE;
436 rbuf = buf_acquire(data_sz + hdr_sz); 408 rbuf = tipc_buf_acquire(data_sz + hdr_sz);
437 if (rbuf == NULL) { 409 if (rbuf == NULL) {
438 buf_discard(buf); 410 buf_discard(buf);
439 return data_sz; 411 return data_sz;
@@ -1242,50 +1214,13 @@ int tipc_shutdown(u32 ref)
1242 return tipc_disconnect(ref); 1214 return tipc_disconnect(ref);
1243} 1215}
1244 1216
1245int tipc_isconnected(u32 ref, int *isconnected)
1246{
1247 struct port *p_ptr;
1248
1249 p_ptr = tipc_port_lock(ref);
1250 if (!p_ptr)
1251 return -EINVAL;
1252 *isconnected = p_ptr->publ.connected;
1253 tipc_port_unlock(p_ptr);
1254 return 0;
1255}
1256
1257int tipc_peer(u32 ref, struct tipc_portid *peer)
1258{
1259 struct port *p_ptr;
1260 int res;
1261
1262 p_ptr = tipc_port_lock(ref);
1263 if (!p_ptr)
1264 return -EINVAL;
1265 if (p_ptr->publ.connected) {
1266 peer->ref = port_peerport(p_ptr);
1267 peer->node = port_peernode(p_ptr);
1268 res = 0;
1269 } else
1270 res = -ENOTCONN;
1271 tipc_port_unlock(p_ptr);
1272 return res;
1273}
1274
1275int tipc_ref_valid(u32 ref)
1276{
1277 /* Works irrespective of type */
1278 return !!tipc_ref_deref(ref);
1279}
1280
1281
1282/* 1217/*
1283 * tipc_port_recv_sections(): Concatenate and deliver sectioned 1218 * tipc_port_recv_sections(): Concatenate and deliver sectioned
1284 * message for this node. 1219 * message for this node.
1285 */ 1220 */
1286 1221
1287int tipc_port_recv_sections(struct port *sender, unsigned int num_sect, 1222static int tipc_port_recv_sections(struct port *sender, unsigned int num_sect,
1288 struct iovec const *msg_sect) 1223 struct iovec const *msg_sect)
1289{ 1224{
1290 struct sk_buff *buf; 1225 struct sk_buff *buf;
1291 int res; 1226 int res;
@@ -1336,65 +1271,16 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect)
1336} 1271}
1337 1272
1338/** 1273/**
1339 * tipc_send_buf - send message buffer on connection
1340 */
1341
1342int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz)
1343{
1344 struct port *p_ptr;
1345 struct tipc_msg *msg;
1346 u32 destnode;
1347 u32 hsz;
1348 u32 sz;
1349 u32 res;
1350
1351 p_ptr = tipc_port_deref(ref);
1352 if (!p_ptr || !p_ptr->publ.connected)
1353 return -EINVAL;
1354
1355 msg = &p_ptr->publ.phdr;
1356 hsz = msg_hdr_sz(msg);
1357 sz = hsz + dsz;
1358 msg_set_size(msg, sz);
1359 if (skb_cow(buf, hsz))
1360 return -ENOMEM;
1361
1362 skb_push(buf, hsz);
1363 skb_copy_to_linear_data(buf, msg, hsz);
1364 destnode = msg_destnode(msg);
1365 p_ptr->publ.congested = 1;
1366 if (!tipc_port_congested(p_ptr)) {
1367 if (likely(destnode != tipc_own_addr))
1368 res = tipc_send_buf_fast(buf, destnode);
1369 else {
1370 tipc_port_recv_msg(buf);
1371 res = sz;
1372 }
1373 if (likely(res != -ELINKCONG)) {
1374 port_incr_out_seqno(p_ptr);
1375 p_ptr->sent++;
1376 p_ptr->publ.congested = 0;
1377 return res;
1378 }
1379 }
1380 if (port_unreliable(p_ptr)) {
1381 p_ptr->publ.congested = 0;
1382 return dsz;
1383 }
1384 return -ELINKCONG;
1385}
1386
1387/**
1388 * tipc_forward2name - forward message sections to port name 1274 * tipc_forward2name - forward message sections to port name
1389 */ 1275 */
1390 1276
1391int tipc_forward2name(u32 ref, 1277static int tipc_forward2name(u32 ref,
1392 struct tipc_name const *name, 1278 struct tipc_name const *name,
1393 u32 domain, 1279 u32 domain,
1394 u32 num_sect, 1280 u32 num_sect,
1395 struct iovec const *msg_sect, 1281 struct iovec const *msg_sect,
1396 struct tipc_portid const *orig, 1282 struct tipc_portid const *orig,
1397 unsigned int importance) 1283 unsigned int importance)
1398{ 1284{
1399 struct port *p_ptr; 1285 struct port *p_ptr;
1400 struct tipc_msg *msg; 1286 struct tipc_msg *msg;
@@ -1457,89 +1343,15 @@ int tipc_send2name(u32 ref,
1457} 1343}
1458 1344
1459/** 1345/**
1460 * tipc_forward_buf2name - forward message buffer to port name
1461 */
1462
1463int tipc_forward_buf2name(u32 ref,
1464 struct tipc_name const *name,
1465 u32 domain,
1466 struct sk_buff *buf,
1467 unsigned int dsz,
1468 struct tipc_portid const *orig,
1469 unsigned int importance)
1470{
1471 struct port *p_ptr;
1472 struct tipc_msg *msg;
1473 u32 destnode = domain;
1474 u32 destport;
1475 int res;
1476
1477 p_ptr = (struct port *)tipc_ref_deref(ref);
1478 if (!p_ptr || p_ptr->publ.connected)
1479 return -EINVAL;
1480
1481 msg = &p_ptr->publ.phdr;
1482 if (importance <= TIPC_CRITICAL_IMPORTANCE)
1483 msg_set_importance(msg, importance);
1484 msg_set_type(msg, TIPC_NAMED_MSG);
1485 msg_set_orignode(msg, orig->node);
1486 msg_set_origport(msg, orig->ref);
1487 msg_set_nametype(msg, name->type);
1488 msg_set_nameinst(msg, name->instance);
1489 msg_set_lookup_scope(msg, tipc_addr_scope(domain));
1490 msg_set_hdr_sz(msg, LONG_H_SIZE);
1491 msg_set_size(msg, LONG_H_SIZE + dsz);
1492 destport = tipc_nametbl_translate(name->type, name->instance, &destnode);
1493 msg_set_destnode(msg, destnode);
1494 msg_set_destport(msg, destport);
1495 msg_dbg(msg, "forw2name ==> ");
1496 if (skb_cow(buf, LONG_H_SIZE))
1497 return -ENOMEM;
1498 skb_push(buf, LONG_H_SIZE);
1499 skb_copy_to_linear_data(buf, msg, LONG_H_SIZE);
1500 msg_dbg(buf_msg(buf),"PREP:");
1501 if (likely(destport)) {
1502 p_ptr->sent++;
1503 if (destnode == tipc_own_addr)
1504 return tipc_port_recv_msg(buf);
1505 res = tipc_send_buf_fast(buf, destnode);
1506 if (likely(res != -ELINKCONG))
1507 return res;
1508 if (port_unreliable(p_ptr))
1509 return dsz;
1510 return -ELINKCONG;
1511 }
1512 return tipc_reject_msg(buf, TIPC_ERR_NO_NAME);
1513}
1514
1515/**
1516 * tipc_send_buf2name - send message buffer to port name
1517 */
1518
1519int tipc_send_buf2name(u32 ref,
1520 struct tipc_name const *dest,
1521 u32 domain,
1522 struct sk_buff *buf,
1523 unsigned int dsz)
1524{
1525 struct tipc_portid orig;
1526
1527 orig.ref = ref;
1528 orig.node = tipc_own_addr;
1529 return tipc_forward_buf2name(ref, dest, domain, buf, dsz, &orig,
1530 TIPC_PORT_IMPORTANCE);
1531}
1532
1533/**
1534 * tipc_forward2port - forward message sections to port identity 1346 * tipc_forward2port - forward message sections to port identity
1535 */ 1347 */
1536 1348
1537int tipc_forward2port(u32 ref, 1349static int tipc_forward2port(u32 ref,
1538 struct tipc_portid const *dest, 1350 struct tipc_portid const *dest,
1539 unsigned int num_sect, 1351 unsigned int num_sect,
1540 struct iovec const *msg_sect, 1352 struct iovec const *msg_sect,
1541 struct tipc_portid const *orig, 1353 struct tipc_portid const *orig,
1542 unsigned int importance) 1354 unsigned int importance)
1543{ 1355{
1544 struct port *p_ptr; 1356 struct port *p_ptr;
1545 struct tipc_msg *msg; 1357 struct tipc_msg *msg;
@@ -1591,12 +1403,12 @@ int tipc_send2port(u32 ref,
1591/** 1403/**
1592 * tipc_forward_buf2port - forward message buffer to port identity 1404 * tipc_forward_buf2port - forward message buffer to port identity
1593 */ 1405 */
1594int tipc_forward_buf2port(u32 ref, 1406static int tipc_forward_buf2port(u32 ref,
1595 struct tipc_portid const *dest, 1407 struct tipc_portid const *dest,
1596 struct sk_buff *buf, 1408 struct sk_buff *buf,
1597 unsigned int dsz, 1409 unsigned int dsz,
1598 struct tipc_portid const *orig, 1410 struct tipc_portid const *orig,
1599 unsigned int importance) 1411 unsigned int importance)
1600{ 1412{
1601 struct port *p_ptr; 1413 struct port *p_ptr;
1602 struct tipc_msg *msg; 1414 struct tipc_msg *msg;
diff --git a/net/tipc/port.h b/net/tipc/port.h
index e74bd9563739..73bbf442b346 100644
--- a/net/tipc/port.h
+++ b/net/tipc/port.h
@@ -109,8 +109,6 @@ struct port {
109extern spinlock_t tipc_port_list_lock; 109extern spinlock_t tipc_port_list_lock;
110struct port_list; 110struct port_list;
111 111
112int tipc_port_recv_sections(struct port *p_ptr, u32 num_sect,
113 struct iovec const *msg_sect);
114int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, 112int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
115 struct iovec const *msg_sect, u32 num_sect, 113 struct iovec const *msg_sect, u32 num_sect,
116 int err); 114 int err);
diff --git a/net/tipc/ref.c b/net/tipc/ref.c
index 8dea66500cf5..ab8ad32d8c20 100644
--- a/net/tipc/ref.c
+++ b/net/tipc/ref.c
@@ -282,23 +282,6 @@ void *tipc_ref_lock(u32 ref)
282 return NULL; 282 return NULL;
283} 283}
284 284
285/**
286 * tipc_ref_unlock - unlock referenced object
287 */
288
289void tipc_ref_unlock(u32 ref)
290{
291 if (likely(tipc_ref_table.entries)) {
292 struct reference *entry;
293
294 entry = &tipc_ref_table.entries[ref &
295 tipc_ref_table.index_mask];
296 if (likely((entry->ref == ref) && (entry->object)))
297 spin_unlock_bh(&entry->lock);
298 else
299 err("Attempt to unlock non-existent reference\n");
300 }
301}
302 285
303/** 286/**
304 * tipc_ref_deref - return pointer referenced object (without locking it) 287 * tipc_ref_deref - return pointer referenced object (without locking it)
diff --git a/net/tipc/ref.h b/net/tipc/ref.h
index 7e3798ea93b9..5bc8e7ab84de 100644
--- a/net/tipc/ref.h
+++ b/net/tipc/ref.h
@@ -44,7 +44,6 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock);
44void tipc_ref_discard(u32 ref); 44void tipc_ref_discard(u32 ref);
45 45
46void *tipc_ref_lock(u32 ref); 46void *tipc_ref_lock(u32 ref);
47void tipc_ref_unlock(u32 ref);
48void *tipc_ref_deref(u32 ref); 47void *tipc_ref_deref(u32 ref);
49 48
50#endif 49#endif
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index 1a5b9a6bd128..18813acc6bef 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -598,12 +598,3 @@ void tipc_subscr_stop(void)
598 topsrv.user_ref = 0; 598 topsrv.user_ref = 0;
599 } 599 }
600} 600}
601
602
603int tipc_ispublished(struct tipc_name const *name)
604{
605 u32 domain = 0;
606
607 return tipc_nametbl_translate(name->type, name->instance, &domain) != 0;
608}
609
diff --git a/net/tipc/zone.c b/net/tipc/zone.c
index 2c01ba2d86bf..83f8b5e91fc8 100644
--- a/net/tipc/zone.c
+++ b/net/tipc/zone.c
@@ -160,14 +160,3 @@ u32 tipc_zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref)
160 } 160 }
161 return 0; 161 return 0;
162} 162}
163
164
165u32 tipc_zone_next_node(u32 addr)
166{
167 struct cluster *c_ptr = tipc_cltr_find(addr);
168
169 if (c_ptr)
170 return tipc_cltr_next_node(c_ptr, addr);
171 return 0;
172}
173
diff --git a/net/tipc/zone.h b/net/tipc/zone.h
index 7bdc3406ba9b..bd1c20ce9d06 100644
--- a/net/tipc/zone.h
+++ b/net/tipc/zone.h
@@ -61,7 +61,6 @@ void tipc_zone_send_external_routes(struct _zone *z_ptr, u32 dest);
61struct _zone *tipc_zone_create(u32 addr); 61struct _zone *tipc_zone_create(u32 addr);
62void tipc_zone_delete(struct _zone *z_ptr); 62void tipc_zone_delete(struct _zone *z_ptr);
63void tipc_zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr); 63void tipc_zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr);
64u32 tipc_zone_next_node(u32 addr);
65 64
66static inline struct _zone *tipc_zone_find(u32 addr) 65static inline struct _zone *tipc_zone_find(u32 addr)
67{ 66{