aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-07-14 21:22:20 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2008-07-26 20:53:08 -0400
commit734550921e9b7ab924a43aa3d0bd4239dac4fbf1 (patch)
tree7be4b0808ba9860f1d953b45120262a277866021 /net
parent7ac6cd653d7c31ad6b7bb5b88c549c4ebf628c34 (diff)
[PATCH] beginning of sysctl cleanup - ctl_table_set
New object: set of sysctls [currently - root and per-net-ns]. Contains: pointer to parent set, list of tables and "should I see this set?" method (->is_seen(set)). Current lists of tables are subsumed by that; net-ns contains such a beast. ->lookup() for ctl_table_root returns pointer to ctl_table_set instead of that to ->list of that ctl_table_set. [folded compile fixes by rdd for configs without sysctl] Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net')
-rw-r--r--net/sysctl_net.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/net/sysctl_net.c b/net/sysctl_net.c
index 63ada437fc2f..cefbc367d8be 100644
--- a/net/sysctl_net.c
+++ b/net/sysctl_net.c
@@ -29,10 +29,15 @@
29#include <linux/if_tr.h> 29#include <linux/if_tr.h>
30#endif 30#endif
31 31
32static struct list_head * 32static struct ctl_table_set *
33net_ctl_header_lookup(struct ctl_table_root *root, struct nsproxy *namespaces) 33net_ctl_header_lookup(struct ctl_table_root *root, struct nsproxy *namespaces)
34{ 34{
35 return &namespaces->net_ns->sysctl_table_headers; 35 return &namespaces->net_ns->sysctls;
36}
37
38static int is_seen(struct ctl_table_set *set)
39{
40 return &current->nsproxy->net_ns->sysctls == set;
36} 41}
37 42
38/* Return standard mode bits for table entry. */ 43/* Return standard mode bits for table entry. */
@@ -53,13 +58,6 @@ static struct ctl_table_root net_sysctl_root = {
53 .permissions = net_ctl_permissions, 58 .permissions = net_ctl_permissions,
54}; 59};
55 60
56static LIST_HEAD(net_sysctl_ro_tables);
57static struct list_head *net_ctl_ro_header_lookup(struct ctl_table_root *root,
58 struct nsproxy *namespaces)
59{
60 return &net_sysctl_ro_tables;
61}
62
63static int net_ctl_ro_header_perms(struct ctl_table_root *root, 61static int net_ctl_ro_header_perms(struct ctl_table_root *root,
64 struct nsproxy *namespaces, struct ctl_table *table) 62 struct nsproxy *namespaces, struct ctl_table *table)
65{ 63{
@@ -70,19 +68,18 @@ static int net_ctl_ro_header_perms(struct ctl_table_root *root,
70} 68}
71 69
72static struct ctl_table_root net_sysctl_ro_root = { 70static struct ctl_table_root net_sysctl_ro_root = {
73 .lookup = net_ctl_ro_header_lookup,
74 .permissions = net_ctl_ro_header_perms, 71 .permissions = net_ctl_ro_header_perms,
75}; 72};
76 73
77static int sysctl_net_init(struct net *net) 74static int sysctl_net_init(struct net *net)
78{ 75{
79 INIT_LIST_HEAD(&net->sysctl_table_headers); 76 setup_sysctl_set(&net->sysctls, NULL, is_seen);
80 return 0; 77 return 0;
81} 78}
82 79
83static void sysctl_net_exit(struct net *net) 80static void sysctl_net_exit(struct net *net)
84{ 81{
85 WARN_ON(!list_empty(&net->sysctl_table_headers)); 82 WARN_ON(!list_empty(&net->sysctls.list));
86 return; 83 return;
87} 84}
88 85
@@ -98,6 +95,7 @@ static __init int sysctl_init(void)
98 if (ret) 95 if (ret)
99 goto out; 96 goto out;
100 register_sysctl_root(&net_sysctl_root); 97 register_sysctl_root(&net_sysctl_root);
98 setup_sysctl_set(&net_sysctl_ro_root.default_set, NULL, NULL);
101 register_sysctl_root(&net_sysctl_ro_root); 99 register_sysctl_root(&net_sysctl_ro_root);
102out: 100out:
103 return ret; 101 return ret;