aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorAllan Stephens <Allan.Stephens@windriver.com>2011-02-23 14:13:41 -0500
committerPaul Gortmaker <paul.gortmaker@windriver.com>2011-03-13 16:35:16 -0400
commitf1379173326de4c745c4f610501486e4f3bd9248 (patch)
tree80c3fca29ae990040b8812f810ce7bf6665d5059 /net/tipc
parent431697eb60d2d36614096aff12bd1b826a9f9bc1 (diff)
tipc: Cosmetic changes to node subscription code
Relocates the code that notifies users of node subscriptions so that it is adjacent to the rest of the routines that implement TIPC's node subscription capability. Renames the name table routine that is invoked by a node subscription to better reflect its purpose and to be consistent with other, similar name table routines. These changes are cosmetic in nature, and do not alter the behavior of TIPC. Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/name_distr.c7
-rw-r--r--net/tipc/node.c9
-rw-r--r--net/tipc/node_subscr.c21
-rw-r--r--net/tipc/node_subscr.h3
4 files changed, 27 insertions, 13 deletions
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 1d4a18aa9ccc..d58dae78b551 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -214,7 +214,7 @@ exit:
214} 214}
215 215
216/** 216/**
217 * node_is_down - remove publication associated with a failed node 217 * named_purge_publ - remove publication associated with a failed node
218 * 218 *
219 * Invoked for each publication issued by a newly failed node. 219 * Invoked for each publication issued by a newly failed node.
220 * Removes publication structure from name table & deletes it. 220 * Removes publication structure from name table & deletes it.
@@ -223,7 +223,7 @@ exit:
223 * publication. Nudge this item's key to distinguish it from the other. 223 * publication. Nudge this item's key to distinguish it from the other.
224 */ 224 */
225 225
226static void node_is_down(struct publication *publ) 226static void named_purge_publ(struct publication *publ)
227{ 227{
228 struct publication *p; 228 struct publication *p;
229 229
@@ -269,7 +269,8 @@ void tipc_named_recv(struct sk_buff *buf)
269 tipc_nodesub_subscribe(&publ->subscr, 269 tipc_nodesub_subscribe(&publ->subscr,
270 msg_orignode(msg), 270 msg_orignode(msg),
271 publ, 271 publ,
272 (net_ev_handler)node_is_down); 272 (net_ev_handler)
273 named_purge_publ);
273 } 274 }
274 } else if (msg_type(msg) == WITHDRAWAL) { 275 } else if (msg_type(msg) == WITHDRAWAL) {
275 publ = tipc_nametbl_remove_publ(ntohl(item->type), 276 publ = tipc_nametbl_remove_publ(ntohl(item->type),
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 8926caaf1fc5..713ab5d7c54f 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -327,7 +327,6 @@ static void node_cleanup_finished(unsigned long node_addr)
327 327
328static void node_lost_contact(struct tipc_node *n_ptr) 328static void node_lost_contact(struct tipc_node *n_ptr)
329{ 329{
330 struct tipc_node_subscr *ns;
331 char addr_string[16]; 330 char addr_string[16];
332 u32 i; 331 u32 i;
333 332
@@ -365,13 +364,7 @@ static void node_lost_contact(struct tipc_node *n_ptr)
365 } 364 }
366 365
367 /* Notify subscribers */ 366 /* Notify subscribers */
368 list_for_each_entry(ns, &n_ptr->nsub, nodesub_list) { 367 tipc_nodesub_notify(n_ptr);
369 if (ns->handle_node_down) {
370 tipc_k_signal((Handler)ns->handle_node_down,
371 (unsigned long)ns->usr_handle);
372 ns->handle_node_down = NULL;
373 }
374 }
375 368
376 /* Prevent re-contact with node until all cleanup is done */ 369 /* Prevent re-contact with node until all cleanup is done */
377 370
diff --git a/net/tipc/node_subscr.c b/net/tipc/node_subscr.c
index 018a55332d91..c3c2815ae630 100644
--- a/net/tipc/node_subscr.c
+++ b/net/tipc/node_subscr.c
@@ -2,7 +2,7 @@
2 * net/tipc/node_subscr.c: TIPC "node down" subscription handling 2 * net/tipc/node_subscr.c: TIPC "node down" subscription handling
3 * 3 *
4 * Copyright (c) 1995-2006, Ericsson AB 4 * Copyright (c) 1995-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, 2010-2011, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -76,3 +76,22 @@ void tipc_nodesub_unsubscribe(struct tipc_node_subscr *node_sub)
76 list_del_init(&node_sub->nodesub_list); 76 list_del_init(&node_sub->nodesub_list);
77 tipc_node_unlock(node_sub->node); 77 tipc_node_unlock(node_sub->node);
78} 78}
79
80/**
81 * tipc_nodesub_notify - notify subscribers that a node is unreachable
82 *
83 * Note: node is locked by caller
84 */
85
86void tipc_nodesub_notify(struct tipc_node *node)
87{
88 struct tipc_node_subscr *ns;
89
90 list_for_each_entry(ns, &node->nsub, nodesub_list) {
91 if (ns->handle_node_down) {
92 tipc_k_signal((Handler)ns->handle_node_down,
93 (unsigned long)ns->usr_handle);
94 ns->handle_node_down = NULL;
95 }
96 }
97}
diff --git a/net/tipc/node_subscr.h b/net/tipc/node_subscr.h
index 006ed739f515..4bc2ca0867a1 100644
--- a/net/tipc/node_subscr.h
+++ b/net/tipc/node_subscr.h
@@ -2,7 +2,7 @@
2 * net/tipc/node_subscr.h: Include file for TIPC "node down" subscription handling 2 * net/tipc/node_subscr.h: Include file for TIPC "node down" subscription handling
3 * 3 *
4 * Copyright (c) 1995-2006, Ericsson AB 4 * Copyright (c) 1995-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, 2010-2011, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -59,5 +59,6 @@ struct tipc_node_subscr {
59void tipc_nodesub_subscribe(struct tipc_node_subscr *node_sub, u32 addr, 59void tipc_nodesub_subscribe(struct tipc_node_subscr *node_sub, u32 addr,
60 void *usr_handle, net_ev_handler handle_down); 60 void *usr_handle, net_ev_handler handle_down);
61void tipc_nodesub_unsubscribe(struct tipc_node_subscr *node_sub); 61void tipc_nodesub_unsubscribe(struct tipc_node_subscr *node_sub);
62void tipc_nodesub_notify(struct tipc_node *node);
62 63
63#endif 64#endif