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 /include/linux/proc_fs.h | |
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>
Diffstat (limited to 'include/linux/proc_fs.h')
-rw-r--r-- | include/linux/proc_fs.h | 140 |
1 files changed, 33 insertions, 107 deletions
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) |