diff options
author | Per Liden <per.liden@ericsson.com> | 2006-01-17 18:38:21 -0500 |
---|---|---|
committer | Per Liden <per.liden@ericsson.com> | 2006-01-17 18:45:16 -0500 |
commit | 4323add67792ced172d0d93b8b2e6187023115f1 (patch) | |
tree | 13224010f6f18029fb710a1e0b48392aea90b486 /net/tipc/node.c | |
parent | 1e63e681e06d438fdc542d40924a4f155d461bbd (diff) |
[TIPC] Avoid polluting the global namespace
This patch adds a tipc_ prefix to all externally visible symbols.
Signed-off-by: Per Liden <per.liden@ericsson.com>
Diffstat (limited to 'net/tipc/node.c')
-rw-r--r-- | net/tipc/node.c | 215 |
1 files changed, 107 insertions, 108 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c index 05688d01138b..6d65010e5fa1 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -45,17 +45,16 @@ | |||
45 | #include "port.h" | 45 | #include "port.h" |
46 | #include "bearer.h" | 46 | #include "bearer.h" |
47 | #include "name_distr.h" | 47 | #include "name_distr.h" |
48 | #include "net.h" | ||
49 | 48 | ||
50 | void node_print(struct print_buf *buf, struct node *n_ptr, char *str); | 49 | void node_print(struct print_buf *buf, struct node *n_ptr, char *str); |
51 | static void node_lost_contact(struct node *n_ptr); | 50 | static void node_lost_contact(struct node *n_ptr); |
52 | static void node_established_contact(struct node *n_ptr); | 51 | static void node_established_contact(struct node *n_ptr); |
53 | 52 | ||
54 | struct node *nodes = NULL; /* sorted list of nodes within cluster */ | 53 | struct node *tipc_nodes = NULL; /* sorted list of nodes within cluster */ |
55 | 54 | ||
56 | u32 tipc_own_tag = 0; | 55 | u32 tipc_own_tag = 0; |
57 | 56 | ||
58 | struct node *node_create(u32 addr) | 57 | struct node *tipc_node_create(u32 addr) |
59 | { | 58 | { |
60 | struct cluster *c_ptr; | 59 | struct cluster *c_ptr; |
61 | struct node *n_ptr; | 60 | struct node *n_ptr; |
@@ -68,16 +67,16 @@ struct node *node_create(u32 addr) | |||
68 | n_ptr->lock = SPIN_LOCK_UNLOCKED; | 67 | n_ptr->lock = SPIN_LOCK_UNLOCKED; |
69 | INIT_LIST_HEAD(&n_ptr->nsub); | 68 | INIT_LIST_HEAD(&n_ptr->nsub); |
70 | 69 | ||
71 | c_ptr = cluster_find(addr); | 70 | c_ptr = tipc_cltr_find(addr); |
72 | if (c_ptr == NULL) | 71 | if (c_ptr == NULL) |
73 | c_ptr = cluster_create(addr); | 72 | c_ptr = tipc_cltr_create(addr); |
74 | if (c_ptr != NULL) { | 73 | if (c_ptr != NULL) { |
75 | n_ptr->owner = c_ptr; | 74 | n_ptr->owner = c_ptr; |
76 | cluster_attach_node(c_ptr, n_ptr); | 75 | tipc_cltr_attach_node(c_ptr, n_ptr); |
77 | n_ptr->last_router = -1; | 76 | n_ptr->last_router = -1; |
78 | 77 | ||
79 | /* Insert node into ordered list */ | 78 | /* Insert node into ordered list */ |
80 | for (curr_node = &nodes; *curr_node; | 79 | for (curr_node = &tipc_nodes; *curr_node; |
81 | curr_node = &(*curr_node)->next) { | 80 | curr_node = &(*curr_node)->next) { |
82 | if (addr < (*curr_node)->addr) { | 81 | if (addr < (*curr_node)->addr) { |
83 | n_ptr->next = *curr_node; | 82 | n_ptr->next = *curr_node; |
@@ -93,13 +92,13 @@ struct node *node_create(u32 addr) | |||
93 | return n_ptr; | 92 | return n_ptr; |
94 | } | 93 | } |
95 | 94 | ||
96 | void node_delete(struct node *n_ptr) | 95 | void tipc_node_delete(struct node *n_ptr) |
97 | { | 96 | { |
98 | if (!n_ptr) | 97 | if (!n_ptr) |
99 | return; | 98 | return; |
100 | 99 | ||
101 | #if 0 | 100 | #if 0 |
102 | /* Not needed because links are already deleted via bearer_stop() */ | 101 | /* Not needed because links are already deleted via tipc_bearer_stop() */ |
103 | 102 | ||
104 | u32 l_num; | 103 | u32 l_num; |
105 | 104 | ||
@@ -114,12 +113,12 @@ void node_delete(struct node *n_ptr) | |||
114 | 113 | ||
115 | 114 | ||
116 | /** | 115 | /** |
117 | * node_link_up - handle addition of link | 116 | * tipc_node_link_up - handle addition of link |
118 | * | 117 | * |
119 | * Link becomes active (alone or shared) or standby, depending on its priority. | 118 | * Link becomes active (alone or shared) or standby, depending on its priority. |
120 | */ | 119 | */ |
121 | 120 | ||
122 | void node_link_up(struct node *n_ptr, struct link *l_ptr) | 121 | void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr) |
123 | { | 122 | { |
124 | struct link **active = &n_ptr->active_links[0]; | 123 | struct link **active = &n_ptr->active_links[0]; |
125 | 124 | ||
@@ -136,7 +135,7 @@ void node_link_up(struct node *n_ptr, struct link *l_ptr) | |||
136 | info("Link is standby\n"); | 135 | info("Link is standby\n"); |
137 | return; | 136 | return; |
138 | } | 137 | } |
139 | link_send_duplicate(active[0], l_ptr); | 138 | tipc_link_send_duplicate(active[0], l_ptr); |
140 | if (l_ptr->priority == active[0]->priority) { | 139 | if (l_ptr->priority == active[0]->priority) { |
141 | active[0] = l_ptr; | 140 | active[0] = l_ptr; |
142 | return; | 141 | return; |
@@ -161,7 +160,7 @@ static void node_select_active_links(struct node *n_ptr) | |||
161 | for (i = 0; i < MAX_BEARERS; i++) { | 160 | for (i = 0; i < MAX_BEARERS; i++) { |
162 | struct link *l_ptr = n_ptr->links[i]; | 161 | struct link *l_ptr = n_ptr->links[i]; |
163 | 162 | ||
164 | if (!l_ptr || !link_is_up(l_ptr) || | 163 | if (!l_ptr || !tipc_link_is_up(l_ptr) || |
165 | (l_ptr->priority < highest_prio)) | 164 | (l_ptr->priority < highest_prio)) |
166 | continue; | 165 | continue; |
167 | 166 | ||
@@ -175,14 +174,14 @@ static void node_select_active_links(struct node *n_ptr) | |||
175 | } | 174 | } |
176 | 175 | ||
177 | /** | 176 | /** |
178 | * node_link_down - handle loss of link | 177 | * tipc_node_link_down - handle loss of link |
179 | */ | 178 | */ |
180 | 179 | ||
181 | void node_link_down(struct node *n_ptr, struct link *l_ptr) | 180 | void tipc_node_link_down(struct node *n_ptr, struct link *l_ptr) |
182 | { | 181 | { |
183 | struct link **active; | 182 | struct link **active; |
184 | 183 | ||
185 | if (!link_is_active(l_ptr)) { | 184 | if (!tipc_link_is_active(l_ptr)) { |
186 | info("Lost standby link <%s> on network plane %c\n", | 185 | info("Lost standby link <%s> on network plane %c\n", |
187 | l_ptr->name, l_ptr->b_ptr->net_plane); | 186 | l_ptr->name, l_ptr->b_ptr->net_plane); |
188 | return; | 187 | return; |
@@ -197,40 +196,40 @@ void node_link_down(struct node *n_ptr, struct link *l_ptr) | |||
197 | active[1] = active[0]; | 196 | active[1] = active[0]; |
198 | if (active[0] == l_ptr) | 197 | if (active[0] == l_ptr) |
199 | node_select_active_links(n_ptr); | 198 | node_select_active_links(n_ptr); |
200 | if (node_is_up(n_ptr)) | 199 | if (tipc_node_is_up(n_ptr)) |
201 | link_changeover(l_ptr); | 200 | tipc_link_changeover(l_ptr); |
202 | else | 201 | else |
203 | node_lost_contact(n_ptr); | 202 | node_lost_contact(n_ptr); |
204 | } | 203 | } |
205 | 204 | ||
206 | int node_has_active_links(struct node *n_ptr) | 205 | int tipc_node_has_active_links(struct node *n_ptr) |
207 | { | 206 | { |
208 | return (n_ptr && | 207 | return (n_ptr && |
209 | ((n_ptr->active_links[0]) || (n_ptr->active_links[1]))); | 208 | ((n_ptr->active_links[0]) || (n_ptr->active_links[1]))); |
210 | } | 209 | } |
211 | 210 | ||
212 | int node_has_redundant_links(struct node *n_ptr) | 211 | int tipc_node_has_redundant_links(struct node *n_ptr) |
213 | { | 212 | { |
214 | return (node_has_active_links(n_ptr) && | 213 | return (tipc_node_has_active_links(n_ptr) && |
215 | (n_ptr->active_links[0] != n_ptr->active_links[1])); | 214 | (n_ptr->active_links[0] != n_ptr->active_links[1])); |
216 | } | 215 | } |
217 | 216 | ||
218 | int node_has_active_routes(struct node *n_ptr) | 217 | int tipc_node_has_active_routes(struct node *n_ptr) |
219 | { | 218 | { |
220 | return (n_ptr && (n_ptr->last_router >= 0)); | 219 | return (n_ptr && (n_ptr->last_router >= 0)); |
221 | } | 220 | } |
222 | 221 | ||
223 | int node_is_up(struct node *n_ptr) | 222 | int tipc_node_is_up(struct node *n_ptr) |
224 | { | 223 | { |
225 | return (node_has_active_links(n_ptr) || node_has_active_routes(n_ptr)); | 224 | return (tipc_node_has_active_links(n_ptr) || tipc_node_has_active_routes(n_ptr)); |
226 | } | 225 | } |
227 | 226 | ||
228 | struct node *node_attach_link(struct link *l_ptr) | 227 | struct node *tipc_node_attach_link(struct link *l_ptr) |
229 | { | 228 | { |
230 | struct node *n_ptr = node_find(l_ptr->addr); | 229 | struct node *n_ptr = tipc_node_find(l_ptr->addr); |
231 | 230 | ||
232 | if (!n_ptr) | 231 | if (!n_ptr) |
233 | n_ptr = node_create(l_ptr->addr); | 232 | n_ptr = tipc_node_create(l_ptr->addr); |
234 | if (n_ptr) { | 233 | if (n_ptr) { |
235 | u32 bearer_id = l_ptr->b_ptr->identity; | 234 | u32 bearer_id = l_ptr->b_ptr->identity; |
236 | char addr_string[16]; | 235 | char addr_string[16]; |
@@ -246,7 +245,7 @@ struct node *node_attach_link(struct link *l_ptr) | |||
246 | 245 | ||
247 | if (!n_ptr->links[bearer_id]) { | 246 | if (!n_ptr->links[bearer_id]) { |
248 | n_ptr->links[bearer_id] = l_ptr; | 247 | n_ptr->links[bearer_id] = l_ptr; |
249 | net.zones[tipc_zone(l_ptr->addr)]->links++; | 248 | tipc_net.zones[tipc_zone(l_ptr->addr)]->links++; |
250 | n_ptr->link_cnt++; | 249 | n_ptr->link_cnt++; |
251 | return n_ptr; | 250 | return n_ptr; |
252 | } | 251 | } |
@@ -257,10 +256,10 @@ struct node *node_attach_link(struct link *l_ptr) | |||
257 | return 0; | 256 | return 0; |
258 | } | 257 | } |
259 | 258 | ||
260 | void node_detach_link(struct node *n_ptr, struct link *l_ptr) | 259 | void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr) |
261 | { | 260 | { |
262 | n_ptr->links[l_ptr->b_ptr->identity] = 0; | 261 | n_ptr->links[l_ptr->b_ptr->identity] = 0; |
263 | net.zones[tipc_zone(l_ptr->addr)]->links--; | 262 | tipc_net.zones[tipc_zone(l_ptr->addr)]->links--; |
264 | n_ptr->link_cnt--; | 263 | n_ptr->link_cnt--; |
265 | } | 264 | } |
266 | 265 | ||
@@ -315,45 +314,45 @@ static void node_established_contact(struct node *n_ptr) | |||
315 | struct cluster *c_ptr; | 314 | struct cluster *c_ptr; |
316 | 315 | ||
317 | dbg("node_established_contact:-> %x\n", n_ptr->addr); | 316 | dbg("node_established_contact:-> %x\n", n_ptr->addr); |
318 | if (!node_has_active_routes(n_ptr)) { | 317 | if (!tipc_node_has_active_routes(n_ptr)) { |
319 | k_signal((Handler)named_node_up, n_ptr->addr); | 318 | tipc_k_signal((Handler)tipc_named_node_up, n_ptr->addr); |
320 | } | 319 | } |
321 | 320 | ||
322 | /* Syncronize broadcast acks */ | 321 | /* Syncronize broadcast acks */ |
323 | n_ptr->bclink.acked = bclink_get_last_sent(); | 322 | n_ptr->bclink.acked = tipc_bclink_get_last_sent(); |
324 | 323 | ||
325 | if (is_slave(tipc_own_addr)) | 324 | if (is_slave(tipc_own_addr)) |
326 | return; | 325 | return; |
327 | if (!in_own_cluster(n_ptr->addr)) { | 326 | if (!in_own_cluster(n_ptr->addr)) { |
328 | /* Usage case 1 (see above) */ | 327 | /* Usage case 1 (see above) */ |
329 | c_ptr = cluster_find(tipc_own_addr); | 328 | c_ptr = tipc_cltr_find(tipc_own_addr); |
330 | if (!c_ptr) | 329 | if (!c_ptr) |
331 | c_ptr = cluster_create(tipc_own_addr); | 330 | c_ptr = tipc_cltr_create(tipc_own_addr); |
332 | if (c_ptr) | 331 | if (c_ptr) |
333 | cluster_bcast_new_route(c_ptr, n_ptr->addr, 1, | 332 | tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1, |
334 | tipc_max_nodes); | 333 | tipc_max_nodes); |
335 | return; | 334 | return; |
336 | } | 335 | } |
337 | 336 | ||
338 | c_ptr = n_ptr->owner; | 337 | c_ptr = n_ptr->owner; |
339 | if (is_slave(n_ptr->addr)) { | 338 | if (is_slave(n_ptr->addr)) { |
340 | /* Usage case 2 (see above) */ | 339 | /* Usage case 2 (see above) */ |
341 | cluster_bcast_new_route(c_ptr, n_ptr->addr, 1, tipc_max_nodes); | 340 | tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1, tipc_max_nodes); |
342 | cluster_send_local_routes(c_ptr, n_ptr->addr); | 341 | tipc_cltr_send_local_routes(c_ptr, n_ptr->addr); |
343 | return; | 342 | return; |
344 | } | 343 | } |
345 | 344 | ||
346 | if (n_ptr->bclink.supported) { | 345 | if (n_ptr->bclink.supported) { |
347 | nmap_add(&cluster_bcast_nodes, n_ptr->addr); | 346 | tipc_nmap_add(&tipc_cltr_bcast_nodes, n_ptr->addr); |
348 | if (n_ptr->addr < tipc_own_addr) | 347 | if (n_ptr->addr < tipc_own_addr) |
349 | tipc_own_tag++; | 348 | tipc_own_tag++; |
350 | } | 349 | } |
351 | 350 | ||
352 | /* Case 3 (see above) */ | 351 | /* Case 3 (see above) */ |
353 | net_send_external_routes(n_ptr->addr); | 352 | tipc_net_send_external_routes(n_ptr->addr); |
354 | cluster_send_slave_routes(c_ptr, n_ptr->addr); | 353 | tipc_cltr_send_slave_routes(c_ptr, n_ptr->addr); |
355 | cluster_bcast_new_route(c_ptr, n_ptr->addr, LOWEST_SLAVE, | 354 | tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, LOWEST_SLAVE, |
356 | highest_allowed_slave); | 355 | tipc_highest_allowed_slave); |
357 | } | 356 | } |
358 | 357 | ||
359 | static void node_lost_contact(struct node *n_ptr) | 358 | static void node_lost_contact(struct node *n_ptr) |
@@ -375,39 +374,39 @@ static void node_lost_contact(struct node *n_ptr) | |||
375 | n_ptr->bclink.defragm = NULL; | 374 | n_ptr->bclink.defragm = NULL; |
376 | } | 375 | } |
377 | if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) { | 376 | if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) { |
378 | bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000)); | 377 | tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000)); |
379 | } | 378 | } |
380 | 379 | ||
381 | /* Update routing tables */ | 380 | /* Update routing tables */ |
382 | if (is_slave(tipc_own_addr)) { | 381 | if (is_slave(tipc_own_addr)) { |
383 | net_remove_as_router(n_ptr->addr); | 382 | tipc_net_remove_as_router(n_ptr->addr); |
384 | } else { | 383 | } else { |
385 | if (!in_own_cluster(n_ptr->addr)) { | 384 | if (!in_own_cluster(n_ptr->addr)) { |
386 | /* Case 4 (see above) */ | 385 | /* Case 4 (see above) */ |
387 | c_ptr = cluster_find(tipc_own_addr); | 386 | c_ptr = tipc_cltr_find(tipc_own_addr); |
388 | cluster_bcast_lost_route(c_ptr, n_ptr->addr, 1, | 387 | tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1, |
389 | tipc_max_nodes); | 388 | tipc_max_nodes); |
390 | } else { | 389 | } else { |
391 | /* Case 5 (see above) */ | 390 | /* Case 5 (see above) */ |
392 | c_ptr = cluster_find(n_ptr->addr); | 391 | c_ptr = tipc_cltr_find(n_ptr->addr); |
393 | if (is_slave(n_ptr->addr)) { | 392 | if (is_slave(n_ptr->addr)) { |
394 | cluster_bcast_lost_route(c_ptr, n_ptr->addr, 1, | 393 | tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1, |
395 | tipc_max_nodes); | 394 | tipc_max_nodes); |
396 | } else { | 395 | } else { |
397 | if (n_ptr->bclink.supported) { | 396 | if (n_ptr->bclink.supported) { |
398 | nmap_remove(&cluster_bcast_nodes, | 397 | tipc_nmap_remove(&tipc_cltr_bcast_nodes, |
399 | n_ptr->addr); | 398 | n_ptr->addr); |
400 | if (n_ptr->addr < tipc_own_addr) | 399 | if (n_ptr->addr < tipc_own_addr) |
401 | tipc_own_tag--; | 400 | tipc_own_tag--; |
402 | } | 401 | } |
403 | net_remove_as_router(n_ptr->addr); | 402 | tipc_net_remove_as_router(n_ptr->addr); |
404 | cluster_bcast_lost_route(c_ptr, n_ptr->addr, | 403 | tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, |
405 | LOWEST_SLAVE, | 404 | LOWEST_SLAVE, |
406 | highest_allowed_slave); | 405 | tipc_highest_allowed_slave); |
407 | } | 406 | } |
408 | } | 407 | } |
409 | } | 408 | } |
410 | if (node_has_active_routes(n_ptr)) | 409 | if (tipc_node_has_active_routes(n_ptr)) |
411 | return; | 410 | return; |
412 | 411 | ||
413 | info("Lost contact with %s\n", | 412 | info("Lost contact with %s\n", |
@@ -420,35 +419,35 @@ static void node_lost_contact(struct node *n_ptr) | |||
420 | continue; | 419 | continue; |
421 | l_ptr->reset_checkpoint = l_ptr->next_in_no; | 420 | l_ptr->reset_checkpoint = l_ptr->next_in_no; |
422 | l_ptr->exp_msg_count = 0; | 421 | l_ptr->exp_msg_count = 0; |
423 | link_reset_fragments(l_ptr); | 422 | tipc_link_reset_fragments(l_ptr); |
424 | } | 423 | } |
425 | 424 | ||
426 | /* Notify subscribers */ | 425 | /* Notify subscribers */ |
427 | list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) { | 426 | list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) { |
428 | ns->node = 0; | 427 | ns->node = 0; |
429 | list_del_init(&ns->nodesub_list); | 428 | list_del_init(&ns->nodesub_list); |
430 | k_signal((Handler)ns->handle_node_down, | 429 | tipc_k_signal((Handler)ns->handle_node_down, |
431 | (unsigned long)ns->usr_handle); | 430 | (unsigned long)ns->usr_handle); |
432 | } | 431 | } |
433 | } | 432 | } |
434 | 433 | ||
435 | /** | 434 | /** |
436 | * node_select_next_hop - find the next-hop node for a message | 435 | * tipc_node_select_next_hop - find the next-hop node for a message |
437 | * | 436 | * |
438 | * Called by when cluster local lookup has failed. | 437 | * Called by when cluster local lookup has failed. |
439 | */ | 438 | */ |
440 | 439 | ||
441 | struct node *node_select_next_hop(u32 addr, u32 selector) | 440 | struct node *tipc_node_select_next_hop(u32 addr, u32 selector) |
442 | { | 441 | { |
443 | struct node *n_ptr; | 442 | struct node *n_ptr; |
444 | u32 router_addr; | 443 | u32 router_addr; |
445 | 444 | ||
446 | if (!addr_domain_valid(addr)) | 445 | if (!tipc_addr_domain_valid(addr)) |
447 | return 0; | 446 | return 0; |
448 | 447 | ||
449 | /* Look for direct link to destination processsor */ | 448 | /* Look for direct link to destination processsor */ |
450 | n_ptr = node_find(addr); | 449 | n_ptr = tipc_node_find(addr); |
451 | if (n_ptr && node_has_active_links(n_ptr)) | 450 | if (n_ptr && tipc_node_has_active_links(n_ptr)) |
452 | return n_ptr; | 451 | return n_ptr; |
453 | 452 | ||
454 | /* Cluster local system nodes *must* have direct links */ | 453 | /* Cluster local system nodes *must* have direct links */ |
@@ -456,9 +455,9 @@ struct node *node_select_next_hop(u32 addr, u32 selector) | |||
456 | return 0; | 455 | return 0; |
457 | 456 | ||
458 | /* Look for cluster local router with direct link to node */ | 457 | /* Look for cluster local router with direct link to node */ |
459 | router_addr = node_select_router(n_ptr, selector); | 458 | router_addr = tipc_node_select_router(n_ptr, selector); |
460 | if (router_addr) | 459 | if (router_addr) |
461 | return node_select(router_addr, selector); | 460 | return tipc_node_select(router_addr, selector); |
462 | 461 | ||
463 | /* Slave nodes can only be accessed within own cluster via a | 462 | /* Slave nodes can only be accessed within own cluster via a |
464 | known router with direct link -- if no router was found,give up */ | 463 | known router with direct link -- if no router was found,give up */ |
@@ -467,25 +466,25 @@ struct node *node_select_next_hop(u32 addr, u32 selector) | |||
467 | 466 | ||
468 | /* Inter zone/cluster -- find any direct link to remote cluster */ | 467 | /* Inter zone/cluster -- find any direct link to remote cluster */ |
469 | addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0); | 468 | addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0); |
470 | n_ptr = net_select_remote_node(addr, selector); | 469 | n_ptr = tipc_net_select_remote_node(addr, selector); |
471 | if (n_ptr && node_has_active_links(n_ptr)) | 470 | if (n_ptr && tipc_node_has_active_links(n_ptr)) |
472 | return n_ptr; | 471 | return n_ptr; |
473 | 472 | ||
474 | /* Last resort -- look for any router to anywhere in remote zone */ | 473 | /* Last resort -- look for any router to anywhere in remote zone */ |
475 | router_addr = net_select_router(addr, selector); | 474 | router_addr = tipc_net_select_router(addr, selector); |
476 | if (router_addr) | 475 | if (router_addr) |
477 | return node_select(router_addr, selector); | 476 | return tipc_node_select(router_addr, selector); |
478 | 477 | ||
479 | return 0; | 478 | return 0; |
480 | } | 479 | } |
481 | 480 | ||
482 | /** | 481 | /** |
483 | * node_select_router - select router to reach specified node | 482 | * tipc_node_select_router - select router to reach specified node |
484 | * | 483 | * |
485 | * Uses a deterministic and fair algorithm for selecting router node. | 484 | * Uses a deterministic and fair algorithm for selecting router node. |
486 | */ | 485 | */ |
487 | 486 | ||
488 | u32 node_select_router(struct node *n_ptr, u32 ref) | 487 | u32 tipc_node_select_router(struct node *n_ptr, u32 ref) |
489 | { | 488 | { |
490 | u32 ulim; | 489 | u32 ulim; |
491 | u32 mask; | 490 | u32 mask; |
@@ -523,7 +522,7 @@ u32 node_select_router(struct node *n_ptr, u32 ref) | |||
523 | return tipc_addr(own_zone(), own_cluster(), r); | 522 | return tipc_addr(own_zone(), own_cluster(), r); |
524 | } | 523 | } |
525 | 524 | ||
526 | void node_add_router(struct node *n_ptr, u32 router) | 525 | void tipc_node_add_router(struct node *n_ptr, u32 router) |
527 | { | 526 | { |
528 | u32 r_num = tipc_node(router); | 527 | u32 r_num = tipc_node(router); |
529 | 528 | ||
@@ -534,7 +533,7 @@ void node_add_router(struct node *n_ptr, u32 router) | |||
534 | !n_ptr->routers[n_ptr->last_router]); | 533 | !n_ptr->routers[n_ptr->last_router]); |
535 | } | 534 | } |
536 | 535 | ||
537 | void node_remove_router(struct node *n_ptr, u32 router) | 536 | void tipc_node_remove_router(struct node *n_ptr, u32 router) |
538 | { | 537 | { |
539 | u32 r_num = tipc_node(router); | 538 | u32 r_num = tipc_node(router); |
540 | 539 | ||
@@ -547,7 +546,7 @@ void node_remove_router(struct node *n_ptr, u32 router) | |||
547 | while ((--n_ptr->last_router >= 0) && | 546 | while ((--n_ptr->last_router >= 0) && |
548 | !n_ptr->routers[n_ptr->last_router]); | 547 | !n_ptr->routers[n_ptr->last_router]); |
549 | 548 | ||
550 | if (!node_is_up(n_ptr)) | 549 | if (!tipc_node_is_up(n_ptr)) |
551 | node_lost_contact(n_ptr); | 550 | node_lost_contact(n_ptr); |
552 | } | 551 | } |
553 | 552 | ||
@@ -572,16 +571,16 @@ u32 tipc_available_nodes(const u32 domain) | |||
572 | struct node *n_ptr; | 571 | struct node *n_ptr; |
573 | u32 cnt = 0; | 572 | u32 cnt = 0; |
574 | 573 | ||
575 | for (n_ptr = nodes; n_ptr; n_ptr = n_ptr->next) { | 574 | for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) { |
576 | if (!in_scope(domain, n_ptr->addr)) | 575 | if (!in_scope(domain, n_ptr->addr)) |
577 | continue; | 576 | continue; |
578 | if (node_is_up(n_ptr)) | 577 | if (tipc_node_is_up(n_ptr)) |
579 | cnt++; | 578 | cnt++; |
580 | } | 579 | } |
581 | return cnt; | 580 | return cnt; |
582 | } | 581 | } |
583 | 582 | ||
584 | struct sk_buff *node_get_nodes(const void *req_tlv_area, int req_tlv_space) | 583 | struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) |
585 | { | 584 | { |
586 | u32 domain; | 585 | u32 domain; |
587 | struct sk_buff *buf; | 586 | struct sk_buff *buf; |
@@ -589,40 +588,40 @@ struct sk_buff *node_get_nodes(const void *req_tlv_area, int req_tlv_space) | |||
589 | struct tipc_node_info node_info; | 588 | struct tipc_node_info node_info; |
590 | 589 | ||
591 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) | 590 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) |
592 | return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 591 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
593 | 592 | ||
594 | domain = *(u32 *)TLV_DATA(req_tlv_area); | 593 | domain = *(u32 *)TLV_DATA(req_tlv_area); |
595 | domain = ntohl(domain); | 594 | domain = ntohl(domain); |
596 | if (!addr_domain_valid(domain)) | 595 | if (!tipc_addr_domain_valid(domain)) |
597 | return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 596 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
598 | " (network address)"); | 597 | " (network address)"); |
599 | 598 | ||
600 | if (!nodes) | 599 | if (!tipc_nodes) |
601 | return cfg_reply_none(); | 600 | return tipc_cfg_reply_none(); |
602 | 601 | ||
603 | /* For now, get space for all other nodes | 602 | /* For now, get space for all other nodes |
604 | (will need to modify this when slave nodes are supported */ | 603 | (will need to modify this when slave nodes are supported */ |
605 | 604 | ||
606 | buf = cfg_reply_alloc(TLV_SPACE(sizeof(node_info)) * | 605 | buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(node_info)) * |
607 | (tipc_max_nodes - 1)); | 606 | (tipc_max_nodes - 1)); |
608 | if (!buf) | 607 | if (!buf) |
609 | return NULL; | 608 | return NULL; |
610 | 609 | ||
611 | /* Add TLVs for all nodes in scope */ | 610 | /* Add TLVs for all nodes in scope */ |
612 | 611 | ||
613 | for (n_ptr = nodes; n_ptr; n_ptr = n_ptr->next) { | 612 | for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) { |
614 | if (!in_scope(domain, n_ptr->addr)) | 613 | if (!in_scope(domain, n_ptr->addr)) |
615 | continue; | 614 | continue; |
616 | node_info.addr = htonl(n_ptr->addr); | 615 | node_info.addr = htonl(n_ptr->addr); |
617 | node_info.up = htonl(node_is_up(n_ptr)); | 616 | node_info.up = htonl(tipc_node_is_up(n_ptr)); |
618 | cfg_append_tlv(buf, TIPC_TLV_NODE_INFO, | 617 | tipc_cfg_append_tlv(buf, TIPC_TLV_NODE_INFO, |
619 | &node_info, sizeof(node_info)); | 618 | &node_info, sizeof(node_info)); |
620 | } | 619 | } |
621 | 620 | ||
622 | return buf; | 621 | return buf; |
623 | } | 622 | } |
624 | 623 | ||
625 | struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space) | 624 | struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) |
626 | { | 625 | { |
627 | u32 domain; | 626 | u32 domain; |
628 | struct sk_buff *buf; | 627 | struct sk_buff *buf; |
@@ -630,22 +629,22 @@ struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space) | |||
630 | struct tipc_link_info link_info; | 629 | struct tipc_link_info link_info; |
631 | 630 | ||
632 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) | 631 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) |
633 | return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 632 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
634 | 633 | ||
635 | domain = *(u32 *)TLV_DATA(req_tlv_area); | 634 | domain = *(u32 *)TLV_DATA(req_tlv_area); |
636 | domain = ntohl(domain); | 635 | domain = ntohl(domain); |
637 | if (!addr_domain_valid(domain)) | 636 | if (!tipc_addr_domain_valid(domain)) |
638 | return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 637 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
639 | " (network address)"); | 638 | " (network address)"); |
640 | 639 | ||
641 | if (!nodes) | 640 | if (!tipc_nodes) |
642 | return cfg_reply_none(); | 641 | return tipc_cfg_reply_none(); |
643 | 642 | ||
644 | /* For now, get space for 2 links to all other nodes + bcast link | 643 | /* For now, get space for 2 links to all other nodes + bcast link |
645 | (will need to modify this when slave nodes are supported */ | 644 | (will need to modify this when slave nodes are supported */ |
646 | 645 | ||
647 | buf = cfg_reply_alloc(TLV_SPACE(sizeof(link_info)) * | 646 | buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(link_info)) * |
648 | (2 * (tipc_max_nodes - 1) + 1)); | 647 | (2 * (tipc_max_nodes - 1) + 1)); |
649 | if (!buf) | 648 | if (!buf) |
650 | return NULL; | 649 | return NULL; |
651 | 650 | ||
@@ -654,12 +653,12 @@ struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space) | |||
654 | link_info.dest = tipc_own_addr & 0xfffff00; | 653 | link_info.dest = tipc_own_addr & 0xfffff00; |
655 | link_info.dest = htonl(link_info.dest); | 654 | link_info.dest = htonl(link_info.dest); |
656 | link_info.up = htonl(1); | 655 | link_info.up = htonl(1); |
657 | sprintf(link_info.str, bc_link_name); | 656 | sprintf(link_info.str, tipc_bclink_name); |
658 | cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); | 657 | tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); |
659 | 658 | ||
660 | /* Add TLVs for any other links in scope */ | 659 | /* Add TLVs for any other links in scope */ |
661 | 660 | ||
662 | for (n_ptr = nodes; n_ptr; n_ptr = n_ptr->next) { | 661 | for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) { |
663 | u32 i; | 662 | u32 i; |
664 | 663 | ||
665 | if (!in_scope(domain, n_ptr->addr)) | 664 | if (!in_scope(domain, n_ptr->addr)) |
@@ -668,10 +667,10 @@ struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space) | |||
668 | if (!n_ptr->links[i]) | 667 | if (!n_ptr->links[i]) |
669 | continue; | 668 | continue; |
670 | link_info.dest = htonl(n_ptr->addr); | 669 | link_info.dest = htonl(n_ptr->addr); |
671 | link_info.up = htonl(link_is_up(n_ptr->links[i])); | 670 | link_info.up = htonl(tipc_link_is_up(n_ptr->links[i])); |
672 | strcpy(link_info.str, n_ptr->links[i]->name); | 671 | strcpy(link_info.str, n_ptr->links[i]->name); |
673 | cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, | 672 | tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, |
674 | &link_info, sizeof(link_info)); | 673 | &link_info, sizeof(link_info)); |
675 | } | 674 | } |
676 | } | 675 | } |
677 | 676 | ||