diff options
Diffstat (limited to 'net/tipc/name_table.c')
-rw-r--r-- | net/tipc/name_table.c | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index 049242ea5c38..9dfc9127acdd 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * net/tipc/name_table.c: TIPC name table code | 2 | * net/tipc/name_table.c: TIPC name table code |
3 | * | 3 | * |
4 | * Copyright (c) 2000-2006, Ericsson AB | 4 | * Copyright (c) 2000-2006, Ericsson AB |
5 | * Copyright (c) 2004-2005, Wind River Systems | 5 | * Copyright (c) 2004-2005, Wind River Systems |
6 | * All rights reserved. | 6 | * All rights reserved. |
@@ -65,7 +65,7 @@ struct sub_seq { | |||
65 | struct publication *zone_list; | 65 | struct publication *zone_list; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * struct name_seq - container for all published instances of a name type | 69 | * struct name_seq - container for all published instances of a name type |
70 | * @type: 32 bit 'type' value for name sequence | 70 | * @type: 32 bit 'type' value for name sequence |
71 | * @sseq: pointer to dynamically-sized array of sub-sequences of this 'type'; | 71 | * @sseq: pointer to dynamically-sized array of sub-sequences of this 'type'; |
@@ -89,7 +89,7 @@ struct name_seq { | |||
89 | 89 | ||
90 | /** | 90 | /** |
91 | * struct name_table - table containing all existing port name publications | 91 | * struct name_table - table containing all existing port name publications |
92 | * @types: pointer to fixed-sized array of name sequence lists, | 92 | * @types: pointer to fixed-sized array of name sequence lists, |
93 | * accessed via hashing on 'type'; name sequence lists are *not* sorted | 93 | * accessed via hashing on 'type'; name sequence lists are *not* sorted |
94 | * @local_publ_count: number of publications issued by this node | 94 | * @local_publ_count: number of publications issued by this node |
95 | */ | 95 | */ |
@@ -113,8 +113,8 @@ static int hash(int x) | |||
113 | * publ_create - create a publication structure | 113 | * publ_create - create a publication structure |
114 | */ | 114 | */ |
115 | 115 | ||
116 | static struct publication *publ_create(u32 type, u32 lower, u32 upper, | 116 | static struct publication *publ_create(u32 type, u32 lower, u32 upper, |
117 | u32 scope, u32 node, u32 port_ref, | 117 | u32 scope, u32 node, u32 port_ref, |
118 | u32 key) | 118 | u32 key) |
119 | { | 119 | { |
120 | struct publication *publ = kzalloc(sizeof(*publ), GFP_ATOMIC); | 120 | struct publication *publ = kzalloc(sizeof(*publ), GFP_ATOMIC); |
@@ -148,7 +148,7 @@ static struct sub_seq *tipc_subseq_alloc(u32 cnt) | |||
148 | 148 | ||
149 | /** | 149 | /** |
150 | * tipc_nameseq_create - create a name sequence structure for the specified 'type' | 150 | * tipc_nameseq_create - create a name sequence structure for the specified 'type' |
151 | * | 151 | * |
152 | * Allocates a single sub-sequence structure and sets it to all 0's. | 152 | * Allocates a single sub-sequence structure and sets it to all 0's. |
153 | */ | 153 | */ |
154 | 154 | ||
@@ -178,7 +178,7 @@ static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_hea | |||
178 | 178 | ||
179 | /** | 179 | /** |
180 | * nameseq_find_subseq - find sub-sequence (if any) matching a name instance | 180 | * nameseq_find_subseq - find sub-sequence (if any) matching a name instance |
181 | * | 181 | * |
182 | * Very time-critical, so binary searches through sub-sequence array. | 182 | * Very time-critical, so binary searches through sub-sequence array. |
183 | */ | 183 | */ |
184 | 184 | ||
@@ -204,7 +204,7 @@ static struct sub_seq *nameseq_find_subseq(struct name_seq *nseq, | |||
204 | 204 | ||
205 | /** | 205 | /** |
206 | * nameseq_locate_subseq - determine position of name instance in sub-sequence | 206 | * nameseq_locate_subseq - determine position of name instance in sub-sequence |
207 | * | 207 | * |
208 | * Returns index in sub-sequence array of the entry that contains the specified | 208 | * Returns index in sub-sequence array of the entry that contains the specified |
209 | * instance value; if no entry contains that value, returns the position | 209 | * instance value; if no entry contains that value, returns the position |
210 | * where a new entry for it would be inserted in the array. | 210 | * where a new entry for it would be inserted in the array. |
@@ -232,7 +232,7 @@ static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance) | |||
232 | } | 232 | } |
233 | 233 | ||
234 | /** | 234 | /** |
235 | * tipc_nameseq_insert_publ - | 235 | * tipc_nameseq_insert_publ - |
236 | */ | 236 | */ |
237 | 237 | ||
238 | static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, | 238 | static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, |
@@ -343,8 +343,8 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, | |||
343 | } | 343 | } |
344 | } | 344 | } |
345 | 345 | ||
346 | /* | 346 | /* |
347 | * Any subscriptions waiting for notification? | 347 | * Any subscriptions waiting for notification? |
348 | */ | 348 | */ |
349 | list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { | 349 | list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { |
350 | dbg("calling report_overlap()\n"); | 350 | dbg("calling report_overlap()\n"); |
@@ -352,7 +352,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, | |||
352 | publ->lower, | 352 | publ->lower, |
353 | publ->upper, | 353 | publ->upper, |
354 | TIPC_PUBLISHED, | 354 | TIPC_PUBLISHED, |
355 | publ->ref, | 355 | publ->ref, |
356 | publ->node, | 356 | publ->node, |
357 | created_subseq); | 357 | created_subseq); |
358 | } | 358 | } |
@@ -361,7 +361,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, | |||
361 | 361 | ||
362 | /** | 362 | /** |
363 | * tipc_nameseq_remove_publ - | 363 | * tipc_nameseq_remove_publ - |
364 | * | 364 | * |
365 | * NOTE: There may be cases where TIPC is asked to remove a publication | 365 | * NOTE: There may be cases where TIPC is asked to remove a publication |
366 | * that is not in the name table. For example, if another node issues a | 366 | * that is not in the name table. For example, if another node issues a |
367 | * publication for a name sequence that overlaps an existing name sequence | 367 | * publication for a name sequence that overlaps an existing name sequence |
@@ -392,12 +392,12 @@ static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 i | |||
392 | 392 | ||
393 | prev = sseq->zone_list; | 393 | prev = sseq->zone_list; |
394 | publ = sseq->zone_list->zone_list_next; | 394 | publ = sseq->zone_list->zone_list_next; |
395 | while ((publ->key != key) || (publ->ref != ref) || | 395 | while ((publ->key != key) || (publ->ref != ref) || |
396 | (publ->node && (publ->node != node))) { | 396 | (publ->node && (publ->node != node))) { |
397 | prev = publ; | 397 | prev = publ; |
398 | publ = publ->zone_list_next; | 398 | publ = publ->zone_list_next; |
399 | if (prev == sseq->zone_list) { | 399 | if (prev == sseq->zone_list) { |
400 | 400 | ||
401 | /* Prevent endless loop if publication not found */ | 401 | /* Prevent endless loop if publication not found */ |
402 | 402 | ||
403 | return NULL; | 403 | return NULL; |
@@ -426,7 +426,7 @@ static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 i | |||
426 | 426 | ||
427 | err("Unable to de-list cluster publication\n" | 427 | err("Unable to de-list cluster publication\n" |
428 | "{%u%u}, node=0x%x, ref=%u, key=%u)\n", | 428 | "{%u%u}, node=0x%x, ref=%u, key=%u)\n", |
429 | publ->type, publ->lower, publ->node, | 429 | publ->type, publ->lower, publ->node, |
430 | publ->ref, publ->key); | 430 | publ->ref, publ->key); |
431 | goto end_cluster; | 431 | goto end_cluster; |
432 | } | 432 | } |
@@ -456,7 +456,7 @@ end_cluster: | |||
456 | 456 | ||
457 | err("Unable to de-list node publication\n" | 457 | err("Unable to de-list node publication\n" |
458 | "{%u%u}, node=0x%x, ref=%u, key=%u)\n", | 458 | "{%u%u}, node=0x%x, ref=%u, key=%u)\n", |
459 | publ->type, publ->lower, publ->node, | 459 | publ->type, publ->lower, publ->node, |
460 | publ->ref, publ->key); | 460 | publ->ref, publ->key); |
461 | goto end_node; | 461 | goto end_node; |
462 | } | 462 | } |
@@ -486,8 +486,8 @@ end_node: | |||
486 | tipc_subscr_report_overlap(s, | 486 | tipc_subscr_report_overlap(s, |
487 | publ->lower, | 487 | publ->lower, |
488 | publ->upper, | 488 | publ->upper, |
489 | TIPC_WITHDRAWN, | 489 | TIPC_WITHDRAWN, |
490 | publ->ref, | 490 | publ->ref, |
491 | publ->node, | 491 | publ->node, |
492 | removed_subseq); | 492 | removed_subseq); |
493 | } | 493 | } |
@@ -517,8 +517,8 @@ void tipc_nameseq_subscribe(struct name_seq *nseq, struct subscription *s) | |||
517 | int must_report = 1; | 517 | int must_report = 1; |
518 | 518 | ||
519 | do { | 519 | do { |
520 | tipc_subscr_report_overlap(s, | 520 | tipc_subscr_report_overlap(s, |
521 | sseq->lower, | 521 | sseq->lower, |
522 | sseq->upper, | 522 | sseq->upper, |
523 | TIPC_PUBLISHED, | 523 | TIPC_PUBLISHED, |
524 | crs->ref, | 524 | crs->ref, |
@@ -576,7 +576,7 @@ struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper, | |||
576 | scope, node, port, key); | 576 | scope, node, port, key); |
577 | } | 577 | } |
578 | 578 | ||
579 | struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, | 579 | struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, |
580 | u32 node, u32 ref, u32 key) | 580 | u32 node, u32 ref, u32 key) |
581 | { | 581 | { |
582 | struct publication *publ; | 582 | struct publication *publ; |
@@ -676,14 +676,14 @@ not_found: | |||
676 | 676 | ||
677 | /** | 677 | /** |
678 | * tipc_nametbl_mc_translate - find multicast destinations | 678 | * tipc_nametbl_mc_translate - find multicast destinations |
679 | * | 679 | * |
680 | * Creates list of all local ports that overlap the given multicast address; | 680 | * Creates list of all local ports that overlap the given multicast address; |
681 | * also determines if any off-node ports overlap. | 681 | * also determines if any off-node ports overlap. |
682 | * | 682 | * |
683 | * Note: Publications with a scope narrower than 'limit' are ignored. | 683 | * Note: Publications with a scope narrower than 'limit' are ignored. |
684 | * (i.e. local node-scope publications mustn't receive messages arriving | 684 | * (i.e. local node-scope publications mustn't receive messages arriving |
685 | * from another node, even if the multcast link brought it here) | 685 | * from another node, even if the multcast link brought it here) |
686 | * | 686 | * |
687 | * Returns non-zero if any off-node ports overlap | 687 | * Returns non-zero if any off-node ports overlap |
688 | */ | 688 | */ |
689 | 689 | ||
@@ -730,7 +730,7 @@ exit: | |||
730 | * tipc_nametbl_publish_rsv - publish port name using a reserved name type | 730 | * tipc_nametbl_publish_rsv - publish port name using a reserved name type |
731 | */ | 731 | */ |
732 | 732 | ||
733 | int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, | 733 | int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, |
734 | struct tipc_name_seq const *seq) | 734 | struct tipc_name_seq const *seq) |
735 | { | 735 | { |
736 | int res; | 736 | int res; |
@@ -745,13 +745,13 @@ int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, | |||
745 | * tipc_nametbl_publish - add name publication to network name tables | 745 | * tipc_nametbl_publish - add name publication to network name tables |
746 | */ | 746 | */ |
747 | 747 | ||
748 | struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper, | 748 | struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper, |
749 | u32 scope, u32 port_ref, u32 key) | 749 | u32 scope, u32 port_ref, u32 key) |
750 | { | 750 | { |
751 | struct publication *publ; | 751 | struct publication *publ; |
752 | 752 | ||
753 | if (table.local_publ_count >= tipc_max_publications) { | 753 | if (table.local_publ_count >= tipc_max_publications) { |
754 | warn("Publication failed, local publication limit reached (%u)\n", | 754 | warn("Publication failed, local publication limit reached (%u)\n", |
755 | tipc_max_publications); | 755 | tipc_max_publications); |
756 | return NULL; | 756 | return NULL; |
757 | } | 757 | } |
@@ -808,22 +808,22 @@ void tipc_nametbl_subscribe(struct subscription *s) | |||
808 | u32 type = s->seq.type; | 808 | u32 type = s->seq.type; |
809 | struct name_seq *seq; | 809 | struct name_seq *seq; |
810 | 810 | ||
811 | write_lock_bh(&tipc_nametbl_lock); | 811 | write_lock_bh(&tipc_nametbl_lock); |
812 | seq = nametbl_find_seq(type); | 812 | seq = nametbl_find_seq(type); |
813 | if (!seq) { | 813 | if (!seq) { |
814 | seq = tipc_nameseq_create(type, &table.types[hash(type)]); | 814 | seq = tipc_nameseq_create(type, &table.types[hash(type)]); |
815 | } | 815 | } |
816 | if (seq){ | 816 | if (seq){ |
817 | spin_lock_bh(&seq->lock); | 817 | spin_lock_bh(&seq->lock); |
818 | dbg("tipc_nametbl_subscribe:found %p for {%u,%u,%u}\n", | 818 | dbg("tipc_nametbl_subscribe:found %p for {%u,%u,%u}\n", |
819 | seq, type, s->seq.lower, s->seq.upper); | 819 | seq, type, s->seq.lower, s->seq.upper); |
820 | tipc_nameseq_subscribe(seq, s); | 820 | tipc_nameseq_subscribe(seq, s); |
821 | spin_unlock_bh(&seq->lock); | 821 | spin_unlock_bh(&seq->lock); |
822 | } else { | 822 | } else { |
823 | warn("Failed to create subscription for {%u,%u,%u}\n", | 823 | warn("Failed to create subscription for {%u,%u,%u}\n", |
824 | s->seq.type, s->seq.lower, s->seq.upper); | 824 | s->seq.type, s->seq.lower, s->seq.upper); |
825 | } | 825 | } |
826 | write_unlock_bh(&tipc_nametbl_lock); | 826 | write_unlock_bh(&tipc_nametbl_lock); |
827 | } | 827 | } |
828 | 828 | ||
829 | /** | 829 | /** |
@@ -834,19 +834,19 @@ void tipc_nametbl_unsubscribe(struct subscription *s) | |||
834 | { | 834 | { |
835 | struct name_seq *seq; | 835 | struct name_seq *seq; |
836 | 836 | ||
837 | write_lock_bh(&tipc_nametbl_lock); | 837 | write_lock_bh(&tipc_nametbl_lock); |
838 | seq = nametbl_find_seq(s->seq.type); | 838 | seq = nametbl_find_seq(s->seq.type); |
839 | if (seq != NULL){ | 839 | if (seq != NULL){ |
840 | spin_lock_bh(&seq->lock); | 840 | spin_lock_bh(&seq->lock); |
841 | list_del_init(&s->nameseq_list); | 841 | list_del_init(&s->nameseq_list); |
842 | spin_unlock_bh(&seq->lock); | 842 | spin_unlock_bh(&seq->lock); |
843 | if ((seq->first_free == 0) && list_empty(&seq->subscriptions)) { | 843 | if ((seq->first_free == 0) && list_empty(&seq->subscriptions)) { |
844 | hlist_del_init(&seq->ns_list); | 844 | hlist_del_init(&seq->ns_list); |
845 | kfree(seq->sseqs); | 845 | kfree(seq->sseqs); |
846 | kfree(seq); | 846 | kfree(seq); |
847 | } | 847 | } |
848 | } | 848 | } |
849 | write_unlock_bh(&tipc_nametbl_lock); | 849 | write_unlock_bh(&tipc_nametbl_lock); |
850 | } | 850 | } |
851 | 851 | ||
852 | 852 | ||
@@ -952,7 +952,7 @@ static void nametbl_header(struct print_buf *buf, u32 depth) | |||
952 | * nametbl_list - print specified name table contents into the given buffer | 952 | * nametbl_list - print specified name table contents into the given buffer |
953 | */ | 953 | */ |
954 | 954 | ||
955 | static void nametbl_list(struct print_buf *buf, u32 depth_info, | 955 | static void nametbl_list(struct print_buf *buf, u32 depth_info, |
956 | u32 type, u32 lowbound, u32 upbound) | 956 | u32 type, u32 lowbound, u32 upbound) |
957 | { | 957 | { |
958 | struct hlist_head *seq_head; | 958 | struct hlist_head *seq_head; |
@@ -976,7 +976,7 @@ static void nametbl_list(struct print_buf *buf, u32 depth_info, | |||
976 | for (i = 0; i < tipc_nametbl_size; i++) { | 976 | for (i = 0; i < tipc_nametbl_size; i++) { |
977 | seq_head = &table.types[i]; | 977 | seq_head = &table.types[i]; |
978 | hlist_for_each_entry(seq, seq_node, seq_head, ns_list) { | 978 | hlist_for_each_entry(seq, seq_node, seq_head, ns_list) { |
979 | nameseq_list(seq, buf, depth, seq->type, | 979 | nameseq_list(seq, buf, depth, seq->type, |
980 | lowbound, upbound, i); | 980 | lowbound, upbound, i); |
981 | } | 981 | } |
982 | } | 982 | } |
@@ -991,7 +991,7 @@ static void nametbl_list(struct print_buf *buf, u32 depth_info, | |||
991 | seq_head = &table.types[i]; | 991 | seq_head = &table.types[i]; |
992 | hlist_for_each_entry(seq, seq_node, seq_head, ns_list) { | 992 | hlist_for_each_entry(seq, seq_node, seq_head, ns_list) { |
993 | if (seq->type == type) { | 993 | if (seq->type == type) { |
994 | nameseq_list(seq, buf, depth, type, | 994 | nameseq_list(seq, buf, depth, type, |
995 | lowbound, upbound, i); | 995 | lowbound, upbound, i); |
996 | break; | 996 | break; |
997 | } | 997 | } |
@@ -1030,7 +1030,7 @@ struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space) | |||
1030 | tipc_printbuf_init(&b, TLV_DATA(rep_tlv), MAX_NAME_TBL_QUERY); | 1030 | tipc_printbuf_init(&b, TLV_DATA(rep_tlv), MAX_NAME_TBL_QUERY); |
1031 | argv = (struct tipc_name_table_query *)TLV_DATA(req_tlv_area); | 1031 | argv = (struct tipc_name_table_query *)TLV_DATA(req_tlv_area); |
1032 | read_lock_bh(&tipc_nametbl_lock); | 1032 | read_lock_bh(&tipc_nametbl_lock); |
1033 | nametbl_list(&b, ntohl(argv->depth), ntohl(argv->type), | 1033 | nametbl_list(&b, ntohl(argv->depth), ntohl(argv->type), |
1034 | ntohl(argv->lowbound), ntohl(argv->upbound)); | 1034 | ntohl(argv->lowbound), ntohl(argv->upbound)); |
1035 | read_unlock_bh(&tipc_nametbl_lock); | 1035 | read_unlock_bh(&tipc_nametbl_lock); |
1036 | str_len = tipc_printbuf_validate(&b); | 1036 | str_len = tipc_printbuf_validate(&b); |