aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2008-10-06 06:14:19 -0400
committerAlexey Dobriyan <adobriyan@gmail.com>2008-10-23 10:32:38 -0400
commit97ce5d6dcb07c403c0fc6001b755aacc38b5d7ff (patch)
tree6b8ff98d11bf8efae963e19a40f4ed902e40656c
parentb5aadf7f14c1acc94956aa257e018e9de3881f41 (diff)
proc: move all /proc/kcore stuff to fs/proc/kcore.c
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
-rw-r--r--fs/proc/kcore.c14
-rw-r--r--fs/proc/proc_misc.c8
-rw-r--r--include/linux/proc_fs.h4
3 files changed, 13 insertions, 13 deletions
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index c2370c76fb71..59b43a068872 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -27,6 +27,8 @@
27#define ELF_CORE_EFLAGS 0 27#define ELF_CORE_EFLAGS 0
28#endif 28#endif
29 29
30static struct proc_dir_entry *proc_root_kcore;
31
30static int open_kcore(struct inode * inode, struct file * filp) 32static int open_kcore(struct inode * inode, struct file * filp)
31{ 33{
32 return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; 34 return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
@@ -34,7 +36,7 @@ static int open_kcore(struct inode * inode, struct file * filp)
34 36
35static ssize_t read_kcore(struct file *, char __user *, size_t, loff_t *); 37static ssize_t read_kcore(struct file *, char __user *, size_t, loff_t *);
36 38
37const struct file_operations proc_kcore_operations = { 39static const struct file_operations proc_kcore_operations = {
38 .read = read_kcore, 40 .read = read_kcore,
39 .open = open_kcore, 41 .open = open_kcore,
40}; 42};
@@ -399,3 +401,13 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
399 401
400 return acc; 402 return acc;
401} 403}
404
405static int __init proc_kcore_init(void)
406{
407 proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, &proc_kcore_operations);
408 if (proc_root_kcore)
409 proc_root_kcore->size =
410 (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
411 return 0;
412}
413module_init(proc_kcore_init);
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 4a768ed5da2e..5ed15ff8fd1d 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -188,19 +188,11 @@ static struct file_operations proc_kpageflags_operations = {
188}; 188};
189#endif /* CONFIG_PROC_PAGE_MONITOR */ 189#endif /* CONFIG_PROC_PAGE_MONITOR */
190 190
191struct proc_dir_entry *proc_root_kcore;
192
193void __init proc_misc_init(void) 191void __init proc_misc_init(void)
194{ 192{
195 proc_symlink("mounts", NULL, "self/mounts"); 193 proc_symlink("mounts", NULL, "self/mounts");
196 194
197 /* And now for trickier ones */ 195 /* And now for trickier ones */
198#ifdef CONFIG_PROC_KCORE
199 proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, &proc_kcore_operations);
200 if (proc_root_kcore)
201 proc_root_kcore->size =
202 (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
203#endif
204#ifdef CONFIG_PROC_PAGE_MONITOR 196#ifdef CONFIG_PROC_PAGE_MONITOR
205 proc_create("kpagecount", S_IRUSR, NULL, &proc_kpagecount_operations); 197 proc_create("kpagecount", S_IRUSR, NULL, &proc_kpagecount_operations);
206 proc_create("kpageflags", S_IRUSR, NULL, &proc_kpageflags_operations); 198 proc_create("kpageflags", S_IRUSR, NULL, &proc_kpageflags_operations);
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 27d534f4470d..9d8308905053 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -97,8 +97,6 @@ struct vmcore {
97 97
98#ifdef CONFIG_PROC_FS 98#ifdef CONFIG_PROC_FS
99 99
100extern struct proc_dir_entry *proc_root_kcore;
101
102extern spinlock_t proc_subdir_lock; 100extern spinlock_t proc_subdir_lock;
103 101
104extern void proc_root_init(void); 102extern void proc_root_init(void);
@@ -138,8 +136,6 @@ extern struct inode *proc_get_inode(struct super_block *, unsigned int, struct p
138extern int proc_readdir(struct file *, void *, filldir_t); 136extern int proc_readdir(struct file *, void *, filldir_t);
139extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *); 137extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *);
140 138
141extern const struct file_operations proc_kcore_operations;
142
143extern int pid_ns_prepare_proc(struct pid_namespace *ns); 139extern int pid_ns_prepare_proc(struct pid_namespace *ns);
144extern void pid_ns_release_proc(struct pid_namespace *ns); 140extern void pid_ns_release_proc(struct pid_namespace *ns);
145 141