aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorJon Paul Maloy <jon.maloy@ericsson.com>2015-05-14 10:46:13 -0400
committerDavid S. Miller <davem@davemloft.net>2015-05-14 12:24:45 -0400
commita6bf70f792963b32e410e5c3d2f96903265b090a (patch)
tree11ca9a3895e3976b9f3ab34b3ce79d077076ae03 /net/tipc
parent75b44b018eb086fb461aa0351d2ecb1eba684302 (diff)
tipc: simplify include dependencies
When we try to add new inline functions in the code, we sometimes run into circular include dependencies. The main problem is that the file core.h, which really should be at the root of the dependency chain, instead is a leaf. I.e., core.h includes a number of header files that themselves should be allowed to include core.h. In reality this is unnecessary, because core.h does not need to know the full signature of any of the structs it refers to, only their type declaration. In this commit, we remove all dependencies from core.h towards any other tipc header file. As a consequence of this change, we can now move the function tipc_own_addr(net) from addr.c to addr.h, and make it inline. There are no functional changes in this commit. Reviewed-by: Erik Hugne <erik.hugne@ericsson.com> Reviewed-by: Ying Xue <ying.xue@windriver.com> Signed-off-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/addr.c7
-rw-r--r--net/tipc/addr.h8
-rw-r--r--net/tipc/bearer.h2
-rw-r--r--net/tipc/core.h17
-rw-r--r--net/tipc/net.c1
-rw-r--r--net/tipc/node.c1
-rw-r--r--net/tipc/node.h2
-rw-r--r--net/tipc/socket.c1
8 files changed, 22 insertions, 17 deletions
diff --git a/net/tipc/addr.c b/net/tipc/addr.c
index ba7daa864d44..48fd3b5a73fb 100644
--- a/net/tipc/addr.c
+++ b/net/tipc/addr.c
@@ -38,13 +38,6 @@
38#include "addr.h" 38#include "addr.h"
39#include "core.h" 39#include "core.h"
40 40
41u32 tipc_own_addr(struct net *net)
42{
43 struct tipc_net *tn = net_generic(net, tipc_net_id);
44
45 return tn->own_addr;
46}
47
48/** 41/**
49 * in_own_cluster - test for cluster inclusion; <0.0.0> always matches 42 * in_own_cluster - test for cluster inclusion; <0.0.0> always matches
50 */ 43 */
diff --git a/net/tipc/addr.h b/net/tipc/addr.h
index 7ba6d5c8ae40..93f7c983be33 100644
--- a/net/tipc/addr.h
+++ b/net/tipc/addr.h
@@ -41,10 +41,18 @@
41#include <linux/tipc.h> 41#include <linux/tipc.h>
42#include <net/net_namespace.h> 42#include <net/net_namespace.h>
43#include <net/netns/generic.h> 43#include <net/netns/generic.h>
44#include "core.h"
44 45
45#define TIPC_ZONE_MASK 0xff000000u 46#define TIPC_ZONE_MASK 0xff000000u
46#define TIPC_CLUSTER_MASK 0xfffff000u 47#define TIPC_CLUSTER_MASK 0xfffff000u
47 48
49static inline u32 tipc_own_addr(struct net *net)
50{
51 struct tipc_net *tn = net_generic(net, tipc_net_id);
52
53 return tn->own_addr;
54}
55
48static inline u32 tipc_zone_mask(u32 addr) 56static inline u32 tipc_zone_mask(u32 addr)
49{ 57{
50 return addr & TIPC_ZONE_MASK; 58 return addr & TIPC_ZONE_MASK;
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h
index 5cad243ee8fc..dc714d977768 100644
--- a/net/tipc/bearer.h
+++ b/net/tipc/bearer.h
@@ -38,9 +38,9 @@
38#define _TIPC_BEARER_H 38#define _TIPC_BEARER_H
39 39
40#include "netlink.h" 40#include "netlink.h"
41#include "core.h"
41#include <net/genetlink.h> 42#include <net/genetlink.h>
42 43
43#define MAX_BEARERS 2
44#define MAX_MEDIA 3 44#define MAX_MEDIA 3
45#define MAX_NODES 4096 45#define MAX_NODES 4096
46#define WSIZE 32 46#define WSIZE 32
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 3dc68c7a966d..53e8146b14e0 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -60,16 +60,19 @@
60#include <net/netns/generic.h> 60#include <net/netns/generic.h>
61#include <linux/rhashtable.h> 61#include <linux/rhashtable.h>
62 62
63#include "node.h" 63struct tipc_node;
64#include "bearer.h" 64struct tipc_bearer;
65#include "bcast.h" 65struct tipc_bcbearer;
66#include "netlink.h" 66struct tipc_bclink;
67#include "link.h" 67struct tipc_link;
68#include "node.h" 68struct tipc_name_table;
69#include "msg.h" 69struct tipc_server;
70 70
71#define TIPC_MOD_VER "2.0.0" 71#define TIPC_MOD_VER "2.0.0"
72 72
73#define NODE_HTABLE_SIZE 512
74#define MAX_BEARERS 3
75
73extern int tipc_net_id __read_mostly; 76extern int tipc_net_id __read_mostly;
74extern int sysctl_tipc_rmem[3] __read_mostly; 77extern int sysctl_tipc_rmem[3] __read_mostly;
75extern int sysctl_tipc_named_timeout __read_mostly; 78extern int sysctl_tipc_named_timeout __read_mostly;
diff --git a/net/tipc/net.c b/net/tipc/net.c
index a54f3cbe2246..d6d1399ae229 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -40,6 +40,7 @@
40#include "subscr.h" 40#include "subscr.h"
41#include "socket.h" 41#include "socket.h"
42#include "node.h" 42#include "node.h"
43#include "bcast.h"
43 44
44static const struct nla_policy tipc_nl_net_policy[TIPC_NLA_NET_MAX + 1] = { 45static const struct nla_policy tipc_nl_net_policy[TIPC_NLA_NET_MAX + 1] = {
45 [TIPC_NLA_NET_UNSPEC] = { .type = NLA_UNSPEC }, 46 [TIPC_NLA_NET_UNSPEC] = { .type = NLA_UNSPEC },
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 22c059ad2999..eb3856bb8c5a 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -39,6 +39,7 @@
39#include "node.h" 39#include "node.h"
40#include "name_distr.h" 40#include "name_distr.h"
41#include "socket.h" 41#include "socket.h"
42#include "bcast.h"
42 43
43static void node_lost_contact(struct tipc_node *n_ptr); 44static void node_lost_contact(struct tipc_node *n_ptr);
44static void node_established_contact(struct tipc_node *n_ptr); 45static void node_established_contact(struct tipc_node *n_ptr);
diff --git a/net/tipc/node.h b/net/tipc/node.h
index 02d5c20dc551..5a834cf142c8 100644
--- a/net/tipc/node.h
+++ b/net/tipc/node.h
@@ -45,8 +45,6 @@
45/* Out-of-range value for node signature */ 45/* Out-of-range value for node signature */
46#define INVALID_NODE_SIG 0x10000 46#define INVALID_NODE_SIG 0x10000
47 47
48#define NODE_HTABLE_SIZE 512
49
50/* Flags used to take different actions according to flag type 48/* Flags used to take different actions according to flag type
51 * TIPC_WAIT_PEER_LINKS_DOWN: wait to see that peer's links are down 49 * TIPC_WAIT_PEER_LINKS_DOWN: wait to see that peer's links are down
52 * TIPC_WAIT_OWN_LINKS_DOWN: wait until peer node is declared down 50 * TIPC_WAIT_OWN_LINKS_DOWN: wait until peer node is declared down
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 8f3c8e2cef8e..9370f953e16f 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -41,6 +41,7 @@
41#include "link.h" 41#include "link.h"
42#include "name_distr.h" 42#include "name_distr.h"
43#include "socket.h" 43#include "socket.h"
44#include "bcast.h"
44 45
45#define SS_LISTENING -1 /* socket is listening */ 46#define SS_LISTENING -1 /* socket is listening */
46#define SS_READY -2 /* socket is connectionless */ 47#define SS_READY -2 /* socket is connectionless */