aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/bearer.c
diff options
context:
space:
mode:
authorPer Liden <per.liden@ericsson.com>2006-01-17 18:38:21 -0500
committerPer Liden <per.liden@ericsson.com>2006-01-17 18:45:16 -0500
commit4323add67792ced172d0d93b8b2e6187023115f1 (patch)
tree13224010f6f18029fb710a1e0b48392aea90b486 /net/tipc/bearer.c
parent1e63e681e06d438fdc542d40924a4f155d461bbd (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/bearer.c')
-rw-r--r--net/tipc/bearer.c170
1 files changed, 85 insertions, 85 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 02b6cf6ab7a4..64dcb0f3a8b2 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -48,7 +48,7 @@
48static struct media *media_list = 0; 48static struct media *media_list = 0;
49static u32 media_count = 0; 49static u32 media_count = 0;
50 50
51struct bearer *bearers = 0; 51struct bearer *tipc_bearers = 0;
52 52
53/** 53/**
54 * media_name_valid - validate media name 54 * media_name_valid - validate media name
@@ -107,7 +107,7 @@ int tipc_register_media(u32 media_type,
107 u32 i; 107 u32 i;
108 int res = -EINVAL; 108 int res = -EINVAL;
109 109
110 write_lock_bh(&net_lock); 110 write_lock_bh(&tipc_net_lock);
111 if (!media_list) 111 if (!media_list)
112 goto exit; 112 goto exit;
113 113
@@ -165,15 +165,15 @@ int tipc_register_media(u32 media_type,
165 dbg("Media <%s> registered\n", name); 165 dbg("Media <%s> registered\n", name);
166 res = 0; 166 res = 0;
167exit: 167exit:
168 write_unlock_bh(&net_lock); 168 write_unlock_bh(&tipc_net_lock);
169 return res; 169 return res;
170} 170}
171 171
172/** 172/**
173 * media_addr_printf - record media address in print buffer 173 * tipc_media_addr_printf - record media address in print buffer
174 */ 174 */
175 175
176void media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a) 176void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a)
177{ 177{
178 struct media *m_ptr; 178 struct media *m_ptr;
179 u32 media_type; 179 u32 media_type;
@@ -201,25 +201,25 @@ void media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a)
201} 201}
202 202
203/** 203/**
204 * media_get_names - record names of registered media in buffer 204 * tipc_media_get_names - record names of registered media in buffer
205 */ 205 */
206 206
207struct sk_buff *media_get_names(void) 207struct sk_buff *tipc_media_get_names(void)
208{ 208{
209 struct sk_buff *buf; 209 struct sk_buff *buf;
210 struct media *m_ptr; 210 struct media *m_ptr;
211 int i; 211 int i;
212 212
213 buf = cfg_reply_alloc(MAX_MEDIA * TLV_SPACE(TIPC_MAX_MEDIA_NAME)); 213 buf = tipc_cfg_reply_alloc(MAX_MEDIA * TLV_SPACE(TIPC_MAX_MEDIA_NAME));
214 if (!buf) 214 if (!buf)
215 return NULL; 215 return NULL;
216 216
217 read_lock_bh(&net_lock); 217 read_lock_bh(&tipc_net_lock);
218 for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) { 218 for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) {
219 cfg_append_tlv(buf, TIPC_TLV_MEDIA_NAME, m_ptr->name, 219 tipc_cfg_append_tlv(buf, TIPC_TLV_MEDIA_NAME, m_ptr->name,
220 strlen(m_ptr->name) + 1); 220 strlen(m_ptr->name) + 1);
221 } 221 }
222 read_unlock_bh(&net_lock); 222 read_unlock_bh(&tipc_net_lock);
223 return buf; 223 return buf;
224} 224}
225 225
@@ -283,7 +283,7 @@ static struct bearer *bearer_find(const char *name)
283 struct bearer *b_ptr; 283 struct bearer *b_ptr;
284 u32 i; 284 u32 i;
285 285
286 for (i = 0, b_ptr = bearers; i < MAX_BEARERS; i++, b_ptr++) { 286 for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) {
287 if (b_ptr->active && (!strcmp(b_ptr->publ.name, name))) 287 if (b_ptr->active && (!strcmp(b_ptr->publ.name, name)))
288 return b_ptr; 288 return b_ptr;
289 } 289 }
@@ -291,16 +291,16 @@ static struct bearer *bearer_find(const char *name)
291} 291}
292 292
293/** 293/**
294 * bearer_find - locates bearer object with matching interface name 294 * tipc_bearer_find_interface - locates bearer object with matching interface name
295 */ 295 */
296 296
297struct bearer *bearer_find_interface(const char *if_name) 297struct bearer *tipc_bearer_find_interface(const char *if_name)
298{ 298{
299 struct bearer *b_ptr; 299 struct bearer *b_ptr;
300 char *b_if_name; 300 char *b_if_name;
301 u32 i; 301 u32 i;
302 302
303 for (i = 0, b_ptr = bearers; i < MAX_BEARERS; i++, b_ptr++) { 303 for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) {
304 if (!b_ptr->active) 304 if (!b_ptr->active)
305 continue; 305 continue;
306 b_if_name = strchr(b_ptr->publ.name, ':') + 1; 306 b_if_name = strchr(b_ptr->publ.name, ':') + 1;
@@ -311,54 +311,54 @@ struct bearer *bearer_find_interface(const char *if_name)
311} 311}
312 312
313/** 313/**
314 * bearer_get_names - record names of bearers in buffer 314 * tipc_bearer_get_names - record names of bearers in buffer
315 */ 315 */
316 316
317struct sk_buff *bearer_get_names(void) 317struct sk_buff *tipc_bearer_get_names(void)
318{ 318{
319 struct sk_buff *buf; 319 struct sk_buff *buf;
320 struct media *m_ptr; 320 struct media *m_ptr;
321 struct bearer *b_ptr; 321 struct bearer *b_ptr;
322 int i, j; 322 int i, j;
323 323
324 buf = cfg_reply_alloc(MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME)); 324 buf = tipc_cfg_reply_alloc(MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME));
325 if (!buf) 325 if (!buf)
326 return NULL; 326 return NULL;
327 327
328 read_lock_bh(&net_lock); 328 read_lock_bh(&tipc_net_lock);
329 for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) { 329 for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) {
330 for (j = 0; j < MAX_BEARERS; j++) { 330 for (j = 0; j < MAX_BEARERS; j++) {
331 b_ptr = &bearers[j]; 331 b_ptr = &tipc_bearers[j];
332 if (b_ptr->active && (b_ptr->media == m_ptr)) { 332 if (b_ptr->active && (b_ptr->media == m_ptr)) {
333 cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME, 333 tipc_cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME,
334 b_ptr->publ.name, 334 b_ptr->publ.name,
335 strlen(b_ptr->publ.name) + 1); 335 strlen(b_ptr->publ.name) + 1);
336 } 336 }
337 } 337 }
338 } 338 }
339 read_unlock_bh(&net_lock); 339 read_unlock_bh(&tipc_net_lock);
340 return buf; 340 return buf;
341} 341}
342 342
343void bearer_add_dest(struct bearer *b_ptr, u32 dest) 343void tipc_bearer_add_dest(struct bearer *b_ptr, u32 dest)
344{ 344{
345 nmap_add(&b_ptr->nodes, dest); 345 tipc_nmap_add(&b_ptr->nodes, dest);
346 disc_update_link_req(b_ptr->link_req); 346 tipc_disc_update_link_req(b_ptr->link_req);
347 bcbearer_sort(); 347 tipc_bcbearer_sort();
348} 348}
349 349
350void bearer_remove_dest(struct bearer *b_ptr, u32 dest) 350void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest)
351{ 351{
352 nmap_remove(&b_ptr->nodes, dest); 352 tipc_nmap_remove(&b_ptr->nodes, dest);
353 disc_update_link_req(b_ptr->link_req); 353 tipc_disc_update_link_req(b_ptr->link_req);
354 bcbearer_sort(); 354 tipc_bcbearer_sort();
355} 355}
356 356
357/* 357/*
358 * bearer_push(): Resolve bearer congestion. Force the waiting 358 * bearer_push(): Resolve bearer congestion. Force the waiting
359 * links to push out their unsent packets, one packet per link 359 * links to push out their unsent packets, one packet per link
360 * per iteration, until all packets are gone or congestion reoccurs. 360 * per iteration, until all packets are gone or congestion reoccurs.
361 * 'net_lock' is read_locked when this function is called 361 * 'tipc_net_lock' is read_locked when this function is called
362 * bearer.lock must be taken before calling 362 * bearer.lock must be taken before calling
363 * Returns binary true(1) ore false(0) 363 * Returns binary true(1) ore false(0)
364 */ 364 */
@@ -372,7 +372,7 @@ static int bearer_push(struct bearer *b_ptr)
372 372
373 while (!list_empty(&b_ptr->cong_links) && (res != PUSH_FAILED)) { 373 while (!list_empty(&b_ptr->cong_links) && (res != PUSH_FAILED)) {
374 list_for_each_entry_safe(ln, tln, &b_ptr->cong_links, link_list) { 374 list_for_each_entry_safe(ln, tln, &b_ptr->cong_links, link_list) {
375 res = link_push_packet(ln); 375 res = tipc_link_push_packet(ln);
376 if (res == PUSH_FAILED) 376 if (res == PUSH_FAILED)
377 break; 377 break;
378 if (res == PUSH_FINISHED) 378 if (res == PUSH_FINISHED)
@@ -382,7 +382,7 @@ static int bearer_push(struct bearer *b_ptr)
382 return list_empty(&b_ptr->cong_links); 382 return list_empty(&b_ptr->cong_links);
383} 383}
384 384
385void bearer_lock_push(struct bearer *b_ptr) 385void tipc_bearer_lock_push(struct bearer *b_ptr)
386{ 386{
387 int res; 387 int res;
388 388
@@ -390,7 +390,7 @@ void bearer_lock_push(struct bearer *b_ptr)
390 res = bearer_push(b_ptr); 390 res = bearer_push(b_ptr);
391 spin_unlock_bh(&b_ptr->publ.lock); 391 spin_unlock_bh(&b_ptr->publ.lock);
392 if (res) 392 if (res)
393 bcbearer_push(); 393 tipc_bcbearer_push();
394} 394}
395 395
396 396
@@ -405,7 +405,7 @@ void tipc_continue(struct tipc_bearer *tb_ptr)
405 spin_lock_bh(&b_ptr->publ.lock); 405 spin_lock_bh(&b_ptr->publ.lock);
406 b_ptr->continue_count++; 406 b_ptr->continue_count++;
407 if (!list_empty(&b_ptr->cong_links)) 407 if (!list_empty(&b_ptr->cong_links))
408 k_signal((Handler)bearer_lock_push, (unsigned long)b_ptr); 408 tipc_k_signal((Handler)tipc_bearer_lock_push, (unsigned long)b_ptr);
409 b_ptr->publ.blocked = 0; 409 b_ptr->publ.blocked = 0;
410 spin_unlock_bh(&b_ptr->publ.lock); 410 spin_unlock_bh(&b_ptr->publ.lock);
411} 411}
@@ -414,11 +414,11 @@ void tipc_continue(struct tipc_bearer *tb_ptr)
414 * Schedule link for sending of messages after the bearer 414 * Schedule link for sending of messages after the bearer
415 * has been deblocked by 'continue()'. This method is called 415 * has been deblocked by 'continue()'. This method is called
416 * when somebody tries to send a message via this link while 416 * when somebody tries to send a message via this link while
417 * the bearer is congested. 'net_lock' is in read_lock here 417 * the bearer is congested. 'tipc_net_lock' is in read_lock here
418 * bearer.lock is busy 418 * bearer.lock is busy
419 */ 419 */
420 420
421static void bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_ptr) 421static void tipc_bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_ptr)
422{ 422{
423 list_move_tail(&l_ptr->link_list, &b_ptr->cong_links); 423 list_move_tail(&l_ptr->link_list, &b_ptr->cong_links);
424} 424}
@@ -427,24 +427,24 @@ static void bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_ptr)
427 * Schedule link for sending of messages after the bearer 427 * Schedule link for sending of messages after the bearer
428 * has been deblocked by 'continue()'. This method is called 428 * has been deblocked by 'continue()'. This method is called
429 * when somebody tries to send a message via this link while 429 * when somebody tries to send a message via this link while
430 * the bearer is congested. 'net_lock' is in read_lock here, 430 * the bearer is congested. 'tipc_net_lock' is in read_lock here,
431 * bearer.lock is free 431 * bearer.lock is free
432 */ 432 */
433 433
434void bearer_schedule(struct bearer *b_ptr, struct link *l_ptr) 434void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr)
435{ 435{
436 spin_lock_bh(&b_ptr->publ.lock); 436 spin_lock_bh(&b_ptr->publ.lock);
437 bearer_schedule_unlocked(b_ptr, l_ptr); 437 tipc_bearer_schedule_unlocked(b_ptr, l_ptr);
438 spin_unlock_bh(&b_ptr->publ.lock); 438 spin_unlock_bh(&b_ptr->publ.lock);
439} 439}
440 440
441 441
442/* 442/*
443 * bearer_resolve_congestion(): Check if there is bearer congestion, 443 * tipc_bearer_resolve_congestion(): Check if there is bearer congestion,
444 * and if there is, try to resolve it before returning. 444 * and if there is, try to resolve it before returning.
445 * 'net_lock' is read_locked when this function is called 445 * 'tipc_net_lock' is read_locked when this function is called
446 */ 446 */
447int bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr) 447int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr)
448{ 448{
449 int res = 1; 449 int res = 1;
450 450
@@ -452,7 +452,7 @@ int bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr)
452 return 1; 452 return 1;
453 spin_lock_bh(&b_ptr->publ.lock); 453 spin_lock_bh(&b_ptr->publ.lock);
454 if (!bearer_push(b_ptr)) { 454 if (!bearer_push(b_ptr)) {
455 bearer_schedule_unlocked(b_ptr, l_ptr); 455 tipc_bearer_schedule_unlocked(b_ptr, l_ptr);
456 res = 0; 456 res = 0;
457 } 457 }
458 spin_unlock_bh(&b_ptr->publ.lock); 458 spin_unlock_bh(&b_ptr->publ.lock);
@@ -479,7 +479,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
479 return -ENOPROTOOPT; 479 return -ENOPROTOOPT;
480 480
481 if (!bearer_name_validate(name, &b_name) || 481 if (!bearer_name_validate(name, &b_name) ||
482 !addr_domain_valid(bcast_scope) || 482 !tipc_addr_domain_valid(bcast_scope) ||
483 !in_scope(bcast_scope, tipc_own_addr)) 483 !in_scope(bcast_scope, tipc_own_addr))
484 return -EINVAL; 484 return -EINVAL;
485 485
@@ -488,8 +488,8 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
488 (priority != TIPC_MEDIA_LINK_PRI)) 488 (priority != TIPC_MEDIA_LINK_PRI))
489 return -EINVAL; 489 return -EINVAL;
490 490
491 write_lock_bh(&net_lock); 491 write_lock_bh(&tipc_net_lock);
492 if (!bearers) 492 if (!tipc_bearers)
493 goto failed; 493 goto failed;
494 494
495 m_ptr = media_find(b_name.media_name); 495 m_ptr = media_find(b_name.media_name);
@@ -505,15 +505,15 @@ restart:
505 bearer_id = MAX_BEARERS; 505 bearer_id = MAX_BEARERS;
506 with_this_prio = 1; 506 with_this_prio = 1;
507 for (i = MAX_BEARERS; i-- != 0; ) { 507 for (i = MAX_BEARERS; i-- != 0; ) {
508 if (!bearers[i].active) { 508 if (!tipc_bearers[i].active) {
509 bearer_id = i; 509 bearer_id = i;
510 continue; 510 continue;
511 } 511 }
512 if (!strcmp(name, bearers[i].publ.name)) { 512 if (!strcmp(name, tipc_bearers[i].publ.name)) {
513 warn("Bearer <%s> already enabled\n", name); 513 warn("Bearer <%s> already enabled\n", name);
514 goto failed; 514 goto failed;
515 } 515 }
516 if ((bearers[i].priority == priority) && 516 if ((tipc_bearers[i].priority == priority) &&
517 (++with_this_prio > 2)) { 517 (++with_this_prio > 2)) {
518 if (priority-- == 0) { 518 if (priority-- == 0) {
519 warn("Third bearer <%s> with priority %u, unable to lower to %u\n", 519 warn("Third bearer <%s> with priority %u, unable to lower to %u\n",
@@ -530,7 +530,7 @@ restart:
530 goto failed; 530 goto failed;
531 } 531 }
532 532
533 b_ptr = &bearers[bearer_id]; 533 b_ptr = &tipc_bearers[bearer_id];
534 memset(b_ptr, 0, sizeof(struct bearer)); 534 memset(b_ptr, 0, sizeof(struct bearer));
535 535
536 strcpy(b_ptr->publ.name, name); 536 strcpy(b_ptr->publ.name, name);
@@ -549,16 +549,16 @@ restart:
549 INIT_LIST_HEAD(&b_ptr->cong_links); 549 INIT_LIST_HEAD(&b_ptr->cong_links);
550 INIT_LIST_HEAD(&b_ptr->links); 550 INIT_LIST_HEAD(&b_ptr->links);
551 if (m_ptr->bcast) { 551 if (m_ptr->bcast) {
552 b_ptr->link_req = disc_init_link_req(b_ptr, &m_ptr->bcast_addr, 552 b_ptr->link_req = tipc_disc_init_link_req(b_ptr, &m_ptr->bcast_addr,
553 bcast_scope, 2); 553 bcast_scope, 2);
554 } 554 }
555 b_ptr->publ.lock = SPIN_LOCK_UNLOCKED; 555 b_ptr->publ.lock = SPIN_LOCK_UNLOCKED;
556 write_unlock_bh(&net_lock); 556 write_unlock_bh(&tipc_net_lock);
557 info("Enabled bearer <%s>, discovery domain %s, priority %u\n", 557 info("Enabled bearer <%s>, discovery domain %s, priority %u\n",
558 name, addr_string_fill(addr_string, bcast_scope), priority); 558 name, addr_string_fill(addr_string, bcast_scope), priority);
559 return 0; 559 return 0;
560failed: 560failed:
561 write_unlock_bh(&net_lock); 561 write_unlock_bh(&tipc_net_lock);
562 return res; 562 return res;
563} 563}
564 564
@@ -576,11 +576,11 @@ int tipc_block_bearer(const char *name)
576 if (tipc_mode != TIPC_NET_MODE) 576 if (tipc_mode != TIPC_NET_MODE)
577 return -ENOPROTOOPT; 577 return -ENOPROTOOPT;
578 578
579 read_lock_bh(&net_lock); 579 read_lock_bh(&tipc_net_lock);
580 b_ptr = bearer_find(name); 580 b_ptr = bearer_find(name);
581 if (!b_ptr) { 581 if (!b_ptr) {
582 warn("Attempt to block unknown bearer <%s>\n", name); 582 warn("Attempt to block unknown bearer <%s>\n", name);
583 read_unlock_bh(&net_lock); 583 read_unlock_bh(&tipc_net_lock);
584 return -EINVAL; 584 return -EINVAL;
585 } 585 }
586 586
@@ -590,11 +590,11 @@ int tipc_block_bearer(const char *name)
590 struct node *n_ptr = l_ptr->owner; 590 struct node *n_ptr = l_ptr->owner;
591 591
592 spin_lock_bh(&n_ptr->lock); 592 spin_lock_bh(&n_ptr->lock);
593 link_reset(l_ptr); 593 tipc_link_reset(l_ptr);
594 spin_unlock_bh(&n_ptr->lock); 594 spin_unlock_bh(&n_ptr->lock);
595 } 595 }
596 spin_unlock_bh(&b_ptr->publ.lock); 596 spin_unlock_bh(&b_ptr->publ.lock);
597 read_unlock_bh(&net_lock); 597 read_unlock_bh(&tipc_net_lock);
598 info("Blocked bearer <%s>\n", name); 598 info("Blocked bearer <%s>\n", name);
599 return TIPC_OK; 599 return TIPC_OK;
600} 600}
@@ -602,7 +602,7 @@ int tipc_block_bearer(const char *name)
602/** 602/**
603 * bearer_disable - 603 * bearer_disable -
604 * 604 *
605 * Note: This routine assumes caller holds net_lock. 605 * Note: This routine assumes caller holds tipc_net_lock.
606 */ 606 */
607 607
608static int bearer_disable(const char *name) 608static int bearer_disable(const char *name)
@@ -620,19 +620,19 @@ static int bearer_disable(const char *name)
620 return -EINVAL; 620 return -EINVAL;
621 } 621 }
622 622
623 disc_stop_link_req(b_ptr->link_req); 623 tipc_disc_stop_link_req(b_ptr->link_req);
624 spin_lock_bh(&b_ptr->publ.lock); 624 spin_lock_bh(&b_ptr->publ.lock);
625 b_ptr->link_req = NULL; 625 b_ptr->link_req = NULL;
626 b_ptr->publ.blocked = 1; 626 b_ptr->publ.blocked = 1;
627 if (b_ptr->media->disable_bearer) { 627 if (b_ptr->media->disable_bearer) {
628 spin_unlock_bh(&b_ptr->publ.lock); 628 spin_unlock_bh(&b_ptr->publ.lock);
629 write_unlock_bh(&net_lock); 629 write_unlock_bh(&tipc_net_lock);
630 b_ptr->media->disable_bearer(&b_ptr->publ); 630 b_ptr->media->disable_bearer(&b_ptr->publ);
631 write_lock_bh(&net_lock); 631 write_lock_bh(&tipc_net_lock);
632 spin_lock_bh(&b_ptr->publ.lock); 632 spin_lock_bh(&b_ptr->publ.lock);
633 } 633 }
634 list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { 634 list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {
635 link_delete(l_ptr); 635 tipc_link_delete(l_ptr);
636 } 636 }
637 spin_unlock_bh(&b_ptr->publ.lock); 637 spin_unlock_bh(&b_ptr->publ.lock);
638 info("Disabled bearer <%s>\n", name); 638 info("Disabled bearer <%s>\n", name);
@@ -644,54 +644,54 @@ int tipc_disable_bearer(const char *name)
644{ 644{
645 int res; 645 int res;
646 646
647 write_lock_bh(&net_lock); 647 write_lock_bh(&tipc_net_lock);
648 res = bearer_disable(name); 648 res = bearer_disable(name);
649 write_unlock_bh(&net_lock); 649 write_unlock_bh(&tipc_net_lock);
650 return res; 650 return res;
651} 651}
652 652
653 653
654 654
655int bearer_init(void) 655int tipc_bearer_init(void)
656{ 656{
657 int res; 657 int res;
658 658
659 write_lock_bh(&net_lock); 659 write_lock_bh(&tipc_net_lock);
660 bearers = kmalloc(MAX_BEARERS * sizeof(struct bearer), GFP_ATOMIC); 660 tipc_bearers = kmalloc(MAX_BEARERS * sizeof(struct bearer), GFP_ATOMIC);
661 media_list = kmalloc(MAX_MEDIA * sizeof(struct media), GFP_ATOMIC); 661 media_list = kmalloc(MAX_MEDIA * sizeof(struct media), GFP_ATOMIC);
662 if (bearers && media_list) { 662 if (tipc_bearers && media_list) {
663 memset(bearers, 0, MAX_BEARERS * sizeof(struct bearer)); 663 memset(tipc_bearers, 0, MAX_BEARERS * sizeof(struct bearer));
664 memset(media_list, 0, MAX_MEDIA * sizeof(struct media)); 664 memset(media_list, 0, MAX_MEDIA * sizeof(struct media));
665 res = TIPC_OK; 665 res = TIPC_OK;
666 } else { 666 } else {
667 kfree(bearers); 667 kfree(tipc_bearers);
668 kfree(media_list); 668 kfree(media_list);
669 bearers = 0; 669 tipc_bearers = 0;
670 media_list = 0; 670 media_list = 0;
671 res = -ENOMEM; 671 res = -ENOMEM;
672 } 672 }
673 write_unlock_bh(&net_lock); 673 write_unlock_bh(&tipc_net_lock);
674 return res; 674 return res;
675} 675}
676 676
677void bearer_stop(void) 677void tipc_bearer_stop(void)
678{ 678{
679 u32 i; 679 u32 i;
680 680
681 if (!bearers) 681 if (!tipc_bearers)
682 return; 682 return;
683 683
684 for (i = 0; i < MAX_BEARERS; i++) { 684 for (i = 0; i < MAX_BEARERS; i++) {
685 if (bearers[i].active) 685 if (tipc_bearers[i].active)
686 bearers[i].publ.blocked = 1; 686 tipc_bearers[i].publ.blocked = 1;
687 } 687 }
688 for (i = 0; i < MAX_BEARERS; i++) { 688 for (i = 0; i < MAX_BEARERS; i++) {
689 if (bearers[i].active) 689 if (tipc_bearers[i].active)
690 bearer_disable(bearers[i].publ.name); 690 bearer_disable(tipc_bearers[i].publ.name);
691 } 691 }
692 kfree(bearers); 692 kfree(tipc_bearers);
693 kfree(media_list); 693 kfree(media_list);
694 bearers = 0; 694 tipc_bearers = 0;
695 media_list = 0; 695 media_list = 0;
696 media_count = 0; 696 media_count = 0;
697} 697}