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/name_table.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/name_table.c')
-rw-r--r-- | net/tipc/name_table.c | 206 |
1 files changed, 103 insertions, 103 deletions
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index 972c83eb83b4..3f4b23bd08f7 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c | |||
@@ -99,9 +99,9 @@ struct name_table { | |||
99 | u32 local_publ_count; | 99 | u32 local_publ_count; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | struct name_table table = { NULL } ; | 102 | static struct name_table table = { NULL } ; |
103 | static atomic_t rsv_publ_ok = ATOMIC_INIT(0); | 103 | static atomic_t rsv_publ_ok = ATOMIC_INIT(0); |
104 | rwlock_t nametbl_lock = RW_LOCK_UNLOCKED; | 104 | rwlock_t tipc_nametbl_lock = RW_LOCK_UNLOCKED; |
105 | 105 | ||
106 | 106 | ||
107 | static inline int hash(int x) | 107 | static inline int hash(int x) |
@@ -139,10 +139,10 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper, | |||
139 | } | 139 | } |
140 | 140 | ||
141 | /** | 141 | /** |
142 | * subseq_alloc - allocate a specified number of sub-sequence structures | 142 | * tipc_subseq_alloc - allocate a specified number of sub-sequence structures |
143 | */ | 143 | */ |
144 | 144 | ||
145 | struct sub_seq *subseq_alloc(u32 cnt) | 145 | struct sub_seq *tipc_subseq_alloc(u32 cnt) |
146 | { | 146 | { |
147 | u32 sz = cnt * sizeof(struct sub_seq); | 147 | u32 sz = cnt * sizeof(struct sub_seq); |
148 | struct sub_seq *sseq = (struct sub_seq *)kmalloc(sz, GFP_ATOMIC); | 148 | struct sub_seq *sseq = (struct sub_seq *)kmalloc(sz, GFP_ATOMIC); |
@@ -153,16 +153,16 @@ struct sub_seq *subseq_alloc(u32 cnt) | |||
153 | } | 153 | } |
154 | 154 | ||
155 | /** | 155 | /** |
156 | * nameseq_create - create a name sequence structure for the specified 'type' | 156 | * tipc_nameseq_create - create a name sequence structure for the specified 'type' |
157 | * | 157 | * |
158 | * Allocates a single sub-sequence structure and sets it to all 0's. | 158 | * Allocates a single sub-sequence structure and sets it to all 0's. |
159 | */ | 159 | */ |
160 | 160 | ||
161 | struct name_seq *nameseq_create(u32 type, struct hlist_head *seq_head) | 161 | struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head) |
162 | { | 162 | { |
163 | struct name_seq *nseq = | 163 | struct name_seq *nseq = |
164 | (struct name_seq *)kmalloc(sizeof(*nseq), GFP_ATOMIC); | 164 | (struct name_seq *)kmalloc(sizeof(*nseq), GFP_ATOMIC); |
165 | struct sub_seq *sseq = subseq_alloc(1); | 165 | struct sub_seq *sseq = tipc_subseq_alloc(1); |
166 | 166 | ||
167 | if (!nseq || !sseq) { | 167 | if (!nseq || !sseq) { |
168 | warn("Memory squeeze; failed to create name sequence\n"); | 168 | warn("Memory squeeze; failed to create name sequence\n"); |
@@ -175,7 +175,7 @@ struct name_seq *nameseq_create(u32 type, struct hlist_head *seq_head) | |||
175 | nseq->lock = SPIN_LOCK_UNLOCKED; | 175 | nseq->lock = SPIN_LOCK_UNLOCKED; |
176 | nseq->type = type; | 176 | nseq->type = type; |
177 | nseq->sseqs = sseq; | 177 | nseq->sseqs = sseq; |
178 | dbg("nameseq_create() nseq = %x type %u, ssseqs %x, ff: %u\n", | 178 | dbg("tipc_nameseq_create() nseq = %x type %u, ssseqs %x, ff: %u\n", |
179 | nseq, type, nseq->sseqs, nseq->first_free); | 179 | nseq, type, nseq->sseqs, nseq->first_free); |
180 | nseq->alloc = 1; | 180 | nseq->alloc = 1; |
181 | INIT_HLIST_NODE(&nseq->ns_list); | 181 | INIT_HLIST_NODE(&nseq->ns_list); |
@@ -240,10 +240,10 @@ static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance) | |||
240 | } | 240 | } |
241 | 241 | ||
242 | /** | 242 | /** |
243 | * nameseq_insert_publ - | 243 | * tipc_nameseq_insert_publ - |
244 | */ | 244 | */ |
245 | 245 | ||
246 | struct publication *nameseq_insert_publ(struct name_seq *nseq, | 246 | struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, |
247 | u32 type, u32 lower, u32 upper, | 247 | u32 type, u32 lower, u32 upper, |
248 | u32 scope, u32 node, u32 port, u32 key) | 248 | u32 scope, u32 node, u32 port, u32 key) |
249 | { | 249 | { |
@@ -285,7 +285,7 @@ struct publication *nameseq_insert_publ(struct name_seq *nseq, | |||
285 | 285 | ||
286 | if (nseq->first_free == nseq->alloc) { | 286 | if (nseq->first_free == nseq->alloc) { |
287 | struct sub_seq *sseqs = nseq->sseqs; | 287 | struct sub_seq *sseqs = nseq->sseqs; |
288 | nseq->sseqs = subseq_alloc(nseq->alloc * 2); | 288 | nseq->sseqs = tipc_subseq_alloc(nseq->alloc * 2); |
289 | if (nseq->sseqs != NULL) { | 289 | if (nseq->sseqs != NULL) { |
290 | memcpy(nseq->sseqs, sseqs, | 290 | memcpy(nseq->sseqs, sseqs, |
291 | nseq->alloc * sizeof (struct sub_seq)); | 291 | nseq->alloc * sizeof (struct sub_seq)); |
@@ -354,23 +354,23 @@ struct publication *nameseq_insert_publ(struct name_seq *nseq, | |||
354 | */ | 354 | */ |
355 | list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { | 355 | list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { |
356 | dbg("calling report_overlap()\n"); | 356 | dbg("calling report_overlap()\n"); |
357 | subscr_report_overlap(s, | 357 | tipc_subscr_report_overlap(s, |
358 | publ->lower, | 358 | publ->lower, |
359 | publ->upper, | 359 | publ->upper, |
360 | TIPC_PUBLISHED, | 360 | TIPC_PUBLISHED, |
361 | publ->ref, | 361 | publ->ref, |
362 | publ->node, | 362 | publ->node, |
363 | created_subseq); | 363 | created_subseq); |
364 | } | 364 | } |
365 | return publ; | 365 | return publ; |
366 | } | 366 | } |
367 | 367 | ||
368 | /** | 368 | /** |
369 | * nameseq_remove_publ - | 369 | * tipc_nameseq_remove_publ - |
370 | */ | 370 | */ |
371 | 371 | ||
372 | struct publication *nameseq_remove_publ(struct name_seq *nseq, u32 inst, | 372 | struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst, |
373 | u32 node, u32 ref, u32 key) | 373 | u32 node, u32 ref, u32 key) |
374 | { | 374 | { |
375 | struct publication *publ; | 375 | struct publication *publ; |
376 | struct publication *prev; | 376 | struct publication *prev; |
@@ -470,24 +470,24 @@ struct publication *nameseq_remove_publ(struct name_seq *nseq, u32 inst, | |||
470 | * Any subscriptions waiting ? | 470 | * Any subscriptions waiting ? |
471 | */ | 471 | */ |
472 | list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { | 472 | list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { |
473 | subscr_report_overlap(s, | 473 | tipc_subscr_report_overlap(s, |
474 | publ->lower, | 474 | publ->lower, |
475 | publ->upper, | 475 | publ->upper, |
476 | TIPC_WITHDRAWN, | 476 | TIPC_WITHDRAWN, |
477 | publ->ref, | 477 | publ->ref, |
478 | publ->node, | 478 | publ->node, |
479 | removed_subseq); | 479 | removed_subseq); |
480 | } | 480 | } |
481 | return publ; | 481 | return publ; |
482 | } | 482 | } |
483 | 483 | ||
484 | /** | 484 | /** |
485 | * nameseq_subscribe: attach a subscription, and issue | 485 | * tipc_nameseq_subscribe: attach a subscription, and issue |
486 | * the prescribed number of events if there is any sub- | 486 | * the prescribed number of events if there is any sub- |
487 | * sequence overlapping with the requested sequence | 487 | * sequence overlapping with the requested sequence |
488 | */ | 488 | */ |
489 | 489 | ||
490 | void nameseq_subscribe(struct name_seq *nseq, struct subscription *s) | 490 | void tipc_nameseq_subscribe(struct name_seq *nseq, struct subscription *s) |
491 | { | 491 | { |
492 | struct sub_seq *sseq = nseq->sseqs; | 492 | struct sub_seq *sseq = nseq->sseqs; |
493 | 493 | ||
@@ -498,18 +498,18 @@ void nameseq_subscribe(struct name_seq *nseq, struct subscription *s) | |||
498 | 498 | ||
499 | while (sseq != &nseq->sseqs[nseq->first_free]) { | 499 | while (sseq != &nseq->sseqs[nseq->first_free]) { |
500 | struct publication *zl = sseq->zone_list; | 500 | struct publication *zl = sseq->zone_list; |
501 | if (zl && subscr_overlap(s,sseq->lower,sseq->upper)) { | 501 | if (zl && tipc_subscr_overlap(s,sseq->lower,sseq->upper)) { |
502 | struct publication *crs = zl; | 502 | struct publication *crs = zl; |
503 | int must_report = 1; | 503 | int must_report = 1; |
504 | 504 | ||
505 | do { | 505 | do { |
506 | subscr_report_overlap(s, | 506 | tipc_subscr_report_overlap(s, |
507 | sseq->lower, | 507 | sseq->lower, |
508 | sseq->upper, | 508 | sseq->upper, |
509 | TIPC_PUBLISHED, | 509 | TIPC_PUBLISHED, |
510 | crs->ref, | 510 | crs->ref, |
511 | crs->node, | 511 | crs->node, |
512 | must_report); | 512 | must_report); |
513 | must_report = 0; | 513 | must_report = 0; |
514 | crs = crs->zone_list_next; | 514 | crs = crs->zone_list_next; |
515 | } while (crs != zl); | 515 | } while (crs != zl); |
@@ -538,8 +538,8 @@ static struct name_seq *nametbl_find_seq(u32 type) | |||
538 | return 0; | 538 | return 0; |
539 | }; | 539 | }; |
540 | 540 | ||
541 | struct publication *nametbl_insert_publ(u32 type, u32 lower, u32 upper, | 541 | struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper, |
542 | u32 scope, u32 node, u32 port, u32 key) | 542 | u32 scope, u32 node, u32 port, u32 key) |
543 | { | 543 | { |
544 | struct name_seq *seq = nametbl_find_seq(type); | 544 | struct name_seq *seq = nametbl_find_seq(type); |
545 | 545 | ||
@@ -552,19 +552,19 @@ struct publication *nametbl_insert_publ(u32 type, u32 lower, u32 upper, | |||
552 | 552 | ||
553 | dbg("Publishing <%u,%u,%u> from %x\n", type, lower, upper, node); | 553 | dbg("Publishing <%u,%u,%u> from %x\n", type, lower, upper, node); |
554 | if (!seq) { | 554 | if (!seq) { |
555 | seq = nameseq_create(type, &table.types[hash(type)]); | 555 | seq = tipc_nameseq_create(type, &table.types[hash(type)]); |
556 | dbg("nametbl_insert_publ: created %x\n", seq); | 556 | dbg("tipc_nametbl_insert_publ: created %x\n", seq); |
557 | } | 557 | } |
558 | if (!seq) | 558 | if (!seq) |
559 | return 0; | 559 | return 0; |
560 | 560 | ||
561 | assert(seq->type == type); | 561 | assert(seq->type == type); |
562 | return nameseq_insert_publ(seq, type, lower, upper, | 562 | return tipc_nameseq_insert_publ(seq, type, lower, upper, |
563 | scope, node, port, key); | 563 | scope, node, port, key); |
564 | } | 564 | } |
565 | 565 | ||
566 | struct publication *nametbl_remove_publ(u32 type, u32 lower, | 566 | struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, |
567 | u32 node, u32 ref, u32 key) | 567 | u32 node, u32 ref, u32 key) |
568 | { | 568 | { |
569 | struct publication *publ; | 569 | struct publication *publ; |
570 | struct name_seq *seq = nametbl_find_seq(type); | 570 | struct name_seq *seq = nametbl_find_seq(type); |
@@ -573,7 +573,7 @@ struct publication *nametbl_remove_publ(u32 type, u32 lower, | |||
573 | return 0; | 573 | return 0; |
574 | 574 | ||
575 | dbg("Withdrawing <%u,%u> from %x\n", type, lower, node); | 575 | dbg("Withdrawing <%u,%u> from %x\n", type, lower, node); |
576 | publ = nameseq_remove_publ(seq, lower, node, ref, key); | 576 | publ = tipc_nameseq_remove_publ(seq, lower, node, ref, key); |
577 | 577 | ||
578 | if (!seq->first_free && list_empty(&seq->subscriptions)) { | 578 | if (!seq->first_free && list_empty(&seq->subscriptions)) { |
579 | hlist_del_init(&seq->ns_list); | 579 | hlist_del_init(&seq->ns_list); |
@@ -584,14 +584,14 @@ struct publication *nametbl_remove_publ(u32 type, u32 lower, | |||
584 | } | 584 | } |
585 | 585 | ||
586 | /* | 586 | /* |
587 | * nametbl_translate(): Translate tipc_name -> tipc_portid. | 587 | * tipc_nametbl_translate(): Translate tipc_name -> tipc_portid. |
588 | * Very time-critical. | 588 | * Very time-critical. |
589 | * | 589 | * |
590 | * Note: on entry 'destnode' is the search domain used during translation; | 590 | * Note: on entry 'destnode' is the search domain used during translation; |
591 | * on exit it passes back the node address of the matching port (if any) | 591 | * on exit it passes back the node address of the matching port (if any) |
592 | */ | 592 | */ |
593 | 593 | ||
594 | u32 nametbl_translate(u32 type, u32 instance, u32 *destnode) | 594 | u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode) |
595 | { | 595 | { |
596 | struct sub_seq *sseq; | 596 | struct sub_seq *sseq; |
597 | struct publication *publ = 0; | 597 | struct publication *publ = 0; |
@@ -601,7 +601,7 @@ u32 nametbl_translate(u32 type, u32 instance, u32 *destnode) | |||
601 | if (!in_scope(*destnode, tipc_own_addr)) | 601 | if (!in_scope(*destnode, tipc_own_addr)) |
602 | return 0; | 602 | return 0; |
603 | 603 | ||
604 | read_lock_bh(&nametbl_lock); | 604 | read_lock_bh(&tipc_nametbl_lock); |
605 | seq = nametbl_find_seq(type); | 605 | seq = nametbl_find_seq(type); |
606 | if (unlikely(!seq)) | 606 | if (unlikely(!seq)) |
607 | goto not_found; | 607 | goto not_found; |
@@ -619,7 +619,7 @@ found: | |||
619 | ref = publ->ref; | 619 | ref = publ->ref; |
620 | *destnode = publ->node; | 620 | *destnode = publ->node; |
621 | spin_unlock_bh(&seq->lock); | 621 | spin_unlock_bh(&seq->lock); |
622 | read_unlock_bh(&nametbl_lock); | 622 | read_unlock_bh(&tipc_nametbl_lock); |
623 | return ref; | 623 | return ref; |
624 | } | 624 | } |
625 | publ = sseq->cluster_list; | 625 | publ = sseq->cluster_list; |
@@ -657,12 +657,12 @@ found: | |||
657 | spin_unlock_bh(&seq->lock); | 657 | spin_unlock_bh(&seq->lock); |
658 | not_found: | 658 | not_found: |
659 | *destnode = 0; | 659 | *destnode = 0; |
660 | read_unlock_bh(&nametbl_lock); | 660 | read_unlock_bh(&tipc_nametbl_lock); |
661 | return 0; | 661 | return 0; |
662 | } | 662 | } |
663 | 663 | ||
664 | /** | 664 | /** |
665 | * nametbl_mc_translate - find multicast destinations | 665 | * tipc_nametbl_mc_translate - find multicast destinations |
666 | * | 666 | * |
667 | * Creates list of all local ports that overlap the given multicast address; | 667 | * Creates list of all local ports that overlap the given multicast address; |
668 | * also determines if any off-node ports overlap. | 668 | * also determines if any off-node ports overlap. |
@@ -674,15 +674,15 @@ not_found: | |||
674 | * Returns non-zero if any off-node ports overlap | 674 | * Returns non-zero if any off-node ports overlap |
675 | */ | 675 | */ |
676 | 676 | ||
677 | int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, | 677 | int tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, |
678 | struct port_list *dports) | 678 | struct port_list *dports) |
679 | { | 679 | { |
680 | struct name_seq *seq; | 680 | struct name_seq *seq; |
681 | struct sub_seq *sseq; | 681 | struct sub_seq *sseq; |
682 | struct sub_seq *sseq_stop; | 682 | struct sub_seq *sseq_stop; |
683 | int res = 0; | 683 | int res = 0; |
684 | 684 | ||
685 | read_lock_bh(&nametbl_lock); | 685 | read_lock_bh(&tipc_nametbl_lock); |
686 | seq = nametbl_find_seq(type); | 686 | seq = nametbl_find_seq(type); |
687 | if (!seq) | 687 | if (!seq) |
688 | goto exit; | 688 | goto exit; |
@@ -700,7 +700,7 @@ int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, | |||
700 | if (publ && (publ->scope <= limit)) | 700 | if (publ && (publ->scope <= limit)) |
701 | do { | 701 | do { |
702 | if (publ->node == tipc_own_addr) | 702 | if (publ->node == tipc_own_addr) |
703 | port_list_add(dports, publ->ref); | 703 | tipc_port_list_add(dports, publ->ref); |
704 | else | 704 | else |
705 | res = 1; | 705 | res = 1; |
706 | publ = publ->cluster_list_next; | 706 | publ = publ->cluster_list_next; |
@@ -709,15 +709,15 @@ int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, | |||
709 | 709 | ||
710 | spin_unlock_bh(&seq->lock); | 710 | spin_unlock_bh(&seq->lock); |
711 | exit: | 711 | exit: |
712 | read_unlock_bh(&nametbl_lock); | 712 | read_unlock_bh(&tipc_nametbl_lock); |
713 | return res; | 713 | return res; |
714 | } | 714 | } |
715 | 715 | ||
716 | /** | 716 | /** |
717 | * nametbl_publish_rsv - publish port name using a reserved name type | 717 | * tipc_nametbl_publish_rsv - publish port name using a reserved name type |
718 | */ | 718 | */ |
719 | 719 | ||
720 | int nametbl_publish_rsv(u32 ref, unsigned int scope, | 720 | int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, |
721 | struct tipc_name_seq const *seq) | 721 | struct tipc_name_seq const *seq) |
722 | { | 722 | { |
723 | int res; | 723 | int res; |
@@ -729,10 +729,10 @@ int nametbl_publish_rsv(u32 ref, unsigned int scope, | |||
729 | } | 729 | } |
730 | 730 | ||
731 | /** | 731 | /** |
732 | * nametbl_publish - add name publication to network name tables | 732 | * tipc_nametbl_publish - add name publication to network name tables |
733 | */ | 733 | */ |
734 | 734 | ||
735 | struct publication *nametbl_publish(u32 type, u32 lower, u32 upper, | 735 | struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper, |
736 | u32 scope, u32 port_ref, u32 key) | 736 | u32 scope, u32 port_ref, u32 key) |
737 | { | 737 | { |
738 | struct publication *publ; | 738 | struct publication *publ; |
@@ -748,77 +748,77 @@ struct publication *nametbl_publish(u32 type, u32 lower, u32 upper, | |||
748 | return 0; | 748 | return 0; |
749 | } | 749 | } |
750 | 750 | ||
751 | write_lock_bh(&nametbl_lock); | 751 | write_lock_bh(&tipc_nametbl_lock); |
752 | table.local_publ_count++; | 752 | table.local_publ_count++; |
753 | publ = nametbl_insert_publ(type, lower, upper, scope, | 753 | publ = tipc_nametbl_insert_publ(type, lower, upper, scope, |
754 | tipc_own_addr, port_ref, key); | 754 | tipc_own_addr, port_ref, key); |
755 | if (publ && (scope != TIPC_NODE_SCOPE)) { | 755 | if (publ && (scope != TIPC_NODE_SCOPE)) { |
756 | named_publish(publ); | 756 | tipc_named_publish(publ); |
757 | } | 757 | } |
758 | write_unlock_bh(&nametbl_lock); | 758 | write_unlock_bh(&tipc_nametbl_lock); |
759 | return publ; | 759 | return publ; |
760 | } | 760 | } |
761 | 761 | ||
762 | /** | 762 | /** |
763 | * nametbl_withdraw - withdraw name publication from network name tables | 763 | * tipc_nametbl_withdraw - withdraw name publication from network name tables |
764 | */ | 764 | */ |
765 | 765 | ||
766 | int nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key) | 766 | int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key) |
767 | { | 767 | { |
768 | struct publication *publ; | 768 | struct publication *publ; |
769 | 769 | ||
770 | dbg("nametbl_withdraw:<%d,%d,%d>\n", type, lower, key); | 770 | dbg("tipc_nametbl_withdraw:<%d,%d,%d>\n", type, lower, key); |
771 | write_lock_bh(&nametbl_lock); | 771 | write_lock_bh(&tipc_nametbl_lock); |
772 | publ = nametbl_remove_publ(type, lower, tipc_own_addr, ref, key); | 772 | publ = tipc_nametbl_remove_publ(type, lower, tipc_own_addr, ref, key); |
773 | if (publ) { | 773 | if (publ) { |
774 | table.local_publ_count--; | 774 | table.local_publ_count--; |
775 | if (publ->scope != TIPC_NODE_SCOPE) | 775 | if (publ->scope != TIPC_NODE_SCOPE) |
776 | named_withdraw(publ); | 776 | tipc_named_withdraw(publ); |
777 | write_unlock_bh(&nametbl_lock); | 777 | write_unlock_bh(&tipc_nametbl_lock); |
778 | list_del_init(&publ->pport_list); | 778 | list_del_init(&publ->pport_list); |
779 | kfree(publ); | 779 | kfree(publ); |
780 | return 1; | 780 | return 1; |
781 | } | 781 | } |
782 | write_unlock_bh(&nametbl_lock); | 782 | write_unlock_bh(&tipc_nametbl_lock); |
783 | return 0; | 783 | return 0; |
784 | } | 784 | } |
785 | 785 | ||
786 | /** | 786 | /** |
787 | * nametbl_subscribe - add a subscription object to the name table | 787 | * tipc_nametbl_subscribe - add a subscription object to the name table |
788 | */ | 788 | */ |
789 | 789 | ||
790 | void | 790 | void |
791 | nametbl_subscribe(struct subscription *s) | 791 | tipc_nametbl_subscribe(struct subscription *s) |
792 | { | 792 | { |
793 | u32 type = s->seq.type; | 793 | u32 type = s->seq.type; |
794 | struct name_seq *seq; | 794 | struct name_seq *seq; |
795 | 795 | ||
796 | write_lock_bh(&nametbl_lock); | 796 | write_lock_bh(&tipc_nametbl_lock); |
797 | seq = nametbl_find_seq(type); | 797 | seq = nametbl_find_seq(type); |
798 | if (!seq) { | 798 | if (!seq) { |
799 | seq = nameseq_create(type, &table.types[hash(type)]); | 799 | seq = tipc_nameseq_create(type, &table.types[hash(type)]); |
800 | } | 800 | } |
801 | if (seq){ | 801 | if (seq){ |
802 | spin_lock_bh(&seq->lock); | 802 | spin_lock_bh(&seq->lock); |
803 | dbg("nametbl_subscribe:found %x for <%u,%u,%u>\n", | 803 | dbg("tipc_nametbl_subscribe:found %x for <%u,%u,%u>\n", |
804 | seq, type, s->seq.lower, s->seq.upper); | 804 | seq, type, s->seq.lower, s->seq.upper); |
805 | assert(seq->type == type); | 805 | assert(seq->type == type); |
806 | nameseq_subscribe(seq, s); | 806 | tipc_nameseq_subscribe(seq, s); |
807 | spin_unlock_bh(&seq->lock); | 807 | spin_unlock_bh(&seq->lock); |
808 | } | 808 | } |
809 | write_unlock_bh(&nametbl_lock); | 809 | write_unlock_bh(&tipc_nametbl_lock); |
810 | } | 810 | } |
811 | 811 | ||
812 | /** | 812 | /** |
813 | * nametbl_unsubscribe - remove a subscription object from name table | 813 | * tipc_nametbl_unsubscribe - remove a subscription object from name table |
814 | */ | 814 | */ |
815 | 815 | ||
816 | void | 816 | void |
817 | nametbl_unsubscribe(struct subscription *s) | 817 | tipc_nametbl_unsubscribe(struct subscription *s) |
818 | { | 818 | { |
819 | struct name_seq *seq; | 819 | struct name_seq *seq; |
820 | 820 | ||
821 | write_lock_bh(&nametbl_lock); | 821 | write_lock_bh(&tipc_nametbl_lock); |
822 | seq = nametbl_find_seq(s->seq.type); | 822 | seq = nametbl_find_seq(s->seq.type); |
823 | if (seq != NULL){ | 823 | if (seq != NULL){ |
824 | spin_lock_bh(&seq->lock); | 824 | spin_lock_bh(&seq->lock); |
@@ -830,7 +830,7 @@ nametbl_unsubscribe(struct subscription *s) | |||
830 | kfree(seq); | 830 | kfree(seq); |
831 | } | 831 | } |
832 | } | 832 | } |
833 | write_unlock_bh(&nametbl_lock); | 833 | write_unlock_bh(&tipc_nametbl_lock); |
834 | } | 834 | } |
835 | 835 | ||
836 | 836 | ||
@@ -983,17 +983,17 @@ static void nametbl_list(struct print_buf *buf, u32 depth_info, | |||
983 | } | 983 | } |
984 | } | 984 | } |
985 | 985 | ||
986 | void nametbl_print(struct print_buf *buf, const char *str) | 986 | void tipc_nametbl_print(struct print_buf *buf, const char *str) |
987 | { | 987 | { |
988 | tipc_printf(buf, str); | 988 | tipc_printf(buf, str); |
989 | read_lock_bh(&nametbl_lock); | 989 | read_lock_bh(&tipc_nametbl_lock); |
990 | nametbl_list(buf, 0, 0, 0, 0); | 990 | nametbl_list(buf, 0, 0, 0, 0); |
991 | read_unlock_bh(&nametbl_lock); | 991 | read_unlock_bh(&tipc_nametbl_lock); |
992 | } | 992 | } |
993 | 993 | ||
994 | #define MAX_NAME_TBL_QUERY 32768 | 994 | #define MAX_NAME_TBL_QUERY 32768 |
995 | 995 | ||
996 | struct sk_buff *nametbl_get(const void *req_tlv_area, int req_tlv_space) | 996 | struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space) |
997 | { | 997 | { |
998 | struct sk_buff *buf; | 998 | struct sk_buff *buf; |
999 | struct tipc_name_table_query *argv; | 999 | struct tipc_name_table_query *argv; |
@@ -1002,20 +1002,20 @@ struct sk_buff *nametbl_get(const void *req_tlv_area, int req_tlv_space) | |||
1002 | int str_len; | 1002 | int str_len; |
1003 | 1003 | ||
1004 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NAME_TBL_QUERY)) | 1004 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NAME_TBL_QUERY)) |
1005 | return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 1005 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
1006 | 1006 | ||
1007 | buf = cfg_reply_alloc(TLV_SPACE(MAX_NAME_TBL_QUERY)); | 1007 | buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_NAME_TBL_QUERY)); |
1008 | if (!buf) | 1008 | if (!buf) |
1009 | return NULL; | 1009 | return NULL; |
1010 | 1010 | ||
1011 | rep_tlv = (struct tlv_desc *)buf->data; | 1011 | rep_tlv = (struct tlv_desc *)buf->data; |
1012 | printbuf_init(&b, TLV_DATA(rep_tlv), MAX_NAME_TBL_QUERY); | 1012 | tipc_printbuf_init(&b, TLV_DATA(rep_tlv), MAX_NAME_TBL_QUERY); |
1013 | argv = (struct tipc_name_table_query *)TLV_DATA(req_tlv_area); | 1013 | argv = (struct tipc_name_table_query *)TLV_DATA(req_tlv_area); |
1014 | read_lock_bh(&nametbl_lock); | 1014 | read_lock_bh(&tipc_nametbl_lock); |
1015 | nametbl_list(&b, ntohl(argv->depth), ntohl(argv->type), | 1015 | nametbl_list(&b, ntohl(argv->depth), ntohl(argv->type), |
1016 | ntohl(argv->lowbound), ntohl(argv->upbound)); | 1016 | ntohl(argv->lowbound), ntohl(argv->upbound)); |
1017 | read_unlock_bh(&nametbl_lock); | 1017 | read_unlock_bh(&tipc_nametbl_lock); |
1018 | str_len = printbuf_validate(&b); | 1018 | str_len = tipc_printbuf_validate(&b); |
1019 | 1019 | ||
1020 | skb_put(buf, TLV_SPACE(str_len)); | 1020 | skb_put(buf, TLV_SPACE(str_len)); |
1021 | TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len); | 1021 | TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len); |
@@ -1023,12 +1023,12 @@ struct sk_buff *nametbl_get(const void *req_tlv_area, int req_tlv_space) | |||
1023 | return buf; | 1023 | return buf; |
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | void nametbl_dump(void) | 1026 | void tipc_nametbl_dump(void) |
1027 | { | 1027 | { |
1028 | nametbl_list(CONS, 0, 0, 0, 0); | 1028 | nametbl_list(TIPC_CONS, 0, 0, 0, 0); |
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | int nametbl_init(void) | 1031 | int tipc_nametbl_init(void) |
1032 | { | 1032 | { |
1033 | int array_size = sizeof(struct hlist_head) * tipc_nametbl_size; | 1033 | int array_size = sizeof(struct hlist_head) * tipc_nametbl_size; |
1034 | 1034 | ||
@@ -1036,14 +1036,14 @@ int nametbl_init(void) | |||
1036 | if (!table.types) | 1036 | if (!table.types) |
1037 | return -ENOMEM; | 1037 | return -ENOMEM; |
1038 | 1038 | ||
1039 | write_lock_bh(&nametbl_lock); | 1039 | write_lock_bh(&tipc_nametbl_lock); |
1040 | memset(table.types, 0, array_size); | 1040 | memset(table.types, 0, array_size); |
1041 | table.local_publ_count = 0; | 1041 | table.local_publ_count = 0; |
1042 | write_unlock_bh(&nametbl_lock); | 1042 | write_unlock_bh(&tipc_nametbl_lock); |
1043 | return 0; | 1043 | return 0; |
1044 | } | 1044 | } |
1045 | 1045 | ||
1046 | void nametbl_stop(void) | 1046 | void tipc_nametbl_stop(void) |
1047 | { | 1047 | { |
1048 | struct hlist_head *seq_head; | 1048 | struct hlist_head *seq_head; |
1049 | struct hlist_node *seq_node; | 1049 | struct hlist_node *seq_node; |
@@ -1054,7 +1054,7 @@ void nametbl_stop(void) | |||
1054 | if (!table.types) | 1054 | if (!table.types) |
1055 | return; | 1055 | return; |
1056 | 1056 | ||
1057 | write_lock_bh(&nametbl_lock); | 1057 | write_lock_bh(&tipc_nametbl_lock); |
1058 | for (i = 0; i < tipc_nametbl_size; i++) { | 1058 | for (i = 0; i < tipc_nametbl_size; i++) { |
1059 | seq_head = &table.types[i]; | 1059 | seq_head = &table.types[i]; |
1060 | hlist_for_each_entry_safe(seq, seq_node, tmp, seq_head, ns_list) { | 1060 | hlist_for_each_entry_safe(seq, seq_node, tmp, seq_head, ns_list) { |
@@ -1075,5 +1075,5 @@ void nametbl_stop(void) | |||
1075 | } | 1075 | } |
1076 | kfree(table.types); | 1076 | kfree(table.types); |
1077 | table.types = NULL; | 1077 | table.types = NULL; |
1078 | write_unlock_bh(&nametbl_lock); | 1078 | write_unlock_bh(&tipc_nametbl_lock); |
1079 | } | 1079 | } |