Skip to content

Commit 97ce5d6

Browse files
author
Alexey Dobriyan
committed
proc: move all /proc/kcore stuff to fs/proc/kcore.c
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
1 parent b5aadf7 commit 97ce5d6

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

‎fs/proc/kcore.c‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,16 @@
2727
#define ELF_CORE_EFLAGS 0
2828
#endif
2929

30+
static struct proc_dir_entry *proc_root_kcore;
31+
3032
static int open_kcore(struct inode * inode, struct file * filp)
3133
{
3234
return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
3335
}
3436

3537
static ssize_t read_kcore(struct file *, char __user *, size_t, loff_t *);
3638

37-
const struct file_operations proc_kcore_operations = {
39+
static const struct file_operations proc_kcore_operations = {
3840
.read = read_kcore,
3941
.open = open_kcore,
4042
};
@@ -399,3 +401,13 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
399401

400402
return acc;
401403
}
404+
405+
static 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+
}
413+
module_init(proc_kcore_init);

‎fs/proc/proc_misc.c‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,19 +188,11 @@ static struct file_operations proc_kpageflags_operations = {
188188
};
189189
#endif /* CONFIG_PROC_PAGE_MONITOR */
190190

191-
struct proc_dir_entry *proc_root_kcore;
192-
193191
void __init proc_misc_init(void)
194192
{
195193
proc_symlink("mounts", NULL, "self/mounts");
196194

197195
/* 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
204196
#ifdef CONFIG_PROC_PAGE_MONITOR
205197
proc_create("kpagecount", S_IRUSR, NULL, &proc_kpagecount_operations);
206198
proc_create("kpageflags", S_IRUSR, NULL, &proc_kpageflags_operations);

‎include/linux/proc_fs.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ struct vmcore {
9797

9898
#ifdef CONFIG_PROC_FS
9999

100-
extern struct proc_dir_entry *proc_root_kcore;
101-
102100
extern spinlock_t proc_subdir_lock;
103101

104102
extern void proc_root_init(void);
@@ -138,8 +136,6 @@ extern struct inode *proc_get_inode(struct super_block *, unsigned int, struct p
138136
extern int proc_readdir(struct file *, void *, filldir_t);
139137
extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *);
140138

141-
extern const struct file_operations proc_kcore_operations;
142-
143139
extern int pid_ns_prepare_proc(struct pid_namespace *ns);
144140
extern void pid_ns_release_proc(struct pid_namespace *ns);
145141

0 commit comments

Comments
 (0)