Skip to content

Commit

Permalink
[NET]: Isolate the net/core/ sysctl table
Browse files Browse the repository at this point in the history
Using ctl paths we can put all the stuff, related to net/core/
sysctl table, into one file and remove all the references on it.

As a good side effect this hides the "core_table" name from
the global scope :)

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
xemul authored and davem330 committed Jan 28, 2008
1 parent 7e2e109 commit 33eb9cf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
4 changes: 0 additions & 4 deletions include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -1325,10 +1325,6 @@ extern __u32 sysctl_rmem_max;

extern void sk_init(void);

#ifdef CONFIG_SYSCTL
extern struct ctl_table core_table[];
#endif

extern int sysctl_optmem_max;

extern __u32 sysctl_wmem_default;
Expand Down
19 changes: 18 additions & 1 deletion net/core/sysctl_net_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
#include <linux/module.h>
#include <linux/socket.h>
#include <linux/netdevice.h>
#include <linux/init.h>
#include <net/sock.h>
#include <net/xfrm.h>

ctl_table core_table[] = {
static struct ctl_table net_core_table[] = {
#ifdef CONFIG_NET
{
.ctl_name = NET_CORE_WMEM_MAX,
Expand Down Expand Up @@ -149,3 +150,19 @@ ctl_table core_table[] = {
},
{ .ctl_name = 0 }
};

static __initdata struct ctl_path net_core_path[] = {
{ .procname = "net", .ctl_name = CTL_NET, },
{ .procname = "core", .ctl_name = NET_CORE, },
{ },
};

static __init int sysctl_core_init(void)
{
struct ctl_table_header *hdr;

hdr = register_sysctl_paths(net_core_path, net_core_table);
return hdr == NULL ? -ENOMEM : 0;
}

__initcall(sysctl_core_init);
6 changes: 0 additions & 6 deletions net/sysctl_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@
#endif

struct ctl_table net_table[] = {
{
.ctl_name = NET_CORE,
.procname = "core",
.mode = 0555,
.child = core_table,
},
#ifdef CONFIG_INET
{
.ctl_name = NET_IPV4,
Expand Down

0 comments on commit 33eb9cf

Please sign in to comment.