diff options
Diffstat (limited to 'include/linux/proc_fs.h')
-rw-r--r-- | include/linux/proc_fs.h | 61 |
1 files changed, 35 insertions, 26 deletions
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 9b6c935f69cf..9883bc942262 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -9,7 +9,6 @@ | |||
9 | 9 | ||
10 | struct net; | 10 | struct net; |
11 | struct completion; | 11 | struct completion; |
12 | |||
13 | /* | 12 | /* |
14 | * The proc filesystem constants/structures | 13 | * The proc filesystem constants/structures |
15 | */ | 14 | */ |
@@ -41,7 +40,7 @@ enum { | |||
41 | * /proc file has a parent, but "subdir" is NULL for all | 40 | * /proc file has a parent, but "subdir" is NULL for all |
42 | * non-directory entries). | 41 | * non-directory entries). |
43 | * | 42 | * |
44 | * "get_info" is called at "read", while "owner" is used to protect module | 43 | * "owner" is used to protect module |
45 | * from unloading while proc_dir_entry is in use | 44 | * from unloading while proc_dir_entry is in use |
46 | */ | 45 | */ |
47 | 46 | ||
@@ -49,7 +48,6 @@ typedef int (read_proc_t)(char *page, char **start, off_t off, | |||
49 | int count, int *eof, void *data); | 48 | int count, int *eof, void *data); |
50 | typedef int (write_proc_t)(struct file *file, const char __user *buffer, | 49 | typedef int (write_proc_t)(struct file *file, const char __user *buffer, |
51 | unsigned long count, void *data); | 50 | unsigned long count, void *data); |
52 | typedef int (get_info_t)(char *, char **, off_t, int); | ||
53 | 51 | ||
54 | struct proc_dir_entry { | 52 | struct proc_dir_entry { |
55 | unsigned int low_ino; | 53 | unsigned int low_ino; |
@@ -70,7 +68,6 @@ struct proc_dir_entry { | |||
70 | * somewhere. | 68 | * somewhere. |
71 | */ | 69 | */ |
72 | const struct file_operations *proc_fops; | 70 | const struct file_operations *proc_fops; |
73 | get_info_t *get_info; | ||
74 | struct module *owner; | 71 | struct module *owner; |
75 | struct proc_dir_entry *next, *parent, *subdir; | 72 | struct proc_dir_entry *next, *parent, *subdir; |
76 | void *data; | 73 | void *data; |
@@ -97,10 +94,6 @@ struct vmcore { | |||
97 | 94 | ||
98 | #ifdef CONFIG_PROC_FS | 95 | #ifdef CONFIG_PROC_FS |
99 | 96 | ||
100 | extern struct proc_dir_entry proc_root; | ||
101 | extern struct proc_dir_entry *proc_root_fs; | ||
102 | extern struct proc_dir_entry *proc_bus; | ||
103 | extern struct proc_dir_entry *proc_root_driver; | ||
104 | extern struct proc_dir_entry *proc_root_kcore; | 97 | extern struct proc_dir_entry *proc_root_kcore; |
105 | 98 | ||
106 | extern spinlock_t proc_subdir_lock; | 99 | extern spinlock_t proc_subdir_lock; |
@@ -123,9 +116,10 @@ void de_put(struct proc_dir_entry *de); | |||
123 | 116 | ||
124 | extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, | 117 | extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, |
125 | struct proc_dir_entry *parent); | 118 | struct proc_dir_entry *parent); |
126 | struct proc_dir_entry *proc_create(const char *name, mode_t mode, | 119 | struct proc_dir_entry *proc_create_data(const char *name, mode_t mode, |
127 | struct proc_dir_entry *parent, | 120 | struct proc_dir_entry *parent, |
128 | const struct file_operations *proc_fops); | 121 | const struct file_operations *proc_fops, |
122 | void *data); | ||
129 | extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); | 123 | extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); |
130 | 124 | ||
131 | extern struct vfsmount *proc_mnt; | 125 | extern struct vfsmount *proc_mnt; |
@@ -180,6 +174,12 @@ extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); | |||
180 | extern struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode, | 174 | extern struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode, |
181 | struct proc_dir_entry *parent); | 175 | struct proc_dir_entry *parent); |
182 | 176 | ||
177 | static inline struct proc_dir_entry *proc_create(const char *name, mode_t mode, | ||
178 | struct proc_dir_entry *parent, const struct file_operations *proc_fops) | ||
179 | { | ||
180 | return proc_create_data(name, mode, parent, proc_fops, NULL); | ||
181 | } | ||
182 | |||
183 | static inline struct proc_dir_entry *create_proc_read_entry(const char *name, | 183 | static inline struct proc_dir_entry *create_proc_read_entry(const char *name, |
184 | mode_t mode, struct proc_dir_entry *base, | 184 | mode_t mode, struct proc_dir_entry *base, |
185 | read_proc_t *read_proc, void * data) | 185 | read_proc_t *read_proc, void * data) |
@@ -192,24 +192,19 @@ static inline struct proc_dir_entry *create_proc_read_entry(const char *name, | |||
192 | return res; | 192 | return res; |
193 | } | 193 | } |
194 | 194 | ||
195 | static inline struct proc_dir_entry *create_proc_info_entry(const char *name, | ||
196 | mode_t mode, struct proc_dir_entry *base, get_info_t *get_info) | ||
197 | { | ||
198 | struct proc_dir_entry *res=create_proc_entry(name,mode,base); | ||
199 | if (res) res->get_info=get_info; | ||
200 | return res; | ||
201 | } | ||
202 | |||
203 | extern struct proc_dir_entry *proc_net_fops_create(struct net *net, | 195 | extern struct proc_dir_entry *proc_net_fops_create(struct net *net, |
204 | const char *name, mode_t mode, const struct file_operations *fops); | 196 | const char *name, mode_t mode, const struct file_operations *fops); |
205 | extern void proc_net_remove(struct net *net, const char *name); | 197 | extern void proc_net_remove(struct net *net, const char *name); |
206 | extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, | 198 | extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, |
207 | struct proc_dir_entry *parent); | 199 | struct proc_dir_entry *parent); |
208 | 200 | ||
209 | #else | 201 | /* While the {get|set|dup}_mm_exe_file functions are for mm_structs, they are |
202 | * only needed to implement /proc/<pid>|self/exe so we define them here. */ | ||
203 | extern void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file); | ||
204 | extern struct file *get_mm_exe_file(struct mm_struct *mm); | ||
205 | extern void dup_mm_exe_file(struct mm_struct *oldmm, struct mm_struct *newmm); | ||
210 | 206 | ||
211 | #define proc_root_driver NULL | 207 | #else |
212 | #define proc_bus NULL | ||
213 | 208 | ||
214 | #define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; }) | 209 | #define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; }) |
215 | static inline void proc_net_remove(struct net *net, const char *name) {} | 210 | static inline void proc_net_remove(struct net *net, const char *name) {} |
@@ -226,6 +221,12 @@ static inline struct proc_dir_entry *proc_create(const char *name, | |||
226 | { | 221 | { |
227 | return NULL; | 222 | return NULL; |
228 | } | 223 | } |
224 | static inline struct proc_dir_entry *proc_create_data(const char *name, | ||
225 | mode_t mode, struct proc_dir_entry *parent, | ||
226 | const struct file_operations *proc_fops, void *data) | ||
227 | { | ||
228 | return NULL; | ||
229 | } | ||
229 | #define remove_proc_entry(name, parent) do {} while (0) | 230 | #define remove_proc_entry(name, parent) do {} while (0) |
230 | 231 | ||
231 | static inline struct proc_dir_entry *proc_symlink(const char *name, | 232 | static inline struct proc_dir_entry *proc_symlink(const char *name, |
@@ -236,16 +237,11 @@ static inline struct proc_dir_entry *proc_mkdir(const char *name, | |||
236 | static inline struct proc_dir_entry *create_proc_read_entry(const char *name, | 237 | static inline struct proc_dir_entry *create_proc_read_entry(const char *name, |
237 | mode_t mode, struct proc_dir_entry *base, | 238 | mode_t mode, struct proc_dir_entry *base, |
238 | read_proc_t *read_proc, void * data) { return NULL; } | 239 | read_proc_t *read_proc, void * data) { return NULL; } |
239 | static inline struct proc_dir_entry *create_proc_info_entry(const char *name, | ||
240 | mode_t mode, struct proc_dir_entry *base, get_info_t *get_info) | ||
241 | { return NULL; } | ||
242 | 240 | ||
243 | struct tty_driver; | 241 | struct tty_driver; |
244 | static inline void proc_tty_register_driver(struct tty_driver *driver) {}; | 242 | static inline void proc_tty_register_driver(struct tty_driver *driver) {}; |
245 | static inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; | 243 | static inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; |
246 | 244 | ||
247 | extern struct proc_dir_entry proc_root; | ||
248 | |||
249 | static inline int pid_ns_prepare_proc(struct pid_namespace *ns) | 245 | static inline int pid_ns_prepare_proc(struct pid_namespace *ns) |
250 | { | 246 | { |
251 | return 0; | 247 | return 0; |
@@ -255,6 +251,19 @@ static inline void pid_ns_release_proc(struct pid_namespace *ns) | |||
255 | { | 251 | { |
256 | } | 252 | } |
257 | 253 | ||
254 | static inline void set_mm_exe_file(struct mm_struct *mm, | ||
255 | struct file *new_exe_file) | ||
256 | {} | ||
257 | |||
258 | static inline struct file *get_mm_exe_file(struct mm_struct *mm) | ||
259 | { | ||
260 | return NULL; | ||
261 | } | ||
262 | |||
263 | static inline void dup_mm_exe_file(struct mm_struct *oldmm, | ||
264 | struct mm_struct *newmm) | ||
265 | {} | ||
266 | |||
258 | #endif /* CONFIG_PROC_FS */ | 267 | #endif /* CONFIG_PROC_FS */ |
259 | 268 | ||
260 | #if !defined(CONFIG_PROC_KCORE) | 269 | #if !defined(CONFIG_PROC_KCORE) |