Commit 31e3c3f6f1f9b154981a0e6620df700463db30ee

Authored by stephen hemminger
Committed by David S. Miller
1 parent 15419227f7

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>

Showing 28 changed files with 84 additions and 462 deletions Side-by-side Diff

include/net/tipc/tipc.h
... ... @@ -50,8 +50,6 @@
50 50 * TIPC operating mode routines
51 51 */
52 52  
53   -u32 tipc_get_addr(void);
54   -
55 53 #define TIPC_NOT_RUNNING 0
56 54 #define TIPC_NODE_MODE 1
57 55 #define TIPC_NET_MODE 2
... ... @@ -62,8 +60,6 @@
62 60  
63 61 void tipc_detach(unsigned int userref);
64 62  
65   -int tipc_get_mode(void);
66   -
67 63 /*
68 64 * TIPC port manipulation routines
69 65 */
... ... @@ -153,12 +149,6 @@
153 149  
154 150 int tipc_shutdown(u32 ref);
155 151  
156   -int tipc_isconnected(u32 portref, int *isconnected);
157   -
158   -int tipc_peer(u32 portref, struct tipc_portid *peer);
159   -
160   -int tipc_ref_valid(u32 portref);
161   -
162 152 /*
163 153 * TIPC messaging routines
164 154 */
165 155  
... ... @@ -170,38 +160,12 @@
170 160 unsigned int num_sect,
171 161 struct iovec const *msg_sect);
172 162  
173   -int tipc_send_buf(u32 portref,
174   - struct sk_buff *buf,
175   - unsigned int dsz);
176   -
177 163 int tipc_send2name(u32 portref,
178 164 struct tipc_name const *name,
179 165 u32 domain,
180 166 unsigned int num_sect,
181 167 struct iovec const *msg_sect);
182 168  
183   -int tipc_send_buf2name(u32 portref,
184   - struct tipc_name const *name,
185   - u32 domain,
186   - struct sk_buff *buf,
187   - unsigned int dsz);
188   -
189   -int tipc_forward2name(u32 portref,
190   - struct tipc_name const *name,
191   - u32 domain,
192   - unsigned int section_count,
193   - struct iovec const *msg_sect,
194   - struct tipc_portid const *origin,
195   - unsigned int importance);
196   -
197   -int tipc_forward_buf2name(u32 portref,
198   - struct tipc_name const *name,
199   - u32 domain,
200   - struct sk_buff *buf,
201   - unsigned int dsz,
202   - struct tipc_portid const *orig,
203   - unsigned int importance);
204   -
205 169 int tipc_send2port(u32 portref,
206 170 struct tipc_portid const *dest,
207 171 unsigned int num_sect,
208 172  
... ... @@ -212,46 +176,11 @@
212 176 struct sk_buff *buf,
213 177 unsigned int dsz);
214 178  
215   -int tipc_forward2port(u32 portref,
216   - struct tipc_portid const *dest,
217   - unsigned int num_sect,
218   - struct iovec const *msg_sect,
219   - struct tipc_portid const *origin,
220   - unsigned int importance);
221   -
222   -int tipc_forward_buf2port(u32 portref,
223   - struct tipc_portid const *dest,
224   - struct sk_buff *buf,
225   - unsigned int dsz,
226   - struct tipc_portid const *orig,
227   - unsigned int importance);
228   -
229 179 int tipc_multicast(u32 portref,
230 180 struct tipc_name_seq const *seq,
231 181 u32 domain, /* currently unused */
232 182 unsigned int section_count,
233 183 struct iovec const *msg);
234   -
235   -#if 0
236   -int tipc_multicast_buf(u32 portref,
237   - struct tipc_name_seq const *seq,
238   - u32 domain,
239   - void *buf,
240   - unsigned int size);
241   -#endif
242   -
243   -/*
244   - * TIPC subscription routines
245   - */
246   -
247   -int tipc_ispublished(struct tipc_name const *name);
248   -
249   -/*
250   - * Get number of available nodes within specified domain (excluding own node)
251   - */
252   -
253   -unsigned int tipc_available_nodes(const u32 domain);
254   -
255 184 #endif
256 185  
257 186 #endif
include/net/tipc/tipc_port.h
... ... @@ -88,8 +88,6 @@
88 88  
89 89 struct tipc_port *tipc_get_port(const u32 ref);
90 90  
91   -void *tipc_get_handle(const u32 ref);
92   -
93 91 /*
94 92 * The following routines require that the port be locked on entry
95 93 */
... ... @@ -41,11 +41,6 @@
41 41 #include "cluster.h"
42 42 #include "net.h"
43 43  
44   -u32 tipc_get_addr(void)
45   -{
46   - return tipc_own_addr;
47   -}
48   -
49 44 /**
50 45 * tipc_addr_domain_valid - validates a network domain address
51 46 *
... ... @@ -121,6 +121,9 @@
121 121  
122 122 const char tipc_bclink_name[] = "broadcast-link";
123 123  
  124 +static 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  
125 128 static u32 buf_seqno(struct sk_buff *buf)
126 129 {
... ... @@ -287,7 +290,7 @@
287 290 if (!less(n_ptr->bclink.gap_after, n_ptr->bclink.gap_to))
288 291 return;
289 292  
290   - buf = buf_acquire(INT_H_SIZE);
  293 + buf = tipc_buf_acquire(INT_H_SIZE);
291 294 if (buf) {
292 295 msg = buf_msg(buf);
293 296 tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG,
... ... @@ -871,8 +874,9 @@
871 874 * @nm_diff: output node map A-B (i.e. nodes of A that are not in B)
872 875 */
873 876  
874   -void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b,
875   - struct tipc_node_map *nm_diff)
  877 +static void tipc_nmap_diff(struct tipc_node_map *nm_a,
  878 + struct tipc_node_map *nm_b,
  879 + struct tipc_node_map *nm_diff)
876 880 {
877 881 int stop = ARRAY_SIZE(nm_a->map);
878 882 int w;
... ... @@ -84,9 +84,6 @@
84 84 return !memcmp(nm_a, nm_b, sizeof(*nm_a));
85 85 }
86 86  
87   -void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b,
88   - struct tipc_node_map *nm_diff);
89   -
90 87 void tipc_port_list_add(struct port_list *pl_ptr, u32 port);
91 88 void tipc_port_list_free(struct port_list *pl_ptr);
92 89  
... ... @@ -113,26 +113,7 @@
113 113 kfree(c_ptr);
114 114 }
115 115  
116   -u32 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 116  
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   -
136 117 void tipc_cltr_attach_node(struct cluster *c_ptr, struct tipc_node *n_ptr)
137 118 {
138 119 u32 n_num = tipc_node(n_ptr->addr);
... ... @@ -232,7 +213,7 @@
232 213 static struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest)
233 214 {
234 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 217 struct tipc_msg *msg;
237 218  
238 219 if (buf) {
... ... @@ -75,7 +75,7 @@
75 75 void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest);
76 76 void tipc_cltr_broadcast(struct sk_buff *buf);
77 77 int tipc_cltr_init(void);
78   -u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr);
  78 +
79 79 void tipc_cltr_bcast_new_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
80 80 void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest);
81 81 void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
... ... @@ -95,7 +95,7 @@
95 95 return 1;
96 96 }
97 97  
98   -struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
  98 +static struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
99 99 {
100 100 struct sk_buff *buf;
101 101 __be32 value_net;
... ... @@ -107,6 +107,11 @@
107 107 sizeof(value_net));
108 108 }
109 109 return buf;
  110 +}
  111 +
  112 +static struct sk_buff *tipc_cfg_reply_unsigned(u32 value)
  113 +{
  114 + return tipc_cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value);
110 115 }
111 116  
112 117 struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string)
... ... @@ -45,17 +45,11 @@
45 45 struct sk_buff *tipc_cfg_reply_alloc(int payload_size);
46 46 int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
47 47 void *tlv_data, int tlv_data_size);
48   -struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value);
49 48 struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string);
50 49  
51 50 static inline struct sk_buff *tipc_cfg_reply_none(void)
52 51 {
53 52 return tipc_cfg_reply_alloc(0);
54   -}
55   -
56   -static inline struct sk_buff *tipc_cfg_reply_unsigned(u32 value)
57   -{
58   - return tipc_cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value);
59 53 }
60 54  
61 55 static inline struct sk_buff *tipc_cfg_reply_error_string(char *string)
... ... @@ -96,13 +96,13 @@
96 96 int tipc_remote_management;
97 97  
98 98  
99   -int tipc_get_mode(void)
  99 +static int tipc_get_mode(void)
100 100 {
101 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 106 * @size: message size (including TIPC header)
107 107 *
108 108 * Returns a new buffer with data pointers set to the specified size.
... ... @@ -111,7 +111,7 @@
111 111 * There may also be unrequested tailroom present at the buffer's end.
112 112 */
113 113  
114   -struct sk_buff *buf_acquire(u32 size)
  114 +struct sk_buff *tipc_buf_acquire(u32 size)
115 115 {
116 116 struct sk_buff *skb;
117 117 unsigned int buf_size = (BUF_HEADROOM + size + 3) & ~3u;
... ... @@ -129,7 +129,7 @@
129 129 * tipc_core_stop_net - shut down TIPC networking sub-systems
130 130 */
131 131  
132   -void tipc_core_stop_net(void)
  132 +static void tipc_core_stop_net(void)
133 133 {
134 134 tipc_eth_media_stop();
135 135 tipc_net_stop();
... ... @@ -154,7 +154,7 @@
154 154 * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode
155 155 */
156 156  
157   -void tipc_core_stop(void)
  157 +static void tipc_core_stop(void)
158 158 {
159 159 if (tipc_mode != TIPC_NODE_MODE)
160 160 return;
... ... @@ -176,7 +176,7 @@
176 176 * tipc_core_start - switch TIPC from NOT RUNNING to SINGLE NODE mode
177 177 */
178 178  
179   -int tipc_core_start(void)
  179 +static int tipc_core_start(void)
180 180 {
181 181 int res;
182 182  
... ... @@ -246,7 +246,6 @@
246 246  
247 247 EXPORT_SYMBOL(tipc_attach);
248 248 EXPORT_SYMBOL(tipc_detach);
249   -EXPORT_SYMBOL(tipc_get_addr);
250 249 EXPORT_SYMBOL(tipc_get_mode);
251 250 EXPORT_SYMBOL(tipc_createport);
252 251 EXPORT_SYMBOL(tipc_deleteport);
253 252  
254 253  
255 254  
256 255  
... ... @@ -262,23 +261,10 @@
262 261 EXPORT_SYMBOL(tipc_connect2port);
263 262 EXPORT_SYMBOL(tipc_disconnect);
264 263 EXPORT_SYMBOL(tipc_shutdown);
265   -EXPORT_SYMBOL(tipc_isconnected);
266   -EXPORT_SYMBOL(tipc_peer);
267   -EXPORT_SYMBOL(tipc_ref_valid);
268 264 EXPORT_SYMBOL(tipc_send);
269   -EXPORT_SYMBOL(tipc_send_buf);
270 265 EXPORT_SYMBOL(tipc_send2name);
271   -EXPORT_SYMBOL(tipc_forward2name);
272   -EXPORT_SYMBOL(tipc_send_buf2name);
273   -EXPORT_SYMBOL(tipc_forward_buf2name);
274 266 EXPORT_SYMBOL(tipc_send2port);
275   -EXPORT_SYMBOL(tipc_forward2port);
276   -EXPORT_SYMBOL(tipc_send_buf2port);
277   -EXPORT_SYMBOL(tipc_forward_buf2port);
278 267 EXPORT_SYMBOL(tipc_multicast);
279   -/* EXPORT_SYMBOL(tipc_multicast_buf); not available yet */
280   -EXPORT_SYMBOL(tipc_ispublished);
281   -EXPORT_SYMBOL(tipc_available_nodes);
282 268  
283 269 /* TIPC API for external bearers (see tipc_bearer.h) */
284 270  
... ... @@ -295,6 +281,4 @@
295 281 EXPORT_SYMBOL(tipc_reject_msg);
296 282 EXPORT_SYMBOL(tipc_send_buf_fast);
297 283 EXPORT_SYMBOL(tipc_acknowledge);
298   -EXPORT_SYMBOL(tipc_get_port);
299   -EXPORT_SYMBOL(tipc_get_handle);
... ... @@ -83,9 +83,7 @@
83 83 * Note: TIPC_LOG is configured to echo its output to the system console;
84 84 * user-defined buffers can be configured to do the same thing.
85 85 */
86   -
87 86 extern struct print_buf *const TIPC_NULL;
88   -extern struct print_buf *const TIPC_CONS;
89 87 extern struct print_buf *const TIPC_LOG;
90 88  
91 89 void tipc_printf(struct print_buf *, const char *fmt, ...);
... ... @@ -204,10 +202,7 @@
204 202 * Routines available to privileged subsystems
205 203 */
206 204  
207   -extern int tipc_core_start(void);
208   -extern void tipc_core_stop(void);
209   -extern int tipc_core_start_net(unsigned long addr);
210   -extern void tipc_core_stop_net(void);
  205 +extern int tipc_core_start_net(unsigned long);
211 206 extern int tipc_handler_start(void);
212 207 extern void tipc_handler_stop(void);
213 208 extern int tipc_netlink_start(void);
... ... @@ -328,7 +323,7 @@
328 323 return (struct tipc_msg *)skb->data;
329 324 }
330 325  
331   -extern struct sk_buff *buf_acquire(u32 size);
  326 +extern struct sk_buff *tipc_buf_acquire(u32 size);
332 327  
333 328 /**
334 329 * buf_discard - frees a TIPC message buffer
... ... @@ -52,7 +52,7 @@
52 52 struct print_buf *const TIPC_NULL = &null_buf;
53 53  
54 54 static struct print_buf cons_buf = { NULL, 0, NULL, 1 };
55   -struct print_buf *const TIPC_CONS = &cons_buf;
  55 +static struct print_buf *const TIPC_CONS = &cons_buf;
56 56  
57 57 static struct print_buf log_buf = { NULL, 0, NULL, 1 };
58 58 struct print_buf *const TIPC_LOG = &log_buf;
... ... @@ -76,6 +76,10 @@
76 76 static char print_string[TIPC_PB_MAX_STR];
77 77 static DEFINE_SPINLOCK(print_lock);
78 78  
  79 +static void tipc_printbuf_reset(struct print_buf *pb);
  80 +static int tipc_printbuf_empty(struct print_buf *pb);
  81 +static void tipc_printbuf_move(struct print_buf *pb_to,
  82 + struct print_buf *pb_from);
79 83  
80 84 #define FORMAT(PTR,LEN,FMT) \
81 85 {\
... ... @@ -116,7 +120,7 @@
116 120 * @pb: pointer to print buffer structure
117 121 */
118 122  
119   -void tipc_printbuf_reset(struct print_buf *pb)
  123 +static void tipc_printbuf_reset(struct print_buf *pb)
120 124 {
121 125 if (pb->buf) {
122 126 pb->crs = pb->buf;
... ... @@ -132,7 +136,7 @@
132 136 * Returns non-zero if print buffer is empty.
133 137 */
134 138  
135   -int tipc_printbuf_empty(struct print_buf *pb)
  139 +static int tipc_printbuf_empty(struct print_buf *pb)
136 140 {
137 141 return !pb->buf || (pb->crs == pb->buf);
138 142 }
... ... @@ -181,7 +185,8 @@
181 185 * Source print buffer becomes empty if a successful move occurs.
182 186 */
183 187  
184   -void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
  188 +static void tipc_printbuf_move(struct print_buf *pb_to,
  189 + struct print_buf *pb_from)
185 190 {
186 191 int len;
187 192  
... ... @@ -56,10 +56,7 @@
56 56 #define TIPC_PB_MAX_STR 512 /* max printable string (with trailing NUL) */
57 57  
58 58 void tipc_printbuf_init(struct print_buf *pb, char *buf, u32 size);
59   -void tipc_printbuf_reset(struct print_buf *pb);
60   -int tipc_printbuf_empty(struct print_buf *pb);
61 59 int tipc_printbuf_validate(struct print_buf *pb);
62   -void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from);
63 60  
64 61 int tipc_log_resize(int log_size);
65 62  
... ... @@ -68,20 +68,6 @@
68 68 unsigned int timer_intv;
69 69 };
70 70  
71   -
72   -/*
73   - * disc_lost_link(): A link has lost contact
74   - */
75   -
76   -void 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 72 * tipc_disc_init_msg - initialize a link setup message
87 73 * @type: message type (request or response)
... ... @@ -95,7 +81,7 @@
95 81 u32 dest_domain,
96 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 85 struct tipc_msg *msg;
100 86  
101 87 if (buf) {
... ... @@ -50,7 +50,5 @@
50 50  
51 51 void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr);
52 52  
53   -void tipc_disc_link_event(u32 addr, char *name, int up);
54   -
55 53 #endif
... ... @@ -112,7 +112,10 @@
112 112 static void link_reset_statistics(struct link *l_ptr);
113 113 static void link_print(struct link *l_ptr, struct print_buf *buf,
114 114 const char *str);
  115 +static void link_start(struct link *l_ptr);
  116 +static int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf);
115 117  
  118 +
116 119 /*
117 120 * Debugging code used by link routines only
118 121 *
... ... @@ -442,7 +445,7 @@
442 445  
443 446 k_init_timer(&l_ptr->timer, (Handler)link_timeout, (unsigned long)l_ptr);
444 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 450 dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n",
448 451 l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit);
449 452  
... ... @@ -482,9 +485,9 @@
482 485 kfree(l_ptr);
483 486 }
484 487  
485   -void tipc_link_start(struct link *l_ptr)
  488 +static 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 491 link_state_event(l_ptr, STARTING_EVT);
489 492 }
490 493  
... ... @@ -1000,7 +1003,7 @@
1000 1003 /* Fragmentation needed ? */
1001 1004  
1002 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 1008 /* Packet can be queued or sent: */
1006 1009  
... ... @@ -1036,7 +1039,7 @@
1036 1039 /* Try creating a new bundle */
1037 1040  
1038 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 1043 struct tipc_msg bundler_hdr;
1041 1044  
1042 1045 if (bundler) {
... ... @@ -1312,7 +1315,7 @@
1312 1315  
1313 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 1319 if (!buf)
1317 1320 return -ENOMEM;
1318 1321 buf->next = NULL;
... ... @@ -1369,7 +1372,7 @@
1369 1372 msg_set_size(&fragm_hdr, fragm_sz + INT_H_SIZE);
1370 1373 msg_set_fragm_no(&fragm_hdr, ++fragm_no);
1371 1374 prev = buf;
1372   - buf = buf_acquire(fragm_sz + INT_H_SIZE);
  1375 + buf = tipc_buf_acquire(fragm_sz + INT_H_SIZE);
1373 1376 if (!buf)
1374 1377 goto error;
1375 1378  
... ... @@ -2145,7 +2148,7 @@
2145 2148 if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) {
2146 2149 if (!l_ptr->proto_msg_queue) {
2147 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 2153 buf = l_ptr->proto_msg_queue;
2151 2154 if (!buf)
... ... @@ -2159,7 +2162,7 @@
2159 2162  
2160 2163 msg_dbg(msg, ">>");
2161 2164  
2162   - buf = buf_acquire(msg_size);
  2165 + buf = tipc_buf_acquire(msg_size);
2163 2166 if (!buf)
2164 2167 return;
2165 2168  
... ... @@ -2318,10 +2321,10 @@
2318 2321 * tipc_link_tunnel(): Send one message via a link belonging to
2319 2322 * another bearer. Owner node is locked.
2320 2323 */
2321   -void tipc_link_tunnel(struct link *l_ptr,
2322   - struct tipc_msg *tunnel_hdr,
2323   - struct tipc_msg *msg,
2324   - u32 selector)
  2324 +static void tipc_link_tunnel(struct link *l_ptr,
  2325 + struct tipc_msg *tunnel_hdr,
  2326 + struct tipc_msg *msg,
  2327 + u32 selector)
2325 2328 {
2326 2329 struct link *tunnel;
2327 2330 struct sk_buff *buf;
... ... @@ -2334,7 +2337,7 @@
2334 2337 return;
2335 2338 }
2336 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 2341 if (!buf) {
2339 2342 warn("Link changeover error, "
2340 2343 "unable to send tunnel msg\n");
... ... @@ -2380,7 +2383,7 @@
2380 2383 if (!l_ptr->first_out) {
2381 2384 struct sk_buff *buf;
2382 2385  
2383   - buf = buf_acquire(INT_H_SIZE);
  2386 + buf = tipc_buf_acquire(INT_H_SIZE);
2384 2387 if (buf) {
2385 2388 skb_copy_to_linear_data(buf, &tunnel_hdr, INT_H_SIZE);
2386 2389 msg_set_size(&tunnel_hdr, INT_H_SIZE);
... ... @@ -2441,7 +2444,7 @@
2441 2444 msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); /* Update */
2442 2445 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
2443 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 2448 if (outbuf == NULL) {
2446 2449 warn("Link changeover error, "
2447 2450 "unable to send duplicate msg\n");
... ... @@ -2477,7 +2480,7 @@
2477 2480 u32 size = msg_size(msg);
2478 2481 struct sk_buff *eb;
2479 2482  
2480   - eb = buf_acquire(size);
  2483 + eb = tipc_buf_acquire(size);
2481 2484 if (eb)
2482 2485 skb_copy_to_linear_data(eb, msg, size);
2483 2486 return eb;
2484 2487  
... ... @@ -2605,11 +2608,11 @@
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 2612 * The buffer is complete, inclusive total message length.
2610 2613 * Returns user data length.
2611 2614 */
2612   -int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
  2615 +static int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
2613 2616 {
2614 2617 struct tipc_msg *inmsg = buf_msg(buf);
2615 2618 struct tipc_msg fragm_hdr;
... ... @@ -2648,7 +2651,7 @@
2648 2651 fragm_sz = rest;
2649 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 2655 if (fragm == NULL) {
2653 2656 warn("Link unable to fragment message\n");
2654 2657 dsz = -ENOMEM;
... ... @@ -2753,7 +2756,7 @@
2753 2756 buf_discard(fbuf);
2754 2757 return 0;
2755 2758 }
2756   - pbuf = buf_acquire(msg_size(imsg));
  2759 + pbuf = tipc_buf_acquire(msg_size(imsg));
2757 2760 if (pbuf != NULL) {
2758 2761 pbuf->next = *pending;
2759 2762 *pending = pbuf;
... ... @@ -225,7 +225,6 @@
225 225 void tipc_link_reset_fragments(struct link *l_ptr);
226 226 int tipc_link_is_up(struct link *l_ptr);
227 227 int tipc_link_is_active(struct link *l_ptr);
228   -void tipc_link_start(struct link *l_ptr);
229 228 u32 tipc_link_push_packet(struct link *l_ptr);
230 229 void tipc_link_stop(struct link *l_ptr);
231 230 struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd);
... ... @@ -239,9 +238,6 @@
239 238 struct iovec const *msg_sect,
240 239 const u32 num_sect,
241 240 u32 destnode);
242   -int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf);
243   -void tipc_link_tunnel(struct link *l_ptr, struct tipc_msg *tnl_hdr,
244   - struct tipc_msg *msg, u32 selector);
245 241 void tipc_link_recv_bundle(struct sk_buff *buf);
246 242 int tipc_link_recv_fragment(struct sk_buff **pending,
247 243 struct sk_buff **fb,
... ... @@ -112,7 +112,7 @@
112 112 return dsz;
113 113 }
114 114  
115   - *buf = buf_acquire(sz);
  115 + *buf = tipc_buf_acquire(sz);
116 116 if (!(*buf))
117 117 return -ENOMEM;
118 118 skb_copy_to_linear_data(*buf, hdr, hsz);
net/tipc/name_distr.c
... ... @@ -98,7 +98,7 @@
98 98  
99 99 static 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 102 struct tipc_msg *msg;
103 103  
104 104 if (buf != NULL) {
... ... @@ -50,7 +50,8 @@
50 50 static void node_lost_contact(struct tipc_node *n_ptr);
51 51 static void node_established_contact(struct tipc_node *n_ptr);
52 52  
53   -struct tipc_node *tipc_nodes = NULL; /* sorted list of nodes within cluster */
  53 +/* sorted list of nodes within cluster */
  54 +static struct tipc_node *tipc_nodes = NULL;
54 55  
55 56 static DEFINE_SPINLOCK(node_create_lock);
56 57  
... ... @@ -585,22 +586,6 @@
585 586  
586 587 if (!tipc_node_is_up(n_ptr))
587 588 node_lost_contact(n_ptr);
588   -}
589   -
590   -u32 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 589 }
605 590  
606 591 struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
... ... @@ -96,7 +96,6 @@
96 96 } bclink;
97 97 };
98 98  
99   -extern struct tipc_node *tipc_nodes;
100 99 extern u32 tipc_own_tag;
101 100  
102 101 struct tipc_node *tipc_node_create(u32 addr);
... ... @@ -293,34 +293,6 @@
293 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   -
302   -struct 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   -
311   -void *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   -
324 296 static int port_unreliable(struct port *p_ptr)
325 297 {
326 298 return msg_src_droppable(&p_ptr->publ.phdr);
... ... @@ -392,7 +364,7 @@
392 364 struct sk_buff *buf;
393 365 struct tipc_msg *msg;
394 366  
395   - buf = buf_acquire(LONG_H_SIZE);
  367 + buf = tipc_buf_acquire(LONG_H_SIZE);
396 368 if (buf) {
397 369 msg = buf_msg(buf);
398 370 tipc_msg_init(msg, usr, type, LONG_H_SIZE, destnode);
... ... @@ -433,7 +405,7 @@
433 405 hdr_sz = MCAST_H_SIZE;
434 406 else
435 407 hdr_sz = LONG_H_SIZE;
436   - rbuf = buf_acquire(data_sz + hdr_sz);
  408 + rbuf = tipc_buf_acquire(data_sz + hdr_sz);
437 409 if (rbuf == NULL) {
438 410 buf_discard(buf);
439 411 return data_sz;
440 412  
... ... @@ -1242,50 +1214,13 @@
1242 1214 return tipc_disconnect(ref);
1243 1215 }
1244 1216  
1245   -int 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   -
1257   -int 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   -
1275   -int tipc_ref_valid(u32 ref)
1276   -{
1277   - /* Works irrespective of type */
1278   - return !!tipc_ref_deref(ref);
1279   -}
1280   -
1281   -
1282 1217 /*
1283 1218 * tipc_port_recv_sections(): Concatenate and deliver sectioned
1284 1219 * message for this node.
1285 1220 */
1286 1221  
1287   -int tipc_port_recv_sections(struct port *sender, unsigned int num_sect,
1288   - struct iovec const *msg_sect)
  1222 +static int tipc_port_recv_sections(struct port *sender, unsigned int num_sect,
  1223 + struct iovec const *msg_sect)
1289 1224 {
1290 1225 struct sk_buff *buf;
1291 1226 int res;
1292 1227  
... ... @@ -1336,65 +1271,16 @@
1336 1271 }
1337 1272  
1338 1273 /**
1339   - * tipc_send_buf - send message buffer on connection
1340   - */
1341   -
1342   -int 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 1274 * tipc_forward2name - forward message sections to port name
1389 1275 */
1390 1276  
1391   -int tipc_forward2name(u32 ref,
1392   - struct tipc_name const *name,
1393   - u32 domain,
1394   - u32 num_sect,
1395   - struct iovec const *msg_sect,
1396   - struct tipc_portid const *orig,
1397   - unsigned int importance)
  1277 +static int tipc_forward2name(u32 ref,
  1278 + struct tipc_name const *name,
  1279 + u32 domain,
  1280 + u32 num_sect,
  1281 + struct iovec const *msg_sect,
  1282 + struct tipc_portid const *orig,
  1283 + unsigned int importance)
1398 1284 {
1399 1285 struct port *p_ptr;
1400 1286 struct tipc_msg *msg;
1401 1287  
... ... @@ -1457,89 +1343,15 @@
1457 1343 }
1458 1344  
1459 1345 /**
1460   - * tipc_forward_buf2name - forward message buffer to port name
1461   - */
1462   -
1463   -int 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   -
1519   -int 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 1346 * tipc_forward2port - forward message sections to port identity
1535 1347 */
1536 1348  
1537   -int tipc_forward2port(u32 ref,
1538   - struct tipc_portid const *dest,
1539   - unsigned int num_sect,
1540   - struct iovec const *msg_sect,
1541   - struct tipc_portid const *orig,
1542   - unsigned int importance)
  1349 +static int tipc_forward2port(u32 ref,
  1350 + struct tipc_portid const *dest,
  1351 + unsigned int num_sect,
  1352 + struct iovec const *msg_sect,
  1353 + struct tipc_portid const *orig,
  1354 + unsigned int importance)
1543 1355 {
1544 1356 struct port *p_ptr;
1545 1357 struct tipc_msg *msg;
... ... @@ -1591,12 +1403,12 @@
1591 1403 /**
1592 1404 * tipc_forward_buf2port - forward message buffer to port identity
1593 1405 */
1594   -int tipc_forward_buf2port(u32 ref,
1595   - struct tipc_portid const *dest,
1596   - struct sk_buff *buf,
1597   - unsigned int dsz,
1598   - struct tipc_portid const *orig,
1599   - unsigned int importance)
  1406 +static int tipc_forward_buf2port(u32 ref,
  1407 + struct tipc_portid const *dest,
  1408 + struct sk_buff *buf,
  1409 + unsigned int dsz,
  1410 + struct tipc_portid const *orig,
  1411 + unsigned int importance)
1600 1412 {
1601 1413 struct port *p_ptr;
1602 1414 struct tipc_msg *msg;
... ... @@ -109,8 +109,6 @@
109 109 extern spinlock_t tipc_port_list_lock;
110 110 struct port_list;
111 111  
112   -int tipc_port_recv_sections(struct port *p_ptr, u32 num_sect,
113   - struct iovec const *msg_sect);
114 112 int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
115 113 struct iovec const *msg_sect, u32 num_sect,
116 114 int err);
... ... @@ -282,23 +282,6 @@
282 282 return NULL;
283 283 }
284 284  
285   -/**
286   - * tipc_ref_unlock - unlock referenced object
287   - */
288   -
289   -void 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 287 * tipc_ref_deref - return pointer referenced object (without locking it)
... ... @@ -44,7 +44,6 @@
44 44 void tipc_ref_discard(u32 ref);
45 45  
46 46 void *tipc_ref_lock(u32 ref);
47   -void tipc_ref_unlock(u32 ref);
48 47 void *tipc_ref_deref(u32 ref);
49 48  
50 49 #endif
... ... @@ -598,12 +598,4 @@
598 598 topsrv.user_ref = 0;
599 599 }
600 600 }
601   -
602   -
603   -int 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   -}
... ... @@ -160,14 +160,4 @@
160 160 }
161 161 return 0;
162 162 }
163   -
164   -
165   -u32 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   -}
... ... @@ -61,7 +61,6 @@
61 61 struct _zone *tipc_zone_create(u32 addr);
62 62 void tipc_zone_delete(struct _zone *z_ptr);
63 63 void tipc_zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr);
64   -u32 tipc_zone_next_node(u32 addr);
65 64  
66 65 static inline struct _zone *tipc_zone_find(u32 addr)
67 66 {