aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/name_table.c
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2012-04-30 15:29:02 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-04-30 15:53:56 -0400
commit617d3c7a50b3dc15f558d60013047aede79dc055 (patch)
tree03908b63390eae5046618595b29f9ff30aea667a /net/tipc/name_table.c
parentaad585473fe1e4b07f2ec1e2432475937f90c385 (diff)
tipc: compress out gratuitous extra carriage returns
Some of the comment blocks are floating in limbo between two functions, or between blocks of code. Delete the extra line feeds between any comment and its associated following block of code, to be consistent with the majority of the rest of the kernel. Also delete trailing newlines at EOF and fix a couple trivial typos in existing comments. This is a 100% cosmetic change with no runtime impact. We get rid of over 500 lines of non-code, and being blank line deletes, they won't even show up as noise in git blame. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc/name_table.c')
-rw-r--r--net/tipc/name_table.c50
1 files changed, 6 insertions, 44 deletions
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 4de58dece9b2..010f24a59da2 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -56,7 +56,6 @@ static int tipc_nametbl_size = 1024; /* must be a power of 2 */
56 * publications of the associated name sequence belong to it. 56 * publications of the associated name sequence belong to it.
57 * (The cluster and node lists may be empty.) 57 * (The cluster and node lists may be empty.)
58 */ 58 */
59
60struct name_info { 59struct name_info {
61 struct list_head node_list; 60 struct list_head node_list;
62 struct list_head cluster_list; 61 struct list_head cluster_list;
@@ -72,7 +71,6 @@ struct name_info {
72 * @upper: name sequence upper bound 71 * @upper: name sequence upper bound
73 * @info: pointer to name sequence publication info 72 * @info: pointer to name sequence publication info
74 */ 73 */
75
76struct sub_seq { 74struct sub_seq {
77 u32 lower; 75 u32 lower;
78 u32 upper; 76 u32 upper;
@@ -90,7 +88,6 @@ struct sub_seq {
90 * @subscriptions: list of subscriptions for this 'type' 88 * @subscriptions: list of subscriptions for this 'type'
91 * @lock: spinlock controlling access to publication lists of all sub-sequences 89 * @lock: spinlock controlling access to publication lists of all sub-sequences
92 */ 90 */
93
94struct name_seq { 91struct name_seq {
95 u32 type; 92 u32 type;
96 struct sub_seq *sseqs; 93 struct sub_seq *sseqs;
@@ -107,7 +104,6 @@ struct name_seq {
107 * accessed via hashing on 'type'; name sequence lists are *not* sorted 104 * accessed via hashing on 'type'; name sequence lists are *not* sorted
108 * @local_publ_count: number of publications issued by this node 105 * @local_publ_count: number of publications issued by this node
109 */ 106 */
110
111struct name_table { 107struct name_table {
112 struct hlist_head *types; 108 struct hlist_head *types;
113 u32 local_publ_count; 109 u32 local_publ_count;
@@ -124,7 +120,6 @@ static int hash(int x)
124/** 120/**
125 * publ_create - create a publication structure 121 * publ_create - create a publication structure
126 */ 122 */
127
128static struct publication *publ_create(u32 type, u32 lower, u32 upper, 123static struct publication *publ_create(u32 type, u32 lower, u32 upper,
129 u32 scope, u32 node, u32 port_ref, 124 u32 scope, u32 node, u32 port_ref,
130 u32 key) 125 u32 key)
@@ -151,7 +146,6 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
151/** 146/**
152 * tipc_subseq_alloc - allocate a specified number of sub-sequence structures 147 * tipc_subseq_alloc - allocate a specified number of sub-sequence structures
153 */ 148 */
154
155static struct sub_seq *tipc_subseq_alloc(u32 cnt) 149static struct sub_seq *tipc_subseq_alloc(u32 cnt)
156{ 150{
157 struct sub_seq *sseq = kcalloc(cnt, sizeof(struct sub_seq), GFP_ATOMIC); 151 struct sub_seq *sseq = kcalloc(cnt, sizeof(struct sub_seq), GFP_ATOMIC);
@@ -163,7 +157,6 @@ static struct sub_seq *tipc_subseq_alloc(u32 cnt)
163 * 157 *
164 * 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.
165 */ 159 */
166
167static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head) 160static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head)
168{ 161{
169 struct name_seq *nseq = kzalloc(sizeof(*nseq), GFP_ATOMIC); 162 struct name_seq *nseq = kzalloc(sizeof(*nseq), GFP_ATOMIC);
@@ -203,7 +196,6 @@ static void nameseq_delete_empty(struct name_seq *seq)
203 * 196 *
204 * Very time-critical, so binary searches through sub-sequence array. 197 * Very time-critical, so binary searches through sub-sequence array.
205 */ 198 */
206
207static struct sub_seq *nameseq_find_subseq(struct name_seq *nseq, 199static struct sub_seq *nameseq_find_subseq(struct name_seq *nseq,
208 u32 instance) 200 u32 instance)
209{ 201{
@@ -233,7 +225,6 @@ static struct sub_seq *nameseq_find_subseq(struct name_seq *nseq,
233 * 225 *
234 * Note: Similar to binary search code for locating a sub-sequence. 226 * Note: Similar to binary search code for locating a sub-sequence.
235 */ 227 */
236
237static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance) 228static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance)
238{ 229{
239 struct sub_seq *sseqs = nseq->sseqs; 230 struct sub_seq *sseqs = nseq->sseqs;
@@ -254,9 +245,8 @@ static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance)
254} 245}
255 246
256/** 247/**
257 * tipc_nameseq_insert_publ - 248 * tipc_nameseq_insert_publ
258 */ 249 */
259
260static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, 250static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
261 u32 type, u32 lower, u32 upper, 251 u32 type, u32 lower, u32 upper,
262 u32 scope, u32 node, u32 port, u32 key) 252 u32 scope, u32 node, u32 port, u32 key)
@@ -272,7 +262,6 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
272 if (sseq) { 262 if (sseq) {
273 263
274 /* Lower end overlaps existing entry => need an exact match */ 264 /* Lower end overlaps existing entry => need an exact match */
275
276 if ((sseq->lower != lower) || (sseq->upper != upper)) { 265 if ((sseq->lower != lower) || (sseq->upper != upper)) {
277 warn("Cannot publish {%u,%u,%u}, overlap error\n", 266 warn("Cannot publish {%u,%u,%u}, overlap error\n",
278 type, lower, upper); 267 type, lower, upper);
@@ -292,11 +281,9 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
292 struct sub_seq *freesseq; 281 struct sub_seq *freesseq;
293 282
294 /* Find where lower end should be inserted */ 283 /* Find where lower end should be inserted */
295
296 inspos = nameseq_locate_subseq(nseq, lower); 284 inspos = nameseq_locate_subseq(nseq, lower);
297 285
298 /* Fail if upper end overlaps into an existing entry */ 286 /* Fail if upper end overlaps into an existing entry */
299
300 if ((inspos < nseq->first_free) && 287 if ((inspos < nseq->first_free) &&
301 (upper >= nseq->sseqs[inspos].lower)) { 288 (upper >= nseq->sseqs[inspos].lower)) {
302 warn("Cannot publish {%u,%u,%u}, overlap error\n", 289 warn("Cannot publish {%u,%u,%u}, overlap error\n",
@@ -305,7 +292,6 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
305 } 292 }
306 293
307 /* Ensure there is space for new sub-sequence */ 294 /* Ensure there is space for new sub-sequence */
308
309 if (nseq->first_free == nseq->alloc) { 295 if (nseq->first_free == nseq->alloc) {
310 struct sub_seq *sseqs = tipc_subseq_alloc(nseq->alloc * 2); 296 struct sub_seq *sseqs = tipc_subseq_alloc(nseq->alloc * 2);
311 297
@@ -333,7 +319,6 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
333 INIT_LIST_HEAD(&info->zone_list); 319 INIT_LIST_HEAD(&info->zone_list);
334 320
335 /* Insert new sub-sequence */ 321 /* Insert new sub-sequence */
336
337 sseq = &nseq->sseqs[inspos]; 322 sseq = &nseq->sseqs[inspos];
338 freesseq = &nseq->sseqs[nseq->first_free]; 323 freesseq = &nseq->sseqs[nseq->first_free];
339 memmove(sseq + 1, sseq, (freesseq - sseq) * sizeof(*sseq)); 324 memmove(sseq + 1, sseq, (freesseq - sseq) * sizeof(*sseq));
@@ -345,8 +330,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
345 created_subseq = 1; 330 created_subseq = 1;
346 } 331 }
347 332
348 /* Insert a publication: */ 333 /* Insert a publication */
349
350 publ = publ_create(type, lower, upper, scope, node, port, key); 334 publ = publ_create(type, lower, upper, scope, node, port, key);
351 if (!publ) 335 if (!publ)
352 return NULL; 336 return NULL;
@@ -364,9 +348,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
364 info->node_list_size++; 348 info->node_list_size++;
365 } 349 }
366 350
367 /* 351 /* Any subscriptions waiting for notification? */
368 * Any subscriptions waiting for notification?
369 */
370 list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { 352 list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) {
371 tipc_subscr_report_overlap(s, 353 tipc_subscr_report_overlap(s,
372 publ->lower, 354 publ->lower,
@@ -380,7 +362,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
380} 362}
381 363
382/** 364/**
383 * tipc_nameseq_remove_publ - 365 * tipc_nameseq_remove_publ
384 * 366 *
385 * NOTE: There may be cases where TIPC is asked to remove a publication 367 * NOTE: There may be cases where TIPC is asked to remove a publication
386 * that is not in the name table. For example, if another node issues a 368 * that is not in the name table. For example, if another node issues a
@@ -390,7 +372,6 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
390 * A failed withdraw request simply returns a failure indication and lets the 372 * A failed withdraw request simply returns a failure indication and lets the
391 * caller issue any error or warning messages associated with such a problem. 373 * caller issue any error or warning messages associated with such a problem.
392 */ 374 */
393
394static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst, 375static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst,
395 u32 node, u32 ref, u32 key) 376 u32 node, u32 ref, u32 key)
396{ 377{
@@ -407,7 +388,6 @@ static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 i
407 info = sseq->info; 388 info = sseq->info;
408 389
409 /* Locate publication, if it exists */ 390 /* Locate publication, if it exists */
410
411 list_for_each_entry(publ, &info->zone_list, zone_list) { 391 list_for_each_entry(publ, &info->zone_list, zone_list) {
412 if ((publ->key == key) && (publ->ref == ref) && 392 if ((publ->key == key) && (publ->ref == ref) &&
413 (!publ->node || (publ->node == node))) 393 (!publ->node || (publ->node == node)))
@@ -417,26 +397,22 @@ static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 i
417 397
418found: 398found:
419 /* Remove publication from zone scope list */ 399 /* Remove publication from zone scope list */
420
421 list_del(&publ->zone_list); 400 list_del(&publ->zone_list);
422 info->zone_list_size--; 401 info->zone_list_size--;
423 402
424 /* Remove publication from cluster scope list, if present */ 403 /* Remove publication from cluster scope list, if present */
425
426 if (in_own_cluster(node)) { 404 if (in_own_cluster(node)) {
427 list_del(&publ->cluster_list); 405 list_del(&publ->cluster_list);
428 info->cluster_list_size--; 406 info->cluster_list_size--;
429 } 407 }
430 408
431 /* Remove publication from node scope list, if present */ 409 /* Remove publication from node scope list, if present */
432
433 if (in_own_node(node)) { 410 if (in_own_node(node)) {
434 list_del(&publ->node_list); 411 list_del(&publ->node_list);
435 info->node_list_size--; 412 info->node_list_size--;
436 } 413 }
437 414
438 /* Contract subseq list if no more publications for that subseq */ 415 /* Contract subseq list if no more publications for that subseq */
439
440 if (list_empty(&info->zone_list)) { 416 if (list_empty(&info->zone_list)) {
441 kfree(info); 417 kfree(info);
442 free = &nseq->sseqs[nseq->first_free--]; 418 free = &nseq->sseqs[nseq->first_free--];
@@ -445,7 +421,6 @@ found:
445 } 421 }
446 422
447 /* Notify any waiting subscriptions */ 423 /* Notify any waiting subscriptions */
448
449 list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { 424 list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) {
450 tipc_subscr_report_overlap(s, 425 tipc_subscr_report_overlap(s,
451 publ->lower, 426 publ->lower,
@@ -464,7 +439,6 @@ found:
464 * the prescribed number of events if there is any sub- 439 * the prescribed number of events if there is any sub-
465 * sequence overlapping with the requested sequence 440 * sequence overlapping with the requested sequence
466 */ 441 */
467
468static void tipc_nameseq_subscribe(struct name_seq *nseq, 442static void tipc_nameseq_subscribe(struct name_seq *nseq,
469 struct tipc_subscription *s) 443 struct tipc_subscription *s)
470{ 444{
@@ -559,7 +533,6 @@ struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower,
559 * - if name translation is attempted and fails, sets 'destnode' to 0 533 * - if name translation is attempted and fails, sets 'destnode' to 0
560 * and returns 0 534 * and returns 0
561 */ 535 */
562
563u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode) 536u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode)
564{ 537{
565 struct sub_seq *sseq; 538 struct sub_seq *sseq;
@@ -582,7 +555,7 @@ u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode)
582 spin_lock_bh(&seq->lock); 555 spin_lock_bh(&seq->lock);
583 info = sseq->info; 556 info = sseq->info;
584 557
585 /* Closest-First Algorithm: */ 558 /* Closest-First Algorithm */
586 if (likely(!*destnode)) { 559 if (likely(!*destnode)) {
587 if (!list_empty(&info->node_list)) { 560 if (!list_empty(&info->node_list)) {
588 publ = list_first_entry(&info->node_list, 561 publ = list_first_entry(&info->node_list,
@@ -605,7 +578,7 @@ u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode)
605 } 578 }
606 } 579 }
607 580
608 /* Round-Robin Algorithm: */ 581 /* Round-Robin Algorithm */
609 else if (*destnode == tipc_own_addr) { 582 else if (*destnode == tipc_own_addr) {
610 if (list_empty(&info->node_list)) 583 if (list_empty(&info->node_list))
611 goto no_match; 584 goto no_match;
@@ -646,7 +619,6 @@ not_found:
646 * 619 *
647 * Returns non-zero if any off-node ports overlap 620 * Returns non-zero if any off-node ports overlap
648 */ 621 */
649
650int tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, 622int tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit,
651 struct tipc_port_list *dports) 623 struct tipc_port_list *dports)
652{ 624{
@@ -690,7 +662,6 @@ exit:
690/* 662/*
691 * tipc_nametbl_publish - add name publication to network name tables 663 * tipc_nametbl_publish - add name publication to network name tables
692 */ 664 */
693
694struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper, 665struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
695 u32 scope, u32 port_ref, u32 key) 666 u32 scope, u32 port_ref, u32 key)
696{ 667{
@@ -716,7 +687,6 @@ struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
716/** 687/**
717 * tipc_nametbl_withdraw - withdraw name publication from network name tables 688 * tipc_nametbl_withdraw - withdraw name publication from network name tables
718 */ 689 */
719
720int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key) 690int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key)
721{ 691{
722 struct publication *publ; 692 struct publication *publ;
@@ -741,7 +711,6 @@ int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key)
741/** 711/**
742 * tipc_nametbl_subscribe - add a subscription object to the name table 712 * tipc_nametbl_subscribe - add a subscription object to the name table
743 */ 713 */
744
745void tipc_nametbl_subscribe(struct tipc_subscription *s) 714void tipc_nametbl_subscribe(struct tipc_subscription *s)
746{ 715{
747 u32 type = s->seq.type; 716 u32 type = s->seq.type;
@@ -765,7 +734,6 @@ void tipc_nametbl_subscribe(struct tipc_subscription *s)
765/** 734/**
766 * tipc_nametbl_unsubscribe - remove a subscription object from name table 735 * tipc_nametbl_unsubscribe - remove a subscription object from name table
767 */ 736 */
768
769void tipc_nametbl_unsubscribe(struct tipc_subscription *s) 737void tipc_nametbl_unsubscribe(struct tipc_subscription *s)
770{ 738{
771 struct name_seq *seq; 739 struct name_seq *seq;
@@ -785,7 +753,6 @@ void tipc_nametbl_unsubscribe(struct tipc_subscription *s)
785/** 753/**
786 * subseq_list: print specified sub-sequence contents into the given buffer 754 * subseq_list: print specified sub-sequence contents into the given buffer
787 */ 755 */
788
789static void subseq_list(struct sub_seq *sseq, struct print_buf *buf, u32 depth, 756static void subseq_list(struct sub_seq *sseq, struct print_buf *buf, u32 depth,
790 u32 index) 757 u32 index)
791{ 758{
@@ -822,7 +789,6 @@ static void subseq_list(struct sub_seq *sseq, struct print_buf *buf, u32 depth,
822/** 789/**
823 * nameseq_list: print specified name sequence contents into the given buffer 790 * nameseq_list: print specified name sequence contents into the given buffer
824 */ 791 */
825
826static void nameseq_list(struct name_seq *seq, struct print_buf *buf, u32 depth, 792static void nameseq_list(struct name_seq *seq, struct print_buf *buf, u32 depth,
827 u32 type, u32 lowbound, u32 upbound, u32 index) 793 u32 type, u32 lowbound, u32 upbound, u32 index)
828{ 794{
@@ -853,7 +819,6 @@ static void nameseq_list(struct name_seq *seq, struct print_buf *buf, u32 depth,
853/** 819/**
854 * nametbl_header - print name table header into the given buffer 820 * nametbl_header - print name table header into the given buffer
855 */ 821 */
856
857static void nametbl_header(struct print_buf *buf, u32 depth) 822static void nametbl_header(struct print_buf *buf, u32 depth)
858{ 823{
859 const char *header[] = { 824 const char *header[] = {
@@ -875,7 +840,6 @@ static void nametbl_header(struct print_buf *buf, u32 depth)
875/** 840/**
876 * nametbl_list - print specified name table contents into the given buffer 841 * nametbl_list - print specified name table contents into the given buffer
877 */ 842 */
878
879static void nametbl_list(struct print_buf *buf, u32 depth_info, 843static void nametbl_list(struct print_buf *buf, u32 depth_info,
880 u32 type, u32 lowbound, u32 upbound) 844 u32 type, u32 lowbound, u32 upbound)
881{ 845{
@@ -974,7 +938,6 @@ void tipc_nametbl_stop(void)
974 return; 938 return;
975 939
976 /* Verify name table is empty, then release it */ 940 /* Verify name table is empty, then release it */
977
978 write_lock_bh(&tipc_nametbl_lock); 941 write_lock_bh(&tipc_nametbl_lock);
979 for (i = 0; i < tipc_nametbl_size; i++) { 942 for (i = 0; i < tipc_nametbl_size; i++) {
980 if (!hlist_empty(&table.types[i])) 943 if (!hlist_empty(&table.types[i]))
@@ -984,4 +947,3 @@ void tipc_nametbl_stop(void)
984 table.types = NULL; 947 table.types = NULL;
985 write_unlock_bh(&tipc_nametbl_lock); 948 write_unlock_bh(&tipc_nametbl_lock);
986} 949}
987