diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-01-09 03:31:49 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:01:09 -0500 |
commit | 3151a9ab04714d0323efbe3c6c12bc5b2b1f058d (patch) | |
tree | 624422f09186fe2dad9c2e788e3cb5d94d27ea85 /net/decnet | |
parent | 90754f8ec011c91382ece2849a43b8f8aa8a0105 (diff) |
[DECNET]: Switch to using ctl_paths.
The decnet includes two places to patch. The first one is
the net/decnet table itself, and it is patched just like
other subsystems in the first patch in this series.
The second place is a bit more complex - it is the
net/decnet/conf/xxx entries,. similar to those in
ipv4/devinet.c and ipv6/addrconf.c. This code is made similar
to those in ipv[46].
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/decnet')
-rw-r--r-- | net/decnet/dn_dev.c | 52 | ||||
-rw-r--r-- | net/decnet/sysctl_net_decnet.c | 23 |
2 files changed, 20 insertions, 55 deletions
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 39c89c682047..1bbfce5f7a2d 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -173,10 +173,6 @@ static int dn_forwarding_sysctl(ctl_table *table, int __user *name, int nlen, | |||
173 | static struct dn_dev_sysctl_table { | 173 | static struct dn_dev_sysctl_table { |
174 | struct ctl_table_header *sysctl_header; | 174 | struct ctl_table_header *sysctl_header; |
175 | ctl_table dn_dev_vars[5]; | 175 | ctl_table dn_dev_vars[5]; |
176 | ctl_table dn_dev_dev[2]; | ||
177 | ctl_table dn_dev_conf_dir[2]; | ||
178 | ctl_table dn_dev_proto_dir[2]; | ||
179 | ctl_table dn_dev_root_dir[2]; | ||
180 | } dn_dev_sysctl = { | 176 | } dn_dev_sysctl = { |
181 | NULL, | 177 | NULL, |
182 | { | 178 | { |
@@ -224,30 +220,6 @@ static struct dn_dev_sysctl_table { | |||
224 | }, | 220 | }, |
225 | {0} | 221 | {0} |
226 | }, | 222 | }, |
227 | {{ | ||
228 | .ctl_name = 0, | ||
229 | .procname = "", | ||
230 | .mode = 0555, | ||
231 | .child = dn_dev_sysctl.dn_dev_vars | ||
232 | }, {0}}, | ||
233 | {{ | ||
234 | .ctl_name = NET_DECNET_CONF, | ||
235 | .procname = "conf", | ||
236 | .mode = 0555, | ||
237 | .child = dn_dev_sysctl.dn_dev_dev | ||
238 | }, {0}}, | ||
239 | {{ | ||
240 | .ctl_name = NET_DECNET, | ||
241 | .procname = "decnet", | ||
242 | .mode = 0555, | ||
243 | .child = dn_dev_sysctl.dn_dev_conf_dir | ||
244 | }, {0}}, | ||
245 | {{ | ||
246 | .ctl_name = CTL_NET, | ||
247 | .procname = "net", | ||
248 | .mode = 0555, | ||
249 | .child = dn_dev_sysctl.dn_dev_proto_dir | ||
250 | }, {0}} | ||
251 | }; | 223 | }; |
252 | 224 | ||
253 | static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms *parms) | 225 | static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms *parms) |
@@ -255,6 +227,16 @@ static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms * | |||
255 | struct dn_dev_sysctl_table *t; | 227 | struct dn_dev_sysctl_table *t; |
256 | int i; | 228 | int i; |
257 | 229 | ||
230 | #define DN_CTL_PATH_DEV 3 | ||
231 | |||
232 | struct ctl_path dn_ctl_path[] = { | ||
233 | { .procname = "net", .ctl_name = CTL_NET, }, | ||
234 | { .procname = "decnet", .ctl_name = NET_DECNET, }, | ||
235 | { .procname = "conf", .ctl_name = NET_DECNET_CONF, }, | ||
236 | { /* to be set */ }, | ||
237 | { }, | ||
238 | }; | ||
239 | |||
258 | t = kmemdup(&dn_dev_sysctl, sizeof(*t), GFP_KERNEL); | 240 | t = kmemdup(&dn_dev_sysctl, sizeof(*t), GFP_KERNEL); |
259 | if (t == NULL) | 241 | if (t == NULL) |
260 | return; | 242 | return; |
@@ -265,20 +247,16 @@ static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms * | |||
265 | } | 247 | } |
266 | 248 | ||
267 | if (dev) { | 249 | if (dev) { |
268 | t->dn_dev_dev[0].procname = dev->name; | 250 | dn_ctl_path[DN_CTL_PATH_DEV].procname = dev->name; |
269 | t->dn_dev_dev[0].ctl_name = dev->ifindex; | 251 | dn_ctl_path[DN_CTL_PATH_DEV].ctl_name = dev->ifindex; |
270 | } else { | 252 | } else { |
271 | t->dn_dev_dev[0].procname = parms->name; | 253 | dn_ctl_path[DN_CTL_PATH_DEV].procname = parms->name; |
272 | t->dn_dev_dev[0].ctl_name = parms->ctl_name; | 254 | dn_ctl_path[DN_CTL_PATH_DEV].ctl_name = parms->ctl_name; |
273 | } | 255 | } |
274 | 256 | ||
275 | t->dn_dev_dev[0].child = t->dn_dev_vars; | ||
276 | t->dn_dev_conf_dir[0].child = t->dn_dev_dev; | ||
277 | t->dn_dev_proto_dir[0].child = t->dn_dev_conf_dir; | ||
278 | t->dn_dev_root_dir[0].child = t->dn_dev_proto_dir; | ||
279 | t->dn_dev_vars[0].extra1 = (void *)dev; | 257 | t->dn_dev_vars[0].extra1 = (void *)dev; |
280 | 258 | ||
281 | t->sysctl_header = register_sysctl_table(t->dn_dev_root_dir); | 259 | t->sysctl_header = register_sysctl_paths(dn_ctl_path, t->dn_dev_vars); |
282 | if (t->sysctl_header == NULL) | 260 | if (t->sysctl_header == NULL) |
283 | kfree(t); | 261 | kfree(t); |
284 | else | 262 | else |
diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c index ae354a43fb97..228067c571ba 100644 --- a/net/decnet/sysctl_net_decnet.c +++ b/net/decnet/sysctl_net_decnet.c | |||
@@ -470,28 +470,15 @@ static ctl_table dn_table[] = { | |||
470 | {0} | 470 | {0} |
471 | }; | 471 | }; |
472 | 472 | ||
473 | static ctl_table dn_dir_table[] = { | 473 | static struct ctl_path dn_path[] = { |
474 | { | 474 | { .procname = "net", .ctl_name = CTL_NET, }, |
475 | .ctl_name = NET_DECNET, | 475 | { .procname = "decnet", .ctl_name = NET_DECNET, }, |
476 | .procname = "decnet", | 476 | { } |
477 | .mode = 0555, | ||
478 | .child = dn_table}, | ||
479 | {0} | ||
480 | }; | ||
481 | |||
482 | static ctl_table dn_root_table[] = { | ||
483 | { | ||
484 | .ctl_name = CTL_NET, | ||
485 | .procname = "net", | ||
486 | .mode = 0555, | ||
487 | .child = dn_dir_table | ||
488 | }, | ||
489 | {0} | ||
490 | }; | 477 | }; |
491 | 478 | ||
492 | void dn_register_sysctl(void) | 479 | void dn_register_sysctl(void) |
493 | { | 480 | { |
494 | dn_table_header = register_sysctl_table(dn_root_table); | 481 | dn_table_header = register_sysctl_paths(dn_path, dn_table); |
495 | } | 482 | } |
496 | 483 | ||
497 | void dn_unregister_sysctl(void) | 484 | void dn_unregister_sysctl(void) |