Commit 9bdcc88f authored by Eric W. Biederman's avatar Eric W. Biederman Committed by David S. Miller

net decnet: Convert to use register_net_sysctl

Using an ascii path to register_net_sysctl as opposed to the slightly
awkward ctl_path allows for much simpler code.
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
Acked-by: default avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8f40a1f9
...@@ -209,15 +209,7 @@ static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms * ...@@ -209,15 +209,7 @@ static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms *
struct dn_dev_sysctl_table *t; struct dn_dev_sysctl_table *t;
int i; int i;
#define DN_CTL_PATH_DEV 3 char path[sizeof("net/decnet/conf/") + IFNAMSIZ];
struct ctl_path dn_ctl_path[] = {
{ .procname = "net", },
{ .procname = "decnet", },
{ .procname = "conf", },
{ /* to be set */ },
{ },
};
t = kmemdup(&dn_dev_sysctl, sizeof(*t), GFP_KERNEL); t = kmemdup(&dn_dev_sysctl, sizeof(*t), GFP_KERNEL);
if (t == NULL) if (t == NULL)
...@@ -228,15 +220,12 @@ static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms * ...@@ -228,15 +220,12 @@ static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms *
t->dn_dev_vars[i].data = ((char *)parms) + offset; t->dn_dev_vars[i].data = ((char *)parms) + offset;
} }
if (dev) { snprintf(path, sizeof(path), "net/decnet/conf/%s",
dn_ctl_path[DN_CTL_PATH_DEV].procname = dev->name; dev? dev->name : parms->name);
} else {
dn_ctl_path[DN_CTL_PATH_DEV].procname = parms->name;
}
t->dn_dev_vars[0].extra1 = (void *)dev; t->dn_dev_vars[0].extra1 = (void *)dev;
t->sysctl_header = register_net_sysctl_table(&init_net, dn_ctl_path, t->dn_dev_vars); t->sysctl_header = register_net_sysctl(&init_net, path, t->dn_dev_vars);
if (t->sysctl_header == NULL) if (t->sysctl_header == NULL)
kfree(t); kfree(t);
else else
......
...@@ -351,15 +351,9 @@ static ctl_table dn_table[] = { ...@@ -351,15 +351,9 @@ static ctl_table dn_table[] = {
{ } { }
}; };
static struct ctl_path dn_path[] = {
{ .procname = "net", },
{ .procname = "decnet", },
{ }
};
void dn_register_sysctl(void) void dn_register_sysctl(void)
{ {
dn_table_header = register_net_sysctl_table(&init_net, dn_path, dn_table); dn_table_header = register_net_sysctl(&init_net, "net/decnet", dn_table);
} }
void dn_unregister_sysctl(void) void dn_unregister_sysctl(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment