aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2011-11-08 13:48:28 -0500
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-02-24 17:05:17 -0500
commitb58343f9ea75f02ef48b984767511c6b3ba76eaf (patch)
tree9569124c832d5ff91f4a2191a13f31ac8c59f0d7 /net/tipc
parent077a26f029e76a5918edf9c1d44d5566eec719fc (diff)
tipc: Eliminate support for tipc_mode global variable
Removes all references to the global variable that records whether TIPC is running in "single node" mode or "network" mode, since this information can be easily deduced from the global variable that records TIPC's network address. (i.e. a non-zero network address means that TIPC is running in network mode.) The changes made update most existing mode-based checks to use the network address global variable. A few checks that are no longer needed are removed entirely, along with any associated code lying on non-executable control paths. Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/bearer.c2
-rw-r--r--net/tipc/config.c4
-rw-r--r--net/tipc/core.c2
-rw-r--r--net/tipc/core.h8
-rw-r--r--net/tipc/net.c7
-rw-r--r--net/tipc/node.c2
6 files changed, 5 insertions, 20 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 5f5e89e12fcf..5dfd89c40429 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -435,7 +435,7 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
435 u32 i; 435 u32 i;
436 int res = -EINVAL; 436 int res = -EINVAL;
437 437
438 if (tipc_mode != TIPC_NET_MODE) { 438 if (!tipc_own_addr) {
439 warn("Bearer <%s> rejected, not supported in standalone mode\n", 439 warn("Bearer <%s> rejected, not supported in standalone mode\n",
440 name); 440 name);
441 return -ENOPROTOOPT; 441 return -ENOPROTOOPT;
diff --git a/net/tipc/config.c b/net/tipc/config.c
index 7ca3854a2ac8..f76d3b15e4e2 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -179,7 +179,7 @@ static struct sk_buff *cfg_set_own_addr(void)
179 if (!tipc_addr_node_valid(addr)) 179 if (!tipc_addr_node_valid(addr))
180 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 180 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
181 " (node address)"); 181 " (node address)");
182 if (tipc_mode == TIPC_NET_MODE) 182 if (tipc_own_addr)
183 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 183 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
184 " (cannot change node address once assigned)"); 184 " (cannot change node address once assigned)");
185 185
@@ -268,7 +268,7 @@ static struct sk_buff *cfg_set_netid(void)
268 if (value < 1 || value > 9999) 268 if (value < 1 || value > 9999)
269 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 269 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
270 " (network id must be 1-9999)"); 270 " (network id must be 1-9999)");
271 if (tipc_mode == TIPC_NET_MODE) 271 if (tipc_own_addr)
272 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 272 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
273 " (cannot change network id once TIPC has joined a network)"); 273 " (cannot change network id once TIPC has joined a network)");
274 tipc_net_id = value; 274 tipc_net_id = value;
diff --git a/net/tipc/core.c b/net/tipc/core.c
index ec381d444bc3..68eba03e7955 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -53,7 +53,6 @@
53 53
54/* global variables used by multiple sub-systems within TIPC */ 54/* global variables used by multiple sub-systems within TIPC */
55 55
56int tipc_mode;
57int tipc_random; 56int tipc_random;
58 57
59const char tipc_alphabet[] = 58const char tipc_alphabet[] =
@@ -144,7 +143,6 @@ static int tipc_core_start(void)
144 int res; 143 int res;
145 144
146 get_random_bytes(&tipc_random, sizeof(tipc_random)); 145 get_random_bytes(&tipc_random, sizeof(tipc_random));
147 tipc_mode = TIPC_NODE_MODE;
148 146
149 res = tipc_handler_start(); 147 res = tipc_handler_start();
150 if (!res) 148 if (!res)
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 9842ec08dd5c..13837e0e56b1 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -130,13 +130,6 @@ void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *);
130#define ELINKCONG EAGAIN /* link congestion <=> resource unavailable */ 130#define ELINKCONG EAGAIN /* link congestion <=> resource unavailable */
131 131
132/* 132/*
133 * TIPC operating mode routines
134 */
135
136#define TIPC_NODE_MODE 1
137#define TIPC_NET_MODE 2
138
139/*
140 * Global configuration variables 133 * Global configuration variables
141 */ 134 */
142 135
@@ -151,7 +144,6 @@ extern int tipc_remote_management;
151 * Other global variables 144 * Other global variables
152 */ 145 */
153 146
154extern int tipc_mode;
155extern int tipc_random; 147extern int tipc_random;
156extern const char tipc_alphabet[]; 148extern const char tipc_alphabet[];
157 149
diff --git a/net/tipc/net.c b/net/tipc/net.c
index 2abd4be4933e..d4531b07076c 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -175,14 +175,10 @@ int tipc_net_start(u32 addr)
175{ 175{
176 char addr_string[16]; 176 char addr_string[16];
177 177
178 if (tipc_mode != TIPC_NODE_MODE)
179 return -ENOPROTOOPT;
180
181 tipc_subscr_stop(); 178 tipc_subscr_stop();
182 tipc_cfg_stop(); 179 tipc_cfg_stop();
183 180
184 tipc_own_addr = addr; 181 tipc_own_addr = addr;
185 tipc_mode = TIPC_NET_MODE;
186 tipc_named_reinit(); 182 tipc_named_reinit();
187 tipc_port_reinit(); 183 tipc_port_reinit();
188 184
@@ -201,10 +197,9 @@ void tipc_net_stop(void)
201{ 197{
202 struct tipc_node *node, *t_node; 198 struct tipc_node *node, *t_node;
203 199
204 if (tipc_mode != TIPC_NET_MODE) 200 if (!tipc_own_addr)
205 return; 201 return;
206 write_lock_bh(&tipc_net_lock); 202 write_lock_bh(&tipc_net_lock);
207 tipc_mode = TIPC_NODE_MODE;
208 tipc_bearer_stop(); 203 tipc_bearer_stop();
209 tipc_bclink_stop(); 204 tipc_bclink_stop();
210 list_for_each_entry_safe(node, t_node, &tipc_node_list, list) 205 list_for_each_entry_safe(node, t_node, &tipc_node_list, list)
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 12ddc6581572..a34cabc2c43a 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -406,7 +406,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
406 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 406 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
407 " (network address)"); 407 " (network address)");
408 408
409 if (tipc_mode != TIPC_NET_MODE) 409 if (!tipc_own_addr)
410 return tipc_cfg_reply_none(); 410 return tipc_cfg_reply_none();
411 411
412 read_lock_bh(&tipc_net_lock); 412 read_lock_bh(&tipc_net_lock);