diff options
author | David Howells <dhowells@redhat.com> | 2013-04-11 08:34:43 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-05-01 17:29:47 -0400 |
commit | 59d8053f1e16904d54ed7469d4b36801ea6b8f2c (patch) | |
tree | ca3879f5ffd0b4b9f89fbdc1b95d409793a1dc79 | |
parent | c30480b92cf497aa3b463367a82f1c2fdc5c46e9 (diff) |
proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h
Move non-public declarations and definitions from linux/proc_fs.h to
fs/proc/internal.h.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/proc/internal.h | 307 | ||||
-rw-r--r-- | fs/proc/kcore.c | 1 | ||||
-rw-r--r-- | include/linux/proc_fs.h | 140 |
3 files changed, 230 insertions, 218 deletions
diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 86a24060e1b9..04255b6e96b7 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* internal.h: internal procfs definitions | 1 | /* Internal procfs definitions |
2 | * | 2 | * |
3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. | 3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. |
4 | * Written by David Howells (dhowells@redhat.com) | 4 | * Written by David Howells (dhowells@redhat.com) |
@@ -9,81 +9,66 @@ | |||
9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/sched.h> | ||
13 | #include <linux/proc_fs.h> | 12 | #include <linux/proc_fs.h> |
13 | #include <linux/proc_ns.h> | ||
14 | #include <linux/spinlock.h> | ||
15 | #include <linux/atomic.h> | ||
14 | #include <linux/binfmts.h> | 16 | #include <linux/binfmts.h> |
15 | struct ctl_table_header; | ||
16 | struct mempolicy; | ||
17 | 17 | ||
18 | extern struct proc_dir_entry proc_root; | 18 | struct ctl_table_header; |
19 | extern void proc_self_init(void); | 19 | struct mempolicy; |
20 | #ifdef CONFIG_PROC_SYSCTL | ||
21 | extern int proc_sys_init(void); | ||
22 | extern void sysctl_head_put(struct ctl_table_header *head); | ||
23 | #else | ||
24 | static inline void proc_sys_init(void) { } | ||
25 | static inline void sysctl_head_put(struct ctl_table_header *head) { } | ||
26 | #endif | ||
27 | #ifdef CONFIG_NET | ||
28 | extern int proc_net_init(void); | ||
29 | #else | ||
30 | static inline int proc_net_init(void) { return 0; } | ||
31 | #endif | ||
32 | 20 | ||
33 | struct vmalloc_info { | 21 | /* |
34 | unsigned long used; | 22 | * This is not completely implemented yet. The idea is to |
35 | unsigned long largest_chunk; | 23 | * create an in-memory tree (like the actual /proc filesystem |
24 | * tree) of these proc_dir_entries, so that we can dynamically | ||
25 | * add new files to /proc. | ||
26 | * | ||
27 | * The "next" pointer creates a linked list of one /proc directory, | ||
28 | * while parent/subdir create the directory structure (every | ||
29 | * /proc file has a parent, but "subdir" is NULL for all | ||
30 | * non-directory entries). | ||
31 | */ | ||
32 | struct proc_dir_entry { | ||
33 | unsigned int low_ino; | ||
34 | umode_t mode; | ||
35 | nlink_t nlink; | ||
36 | kuid_t uid; | ||
37 | kgid_t gid; | ||
38 | loff_t size; | ||
39 | const struct inode_operations *proc_iops; | ||
40 | const struct file_operations *proc_fops; | ||
41 | struct proc_dir_entry *next, *parent, *subdir; | ||
42 | void *data; | ||
43 | atomic_t count; /* use count */ | ||
44 | atomic_t in_use; /* number of callers into module in progress; */ | ||
45 | /* negative -> it's going away RSN */ | ||
46 | struct completion *pde_unload_completion; | ||
47 | struct list_head pde_openers; /* who did ->open, but not ->release */ | ||
48 | spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */ | ||
49 | u8 namelen; | ||
50 | char name[]; | ||
36 | }; | 51 | }; |
37 | 52 | ||
38 | #ifdef CONFIG_MMU | 53 | union proc_op { |
39 | #define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START) | 54 | int (*proc_get_link)(struct dentry *, struct path *); |
40 | extern void get_vmalloc_info(struct vmalloc_info *vmi); | 55 | int (*proc_read)(struct task_struct *task, char *page); |
41 | #else | 56 | int (*proc_show)(struct seq_file *m, |
42 | 57 | struct pid_namespace *ns, struct pid *pid, | |
43 | #define VMALLOC_TOTAL 0UL | 58 | struct task_struct *task); |
44 | #define get_vmalloc_info(vmi) \ | 59 | }; |
45 | do { \ | ||
46 | (vmi)->used = 0; \ | ||
47 | (vmi)->largest_chunk = 0; \ | ||
48 | } while(0) | ||
49 | #endif | ||
50 | |||
51 | extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns, | ||
52 | struct pid *pid, struct task_struct *task); | ||
53 | extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns, | ||
54 | struct pid *pid, struct task_struct *task); | ||
55 | extern int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, | ||
56 | struct pid *pid, struct task_struct *task); | ||
57 | extern int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns, | ||
58 | struct pid *pid, struct task_struct *task); | ||
59 | extern loff_t mem_lseek(struct file *file, loff_t offset, int orig); | ||
60 | |||
61 | extern const struct file_operations proc_tid_children_operations; | ||
62 | extern const struct file_operations proc_pid_maps_operations; | ||
63 | extern const struct file_operations proc_tid_maps_operations; | ||
64 | extern const struct file_operations proc_pid_numa_maps_operations; | ||
65 | extern const struct file_operations proc_tid_numa_maps_operations; | ||
66 | extern const struct file_operations proc_pid_smaps_operations; | ||
67 | extern const struct file_operations proc_tid_smaps_operations; | ||
68 | extern const struct file_operations proc_clear_refs_operations; | ||
69 | extern const struct file_operations proc_pagemap_operations; | ||
70 | extern const struct file_operations proc_net_operations; | ||
71 | extern const struct inode_operations proc_net_inode_operations; | ||
72 | extern const struct inode_operations proc_pid_link_inode_operations; | ||
73 | 60 | ||
74 | struct proc_maps_private { | 61 | struct proc_inode { |
75 | struct pid *pid; | 62 | struct pid *pid; |
76 | struct task_struct *task; | 63 | int fd; |
77 | #ifdef CONFIG_MMU | 64 | union proc_op op; |
78 | struct vm_area_struct *tail_vma; | 65 | struct proc_dir_entry *pde; |
79 | #endif | 66 | struct ctl_table_header *sysctl; |
80 | #ifdef CONFIG_NUMA | 67 | struct ctl_table *sysctl_entry; |
81 | struct mempolicy *task_mempolicy; | 68 | struct proc_ns ns; |
82 | #endif | 69 | struct inode vfs_inode; |
83 | }; | 70 | }; |
84 | 71 | ||
85 | void proc_init_inodecache(void); | ||
86 | |||
87 | /* | 72 | /* |
88 | * General functions | 73 | * General functions |
89 | */ | 74 | */ |
@@ -150,79 +135,142 @@ out: | |||
150 | } | 135 | } |
151 | 136 | ||
152 | /* | 137 | /* |
153 | * base.c | 138 | * Offset of the first process in the /proc root directory.. |
154 | */ | 139 | */ |
155 | extern int pid_delete_dentry(const struct dentry *); | 140 | #define FIRST_PROCESS_ENTRY 256 |
156 | 141 | ||
157 | struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *ino, | 142 | /* Worst case buffer size needed for holding an integer. */ |
158 | struct dentry *dentry); | 143 | #define PROC_NUMBUF 13 |
159 | int proc_readdir_de(struct proc_dir_entry *de, struct file *filp, void *dirent, | ||
160 | filldir_t filldir); | ||
161 | 144 | ||
162 | struct pde_opener { | 145 | /* |
163 | struct file *file; | 146 | * array.c |
164 | struct list_head lh; | 147 | */ |
165 | int closing; | 148 | extern const struct file_operations proc_tid_children_operations; |
166 | struct completion *c; | 149 | |
167 | }; | 150 | extern int proc_tid_stat(struct seq_file *, struct pid_namespace *, |
151 | struct pid *, struct task_struct *); | ||
152 | extern int proc_tgid_stat(struct seq_file *, struct pid_namespace *, | ||
153 | struct pid *, struct task_struct *); | ||
154 | extern int proc_pid_status(struct seq_file *, struct pid_namespace *, | ||
155 | struct pid *, struct task_struct *); | ||
156 | extern int proc_pid_statm(struct seq_file *, struct pid_namespace *, | ||
157 | struct pid *, struct task_struct *); | ||
158 | |||
159 | /* | ||
160 | * base.c | ||
161 | */ | ||
162 | extern const struct dentry_operations pid_dentry_operations; | ||
163 | extern int pid_getattr(struct vfsmount *, struct dentry *, struct kstat *); | ||
164 | extern int proc_setattr(struct dentry *, struct iattr *); | ||
165 | extern struct inode *proc_pid_make_inode(struct super_block *, struct task_struct *); | ||
166 | extern int pid_revalidate(struct dentry *, unsigned int); | ||
167 | extern int pid_delete_dentry(const struct dentry *); | ||
168 | extern int proc_pid_readdir(struct file *, void *, filldir_t); | ||
169 | extern struct dentry *proc_pid_lookup(struct inode *, struct dentry *, unsigned int); | ||
170 | extern loff_t mem_lseek(struct file *, loff_t, int); | ||
168 | 171 | ||
169 | void proc_entry_rundown(struct proc_dir_entry *); | 172 | /* Lookups */ |
173 | typedef struct dentry *instantiate_t(struct inode *, struct dentry *, | ||
174 | struct task_struct *, const void *); | ||
175 | extern int proc_fill_cache(struct file *, void *, filldir_t, const char *, int, | ||
176 | instantiate_t, struct task_struct *, const void *); | ||
170 | 177 | ||
178 | /* | ||
179 | * generic.c | ||
180 | */ | ||
171 | extern spinlock_t proc_subdir_lock; | 181 | extern spinlock_t proc_subdir_lock; |
172 | 182 | ||
173 | struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, unsigned int); | 183 | extern struct dentry *proc_lookup(struct inode *, struct dentry *, unsigned int); |
174 | int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir); | 184 | extern struct dentry *proc_lookup_de(struct proc_dir_entry *, struct inode *, |
175 | unsigned long task_vsize(struct mm_struct *); | 185 | struct dentry *); |
176 | unsigned long task_statm(struct mm_struct *, | 186 | extern int proc_readdir(struct file *, void *, filldir_t); |
177 | unsigned long *, unsigned long *, unsigned long *, unsigned long *); | 187 | extern int proc_readdir_de(struct proc_dir_entry *, struct file *, void *, filldir_t); |
178 | void task_mem(struct seq_file *, struct mm_struct *); | ||
179 | 188 | ||
180 | static inline struct proc_dir_entry *pde_get(struct proc_dir_entry *pde) | 189 | static inline struct proc_dir_entry *pde_get(struct proc_dir_entry *pde) |
181 | { | 190 | { |
182 | atomic_inc(&pde->count); | 191 | atomic_inc(&pde->count); |
183 | return pde; | 192 | return pde; |
184 | } | 193 | } |
185 | void pde_put(struct proc_dir_entry *pde); | 194 | extern void pde_put(struct proc_dir_entry *); |
195 | |||
196 | /* | ||
197 | * inode.c | ||
198 | */ | ||
199 | struct pde_opener { | ||
200 | struct file *file; | ||
201 | struct list_head lh; | ||
202 | int closing; | ||
203 | struct completion *c; | ||
204 | }; | ||
186 | 205 | ||
187 | int proc_fill_super(struct super_block *); | 206 | extern const struct inode_operations proc_pid_link_inode_operations; |
188 | struct inode *proc_get_inode(struct super_block *, struct proc_dir_entry *); | 207 | |
189 | int proc_remount(struct super_block *sb, int *flags, char *data); | 208 | extern void proc_init_inodecache(void); |
209 | extern struct inode *proc_get_inode(struct super_block *, struct proc_dir_entry *); | ||
210 | extern int proc_fill_super(struct super_block *); | ||
211 | extern void proc_entry_rundown(struct proc_dir_entry *); | ||
190 | 212 | ||
191 | /* | 213 | /* |
192 | * These are generic /proc routines that use the internal | 214 | * mmu.c |
193 | * "struct proc_dir_entry" tree to traverse the filesystem. | ||
194 | * | ||
195 | * The /proc root directory has extended versions to take care | ||
196 | * of the /proc/<pid> subdirectories. | ||
197 | */ | 215 | */ |
198 | int proc_readdir(struct file *, void *, filldir_t); | 216 | struct vmalloc_info { |
199 | struct dentry *proc_lookup(struct inode *, struct dentry *, unsigned int); | 217 | unsigned long used; |
218 | unsigned long largest_chunk; | ||
219 | }; | ||
200 | 220 | ||
221 | #ifdef CONFIG_MMU | ||
222 | #define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START) | ||
223 | extern void get_vmalloc_info(struct vmalloc_info *); | ||
201 | 224 | ||
225 | #else | ||
226 | #define VMALLOC_TOTAL 0UL | ||
227 | static inline void get_vmalloc_info(struct vmalloc_info *vmi) | ||
228 | { | ||
229 | vmi->used = 0; | ||
230 | vmi->largest_chunk = 0; | ||
231 | } | ||
232 | #endif | ||
202 | 233 | ||
203 | /* Lookups */ | 234 | /* |
204 | typedef struct dentry *instantiate_t(struct inode *, struct dentry *, | 235 | * proc_devtree.c |
205 | struct task_struct *, const void *); | 236 | */ |
206 | int proc_fill_cache(struct file *filp, void *dirent, filldir_t filldir, | 237 | #ifdef CONFIG_PROC_DEVICETREE |
207 | const char *name, int len, | 238 | extern void proc_device_tree_init(void); |
208 | instantiate_t instantiate, struct task_struct *task, const void *ptr); | 239 | #endif |
209 | int pid_revalidate(struct dentry *dentry, unsigned int flags); | ||
210 | struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct *task); | ||
211 | extern const struct dentry_operations pid_dentry_operations; | ||
212 | int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat); | ||
213 | int proc_setattr(struct dentry *dentry, struct iattr *attr); | ||
214 | 240 | ||
241 | /* | ||
242 | * proc_namespaces.c | ||
243 | */ | ||
215 | extern const struct inode_operations proc_ns_dir_inode_operations; | 244 | extern const struct inode_operations proc_ns_dir_inode_operations; |
216 | extern const struct file_operations proc_ns_dir_operations; | 245 | extern const struct file_operations proc_ns_dir_operations; |
217 | 246 | ||
247 | /* | ||
248 | * proc_net.c | ||
249 | */ | ||
250 | extern const struct file_operations proc_net_operations; | ||
251 | extern const struct inode_operations proc_net_inode_operations; | ||
252 | |||
253 | #ifdef CONFIG_NET | ||
254 | extern int proc_net_init(void); | ||
255 | #else | ||
256 | static inline int proc_net_init(void) { return 0; } | ||
257 | #endif | ||
258 | |||
259 | /* | ||
260 | * proc_self.c | ||
261 | */ | ||
218 | extern int proc_setup_self(struct super_block *); | 262 | extern int proc_setup_self(struct super_block *); |
219 | 263 | ||
220 | /* | 264 | /* |
221 | * proc_devtree.c | 265 | * proc_sysctl.c |
222 | */ | 266 | */ |
223 | #ifdef CONFIG_PROC_DEVICETREE | 267 | #ifdef CONFIG_PROC_SYSCTL |
224 | extern void proc_device_tree_init(void); | 268 | extern int proc_sys_init(void); |
225 | #endif /* CONFIG_PROC_DEVICETREE */ | 269 | extern void sysctl_head_put(struct ctl_table_header *); |
270 | #else | ||
271 | static inline void proc_sys_init(void) { } | ||
272 | static inline void sysctl_head_put(struct ctl_table_header *head) { } | ||
273 | #endif | ||
226 | 274 | ||
227 | /* | 275 | /* |
228 | * proc_tty.c | 276 | * proc_tty.c |
@@ -232,3 +280,40 @@ extern void proc_tty_init(void); | |||
232 | #else | 280 | #else |
233 | static inline void proc_tty_init(void) {} | 281 | static inline void proc_tty_init(void) {} |
234 | #endif | 282 | #endif |
283 | |||
284 | /* | ||
285 | * root.c | ||
286 | */ | ||
287 | extern struct proc_dir_entry proc_root; | ||
288 | |||
289 | extern void proc_self_init(void); | ||
290 | extern int proc_remount(struct super_block *, int *, char *); | ||
291 | |||
292 | /* | ||
293 | * task_[no]mmu.c | ||
294 | */ | ||
295 | struct proc_maps_private { | ||
296 | struct pid *pid; | ||
297 | struct task_struct *task; | ||
298 | #ifdef CONFIG_MMU | ||
299 | struct vm_area_struct *tail_vma; | ||
300 | #endif | ||
301 | #ifdef CONFIG_NUMA | ||
302 | struct mempolicy *task_mempolicy; | ||
303 | #endif | ||
304 | }; | ||
305 | |||
306 | extern const struct file_operations proc_pid_maps_operations; | ||
307 | extern const struct file_operations proc_tid_maps_operations; | ||
308 | extern const struct file_operations proc_pid_numa_maps_operations; | ||
309 | extern const struct file_operations proc_tid_numa_maps_operations; | ||
310 | extern const struct file_operations proc_pid_smaps_operations; | ||
311 | extern const struct file_operations proc_tid_smaps_operations; | ||
312 | extern const struct file_operations proc_clear_refs_operations; | ||
313 | extern const struct file_operations proc_pagemap_operations; | ||
314 | |||
315 | extern unsigned long task_vsize(struct mm_struct *); | ||
316 | extern unsigned long task_statm(struct mm_struct *, | ||
317 | unsigned long *, unsigned long *, | ||
318 | unsigned long *, unsigned long *); | ||
319 | extern void task_mem(struct seq_file *, struct mm_struct *); | ||
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index 8e6ce830de44..13cf87c4686f 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/ioport.h> | 28 | #include <linux/ioport.h> |
29 | #include <linux/memory.h> | 29 | #include <linux/memory.h> |
30 | #include <asm/sections.h> | 30 | #include <asm/sections.h> |
31 | #include "internal.h" | ||
31 | 32 | ||
32 | #define CORE_STR "CORE" | 33 | #define CORE_STR "CORE" |
33 | 34 | ||
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 2112926de854..608e60a74c3c 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -1,148 +1,74 @@ | |||
1 | #ifndef _LINUX_PROC_FS_H | ||
2 | #define _LINUX_PROC_FS_H | ||
3 | |||
4 | #include <linux/slab.h> | ||
5 | #include <linux/fs.h> | ||
6 | #include <linux/spinlock.h> | ||
7 | #include <linux/magic.h> | ||
8 | #include <linux/atomic.h> | ||
9 | #include <linux/proc_ns.h> | ||
10 | |||
11 | struct net; | ||
12 | struct completion; | ||
13 | struct mm_struct; | ||
14 | |||
15 | /* | 1 | /* |
16 | * The proc filesystem constants/structures | 2 | * The proc filesystem constants/structures |
17 | */ | 3 | */ |
4 | #ifndef _LINUX_PROC_FS_H | ||
5 | #define _LINUX_PROC_FS_H | ||
18 | 6 | ||
19 | /* | 7 | #include <linux/types.h> |
20 | * Offset of the first process in the /proc root directory.. | 8 | #include <linux/fs.h> |
21 | */ | ||
22 | #define FIRST_PROCESS_ENTRY 256 | ||
23 | |||
24 | /* Worst case buffer size needed for holding an integer. */ | ||
25 | #define PROC_NUMBUF 13 | ||
26 | |||
27 | /* | ||
28 | * This is not completely implemented yet. The idea is to | ||
29 | * create an in-memory tree (like the actual /proc filesystem | ||
30 | * tree) of these proc_dir_entries, so that we can dynamically | ||
31 | * add new files to /proc. | ||
32 | * | ||
33 | * The "next" pointer creates a linked list of one /proc directory, | ||
34 | * while parent/subdir create the directory structure (every | ||
35 | * /proc file has a parent, but "subdir" is NULL for all | ||
36 | * non-directory entries). | ||
37 | */ | ||
38 | 9 | ||
39 | struct proc_dir_entry { | 10 | struct proc_dir_entry; |
40 | unsigned int low_ino; | ||
41 | umode_t mode; | ||
42 | nlink_t nlink; | ||
43 | kuid_t uid; | ||
44 | kgid_t gid; | ||
45 | loff_t size; | ||
46 | const struct inode_operations *proc_iops; | ||
47 | const struct file_operations *proc_fops; | ||
48 | struct proc_dir_entry *next, *parent, *subdir; | ||
49 | void *data; | ||
50 | atomic_t count; /* use count */ | ||
51 | atomic_t in_use; /* number of callers into module in progress; */ | ||
52 | /* negative -> it's going away RSN */ | ||
53 | struct completion *pde_unload_completion; | ||
54 | struct list_head pde_openers; /* who did ->open, but not ->release */ | ||
55 | spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */ | ||
56 | u8 namelen; | ||
57 | char name[]; | ||
58 | }; | ||
59 | 11 | ||
60 | #ifdef CONFIG_PROC_FS | 12 | #ifdef CONFIG_PROC_FS |
61 | 13 | ||
62 | extern void proc_root_init(void); | 14 | extern void proc_root_init(void); |
63 | 15 | extern void proc_flush_task(struct task_struct *); | |
64 | void proc_flush_task(struct task_struct *task); | ||
65 | |||
66 | struct proc_dir_entry *proc_create_data(const char *name, umode_t mode, | ||
67 | struct proc_dir_entry *parent, | ||
68 | const struct file_operations *proc_fops, | ||
69 | void *data); | ||
70 | extern void proc_remove(struct proc_dir_entry *); | ||
71 | extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); | ||
72 | extern int remove_proc_subtree(const char *name, struct proc_dir_entry *parent); | ||
73 | 16 | ||
74 | extern struct proc_dir_entry *proc_symlink(const char *, | 17 | extern struct proc_dir_entry *proc_symlink(const char *, |
75 | struct proc_dir_entry *, const char *); | 18 | struct proc_dir_entry *, const char *); |
76 | extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); | 19 | extern struct proc_dir_entry *proc_mkdir(const char *, struct proc_dir_entry *); |
77 | extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t, | 20 | extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t, |
78 | struct proc_dir_entry *, void *); | 21 | struct proc_dir_entry *, void *); |
79 | extern struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode, | 22 | extern struct proc_dir_entry *proc_mkdir_mode(const char *, umode_t, |
80 | struct proc_dir_entry *parent); | 23 | struct proc_dir_entry *); |
81 | 24 | ||
82 | static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode, | 25 | extern struct proc_dir_entry *proc_create_data(const char *, umode_t, |
83 | struct proc_dir_entry *parent, const struct file_operations *proc_fops) | 26 | struct proc_dir_entry *, |
27 | const struct file_operations *, | ||
28 | void *); | ||
29 | |||
30 | static inline struct proc_dir_entry *proc_create( | ||
31 | const char *name, umode_t mode, struct proc_dir_entry *parent, | ||
32 | const struct file_operations *proc_fops) | ||
84 | { | 33 | { |
85 | return proc_create_data(name, mode, parent, proc_fops, NULL); | 34 | return proc_create_data(name, mode, parent, proc_fops, NULL); |
86 | } | 35 | } |
87 | 36 | ||
88 | extern void proc_set_size(struct proc_dir_entry *, loff_t); | 37 | extern void proc_set_size(struct proc_dir_entry *, loff_t); |
89 | extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t); | 38 | extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t); |
90 | extern void *PDE_DATA(const struct inode *); | 39 | extern void *PDE_DATA(const struct inode *); |
91 | extern void *proc_get_parent_data(const struct inode *); | 40 | extern void *proc_get_parent_data(const struct inode *); |
92 | #else | 41 | extern void proc_remove(struct proc_dir_entry *); |
42 | extern void remove_proc_entry(const char *, struct proc_dir_entry *); | ||
43 | extern int remove_proc_subtree(const char *, struct proc_dir_entry *); | ||
44 | |||
45 | #else /* CONFIG_PROC_FS */ | ||
93 | 46 | ||
94 | static inline void proc_flush_task(struct task_struct *task) | 47 | static inline void proc_flush_task(struct task_struct *task) |
95 | { | 48 | { |
96 | } | 49 | } |
97 | 50 | ||
98 | #define proc_create(name, mode, parent, fops) ({ (void)(mode), NULL; }) | ||
99 | |||
100 | static inline struct proc_dir_entry *proc_create_data(const char *name, | ||
101 | umode_t mode, struct proc_dir_entry *parent, | ||
102 | const struct file_operations *proc_fops, void *data) | ||
103 | { | ||
104 | return NULL; | ||
105 | } | ||
106 | static inline void proc_remove(struct proc_dir_entry *de) {} | ||
107 | #define remove_proc_entry(name, parent) do {} while (0) | ||
108 | #define remove_proc_subtree(name, parent) do {} while (0) | ||
109 | |||
110 | static inline struct proc_dir_entry *proc_symlink(const char *name, | 51 | static inline struct proc_dir_entry *proc_symlink(const char *name, |
111 | struct proc_dir_entry *parent,const char *dest) {return NULL;} | 52 | struct proc_dir_entry *parent,const char *dest) { return NULL;} |
112 | static inline struct proc_dir_entry *proc_mkdir(const char *name, | 53 | static inline struct proc_dir_entry *proc_mkdir(const char *name, |
113 | struct proc_dir_entry *parent) {return NULL;} | 54 | struct proc_dir_entry *parent) {return NULL;} |
114 | static inline struct proc_dir_entry *proc_mkdir_data(const char *name, | 55 | static inline struct proc_dir_entry *proc_mkdir_data(const char *name, |
115 | umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; } | 56 | umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; } |
116 | static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, | 57 | static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, |
117 | umode_t mode, struct proc_dir_entry *parent) { return NULL; } | 58 | umode_t mode, struct proc_dir_entry *parent) { return NULL; } |
59 | #define proc_create(name, mode, parent, proc_fops) ({NULL;}) | ||
60 | #define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;}) | ||
61 | |||
118 | static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {} | 62 | static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {} |
119 | static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {} | 63 | static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {} |
120 | static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;} | 64 | static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;} |
65 | static inline void *proc_get_parent_data(const struct inode *inode) { BUG(); return NULL; } | ||
121 | 66 | ||
122 | #endif /* CONFIG_PROC_FS */ | 67 | static inline void proc_remove(struct proc_dir_entry *de) {} |
123 | 68 | #define remove_proc_entry(name, parent) do {} while (0) | |
124 | 69 | static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) { return 0; } | |
125 | union proc_op { | ||
126 | int (*proc_get_link)(struct dentry *, struct path *); | ||
127 | int (*proc_read)(struct task_struct *task, char *page); | ||
128 | int (*proc_show)(struct seq_file *m, | ||
129 | struct pid_namespace *ns, struct pid *pid, | ||
130 | struct task_struct *task); | ||
131 | }; | ||
132 | |||
133 | struct ctl_table_header; | ||
134 | struct ctl_table; | ||
135 | 70 | ||
136 | struct proc_inode { | 71 | #endif /* CONFIG_PROC_FS */ |
137 | struct pid *pid; | ||
138 | int fd; | ||
139 | union proc_op op; | ||
140 | struct proc_dir_entry *pde; | ||
141 | struct ctl_table_header *sysctl; | ||
142 | struct ctl_table *sysctl_entry; | ||
143 | struct proc_ns ns; | ||
144 | struct inode vfs_inode; | ||
145 | }; | ||
146 | 72 | ||
147 | static inline struct proc_dir_entry *proc_net_mkdir( | 73 | static inline struct proc_dir_entry *proc_net_mkdir( |
148 | struct net *net, const char *name, struct proc_dir_entry *parent) | 74 | struct net *net, const char *name, struct proc_dir_entry *parent) |