diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2012-01-06 06:13:27 -0500 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2012-01-24 19:37:54 -0500 |
commit | 0ce8974d504913a0f0ae2d97b20a5ac665431a41 (patch) | |
tree | 50edf9b96066a3ca66143da742980dc04d72fb05 /include/linux/sysctl.h | |
parent | 36885d7b1121c779e4060d45472fe53a5b21e09f (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.h | 95 |
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 | |||
937 | struct ctl_table; | 937 | struct ctl_table; |
938 | struct nsproxy; | 938 | struct nsproxy; |
939 | struct ctl_table_root; | 939 | struct ctl_table_root; |
940 | |||
941 | struct ctl_table_set { | ||
942 | struct list_head list; | ||
943 | struct ctl_table_set *parent; | ||
944 | int (*is_seen)(struct ctl_table_set *); | ||
945 | }; | ||
946 | |||
947 | extern void setup_sysctl_set(struct ctl_table_set *p, | ||
948 | struct ctl_table_set *parent, | ||
949 | int (*is_seen)(struct ctl_table_set *)); | ||
950 | |||
951 | struct ctl_table_header; | 940 | struct ctl_table_header; |
952 | 941 | ||
953 | extern void sysctl_head_get(struct ctl_table_header *); | ||
954 | extern void sysctl_head_put(struct ctl_table_header *); | ||
955 | extern int sysctl_is_seen(struct ctl_table_header *); | ||
956 | extern struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *); | ||
957 | extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); | ||
958 | extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces, | ||
959 | struct ctl_table_header *prev); | ||
960 | extern void sysctl_head_finish(struct ctl_table_header *prev); | ||
961 | extern int sysctl_perm(struct ctl_table_root *root, | ||
962 | struct ctl_table *table, int op); | ||
963 | |||
964 | typedef struct ctl_table ctl_table; | 942 | typedef struct ctl_table ctl_table; |
965 | 943 | ||
966 | typedef int proc_handler (struct ctl_table *ctl, int write, | 944 | typedef 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 | ||
1026 | void 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 | ||
1050 | struct 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. */ |
1061 | struct ctl_table_header | 1028 | struct 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 | ||
1048 | struct ctl_table_set { | ||
1049 | struct list_head list; | ||
1050 | struct ctl_table_set *parent; | ||
1051 | int (*is_seen)(struct ctl_table_set *); | ||
1052 | }; | ||
1053 | |||
1054 | struct 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 */ |
1082 | struct ctl_path { | 1064 | struct ctl_path { |
1083 | const char *procname; | 1065 | const char *procname; |
1084 | }; | 1066 | }; |
1085 | 1067 | ||
1068 | #ifdef CONFIG_SYSCTL | ||
1069 | |||
1070 | void proc_sys_poll_notify(struct ctl_table_poll *poll); | ||
1071 | |||
1072 | extern void setup_sysctl_set(struct ctl_table_set *p, | ||
1073 | struct ctl_table_set *parent, | ||
1074 | int (*is_seen)(struct ctl_table_set *)); | ||
1075 | |||
1076 | extern void sysctl_head_get(struct ctl_table_header *); | ||
1077 | extern void sysctl_head_put(struct ctl_table_header *); | ||
1078 | extern int sysctl_is_seen(struct ctl_table_header *); | ||
1079 | extern struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *); | ||
1080 | extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); | ||
1081 | extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces, | ||
1082 | struct ctl_table_header *prev); | ||
1083 | extern void sysctl_head_finish(struct ctl_table_header *prev); | ||
1084 | extern int sysctl_perm(struct ctl_table_root *root, | ||
1085 | struct ctl_table *table, int op); | ||
1086 | |||
1086 | void register_sysctl_root(struct ctl_table_root *root); | 1087 | void register_sysctl_root(struct ctl_table_root *root); |
1087 | struct ctl_table_header *__register_sysctl_paths( | 1088 | struct 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, | |||
1094 | void unregister_sysctl_table(struct ctl_table_header * table); | 1095 | void unregister_sysctl_table(struct ctl_table_header * table); |
1095 | int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table); | 1096 | int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table); |
1096 | 1097 | ||
1098 | #else /* CONFIG_SYSCTL */ | ||
1099 | static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * table) | ||
1100 | { | ||
1101 | return NULL; | ||
1102 | } | ||
1103 | |||
1104 | static inline struct ctl_table_header *register_sysctl_paths( | ||
1105 | const struct ctl_path *path, struct ctl_table *table) | ||
1106 | { | ||
1107 | return NULL; | ||
1108 | } | ||
1109 | |||
1110 | static inline void unregister_sysctl_table(struct ctl_table_header * table) | ||
1111 | { | ||
1112 | } | ||
1113 | |||
1114 | static 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 | |||
1120 | static 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 */ |