diff options
author | Ying Xue <ying.xue@windriver.com> | 2014-11-25 22:41:45 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-11-26 12:30:16 -0500 |
commit | a8f48af587b0f257c49dce5b49a62554a4b8627e (patch) | |
tree | dd28b059961d63e1f925a5c34f05fb14a741d405 /net/tipc | |
parent | 73cf0e923d685a6a1b7754c7d29cc14944f271d9 (diff) |
tipc: remove node subscription infrastructure
The node subscribe infrastructure represents a virtual base class, so
its users, such as struct tipc_port and struct publication, can derive
its implemented functionalities. However, after the removal of struct
tipc_port, struct publication is left as its only single user now. So
defining an abstract infrastructure for one user becomes no longer
reasonable. If corresponding new functions associated with the
infrastructure are moved to name_table.c file, the node subscription
infrastructure can be removed as well.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/Makefile | 4 | ||||
-rw-r--r-- | net/tipc/name_distr.c | 52 | ||||
-rw-r--r-- | net/tipc/name_distr.h | 1 | ||||
-rw-r--r-- | net/tipc/name_table.c | 2 | ||||
-rw-r--r-- | net/tipc/name_table.h | 6 | ||||
-rw-r--r-- | net/tipc/node.c | 6 | ||||
-rw-r--r-- | net/tipc/node.h | 5 | ||||
-rw-r--r-- | net/tipc/node_subscr.c | 96 | ||||
-rw-r--r-- | net/tipc/node_subscr.h | 63 |
9 files changed, 56 insertions, 179 deletions
diff --git a/net/tipc/Makefile b/net/tipc/Makefile index b8a13caad59a..333e4592772c 100644 --- a/net/tipc/Makefile +++ b/net/tipc/Makefile | |||
@@ -7,8 +7,8 @@ obj-$(CONFIG_TIPC) := tipc.o | |||
7 | tipc-y += addr.o bcast.o bearer.o config.o \ | 7 | tipc-y += addr.o bcast.o bearer.o config.o \ |
8 | core.o link.o discover.o msg.o \ | 8 | core.o link.o discover.o msg.o \ |
9 | name_distr.o subscr.o name_table.o net.o \ | 9 | name_distr.o subscr.o name_table.o net.o \ |
10 | netlink.o node.o node_subscr.o \ | 10 | netlink.o node.o socket.o log.o eth_media.o \ |
11 | socket.o log.o eth_media.o server.o | 11 | server.o |
12 | 12 | ||
13 | tipc-$(CONFIG_TIPC_MEDIA_IB) += ib_media.o | 13 | tipc-$(CONFIG_TIPC_MEDIA_IB) += ib_media.o |
14 | tipc-$(CONFIG_SYSCTL) += sysctl.o | 14 | tipc-$(CONFIG_SYSCTL) += sysctl.o |
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index 376d2bb51d8d..6c2638d3c659 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c | |||
@@ -250,13 +250,45 @@ void tipc_named_node_up(u32 dnode) | |||
250 | tipc_link_xmit(buf_chain, dnode, dnode); | 250 | tipc_link_xmit(buf_chain, dnode, dnode); |
251 | } | 251 | } |
252 | 252 | ||
253 | static void tipc_publ_subscribe(struct publication *publ, u32 addr) | ||
254 | { | ||
255 | struct tipc_node *node; | ||
256 | |||
257 | if (in_own_node(addr)) | ||
258 | return; | ||
259 | |||
260 | node = tipc_node_find(addr); | ||
261 | if (!node) { | ||
262 | pr_warn("Node subscription rejected, unknown node 0x%x\n", | ||
263 | addr); | ||
264 | return; | ||
265 | } | ||
266 | |||
267 | tipc_node_lock(node); | ||
268 | list_add_tail(&publ->nodesub_list, &node->publ_list); | ||
269 | tipc_node_unlock(node); | ||
270 | } | ||
271 | |||
272 | static void tipc_publ_unsubscribe(struct publication *publ, u32 addr) | ||
273 | { | ||
274 | struct tipc_node *node; | ||
275 | |||
276 | node = tipc_node_find(addr); | ||
277 | if (!node) | ||
278 | return; | ||
279 | |||
280 | tipc_node_lock(node); | ||
281 | list_del_init(&publ->nodesub_list); | ||
282 | tipc_node_unlock(node); | ||
283 | } | ||
284 | |||
253 | /** | 285 | /** |
254 | * named_purge_publ - remove publication associated with a failed node | 286 | * tipc_publ_purge - remove publication associated with a failed node |
255 | * | 287 | * |
256 | * Invoked for each publication issued by a newly failed node. | 288 | * Invoked for each publication issued by a newly failed node. |
257 | * Removes publication structure from name table & deletes it. | 289 | * Removes publication structure from name table & deletes it. |
258 | */ | 290 | */ |
259 | static void named_purge_publ(struct publication *publ) | 291 | static void tipc_publ_purge(struct publication *publ, u32 addr) |
260 | { | 292 | { |
261 | struct publication *p; | 293 | struct publication *p; |
262 | 294 | ||
@@ -264,7 +296,7 @@ static void named_purge_publ(struct publication *publ) | |||
264 | p = tipc_nametbl_remove_publ(publ->type, publ->lower, | 296 | p = tipc_nametbl_remove_publ(publ->type, publ->lower, |
265 | publ->node, publ->ref, publ->key); | 297 | publ->node, publ->ref, publ->key); |
266 | if (p) | 298 | if (p) |
267 | tipc_nodesub_unsubscribe(&p->subscr); | 299 | tipc_publ_unsubscribe(p, addr); |
268 | write_unlock_bh(&tipc_nametbl_lock); | 300 | write_unlock_bh(&tipc_nametbl_lock); |
269 | 301 | ||
270 | if (p != publ) { | 302 | if (p != publ) { |
@@ -277,6 +309,14 @@ static void named_purge_publ(struct publication *publ) | |||
277 | kfree(p); | 309 | kfree(p); |
278 | } | 310 | } |
279 | 311 | ||
312 | void tipc_publ_notify(struct list_head *nsub_list, u32 addr) | ||
313 | { | ||
314 | struct publication *publ, *tmp; | ||
315 | |||
316 | list_for_each_entry_safe(publ, tmp, nsub_list, nodesub_list) | ||
317 | tipc_publ_purge(publ, addr); | ||
318 | } | ||
319 | |||
280 | /** | 320 | /** |
281 | * tipc_update_nametbl - try to process a nametable update and notify | 321 | * tipc_update_nametbl - try to process a nametable update and notify |
282 | * subscribers | 322 | * subscribers |
@@ -294,9 +334,7 @@ static bool tipc_update_nametbl(struct distr_item *i, u32 node, u32 dtype) | |||
294 | TIPC_CLUSTER_SCOPE, node, | 334 | TIPC_CLUSTER_SCOPE, node, |
295 | ntohl(i->ref), ntohl(i->key)); | 335 | ntohl(i->ref), ntohl(i->key)); |
296 | if (publ) { | 336 | if (publ) { |
297 | tipc_nodesub_subscribe(&publ->subscr, node, publ, | 337 | tipc_publ_subscribe(publ, node); |
298 | (net_ev_handler) | ||
299 | named_purge_publ); | ||
300 | return true; | 338 | return true; |
301 | } | 339 | } |
302 | } else if (dtype == WITHDRAWAL) { | 340 | } else if (dtype == WITHDRAWAL) { |
@@ -304,7 +342,7 @@ static bool tipc_update_nametbl(struct distr_item *i, u32 node, u32 dtype) | |||
304 | node, ntohl(i->ref), | 342 | node, ntohl(i->ref), |
305 | ntohl(i->key)); | 343 | ntohl(i->key)); |
306 | if (publ) { | 344 | if (publ) { |
307 | tipc_nodesub_unsubscribe(&publ->subscr); | 345 | tipc_publ_unsubscribe(publ, node); |
308 | kfree(publ); | 346 | kfree(publ); |
309 | return true; | 347 | return true; |
310 | } | 348 | } |
diff --git a/net/tipc/name_distr.h b/net/tipc/name_distr.h index b9e75feb3434..cef55cedcfb2 100644 --- a/net/tipc/name_distr.h +++ b/net/tipc/name_distr.h | |||
@@ -74,5 +74,6 @@ void tipc_named_node_up(u32 dnode); | |||
74 | void tipc_named_rcv(struct sk_buff *buf); | 74 | void tipc_named_rcv(struct sk_buff *buf); |
75 | void tipc_named_reinit(void); | 75 | void tipc_named_reinit(void); |
76 | void tipc_named_process_backlog(void); | 76 | void tipc_named_process_backlog(void); |
77 | void tipc_publ_notify(struct list_head *nsub_list, u32 addr); | ||
77 | 78 | ||
78 | #endif | 79 | #endif |
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index 7cfb7a4aa58f..772be1cd8bf6 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c | |||
@@ -144,7 +144,7 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper, | |||
144 | publ->key = key; | 144 | publ->key = key; |
145 | INIT_LIST_HEAD(&publ->local_list); | 145 | INIT_LIST_HEAD(&publ->local_list); |
146 | INIT_LIST_HEAD(&publ->pport_list); | 146 | INIT_LIST_HEAD(&publ->pport_list); |
147 | INIT_LIST_HEAD(&publ->subscr.nodesub_list); | 147 | INIT_LIST_HEAD(&publ->nodesub_list); |
148 | return publ; | 148 | return publ; |
149 | } | 149 | } |
150 | 150 | ||
diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h index b38ebecac766..c62877826655 100644 --- a/net/tipc/name_table.h +++ b/net/tipc/name_table.h | |||
@@ -37,8 +37,6 @@ | |||
37 | #ifndef _TIPC_NAME_TABLE_H | 37 | #ifndef _TIPC_NAME_TABLE_H |
38 | #define _TIPC_NAME_TABLE_H | 38 | #define _TIPC_NAME_TABLE_H |
39 | 39 | ||
40 | #include "node_subscr.h" | ||
41 | |||
42 | struct tipc_subscription; | 40 | struct tipc_subscription; |
43 | struct tipc_port_list; | 41 | struct tipc_port_list; |
44 | 42 | ||
@@ -56,7 +54,7 @@ struct tipc_port_list; | |||
56 | * @node: network address of publishing port's node | 54 | * @node: network address of publishing port's node |
57 | * @ref: publishing port | 55 | * @ref: publishing port |
58 | * @key: publication key | 56 | * @key: publication key |
59 | * @subscr: subscription to "node down" event (for off-node publications only) | 57 | * @nodesub_list: subscription to "node down" event (off-node publication only) |
60 | * @local_list: adjacent entries in list of publications made by this node | 58 | * @local_list: adjacent entries in list of publications made by this node |
61 | * @pport_list: adjacent entries in list of publications made by this port | 59 | * @pport_list: adjacent entries in list of publications made by this port |
62 | * @node_list: adjacent matching name seq publications with >= node scope | 60 | * @node_list: adjacent matching name seq publications with >= node scope |
@@ -73,7 +71,7 @@ struct publication { | |||
73 | u32 node; | 71 | u32 node; |
74 | u32 ref; | 72 | u32 ref; |
75 | u32 key; | 73 | u32 key; |
76 | struct tipc_node_subscr subscr; | 74 | struct list_head nodesub_list; |
77 | struct list_head local_list; | 75 | struct list_head local_list; |
78 | struct list_head pport_list; | 76 | struct list_head pport_list; |
79 | struct list_head node_list; | 77 | struct list_head node_list; |
diff --git a/net/tipc/node.c b/net/tipc/node.c index 82e5edddc376..17b8092f9c40 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -113,7 +113,7 @@ struct tipc_node *tipc_node_create(u32 addr) | |||
113 | spin_lock_init(&n_ptr->lock); | 113 | spin_lock_init(&n_ptr->lock); |
114 | INIT_HLIST_NODE(&n_ptr->hash); | 114 | INIT_HLIST_NODE(&n_ptr->hash); |
115 | INIT_LIST_HEAD(&n_ptr->list); | 115 | INIT_LIST_HEAD(&n_ptr->list); |
116 | INIT_LIST_HEAD(&n_ptr->nsub); | 116 | INIT_LIST_HEAD(&n_ptr->publ_list); |
117 | INIT_LIST_HEAD(&n_ptr->conn_sks); | 117 | INIT_LIST_HEAD(&n_ptr->conn_sks); |
118 | __skb_queue_head_init(&n_ptr->waiting_sks); | 118 | __skb_queue_head_init(&n_ptr->waiting_sks); |
119 | 119 | ||
@@ -574,7 +574,7 @@ void tipc_node_unlock(struct tipc_node *node) | |||
574 | skb_queue_splice_init(&node->waiting_sks, &waiting_sks); | 574 | skb_queue_splice_init(&node->waiting_sks, &waiting_sks); |
575 | 575 | ||
576 | if (flags & TIPC_NOTIFY_NODE_DOWN) { | 576 | if (flags & TIPC_NOTIFY_NODE_DOWN) { |
577 | list_replace_init(&node->nsub, &nsub_list); | 577 | list_replace_init(&node->publ_list, &nsub_list); |
578 | list_replace_init(&node->conn_sks, &conn_sks); | 578 | list_replace_init(&node->conn_sks, &conn_sks); |
579 | } | 579 | } |
580 | node->action_flags &= ~(TIPC_WAKEUP_USERS | TIPC_NOTIFY_NODE_DOWN | | 580 | node->action_flags &= ~(TIPC_WAKEUP_USERS | TIPC_NOTIFY_NODE_DOWN | |
@@ -591,7 +591,7 @@ void tipc_node_unlock(struct tipc_node *node) | |||
591 | tipc_node_abort_sock_conns(&conn_sks); | 591 | tipc_node_abort_sock_conns(&conn_sks); |
592 | 592 | ||
593 | if (!list_empty(&nsub_list)) | 593 | if (!list_empty(&nsub_list)) |
594 | tipc_nodesub_notify(&nsub_list); | 594 | tipc_publ_notify(&nsub_list, addr); |
595 | 595 | ||
596 | if (flags & TIPC_WAKEUP_BCAST_USERS) | 596 | if (flags & TIPC_WAKEUP_BCAST_USERS) |
597 | tipc_bclink_wakeup_users(); | 597 | tipc_bclink_wakeup_users(); |
diff --git a/net/tipc/node.h b/net/tipc/node.h index 005fbcef3212..f1994511f033 100644 --- a/net/tipc/node.h +++ b/net/tipc/node.h | |||
@@ -37,7 +37,6 @@ | |||
37 | #ifndef _TIPC_NODE_H | 37 | #ifndef _TIPC_NODE_H |
38 | #define _TIPC_NODE_H | 38 | #define _TIPC_NODE_H |
39 | 39 | ||
40 | #include "node_subscr.h" | ||
41 | #include "addr.h" | 40 | #include "addr.h" |
42 | #include "net.h" | 41 | #include "net.h" |
43 | #include "bearer.h" | 42 | #include "bearer.h" |
@@ -104,7 +103,7 @@ struct tipc_node_bclink { | |||
104 | * @link_cnt: number of links to node | 103 | * @link_cnt: number of links to node |
105 | * @signature: node instance identifier | 104 | * @signature: node instance identifier |
106 | * @link_id: local and remote bearer ids of changing link, if any | 105 | * @link_id: local and remote bearer ids of changing link, if any |
107 | * @nsub: list of "node down" subscriptions monitoring node | 106 | * @publ_list: list of publications |
108 | * @rcu: rcu struct for tipc_node | 107 | * @rcu: rcu struct for tipc_node |
109 | */ | 108 | */ |
110 | struct tipc_node { | 109 | struct tipc_node { |
@@ -121,7 +120,7 @@ struct tipc_node { | |||
121 | int working_links; | 120 | int working_links; |
122 | u32 signature; | 121 | u32 signature; |
123 | u32 link_id; | 122 | u32 link_id; |
124 | struct list_head nsub; | 123 | struct list_head publ_list; |
125 | struct sk_buff_head waiting_sks; | 124 | struct sk_buff_head waiting_sks; |
126 | struct list_head conn_sks; | 125 | struct list_head conn_sks; |
127 | struct rcu_head rcu; | 126 | struct rcu_head rcu; |
diff --git a/net/tipc/node_subscr.c b/net/tipc/node_subscr.c deleted file mode 100644 index 2d13eea8574a..000000000000 --- a/net/tipc/node_subscr.c +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | /* | ||
2 | * net/tipc/node_subscr.c: TIPC "node down" subscription handling | ||
3 | * | ||
4 | * Copyright (c) 1995-2006, Ericsson AB | ||
5 | * Copyright (c) 2005, 2010-2011, Wind River Systems | ||
6 | * All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions are met: | ||
10 | * | ||
11 | * 1. Redistributions of source code must retain the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer. | ||
13 | * 2. Redistributions in binary form must reproduce the above copyright | ||
14 | * notice, this list of conditions and the following disclaimer in the | ||
15 | * documentation and/or other materials provided with the distribution. | ||
16 | * 3. Neither the names of the copyright holders nor the names of its | ||
17 | * contributors may be used to endorse or promote products derived from | ||
18 | * this software without specific prior written permission. | ||
19 | * | ||
20 | * Alternatively, this software may be distributed under the terms of the | ||
21 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
22 | * Software Foundation. | ||
23 | * | ||
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
34 | * POSSIBILITY OF SUCH DAMAGE. | ||
35 | */ | ||
36 | |||
37 | #include "core.h" | ||
38 | #include "node_subscr.h" | ||
39 | #include "node.h" | ||
40 | |||
41 | /** | ||
42 | * tipc_nodesub_subscribe - create "node down" subscription for specified node | ||
43 | */ | ||
44 | void tipc_nodesub_subscribe(struct tipc_node_subscr *node_sub, u32 addr, | ||
45 | void *usr_handle, net_ev_handler handle_down) | ||
46 | { | ||
47 | if (in_own_node(addr)) { | ||
48 | node_sub->node = NULL; | ||
49 | return; | ||
50 | } | ||
51 | |||
52 | node_sub->node = tipc_node_find(addr); | ||
53 | if (!node_sub->node) { | ||
54 | pr_warn("Node subscription rejected, unknown node 0x%x\n", | ||
55 | addr); | ||
56 | return; | ||
57 | } | ||
58 | node_sub->handle_node_down = handle_down; | ||
59 | node_sub->usr_handle = usr_handle; | ||
60 | |||
61 | tipc_node_lock(node_sub->node); | ||
62 | list_add_tail(&node_sub->nodesub_list, &node_sub->node->nsub); | ||
63 | tipc_node_unlock(node_sub->node); | ||
64 | } | ||
65 | |||
66 | /** | ||
67 | * tipc_nodesub_unsubscribe - cancel "node down" subscription (if any) | ||
68 | */ | ||
69 | void tipc_nodesub_unsubscribe(struct tipc_node_subscr *node_sub) | ||
70 | { | ||
71 | if (!node_sub->node) | ||
72 | return; | ||
73 | |||
74 | tipc_node_lock(node_sub->node); | ||
75 | list_del_init(&node_sub->nodesub_list); | ||
76 | tipc_node_unlock(node_sub->node); | ||
77 | } | ||
78 | |||
79 | /** | ||
80 | * tipc_nodesub_notify - notify subscribers that a node is unreachable | ||
81 | * | ||
82 | * Note: node is locked by caller | ||
83 | */ | ||
84 | void tipc_nodesub_notify(struct list_head *nsub_list) | ||
85 | { | ||
86 | struct tipc_node_subscr *ns, *safe; | ||
87 | net_ev_handler handle_node_down; | ||
88 | |||
89 | list_for_each_entry_safe(ns, safe, nsub_list, nodesub_list) { | ||
90 | handle_node_down = ns->handle_node_down; | ||
91 | if (handle_node_down) { | ||
92 | ns->handle_node_down = NULL; | ||
93 | handle_node_down(ns->usr_handle); | ||
94 | } | ||
95 | } | ||
96 | } | ||
diff --git a/net/tipc/node_subscr.h b/net/tipc/node_subscr.h deleted file mode 100644 index d91b8cc81e3d..000000000000 --- a/net/tipc/node_subscr.h +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | /* | ||
2 | * net/tipc/node_subscr.h: Include file for TIPC "node down" subscription handling | ||
3 | * | ||
4 | * Copyright (c) 1995-2006, Ericsson AB | ||
5 | * Copyright (c) 2005, 2010-2011, Wind River Systems | ||
6 | * All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions are met: | ||
10 | * | ||
11 | * 1. Redistributions of source code must retain the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer. | ||
13 | * 2. Redistributions in binary form must reproduce the above copyright | ||
14 | * notice, this list of conditions and the following disclaimer in the | ||
15 | * documentation and/or other materials provided with the distribution. | ||
16 | * 3. Neither the names of the copyright holders nor the names of its | ||
17 | * contributors may be used to endorse or promote products derived from | ||
18 | * this software without specific prior written permission. | ||
19 | * | ||
20 | * Alternatively, this software may be distributed under the terms of the | ||
21 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
22 | * Software Foundation. | ||
23 | * | ||
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
34 | * POSSIBILITY OF SUCH DAMAGE. | ||
35 | */ | ||
36 | |||
37 | #ifndef _TIPC_NODE_SUBSCR_H | ||
38 | #define _TIPC_NODE_SUBSCR_H | ||
39 | |||
40 | #include "addr.h" | ||
41 | |||
42 | typedef void (*net_ev_handler) (void *usr_handle); | ||
43 | |||
44 | /** | ||
45 | * struct tipc_node_subscr - "node down" subscription entry | ||
46 | * @node: ptr to node structure of interest (or NULL, if none) | ||
47 | * @handle_node_down: routine to invoke when node fails | ||
48 | * @usr_handle: argument to pass to routine when node fails | ||
49 | * @nodesub_list: adjacent entries in list of subscriptions for the node | ||
50 | */ | ||
51 | struct tipc_node_subscr { | ||
52 | struct tipc_node *node; | ||
53 | net_ev_handler handle_node_down; | ||
54 | void *usr_handle; | ||
55 | struct list_head nodesub_list; | ||
56 | }; | ||
57 | |||
58 | void tipc_nodesub_subscribe(struct tipc_node_subscr *node_sub, u32 addr, | ||
59 | void *usr_handle, net_ev_handler handle_down); | ||
60 | void tipc_nodesub_unsubscribe(struct tipc_node_subscr *node_sub); | ||
61 | void tipc_nodesub_notify(struct list_head *nsub_list); | ||
62 | |||
63 | #endif | ||