netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, allan.stephens@windriver.com,
	ying.xue@windriver.com,
	Paul Gortmaker <paul.gortmaker@windriver.com>
Subject: [PATCH net-next 14/17] tipc: Eliminate support for tipc_mode global variable
Date: Wed, 29 Feb 2012 18:18:40 -0500	[thread overview]
Message-ID: <1330557523-2024-15-git-send-email-paul.gortmaker@windriver.com> (raw)
In-Reply-To: <1330557523-2024-1-git-send-email-paul.gortmaker@windriver.com>

From: Allan Stephens <allan.stephens@windriver.com>

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>
---
 net/tipc/bearer.c |    2 +-
 net/tipc/config.c |    4 ++--
 net/tipc/core.c   |    2 --
 net/tipc/core.h   |    8 --------
 net/tipc/net.c    |    7 +------
 net/tipc/node.c   |    2 +-
 6 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 5f5e89e..5dfd89c 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)
 	u32 i;
 	int res = -EINVAL;
 
-	if (tipc_mode != TIPC_NET_MODE) {
+	if (!tipc_own_addr) {
 		warn("Bearer <%s> rejected, not supported in standalone mode\n",
 		     name);
 		return -ENOPROTOOPT;
diff --git a/net/tipc/config.c b/net/tipc/config.c
index 7ca3854..f76d3b1 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -179,7 +179,7 @@ static struct sk_buff *cfg_set_own_addr(void)
 	if (!tipc_addr_node_valid(addr))
 		return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
 						   " (node address)");
-	if (tipc_mode == TIPC_NET_MODE)
+	if (tipc_own_addr)
 		return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
 						   " (cannot change node address once assigned)");
 
@@ -268,7 +268,7 @@ static struct sk_buff *cfg_set_netid(void)
 	if (value < 1 || value > 9999)
 		return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
 						   " (network id must be 1-9999)");
-	if (tipc_mode == TIPC_NET_MODE)
+	if (tipc_own_addr)
 		return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
 			" (cannot change network id once TIPC has joined a network)");
 	tipc_net_id = value;
diff --git a/net/tipc/core.c b/net/tipc/core.c
index ec381d4..68eba03 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -53,7 +53,6 @@
 
 /* global variables used by multiple sub-systems within TIPC */
 
-int tipc_mode;
 int tipc_random;
 
 const char tipc_alphabet[] =
@@ -144,7 +143,6 @@ static int tipc_core_start(void)
 	int res;
 
 	get_random_bytes(&tipc_random, sizeof(tipc_random));
-	tipc_mode = TIPC_NODE_MODE;
 
 	res = tipc_handler_start();
 	if (!res)
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 9842ec0..13837e0 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 *);
 #define ELINKCONG EAGAIN	/* link congestion <=> resource unavailable */
 
 /*
- * TIPC operating mode routines
- */
-
-#define TIPC_NODE_MODE    1
-#define TIPC_NET_MODE     2
-
-/*
  * Global configuration variables
  */
 
@@ -151,7 +144,6 @@ extern int tipc_remote_management;
  * Other global variables
  */
 
-extern int tipc_mode;
 extern int tipc_random;
 extern const char tipc_alphabet[];
 
diff --git a/net/tipc/net.c b/net/tipc/net.c
index 2abd4be..d4531b0 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -175,14 +175,10 @@ int tipc_net_start(u32 addr)
 {
 	char addr_string[16];
 
-	if (tipc_mode != TIPC_NODE_MODE)
-		return -ENOPROTOOPT;
-
 	tipc_subscr_stop();
 	tipc_cfg_stop();
 
 	tipc_own_addr = addr;
-	tipc_mode = TIPC_NET_MODE;
 	tipc_named_reinit();
 	tipc_port_reinit();
 
@@ -201,10 +197,9 @@ void tipc_net_stop(void)
 {
 	struct tipc_node *node, *t_node;
 
-	if (tipc_mode != TIPC_NET_MODE)
+	if (!tipc_own_addr)
 		return;
 	write_lock_bh(&tipc_net_lock);
-	tipc_mode = TIPC_NODE_MODE;
 	tipc_bearer_stop();
 	tipc_bclink_stop();
 	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 12ddc65..a34cabc 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)
 		return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
 						   " (network address)");
 
-	if (tipc_mode != TIPC_NET_MODE)
+	if (!tipc_own_addr)
 		return tipc_cfg_reply_none();
 
 	read_lock_bh(&tipc_net_lock);
-- 
1.7.9.1

  parent reply	other threads:[~2012-02-29 23:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-29 23:18 [PATCH net-next 00/17] Another batch of TIPC commits for 3.4 Paul Gortmaker
2012-02-29 23:18 ` [PATCH net-next 01/17] tipc: Introduce node signature field in neighbor discovery message Paul Gortmaker
2012-02-29 23:18 ` [PATCH net-next 02/17] tipc: Detect duplicate nodes using different network interfaces Paul Gortmaker
2012-02-29 23:18 ` [PATCH net-next 03/17] tipc: Remove duplicate check of message destination node Paul Gortmaker
2012-02-29 23:18 ` [PATCH net-next 04/17] tipc: Simplify enforcement of reserved name type prohibition Paul Gortmaker
2012-02-29 23:18 ` [PATCH net-next 05/17] tipc: Add check to prevent insertion of duplicate name table entries Paul Gortmaker
2012-02-29 23:18 ` [PATCH net-next 06/17] tipc: nuke the delimit static inline function Paul Gortmaker
2012-02-29 23:18 ` [PATCH net-next 07/17] tipc: Eliminate a test for negative unsigned quantities Paul Gortmaker
2012-02-29 23:18 ` [PATCH net-next 08/17] tipc: Hide internal details of node table implementation Paul Gortmaker
2012-02-29 23:18 ` [PATCH net-next 09/17] tipc: Eliminate trivial buffer manipulation helper routines Paul Gortmaker
2012-02-29 23:18 ` [PATCH net-next 10/17] tipc: Remove obsolete comments about routing table updates Paul Gortmaker
2012-02-29 23:18 ` [PATCH net-next 11/17] tipc: Minor optimization to broadcast link synchronization logic Paul Gortmaker
2012-02-29 23:18 ` [PATCH net-next 12/17] tipc: Revert name table translation optimization Paul Gortmaker
2012-02-29 23:18 ` [PATCH net-next 13/17] tipc: Eliminate obsolete support for "not running" mode Paul Gortmaker
2012-02-29 23:18 ` Paul Gortmaker [this message]
2012-02-29 23:18 ` [PATCH net-next 15/17] tipc: Un-inline port routine for processing incoming messages Paul Gortmaker
2012-02-29 23:18 ` [PATCH net-next 16/17] tipc: Eliminate obsolete code for re-sending a message Paul Gortmaker
2012-02-29 23:18 ` [PATCH net-next 17/17] tipc: Optimize setting of immutable payload message header fields Paul Gortmaker
2012-03-01  4:52 ` [PATCH net-next 00/17] Another batch of TIPC commits for 3.4 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1330557523-2024-15-git-send-email-paul.gortmaker@windriver.com \
    --to=paul.gortmaker@windriver.com \
    --cc=allan.stephens@windriver.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=ying.xue@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).