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