提交 f1379173 编写于 作者: A Allan Stephens 提交者: Paul Gortmaker

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: NAllan Stephens <Allan.Stephens@windriver.com>
Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
上级 431697eb
...@@ -214,7 +214,7 @@ void tipc_named_node_up(unsigned long node) ...@@ -214,7 +214,7 @@ void tipc_named_node_up(unsigned long node)
} }
/** /**
* node_is_down - remove publication associated with a failed node * named_purge_publ - remove publication associated with a failed node
* *
* Invoked for each publication issued by a newly failed node. * Invoked for each publication issued by a newly failed node.
* Removes publication structure from name table & deletes it. * Removes publication structure from name table & deletes it.
...@@ -223,7 +223,7 @@ void tipc_named_node_up(unsigned long node) ...@@ -223,7 +223,7 @@ void tipc_named_node_up(unsigned long node)
* publication. Nudge this item's key to distinguish it from the other. * publication. Nudge this item's key to distinguish it from the other.
*/ */
static void node_is_down(struct publication *publ) static void named_purge_publ(struct publication *publ)
{ {
struct publication *p; struct publication *p;
...@@ -269,7 +269,8 @@ void tipc_named_recv(struct sk_buff *buf) ...@@ -269,7 +269,8 @@ void tipc_named_recv(struct sk_buff *buf)
tipc_nodesub_subscribe(&publ->subscr, tipc_nodesub_subscribe(&publ->subscr,
msg_orignode(msg), msg_orignode(msg),
publ, publ,
(net_ev_handler)node_is_down); (net_ev_handler)
named_purge_publ);
} }
} else if (msg_type(msg) == WITHDRAWAL) { } else if (msg_type(msg) == WITHDRAWAL) {
publ = tipc_nametbl_remove_publ(ntohl(item->type), publ = tipc_nametbl_remove_publ(ntohl(item->type),
......
...@@ -327,7 +327,6 @@ static void node_cleanup_finished(unsigned long node_addr) ...@@ -327,7 +327,6 @@ static void node_cleanup_finished(unsigned long node_addr)
static void node_lost_contact(struct tipc_node *n_ptr) static void node_lost_contact(struct tipc_node *n_ptr)
{ {
struct tipc_node_subscr *ns;
char addr_string[16]; char addr_string[16];
u32 i; u32 i;
...@@ -365,13 +364,7 @@ static void node_lost_contact(struct tipc_node *n_ptr) ...@@ -365,13 +364,7 @@ static void node_lost_contact(struct tipc_node *n_ptr)
} }
/* Notify subscribers */ /* Notify subscribers */
list_for_each_entry(ns, &n_ptr->nsub, nodesub_list) { tipc_nodesub_notify(n_ptr);
if (ns->handle_node_down) {
tipc_k_signal((Handler)ns->handle_node_down,
(unsigned long)ns->usr_handle);
ns->handle_node_down = NULL;
}
}
/* Prevent re-contact with node until all cleanup is done */ /* Prevent re-contact with node until all cleanup is done */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/node_subscr.c: TIPC "node down" subscription handling * net/tipc/node_subscr.c: TIPC "node down" subscription handling
* *
* Copyright (c) 1995-2006, Ericsson AB * Copyright (c) 1995-2006, Ericsson AB
* Copyright (c) 2005, Wind River Systems * Copyright (c) 2005, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * 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,3 +76,22 @@ void tipc_nodesub_unsubscribe(struct tipc_node_subscr *node_sub)
list_del_init(&node_sub->nodesub_list); list_del_init(&node_sub->nodesub_list);
tipc_node_unlock(node_sub->node); tipc_node_unlock(node_sub->node);
} }
/**
* tipc_nodesub_notify - notify subscribers that a node is unreachable
*
* Note: node is locked by caller
*/
void tipc_nodesub_notify(struct tipc_node *node)
{
struct tipc_node_subscr *ns;
list_for_each_entry(ns, &node->nsub, nodesub_list) {
if (ns->handle_node_down) {
tipc_k_signal((Handler)ns->handle_node_down,
(unsigned long)ns->usr_handle);
ns->handle_node_down = NULL;
}
}
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/node_subscr.h: Include file for TIPC "node down" subscription handling * net/tipc/node_subscr.h: Include file for TIPC "node down" subscription handling
* *
* Copyright (c) 1995-2006, Ericsson AB * Copyright (c) 1995-2006, Ericsson AB
* Copyright (c) 2005, Wind River Systems * Copyright (c) 2005, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -59,5 +59,6 @@ struct tipc_node_subscr { ...@@ -59,5 +59,6 @@ struct tipc_node_subscr {
void tipc_nodesub_subscribe(struct tipc_node_subscr *node_sub, u32 addr, void tipc_nodesub_subscribe(struct tipc_node_subscr *node_sub, u32 addr,
void *usr_handle, net_ev_handler handle_down); void *usr_handle, net_ev_handler handle_down);
void tipc_nodesub_unsubscribe(struct tipc_node_subscr *node_sub); void tipc_nodesub_unsubscribe(struct tipc_node_subscr *node_sub);
void tipc_nodesub_notify(struct tipc_node *node);
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册