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 f9e88d8b04ca..50d57429ebca 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * net/tipc/core.c: TIPC module code | 2 | * net/tipc/core.c: TIPC module code |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2003-2006, Ericsson AB | 4 | * Copyright (c) 2003-2006, 2013, Ericsson AB |
| 5 | * Copyright (c) 2005-2006, 2010-2013, Wind River Systems | 5 | * Copyright (c) 2005-2006, 2010-2013, Wind River Systems |
| 6 | * All rights reserved. | 6 | * All rights reserved. |
| 7 | * | 7 | * |
| @@ -50,7 +50,6 @@ int tipc_random __read_mostly; | |||
| 50 | u32 tipc_own_addr __read_mostly; | 50 | u32 tipc_own_addr __read_mostly; |
| 51 | int tipc_max_ports __read_mostly; | 51 | int tipc_max_ports __read_mostly; |
| 52 | int tipc_net_id __read_mostly; | 52 | int tipc_net_id __read_mostly; |
| 53 | int tipc_remote_management __read_mostly; | ||
| 54 | int sysctl_tipc_rmem[3] __read_mostly; /* min/default/max */ | 53 | int sysctl_tipc_rmem[3] __read_mostly; /* min/default/max */ |
| 55 | 54 | ||
| 56 | /** | 55 | /** |
| @@ -77,39 +76,14 @@ struct sk_buff *tipc_buf_acquire(u32 size) | |||
| 77 | } | 76 | } |
| 78 | 77 | ||
| 79 | /** | 78 | /** |
| 80 | * tipc_core_stop_net - shut down TIPC networking sub-systems | ||
| 81 | */ | ||
| 82 | static void tipc_core_stop_net(void) | ||
| 83 | { | ||
| 84 | tipc_net_stop(); | ||
| 85 | tipc_bearer_cleanup(); | ||
| 86 | } | ||
| 87 | |||
| 88 | /** | ||
| 89 | * start_net - start TIPC networking sub-systems | ||
| 90 | */ | ||
| 91 | int tipc_core_start_net(unsigned long addr) | ||
| 92 | { | ||
| 93 | int res; | ||
| 94 | |||
| 95 | tipc_net_start(addr); | ||
| 96 | res = tipc_bearer_setup(); | ||
| 97 | if (res < 0) | ||
| 98 | goto err; | ||
| 99 | return res; | ||
| 100 | |||
| 101 | err: | ||
| 102 | tipc_core_stop_net(); | ||
| 103 | return res; | ||
| 104 | } | ||
| 105 | |||
| 106 | /** | ||
| 107 | * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode | 79 | * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode |
| 108 | */ | 80 | */ |
| 109 | static void tipc_core_stop(void) | 81 | static void tipc_core_stop(void) |
| 110 | { | 82 | { |
| 83 | tipc_handler_stop(); | ||
| 84 | tipc_net_stop(); | ||
| 85 | tipc_bearer_cleanup(); | ||
| 111 | tipc_netlink_stop(); | 86 | tipc_netlink_stop(); |
| 112 | tipc_cfg_stop(); | ||
| 113 | tipc_subscr_stop(); | 87 | tipc_subscr_stop(); |
| 114 | tipc_nametbl_stop(); | 88 | tipc_nametbl_stop(); |
| 115 | tipc_ref_table_stop(); | 89 | tipc_ref_table_stop(); |
| @@ -122,30 +96,59 @@ static void tipc_core_stop(void) | |||
| 122 | */ | 96 | */ |
| 123 | static int tipc_core_start(void) | 97 | static int tipc_core_start(void) |
| 124 | { | 98 | { |
| 125 | int res; | 99 | int err; |
| 126 | 100 | ||
| 127 | get_random_bytes(&tipc_random, sizeof(tipc_random)); | 101 | get_random_bytes(&tipc_random, sizeof(tipc_random)); |
| 128 | 102 | ||
| 129 | res = tipc_handler_start(); | 103 | err = tipc_handler_start(); |
| 130 | if (!res) | 104 | if (err) |
| 131 | res = tipc_ref_table_init(tipc_max_ports, tipc_random); | 105 | goto out_handler; |
| 132 | if (!res) | 106 | |
| 133 | res = tipc_nametbl_init(); | 107 | err = tipc_ref_table_init(tipc_max_ports, tipc_random); |
| 134 | if (!res) | 108 | if (err) |
| 135 | res = tipc_netlink_start(); | 109 | goto out_reftbl; |
| 136 | if (!res) | 110 | |
| 137 | res = tipc_socket_init(); | 111 | err = tipc_nametbl_init(); |
| 138 | if (!res) | 112 | if (err) |
| 139 | res = tipc_register_sysctl(); | 113 | goto out_nametbl; |
| 140 | if (!res) | 114 | |
| 141 | res = tipc_subscr_start(); | 115 | err = tipc_netlink_start(); |
| 142 | if (!res) | 116 | if (err) |
| 143 | res = tipc_cfg_init(); | 117 | goto out_netlink; |
| 144 | if (res) { | 118 | |
| 145 | tipc_handler_stop(); | 119 | err = tipc_socket_init(); |
| 146 | tipc_core_stop(); | 120 | if (err) |
| 147 | } | 121 | goto out_socket; |
| 148 | return res; | 122 | |
| 123 | err = tipc_register_sysctl(); | ||
| 124 | if (err) | ||
| 125 | goto out_sysctl; | ||
| 126 | |||
| 127 | err = tipc_subscr_start(); | ||
| 128 | if (err) | ||
| 129 | goto out_subscr; | ||
| 130 | |||
| 131 | err = tipc_bearer_setup(); | ||
| 132 | if (err) | ||
| 133 | goto out_bearer; | ||
| 134 | |||
| 135 | return 0; | ||
| 136 | out_bearer: | ||
| 137 | tipc_subscr_stop(); | ||
| 138 | out_subscr: | ||
| 139 | tipc_unregister_sysctl(); | ||
| 140 | out_sysctl: | ||
| 141 | tipc_socket_stop(); | ||
| 142 | out_socket: | ||
| 143 | tipc_netlink_stop(); | ||
| 144 | out_netlink: | ||
| 145 | tipc_nametbl_stop(); | ||
| 146 | out_nametbl: | ||
| 147 | tipc_ref_table_stop(); | ||
| 148 | out_reftbl: | ||
| 149 | tipc_handler_stop(); | ||
| 150 | out_handler: | ||
| 151 | return err; | ||
| 149 | } | 152 | } |
| 150 | 153 | ||
| 151 | static int __init tipc_init(void) | 154 | static int __init tipc_init(void) |
| @@ -155,7 +158,6 @@ static int __init tipc_init(void) | |||
| 155 | pr_info("Activated (version " TIPC_MOD_VER ")\n"); | 158 | pr_info("Activated (version " TIPC_MOD_VER ")\n"); |
| 156 | 159 | ||
| 157 | tipc_own_addr = 0; | 160 | tipc_own_addr = 0; |
| 158 | tipc_remote_management = 1; | ||
| 159 | tipc_max_ports = CONFIG_TIPC_PORTS; | 161 | tipc_max_ports = CONFIG_TIPC_PORTS; |
| 160 | tipc_net_id = 4711; | 162 | tipc_net_id = 4711; |
| 161 | 163 | ||
| @@ -174,8 +176,6 @@ static int __init tipc_init(void) | |||
| 174 | 176 | ||
| 175 | static void __exit tipc_exit(void) | 177 | static void __exit tipc_exit(void) |
| 176 | { | 178 | { |
| 177 | tipc_handler_stop(); | ||
| 178 | tipc_core_stop_net(); | ||
| 179 | tipc_core_stop(); | 179 | tipc_core_stop(); |
| 180 | pr_info("Deactivated\n"); | 180 | pr_info("Deactivated\n"); |
| 181 | } | 181 | } |
