diff options
author | Patrick McHardy <kaber@trash.net> | 2011-01-14 08:12:37 -0500 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2011-01-14 08:12:37 -0500 |
commit | 0134e89c7bcc9fde1da962c82a120691e185619f (patch) | |
tree | 3e03335cf001019a2687d161e956de4f73379984 /net/tipc/subscr.c | |
parent | c7066f70d9610df0b9406cc635fc09e86136e714 (diff) | |
parent | 6faee60a4e82075853a437831768cc9e2e563e4e (diff) |
Merge branch 'master' of git://1984.lsi.us.es/net-next-2.6
Conflicts:
net/ipv4/route.c
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/tipc/subscr.c')
-rw-r--r-- | net/tipc/subscr.c | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c index 33313961d010..ca04479c3d42 100644 --- a/net/tipc/subscr.c +++ b/net/tipc/subscr.c | |||
@@ -35,10 +35,8 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "core.h" | 37 | #include "core.h" |
38 | #include "dbg.h" | ||
39 | #include "name_table.h" | 38 | #include "name_table.h" |
40 | #include "port.h" | 39 | #include "port.h" |
41 | #include "ref.h" | ||
42 | #include "subscr.h" | 40 | #include "subscr.h" |
43 | 41 | ||
44 | /** | 42 | /** |
@@ -66,14 +64,13 @@ struct subscriber { | |||
66 | */ | 64 | */ |
67 | 65 | ||
68 | struct top_srv { | 66 | struct top_srv { |
69 | u32 user_ref; | ||
70 | u32 setup_port; | 67 | u32 setup_port; |
71 | atomic_t subscription_count; | 68 | atomic_t subscription_count; |
72 | struct list_head subscriber_list; | 69 | struct list_head subscriber_list; |
73 | spinlock_t lock; | 70 | spinlock_t lock; |
74 | }; | 71 | }; |
75 | 72 | ||
76 | static struct top_srv topsrv = { 0 }; | 73 | static struct top_srv topsrv; |
77 | 74 | ||
78 | /** | 75 | /** |
79 | * htohl - convert value to endianness used by destination | 76 | * htohl - convert value to endianness used by destination |
@@ -252,8 +249,6 @@ static void subscr_terminate(struct subscriber *subscriber) | |||
252 | k_cancel_timer(&sub->timer); | 249 | k_cancel_timer(&sub->timer); |
253 | k_term_timer(&sub->timer); | 250 | k_term_timer(&sub->timer); |
254 | } | 251 | } |
255 | dbg("Term: Removing sub %u,%u,%u from subscriber %x list\n", | ||
256 | sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber); | ||
257 | subscr_del(sub); | 252 | subscr_del(sub); |
258 | } | 253 | } |
259 | 254 | ||
@@ -310,8 +305,6 @@ static void subscr_cancel(struct tipc_subscr *s, | |||
310 | k_term_timer(&sub->timer); | 305 | k_term_timer(&sub->timer); |
311 | spin_lock_bh(subscriber->lock); | 306 | spin_lock_bh(subscriber->lock); |
312 | } | 307 | } |
313 | dbg("Cancel: removing sub %u,%u,%u from subscriber %x list\n", | ||
314 | sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber); | ||
315 | subscr_del(sub); | 308 | subscr_del(sub); |
316 | } | 309 | } |
317 | 310 | ||
@@ -496,8 +489,7 @@ static void subscr_named_msg_event(void *usr_handle, | |||
496 | 489 | ||
497 | /* Create server port & establish connection to subscriber */ | 490 | /* Create server port & establish connection to subscriber */ |
498 | 491 | ||
499 | tipc_createport(topsrv.user_ref, | 492 | tipc_createport(subscriber, |
500 | subscriber, | ||
501 | importance, | 493 | importance, |
502 | NULL, | 494 | NULL, |
503 | NULL, | 495 | NULL, |
@@ -544,21 +536,14 @@ static void subscr_named_msg_event(void *usr_handle, | |||
544 | int tipc_subscr_start(void) | 536 | int tipc_subscr_start(void) |
545 | { | 537 | { |
546 | struct tipc_name_seq seq = {TIPC_TOP_SRV, TIPC_TOP_SRV, TIPC_TOP_SRV}; | 538 | struct tipc_name_seq seq = {TIPC_TOP_SRV, TIPC_TOP_SRV, TIPC_TOP_SRV}; |
547 | int res = -1; | 539 | int res; |
548 | 540 | ||
549 | memset(&topsrv, 0, sizeof (topsrv)); | 541 | memset(&topsrv, 0, sizeof(topsrv)); |
550 | spin_lock_init(&topsrv.lock); | 542 | spin_lock_init(&topsrv.lock); |
551 | INIT_LIST_HEAD(&topsrv.subscriber_list); | 543 | INIT_LIST_HEAD(&topsrv.subscriber_list); |
552 | 544 | ||
553 | spin_lock_bh(&topsrv.lock); | 545 | spin_lock_bh(&topsrv.lock); |
554 | res = tipc_attach(&topsrv.user_ref, NULL, NULL); | 546 | res = tipc_createport(NULL, |
555 | if (res) { | ||
556 | spin_unlock_bh(&topsrv.lock); | ||
557 | return res; | ||
558 | } | ||
559 | |||
560 | res = tipc_createport(topsrv.user_ref, | ||
561 | NULL, | ||
562 | TIPC_CRITICAL_IMPORTANCE, | 547 | TIPC_CRITICAL_IMPORTANCE, |
563 | NULL, | 548 | NULL, |
564 | NULL, | 549 | NULL, |
@@ -572,16 +557,17 @@ int tipc_subscr_start(void) | |||
572 | goto failed; | 557 | goto failed; |
573 | 558 | ||
574 | res = tipc_nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq); | 559 | res = tipc_nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq); |
575 | if (res) | 560 | if (res) { |
561 | tipc_deleteport(topsrv.setup_port); | ||
562 | topsrv.setup_port = 0; | ||
576 | goto failed; | 563 | goto failed; |
564 | } | ||
577 | 565 | ||
578 | spin_unlock_bh(&topsrv.lock); | 566 | spin_unlock_bh(&topsrv.lock); |
579 | return 0; | 567 | return 0; |
580 | 568 | ||
581 | failed: | 569 | failed: |
582 | err("Failed to create subscription service\n"); | 570 | err("Failed to create subscription service\n"); |
583 | tipc_detach(topsrv.user_ref); | ||
584 | topsrv.user_ref = 0; | ||
585 | spin_unlock_bh(&topsrv.lock); | 571 | spin_unlock_bh(&topsrv.lock); |
586 | return res; | 572 | return res; |
587 | } | 573 | } |
@@ -592,8 +578,10 @@ void tipc_subscr_stop(void) | |||
592 | struct subscriber *subscriber_temp; | 578 | struct subscriber *subscriber_temp; |
593 | spinlock_t *subscriber_lock; | 579 | spinlock_t *subscriber_lock; |
594 | 580 | ||
595 | if (topsrv.user_ref) { | 581 | if (topsrv.setup_port) { |
596 | tipc_deleteport(topsrv.setup_port); | 582 | tipc_deleteport(topsrv.setup_port); |
583 | topsrv.setup_port = 0; | ||
584 | |||
597 | list_for_each_entry_safe(subscriber, subscriber_temp, | 585 | list_for_each_entry_safe(subscriber, subscriber_temp, |
598 | &topsrv.subscriber_list, | 586 | &topsrv.subscriber_list, |
599 | subscriber_list) { | 587 | subscriber_list) { |
@@ -602,7 +590,5 @@ void tipc_subscr_stop(void) | |||
602 | subscr_terminate(subscriber); | 590 | subscr_terminate(subscriber); |
603 | spin_unlock_bh(subscriber_lock); | 591 | spin_unlock_bh(subscriber_lock); |
604 | } | 592 | } |
605 | tipc_detach(topsrv.user_ref); | ||
606 | topsrv.user_ref = 0; | ||
607 | } | 593 | } |
608 | } | 594 | } |