From d89ac12b4e1f18484577a4a38457e574812ff8a3 Mon Sep 17 00:00:00 2001 From: Allan Stephens Date: Tue, 11 May 2010 14:30:15 +0000 Subject: [PATCH] --- yaml --- r: 195031 b: refs/heads/master c: 43608edc2dbe83057544cf76b765ecdf63d59e8c h: refs/heads/master i: 195029: b7dfb4c0265a57d54cd7e96cdd64d20a95f7462c 195027: 20f61a15b4fcaf5f86f11a1e82aa8e3442c375c9 195023: fdd9c944104ffcb5cc4caf88fb4efc6afd5da56b v: v3 --- [refs] | 2 +- trunk/net/tipc/bcast.c | 50 ++++++++++++++++++++++++++++++++++++++++ trunk/net/tipc/bcast.h | 52 ++---------------------------------------- 3 files changed, 53 insertions(+), 51 deletions(-) diff --git a/[refs] b/[refs] index 41ac60137d06..aba69467d281 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3e22e62b6204414cf31c414d5a91897e2b718135 +refs/heads/master: 43608edc2dbe83057544cf76b765ecdf63d59e8c diff --git a/trunk/net/tipc/bcast.c b/trunk/net/tipc/bcast.c index 1ee6424ef3e0..a008c6689305 100644 --- a/trunk/net/tipc/bcast.c +++ b/trunk/net/tipc/bcast.c @@ -882,3 +882,53 @@ void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b, } } } + +/** + * tipc_port_list_add - add a port to a port list, ensuring no duplicates + */ + +void tipc_port_list_add(struct port_list *pl_ptr, u32 port) +{ + struct port_list *item = pl_ptr; + int i; + int item_sz = PLSIZE; + int cnt = pl_ptr->count; + + for (; ; cnt -= item_sz, item = item->next) { + if (cnt < PLSIZE) + item_sz = cnt; + for (i = 0; i < item_sz; i++) + if (item->ports[i] == port) + return; + if (i < PLSIZE) { + item->ports[i] = port; + pl_ptr->count++; + return; + } + if (!item->next) { + item->next = kmalloc(sizeof(*item), GFP_ATOMIC); + if (!item->next) { + warn("Incomplete multicast delivery, no memory\n"); + return; + } + item->next->next = NULL; + } + } +} + +/** + * tipc_port_list_free - free dynamically created entries in port_list chain + * + */ + +void tipc_port_list_free(struct port_list *pl_ptr) +{ + struct port_list *item; + struct port_list *next; + + for (item = pl_ptr->next; item; item = next) { + next = item->next; + kfree(item); + } +} + diff --git a/trunk/net/tipc/bcast.h b/trunk/net/tipc/bcast.h index cd779816383f..e8c2b81658c7 100644 --- a/trunk/net/tipc/bcast.h +++ b/trunk/net/tipc/bcast.h @@ -87,56 +87,8 @@ static inline int tipc_nmap_equal(struct tipc_node_map *nm_a, struct tipc_node_m void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b, struct tipc_node_map *nm_diff); -/** - * tipc_port_list_add - add a port to a port list, ensuring no duplicates - */ - -static inline void tipc_port_list_add(struct port_list *pl_ptr, u32 port) -{ - struct port_list *item = pl_ptr; - int i; - int item_sz = PLSIZE; - int cnt = pl_ptr->count; - - for (; ; cnt -= item_sz, item = item->next) { - if (cnt < PLSIZE) - item_sz = cnt; - for (i = 0; i < item_sz; i++) - if (item->ports[i] == port) - return; - if (i < PLSIZE) { - item->ports[i] = port; - pl_ptr->count++; - return; - } - if (!item->next) { - item->next = kmalloc(sizeof(*item), GFP_ATOMIC); - if (!item->next) { - warn("Incomplete multicast delivery, no memory\n"); - return; - } - item->next->next = NULL; - } - } -} - -/** - * tipc_port_list_free - free dynamically created entries in port_list chain - * - * Note: First item is on stack, so it doesn't need to be released - */ - -static inline void tipc_port_list_free(struct port_list *pl_ptr) -{ - struct port_list *item; - struct port_list *next; - - for (item = pl_ptr->next; item; item = next) { - next = item->next; - kfree(item); - } -} - +void tipc_port_list_add(struct port_list *pl_ptr, u32 port); +void tipc_port_list_free(struct port_list *pl_ptr); int tipc_bclink_init(void); void tipc_bclink_stop(void);