aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sysctl.h
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-01-06 06:13:27 -0500
committerEric W. Biederman <ebiederm@xmission.com>2012-01-24 19:37:54 -0500
commit0ce8974d504913a0f0ae2d97b20a5ac665431a41 (patch)
tree50edf9b96066a3ca66143da742980dc04d72fb05 /include/linux/sysctl.h
parent36885d7b1121c779e4060d45472fe53a5b21e09f (diff)
sysctl: Consolidate !CONFIG_SYSCTL handling
- In sysctl.h move functions only available if CONFIG_SYSCL is defined inside of #ifdef CONFIG_SYSCTL - Move the stub function definitions for !CONFIG_SYSCTL into sysctl.h and make them static inlines. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'include/linux/sysctl.h')
-rw-r--r--include/linux/sysctl.h95
1 files changed, 62 insertions, 33 deletions
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index bb9127dd814b..cf3ee7f246d6 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -937,30 +937,8 @@ enum
937struct ctl_table; 937struct ctl_table;
938struct nsproxy; 938struct nsproxy;
939struct ctl_table_root; 939struct ctl_table_root;
940
941struct ctl_table_set {
942 struct list_head list;
943 struct ctl_table_set *parent;
944 int (*is_seen)(struct ctl_table_set *);
945};
946
947extern void setup_sysctl_set(struct ctl_table_set *p,
948 struct ctl_table_set *parent,
949 int (*is_seen)(struct ctl_table_set *));
950
951struct ctl_table_header; 940struct ctl_table_header;
952 941
953extern void sysctl_head_get(struct ctl_table_header *);
954extern void sysctl_head_put(struct ctl_table_header *);
955extern int sysctl_is_seen(struct ctl_table_header *);
956extern struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *);
957extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev);
958extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
959 struct ctl_table_header *prev);
960extern void sysctl_head_finish(struct ctl_table_header *prev);
961extern int sysctl_perm(struct ctl_table_root *root,
962 struct ctl_table *table, int op);
963
964typedef struct ctl_table ctl_table; 942typedef struct ctl_table ctl_table;
965 943
966typedef int proc_handler (struct ctl_table *ctl, int write, 944typedef int proc_handler (struct ctl_table *ctl, int write,
@@ -1023,8 +1001,6 @@ static inline void *proc_sys_poll_event(struct ctl_table_poll *poll)
1023 return (void *)(unsigned long)atomic_read(&poll->event); 1001 return (void *)(unsigned long)atomic_read(&poll->event);
1024} 1002}
1025 1003
1026void proc_sys_poll_notify(struct ctl_table_poll *poll);
1027
1028#define __CTL_TABLE_POLL_INITIALIZER(name) { \ 1004#define __CTL_TABLE_POLL_INITIALIZER(name) { \
1029 .event = ATOMIC_INIT(0), \ 1005 .event = ATOMIC_INIT(0), \
1030 .wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait) } 1006 .wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait) }
@@ -1047,15 +1023,6 @@ struct ctl_table
1047 void *extra2; 1023 void *extra2;
1048}; 1024};
1049 1025
1050struct ctl_table_root {
1051 struct list_head root_list;
1052 struct ctl_table_set default_set;
1053 struct ctl_table_set *(*lookup)(struct ctl_table_root *root,
1054 struct nsproxy *namespaces);
1055 int (*permissions)(struct ctl_table_root *root,
1056 struct nsproxy *namespaces, struct ctl_table *table);
1057};
1058
1059/* struct ctl_table_header is used to maintain dynamic lists of 1026/* struct ctl_table_header is used to maintain dynamic lists of
1060 struct ctl_table trees. */ 1027 struct ctl_table trees. */
1061struct ctl_table_header 1028struct ctl_table_header
@@ -1078,11 +1045,45 @@ struct ctl_table_header
1078 struct ctl_table_header *parent; 1045 struct ctl_table_header *parent;
1079}; 1046};
1080 1047
1048struct ctl_table_set {
1049 struct list_head list;
1050 struct ctl_table_set *parent;
1051 int (*is_seen)(struct ctl_table_set *);
1052};
1053
1054struct ctl_table_root {
1055 struct list_head root_list;
1056 struct ctl_table_set default_set;
1057 struct ctl_table_set *(*lookup)(struct ctl_table_root *root,
1058 struct nsproxy *namespaces);
1059 int (*permissions)(struct ctl_table_root *root,
1060 struct nsproxy *namespaces, struct ctl_table *table);
1061};
1062
1081/* struct ctl_path describes where in the hierarchy a table is added */ 1063/* struct ctl_path describes where in the hierarchy a table is added */
1082struct ctl_path { 1064struct ctl_path {
1083 const char *procname; 1065 const char *procname;
1084}; 1066};
1085 1067
1068#ifdef CONFIG_SYSCTL
1069
1070void proc_sys_poll_notify(struct ctl_table_poll *poll);
1071
1072extern void setup_sysctl_set(struct ctl_table_set *p,
1073 struct ctl_table_set *parent,
1074 int (*is_seen)(struct ctl_table_set *));
1075
1076extern void sysctl_head_get(struct ctl_table_header *);
1077extern void sysctl_head_put(struct ctl_table_header *);
1078extern int sysctl_is_seen(struct ctl_table_header *);
1079extern struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *);
1080extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev);
1081extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
1082 struct ctl_table_header *prev);
1083extern void sysctl_head_finish(struct ctl_table_header *prev);
1084extern int sysctl_perm(struct ctl_table_root *root,
1085 struct ctl_table *table, int op);
1086
1086void register_sysctl_root(struct ctl_table_root *root); 1087void register_sysctl_root(struct ctl_table_root *root);
1087struct ctl_table_header *__register_sysctl_paths( 1088struct ctl_table_header *__register_sysctl_paths(
1088 struct ctl_table_root *root, struct nsproxy *namespaces, 1089 struct ctl_table_root *root, struct nsproxy *namespaces,
@@ -1094,6 +1095,34 @@ struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1094void unregister_sysctl_table(struct ctl_table_header * table); 1095void unregister_sysctl_table(struct ctl_table_header * table);
1095int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table); 1096int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table);
1096 1097
1098#else /* CONFIG_SYSCTL */
1099static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
1100{
1101 return NULL;
1102}
1103
1104static inline struct ctl_table_header *register_sysctl_paths(
1105 const struct ctl_path *path, struct ctl_table *table)
1106{
1107 return NULL;
1108}
1109
1110static inline void unregister_sysctl_table(struct ctl_table_header * table)
1111{
1112}
1113
1114static inline void setup_sysctl_set(struct ctl_table_set *p,
1115 struct ctl_table_set *parent,
1116 int (*is_seen)(struct ctl_table_set *))
1117{
1118}
1119
1120static inline void sysctl_head_put(struct ctl_table_header *head)
1121{
1122}
1123
1124#endif /* CONFIG_SYSCTL */
1125
1097#endif /* __KERNEL__ */ 1126#endif /* __KERNEL__ */
1098 1127
1099#endif /* _LINUX_SYSCTL_H */ 1128#endif /* _LINUX_SYSCTL_H */