aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmerigo Wang <amwang@redhat.com>2009-12-24 12:26:48 -0500
committerDavid S. Miller <davem@davemloft.net>2010-01-04 00:31:04 -0500
commitee983ac76865797a5553597a9412c835c2710f51 (patch)
tree3d830f175d416b4fe3628277ce7e4e2c391eff02
parentc1c5523dd1517250cac8b15a4acbc237c24a67d4 (diff)
tipc: use kconfig to limit numeric ranges
We can rely on kconfig to limit these numbers, no need to limit them at compile time/run time. Users who modify these numbers manually should be responsible for themself. :) Signed-off-by: WANG Cong <amwang@redhat.com> Cc: Per Liden <per.liden@ericsson.com> Cc: Jon Maloy <jon.maloy@ericsson.com> Cc: Allan Stephens <allan.stephens@windriver.com> Cc: David S. Miller <davem@davemloft.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/tipc/Kconfig8
-rw-r--r--net/tipc/core.c10
2 files changed, 11 insertions, 7 deletions
diff --git a/net/tipc/Kconfig b/net/tipc/Kconfig
index 3b30d1130b61..dafbd533067c 100644
--- a/net/tipc/Kconfig
+++ b/net/tipc/Kconfig
@@ -33,6 +33,7 @@ config TIPC_ADVANCED
33config TIPC_ZONES 33config TIPC_ZONES
34 int "Maximum number of zones in network" 34 int "Maximum number of zones in network"
35 depends on TIPC_ADVANCED 35 depends on TIPC_ADVANCED
36 range 1 255
36 default "3" 37 default "3"
37 help 38 help
38 Max number of zones inside TIPC network. Max supported value 39 Max number of zones inside TIPC network. Max supported value
@@ -44,10 +45,10 @@ config TIPC_ZONES
44config TIPC_CLUSTERS 45config TIPC_CLUSTERS
45 int "Maximum number of clusters in a zone" 46 int "Maximum number of clusters in a zone"
46 depends on TIPC_ADVANCED 47 depends on TIPC_ADVANCED
48 range 1 1
47 default "1" 49 default "1"
48 help 50 help
49 ***Only 1 (one cluster in a zone) is supported by current code. 51 ***Only 1 (one cluster in a zone) is supported by current code.***
50 Any value set here will be overridden.***
51 52
52 (Max number of clusters inside TIPC zone. Max supported 53 (Max number of clusters inside TIPC zone. Max supported
53 value is 4095 clusters, minimum is 1. 54 value is 4095 clusters, minimum is 1.
@@ -59,6 +60,7 @@ config TIPC_CLUSTERS
59config TIPC_NODES 60config TIPC_NODES
60 int "Maximum number of nodes in cluster" 61 int "Maximum number of nodes in cluster"
61 depends on TIPC_ADVANCED 62 depends on TIPC_ADVANCED
63 range 8 2047
62 default "255" 64 default "255"
63 help 65 help
64 Maximum number of nodes inside a TIPC cluster. Maximum 66 Maximum number of nodes inside a TIPC cluster. Maximum
@@ -70,6 +72,7 @@ config TIPC_NODES
70config TIPC_SLAVE_NODES 72config TIPC_SLAVE_NODES
71 int "Maximum number of slave nodes in cluster" 73 int "Maximum number of slave nodes in cluster"
72 depends on TIPC_ADVANCED 74 depends on TIPC_ADVANCED
75 range 0 2047
73 default "0" 76 default "0"
74 help 77 help
75 ***This capability is not supported by current code.*** 78 ***This capability is not supported by current code.***
@@ -83,6 +86,7 @@ config TIPC_SLAVE_NODES
83config TIPC_PORTS 86config TIPC_PORTS
84 int "Maximum number of ports in a node" 87 int "Maximum number of ports in a node"
85 depends on TIPC_ADVANCED 88 depends on TIPC_ADVANCED
89 range 217 65536
86 default "8191" 90 default "8191"
87 help 91 help
88 Maximum number of ports within a node. Maximum 92 Maximum number of ports within a node. Maximum
diff --git a/net/tipc/core.c b/net/tipc/core.c
index 3256bd7d398f..52c571fedbe0 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -189,11 +189,11 @@ static int __init tipc_init(void)
189 tipc_remote_management = 1; 189 tipc_remote_management = 1;
190 tipc_max_publications = 10000; 190 tipc_max_publications = 10000;
191 tipc_max_subscriptions = 2000; 191 tipc_max_subscriptions = 2000;
192 tipc_max_ports = delimit(CONFIG_TIPC_PORTS, 127, 65536); 192 tipc_max_ports = CONFIG_TIPC_PORTS;
193 tipc_max_zones = delimit(CONFIG_TIPC_ZONES, 1, 255); 193 tipc_max_zones = CONFIG_TIPC_ZONES;
194 tipc_max_clusters = delimit(CONFIG_TIPC_CLUSTERS, 1, 1); 194 tipc_max_clusters = CONFIG_TIPC_CLUSTERS;
195 tipc_max_nodes = delimit(CONFIG_TIPC_NODES, 8, 2047); 195 tipc_max_nodes = CONFIG_TIPC_NODES;
196 tipc_max_slaves = delimit(CONFIG_TIPC_SLAVE_NODES, 0, 2047); 196 tipc_max_slaves = CONFIG_TIPC_SLAVE_NODES;
197 tipc_net_id = 4711; 197 tipc_net_id = 4711;
198 198
199 if ((res = tipc_core_start())) 199 if ((res = tipc_core_start()))