diff options
author | Jon Maloy <jon.maloy@ericsson.com> | 2017-10-13 11:04:22 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-13 08:46:00 -0700 |
commit | a80ae5306a7346d4e52f59462878beb8362f4bbd (patch) | |
tree | c81696b3bf35b844513994379571f954e0d631e8 /net/tipc/name_table.h | |
parent | f70d37b796241f617107d5585ee96a7e1b660b63 (diff) | |
download | linux-a80ae5306a7346d4e52f59462878beb8362f4bbd.tar.gz linux-a80ae5306a7346d4e52f59462878beb8362f4bbd.tar.bz2 linux-a80ae5306a7346d4e52f59462878beb8362f4bbd.zip |
tipc: improve destination linked list
We often see a need for a linked list of destination identities,
sometimes containing a port number, sometimes a node identity, and
sometimes both. The currently defined struct u32_list is not generic
enough to cover all cases, so we extend it to contain two u32 integers
and rename it to struct tipc_dest_list.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/name_table.h')
-rw-r--r-- | net/tipc/name_table.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h index 6ebdeb1d84a5..d121175a92b5 100644 --- a/net/tipc/name_table.h +++ b/net/tipc/name_table.h @@ -120,16 +120,22 @@ void tipc_nametbl_unsubscribe(struct tipc_subscription *s); int tipc_nametbl_init(struct net *net); void tipc_nametbl_stop(struct net *net); -struct u32_item { +struct tipc_dest { struct list_head list; - u32 value; + union { + struct { + u32 port; + u32 node; + }; + u64 value; + }; }; -bool u32_push(struct list_head *l, u32 value); -u32 u32_pop(struct list_head *l); -bool u32_find(struct list_head *l, u32 value); -bool u32_del(struct list_head *l, u32 value); -void u32_list_purge(struct list_head *l); -int u32_list_len(struct list_head *l); +struct tipc_dest *tipc_dest_find(struct list_head *l, u32 node, u32 port); +bool tipc_dest_push(struct list_head *l, u32 node, u32 port); +bool tipc_dest_pop(struct list_head *l, u32 *node, u32 *port); +bool tipc_dest_del(struct list_head *l, u32 node, u32 port); +void tipc_dest_list_purge(struct list_head *l); +int tipc_dest_list_len(struct list_head *l); #endif |