diff options
Diffstat (limited to 'net/tipc/core.c')
| -rw-r--r-- | net/tipc/core.c | 108 | 
1 files changed, 54 insertions, 54 deletions
| diff --git a/net/tipc/core.c b/net/tipc/core.c index f9e88d8b04c..50d57429ebc 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c @@ -1,7 +1,7 @@  /*   * net/tipc/core.c: TIPC module code   * - * Copyright (c) 2003-2006, Ericsson AB + * Copyright (c) 2003-2006, 2013, Ericsson AB   * Copyright (c) 2005-2006, 2010-2013, Wind River Systems   * All rights reserved.   * @@ -50,7 +50,6 @@ int tipc_random __read_mostly;  u32 tipc_own_addr __read_mostly;  int tipc_max_ports __read_mostly;  int tipc_net_id __read_mostly; -int tipc_remote_management __read_mostly;  int sysctl_tipc_rmem[3] __read_mostly;	/* min/default/max */  /** @@ -77,39 +76,14 @@ struct sk_buff *tipc_buf_acquire(u32 size)  }  /** - * tipc_core_stop_net - shut down TIPC networking sub-systems - */ -static void tipc_core_stop_net(void) -{ -	tipc_net_stop(); -	tipc_bearer_cleanup(); -} - -/** - * start_net - start TIPC networking sub-systems - */ -int tipc_core_start_net(unsigned long addr) -{ -	int res; - -	tipc_net_start(addr); -	res = tipc_bearer_setup(); -	if (res < 0) -		goto err; -	return res; - -err: -	tipc_core_stop_net(); -	return res; -} - -/**   * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode   */  static void tipc_core_stop(void)  { +	tipc_handler_stop(); +	tipc_net_stop(); +	tipc_bearer_cleanup();  	tipc_netlink_stop(); -	tipc_cfg_stop();  	tipc_subscr_stop();  	tipc_nametbl_stop();  	tipc_ref_table_stop(); @@ -122,30 +96,59 @@ static void tipc_core_stop(void)   */  static int tipc_core_start(void)  { -	int res; +	int err;  	get_random_bytes(&tipc_random, sizeof(tipc_random)); -	res = tipc_handler_start(); -	if (!res) -		res = tipc_ref_table_init(tipc_max_ports, tipc_random); -	if (!res) -		res = tipc_nametbl_init(); -	if (!res) -		res = tipc_netlink_start(); -	if (!res) -		res = tipc_socket_init(); -	if (!res) -		res = tipc_register_sysctl(); -	if (!res) -		res = tipc_subscr_start(); -	if (!res) -		res = tipc_cfg_init(); -	if (res) { -		tipc_handler_stop(); -		tipc_core_stop(); -	} -	return res; +	err = tipc_handler_start(); +	if (err) +		goto out_handler; + +	err = tipc_ref_table_init(tipc_max_ports, tipc_random); +	if (err) +		goto out_reftbl; + +	err = tipc_nametbl_init(); +	if (err) +		goto out_nametbl; + +	err = tipc_netlink_start(); +	if (err) +		goto out_netlink; + +	err = tipc_socket_init(); +	if (err) +		goto out_socket; + +	err = tipc_register_sysctl(); +	if (err) +		goto out_sysctl; + +	err = tipc_subscr_start(); +	if (err) +		goto out_subscr; + +	err = tipc_bearer_setup(); +	if (err) +		goto out_bearer; + +	return 0; +out_bearer: +	tipc_subscr_stop(); +out_subscr: +	tipc_unregister_sysctl(); +out_sysctl: +	tipc_socket_stop(); +out_socket: +	tipc_netlink_stop(); +out_netlink: +	tipc_nametbl_stop(); +out_nametbl: +	tipc_ref_table_stop(); +out_reftbl: +	tipc_handler_stop(); +out_handler: +	return err;  }  static int __init tipc_init(void) @@ -155,7 +158,6 @@ static int __init tipc_init(void)  	pr_info("Activated (version " TIPC_MOD_VER ")\n");  	tipc_own_addr = 0; -	tipc_remote_management = 1;  	tipc_max_ports = CONFIG_TIPC_PORTS;  	tipc_net_id = 4711; @@ -174,8 +176,6 @@ static int __init tipc_init(void)  static void __exit tipc_exit(void)  { -	tipc_handler_stop(); -	tipc_core_stop_net();  	tipc_core_stop();  	pr_info("Deactivated\n");  } | 
