aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2008-10-16 01:04:23 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 14:21:47 -0400
commitf221e726bf4e082a05dcd573379ac859bfba7126 (patch)
treea05f674caac693dc9aec7e46dd06115389f7ece3 /net
parentf40cbaa5b0a4719489e6e7947351c99a159aca30 (diff)
sysctl: simplify ->strategy
name and nlen parameters passed to ->strategy hook are unused, remove them. In general ->strategy hook should know what it's doing, and don't do something tricky for which, say, pointer to original userspace array may be needed (name). Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Acked-by: David S. Miller <davem@davemloft.net> [ networking bits ] Cc: Ralf Baechle <ralf@linux-mips.org> Cc: David Howells <dhowells@redhat.com> Cc: Matt Mackall <mpm@selenic.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/decnet/dn_dev.c4
-rw-r--r--net/decnet/sysctl_net_decnet.c4
-rw-r--r--net/ipv4/devinet.c7
-rw-r--r--net/ipv4/route.c7
-rw-r--r--net/ipv4/sysctl_net_ipv4.c18
-rw-r--r--net/ipv6/addrconf.c1
-rw-r--r--net/ipv6/ndisc.c11
7 files changed, 21 insertions, 31 deletions
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 2f0ac3c3eb71..96f9fcef2958 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -166,7 +166,7 @@ static int max_priority[] = { 127 }; /* From DECnet spec */
166 166
167static int dn_forwarding_proc(ctl_table *, int, struct file *, 167static int dn_forwarding_proc(ctl_table *, int, struct file *,
168 void __user *, size_t *, loff_t *); 168 void __user *, size_t *, loff_t *);
169static int dn_forwarding_sysctl(ctl_table *table, int __user *name, int nlen, 169static int dn_forwarding_sysctl(ctl_table *table,
170 void __user *oldval, size_t __user *oldlenp, 170 void __user *oldval, size_t __user *oldlenp,
171 void __user *newval, size_t newlen); 171 void __user *newval, size_t newlen);
172 172
@@ -318,7 +318,7 @@ static int dn_forwarding_proc(ctl_table *table, int write,
318#endif 318#endif
319} 319}
320 320
321static int dn_forwarding_sysctl(ctl_table *table, int __user *name, int nlen, 321static int dn_forwarding_sysctl(ctl_table *table,
322 void __user *oldval, size_t __user *oldlenp, 322 void __user *oldval, size_t __user *oldlenp,
323 void __user *newval, size_t newlen) 323 void __user *newval, size_t newlen)
324{ 324{
diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c
index 228067c571ba..36400b266896 100644
--- a/net/decnet/sysctl_net_decnet.c
+++ b/net/decnet/sysctl_net_decnet.c
@@ -132,7 +132,7 @@ static int parse_addr(__le16 *addr, char *str)
132} 132}
133 133
134 134
135static int dn_node_address_strategy(ctl_table *table, int __user *name, int nlen, 135static int dn_node_address_strategy(ctl_table *table,
136 void __user *oldval, size_t __user *oldlenp, 136 void __user *oldval, size_t __user *oldlenp,
137 void __user *newval, size_t newlen) 137 void __user *newval, size_t newlen)
138{ 138{
@@ -217,7 +217,7 @@ static int dn_node_address_handler(ctl_table *table, int write,
217} 217}
218 218
219 219
220static int dn_def_dev_strategy(ctl_table *table, int __user *name, int nlen, 220static int dn_def_dev_strategy(ctl_table *table,
221 void __user *oldval, size_t __user *oldlenp, 221 void __user *oldval, size_t __user *oldlenp,
222 void __user *newval, size_t newlen) 222 void __user *newval, size_t newlen)
223{ 223{
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index b12dae2b0b2d..5154e729cf16 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1283,7 +1283,7 @@ static int devinet_conf_proc(ctl_table *ctl, int write,
1283 return ret; 1283 return ret;
1284} 1284}
1285 1285
1286static int devinet_conf_sysctl(ctl_table *table, int __user *name, int nlen, 1286static int devinet_conf_sysctl(ctl_table *table,
1287 void __user *oldval, size_t __user *oldlenp, 1287 void __user *oldval, size_t __user *oldlenp,
1288 void __user *newval, size_t newlen) 1288 void __user *newval, size_t newlen)
1289{ 1289{
@@ -1379,12 +1379,11 @@ int ipv4_doint_and_flush(ctl_table *ctl, int write,
1379 return ret; 1379 return ret;
1380} 1380}
1381 1381
1382int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen, 1382int ipv4_doint_and_flush_strategy(ctl_table *table,
1383 void __user *oldval, size_t __user *oldlenp, 1383 void __user *oldval, size_t __user *oldlenp,
1384 void __user *newval, size_t newlen) 1384 void __user *newval, size_t newlen)
1385{ 1385{
1386 int ret = devinet_conf_sysctl(table, name, nlen, oldval, oldlenp, 1386 int ret = devinet_conf_sysctl(table, oldval, oldlenp, newval, newlen);
1387 newval, newlen);
1388 struct net *net = table->extra2; 1387 struct net *net = table->extra2;
1389 1388
1390 if (ret == 1) 1389 if (ret == 1)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index a6d7c584f53b..942be04e7955 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2908,8 +2908,6 @@ static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write,
2908} 2908}
2909 2909
2910static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table, 2910static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table,
2911 int __user *name,
2912 int nlen,
2913 void __user *oldval, 2911 void __user *oldval,
2914 size_t __user *oldlenp, 2912 size_t __user *oldlenp,
2915 void __user *newval, 2913 void __user *newval,
@@ -2972,16 +2970,13 @@ static int ipv4_sysctl_rt_secret_interval(ctl_table *ctl, int write,
2972} 2970}
2973 2971
2974static int ipv4_sysctl_rt_secret_interval_strategy(ctl_table *table, 2972static int ipv4_sysctl_rt_secret_interval_strategy(ctl_table *table,
2975 int __user *name,
2976 int nlen,
2977 void __user *oldval, 2973 void __user *oldval,
2978 size_t __user *oldlenp, 2974 size_t __user *oldlenp,
2979 void __user *newval, 2975 void __user *newval,
2980 size_t newlen) 2976 size_t newlen)
2981{ 2977{
2982 int old = ip_rt_secret_interval; 2978 int old = ip_rt_secret_interval;
2983 int ret = sysctl_jiffies(table, name, nlen, oldval, oldlenp, newval, 2979 int ret = sysctl_jiffies(table, oldval, oldlenp, newval, newlen);
2984 newlen);
2985 2980
2986 rt_secret_reschedule(old); 2981 rt_secret_reschedule(old);
2987 2982
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 276d047fb85a..1bb10df8ce7d 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -64,8 +64,8 @@ static int ipv4_local_port_range(ctl_table *table, int write, struct file *filp,
64} 64}
65 65
66/* Validate changes from sysctl interface. */ 66/* Validate changes from sysctl interface. */
67static int ipv4_sysctl_local_port_range(ctl_table *table, int __user *name, 67static int ipv4_sysctl_local_port_range(ctl_table *table,
68 int nlen, void __user *oldval, 68 void __user *oldval,
69 size_t __user *oldlenp, 69 size_t __user *oldlenp,
70 void __user *newval, size_t newlen) 70 void __user *newval, size_t newlen)
71{ 71{
@@ -80,7 +80,7 @@ static int ipv4_sysctl_local_port_range(ctl_table *table, int __user *name,
80 }; 80 };
81 81
82 inet_get_local_port_range(range, range + 1); 82 inet_get_local_port_range(range, range + 1);
83 ret = sysctl_intvec(&tmp, name, nlen, oldval, oldlenp, newval, newlen); 83 ret = sysctl_intvec(&tmp, oldval, oldlenp, newval, newlen);
84 if (ret == 0 && newval && newlen) { 84 if (ret == 0 && newval && newlen) {
85 if (range[1] < range[0]) 85 if (range[1] < range[0])
86 ret = -EINVAL; 86 ret = -EINVAL;
@@ -109,8 +109,8 @@ static int proc_tcp_congestion_control(ctl_table *ctl, int write, struct file *
109 return ret; 109 return ret;
110} 110}
111 111
112static int sysctl_tcp_congestion_control(ctl_table *table, int __user *name, 112static int sysctl_tcp_congestion_control(ctl_table *table,
113 int nlen, void __user *oldval, 113 void __user *oldval,
114 size_t __user *oldlenp, 114 size_t __user *oldlenp,
115 void __user *newval, size_t newlen) 115 void __user *newval, size_t newlen)
116{ 116{
@@ -122,7 +122,7 @@ static int sysctl_tcp_congestion_control(ctl_table *table, int __user *name,
122 int ret; 122 int ret;
123 123
124 tcp_get_default_congestion_control(val); 124 tcp_get_default_congestion_control(val);
125 ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen); 125 ret = sysctl_string(&tbl, oldval, oldlenp, newval, newlen);
126 if (ret == 1 && newval && newlen) 126 if (ret == 1 && newval && newlen)
127 ret = tcp_set_default_congestion_control(val); 127 ret = tcp_set_default_congestion_control(val);
128 return ret; 128 return ret;
@@ -165,8 +165,8 @@ static int proc_allowed_congestion_control(ctl_table *ctl,
165 return ret; 165 return ret;
166} 166}
167 167
168static int strategy_allowed_congestion_control(ctl_table *table, int __user *name, 168static int strategy_allowed_congestion_control(ctl_table *table,
169 int nlen, void __user *oldval, 169 void __user *oldval,
170 size_t __user *oldlenp, 170 size_t __user *oldlenp,
171 void __user *newval, 171 void __user *newval,
172 size_t newlen) 172 size_t newlen)
@@ -179,7 +179,7 @@ static int strategy_allowed_congestion_control(ctl_table *table, int __user *nam
179 return -ENOMEM; 179 return -ENOMEM;
180 180
181 tcp_get_available_congestion_control(tbl.data, tbl.maxlen); 181 tcp_get_available_congestion_control(tbl.data, tbl.maxlen);
182 ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen); 182 ret = sysctl_string(&tbl, oldval, oldlenp, newval, newlen);
183 if (ret == 1 && newval && newlen) 183 if (ret == 1 && newval && newlen)
184 ret = tcp_set_allowed_congestion_control(tbl.data); 184 ret = tcp_set_allowed_congestion_control(tbl.data);
185 kfree(tbl.data); 185 kfree(tbl.data);
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 7b6a584b62dd..eea9542728ca 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3982,7 +3982,6 @@ int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
3982} 3982}
3983 3983
3984static int addrconf_sysctl_forward_strategy(ctl_table *table, 3984static int addrconf_sysctl_forward_strategy(ctl_table *table,
3985 int __user *name, int nlen,
3986 void __user *oldval, 3985 void __user *oldval,
3987 size_t __user *oldlenp, 3986 size_t __user *oldlenp,
3988 void __user *newval, size_t newlen) 3987 void __user *newval, size_t newlen)
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 840b15780a36..7f39e9b36456 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1730,9 +1730,8 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * f
1730 return ret; 1730 return ret;
1731} 1731}
1732 1732
1733int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name, 1733int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl,
1734 int nlen, void __user *oldval, 1734 void __user *oldval, size_t __user *oldlenp,
1735 size_t __user *oldlenp,
1736 void __user *newval, size_t newlen) 1735 void __user *newval, size_t newlen)
1737{ 1736{
1738 struct net_device *dev = ctl->extra1; 1737 struct net_device *dev = ctl->extra1;
@@ -1745,13 +1744,11 @@ int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name,
1745 1744
1746 switch (ctl->ctl_name) { 1745 switch (ctl->ctl_name) {
1747 case NET_NEIGH_REACHABLE_TIME: 1746 case NET_NEIGH_REACHABLE_TIME:
1748 ret = sysctl_jiffies(ctl, name, nlen, 1747 ret = sysctl_jiffies(ctl, oldval, oldlenp, newval, newlen);
1749 oldval, oldlenp, newval, newlen);
1750 break; 1748 break;
1751 case NET_NEIGH_RETRANS_TIME_MS: 1749 case NET_NEIGH_RETRANS_TIME_MS:
1752 case NET_NEIGH_REACHABLE_TIME_MS: 1750 case NET_NEIGH_REACHABLE_TIME_MS:
1753 ret = sysctl_ms_jiffies(ctl, name, nlen, 1751 ret = sysctl_ms_jiffies(ctl, oldval, oldlenp, newval, newlen);
1754 oldval, oldlenp, newval, newlen);
1755 break; 1752 break;
1756 default: 1753 default:
1757 ret = 0; 1754 ret = 0;