aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet
diff options
context:
space:
mode:
Diffstat (limited to 'net/decnet')
-rw-r--r--net/decnet/dn_dev.c52
-rw-r--r--net/decnet/sysctl_net_decnet.c23
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,
173static struct dn_dev_sysctl_table { 173static 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
253static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms *parms) 225static 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
473static ctl_table dn_dir_table[] = { 473static 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
482static 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
492void dn_register_sysctl(void) 479void 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
497void dn_unregister_sysctl(void) 484void dn_unregister_sysctl(void)