diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2007-11-30 07:54:00 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:55:17 -0500 |
commit | e51b6ba077791f2f8c876022b37419be7a2ceec3 (patch) | |
tree | 9d8ca18f3239eff84cad5b79b715c332970fa89d /include/linux/sysctl.h | |
parent | 23eb06de7d2d333a0f7ebba2da663e00c9c9483e (diff) |
sysctl: Infrastructure for per namespace sysctls
This patch implements the basic infrastructure for per namespace sysctls.
A list of lists of sysctl headers is added, allowing each namespace to have
it's own list of sysctl headers.
Each list of sysctl headers has a lookup function to find the first
sysctl header in the list, allowing the lists to have a per namespace
instance.
register_sysct_root is added to tell sysctl.c about additional
lists of sysctl_headers. As all of the users are expected to be in
kernel no unregister function is provided.
sysctl_head_next is updated to walk through the list of lists.
__register_sysctl_paths is added to add a new sysctl table on
a non-default sysctl list.
The only intrusive part of this patch is propagating the information
to decided which list of sysctls to use for sysctl_check_table.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Serge Hallyn <serue@us.ibm.com>
Cc: Daniel Lezcano <dlezcano@fr.ibm.com>
Cc: Cedric Le Goater <clg@fr.ibm.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/sysctl.h')
-rw-r--r-- | include/linux/sysctl.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 77de3bfd8744..89faebfe48b8 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -945,7 +945,10 @@ enum | |||
945 | 945 | ||
946 | /* For the /proc/sys support */ | 946 | /* For the /proc/sys support */ |
947 | struct ctl_table; | 947 | struct ctl_table; |
948 | struct nsproxy; | ||
948 | extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); | 949 | extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); |
950 | extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces, | ||
951 | struct ctl_table_header *prev); | ||
949 | extern void sysctl_head_finish(struct ctl_table_header *prev); | 952 | extern void sysctl_head_finish(struct ctl_table_header *prev); |
950 | extern int sysctl_perm(struct ctl_table *table, int op); | 953 | extern int sysctl_perm(struct ctl_table *table, int op); |
951 | 954 | ||
@@ -1049,6 +1052,13 @@ struct ctl_table | |||
1049 | void *extra2; | 1052 | void *extra2; |
1050 | }; | 1053 | }; |
1051 | 1054 | ||
1055 | struct ctl_table_root { | ||
1056 | struct list_head root_list; | ||
1057 | struct list_head header_list; | ||
1058 | struct list_head *(*lookup)(struct ctl_table_root *root, | ||
1059 | struct nsproxy *namespaces); | ||
1060 | }; | ||
1061 | |||
1052 | /* struct ctl_table_header is used to maintain dynamic lists of | 1062 | /* struct ctl_table_header is used to maintain dynamic lists of |
1053 | struct ctl_table trees. */ | 1063 | struct ctl_table trees. */ |
1054 | struct ctl_table_header | 1064 | struct ctl_table_header |
@@ -1058,6 +1068,7 @@ struct ctl_table_header | |||
1058 | int used; | 1068 | int used; |
1059 | struct completion *unregistering; | 1069 | struct completion *unregistering; |
1060 | struct ctl_table *ctl_table_arg; | 1070 | struct ctl_table *ctl_table_arg; |
1071 | struct ctl_table_root *root; | ||
1061 | }; | 1072 | }; |
1062 | 1073 | ||
1063 | /* struct ctl_path describes where in the hierarchy a table is added */ | 1074 | /* struct ctl_path describes where in the hierarchy a table is added */ |
@@ -1066,12 +1077,16 @@ struct ctl_path { | |||
1066 | int ctl_name; | 1077 | int ctl_name; |
1067 | }; | 1078 | }; |
1068 | 1079 | ||
1080 | void register_sysctl_root(struct ctl_table_root *root); | ||
1081 | struct ctl_table_header *__register_sysctl_paths( | ||
1082 | struct ctl_table_root *root, struct nsproxy *namespaces, | ||
1083 | const struct ctl_path *path, struct ctl_table *table); | ||
1069 | struct ctl_table_header *register_sysctl_table(struct ctl_table * table); | 1084 | struct ctl_table_header *register_sysctl_table(struct ctl_table * table); |
1070 | struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, | 1085 | struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, |
1071 | struct ctl_table *table); | 1086 | struct ctl_table *table); |
1072 | 1087 | ||
1073 | void unregister_sysctl_table(struct ctl_table_header * table); | 1088 | void unregister_sysctl_table(struct ctl_table_header * table); |
1074 | int sysctl_check_table(struct ctl_table *table); | 1089 | int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table); |
1075 | 1090 | ||
1076 | #else /* __KERNEL__ */ | 1091 | #else /* __KERNEL__ */ |
1077 | 1092 | ||