Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

proc: move all /proc/kcore stuff to fs/proc/kcore.c

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>

+13 -13
+13 -1
fs/proc/kcore.c
··· 27 27 #define ELF_CORE_EFLAGS 0 28 28 #endif 29 29 30 + static struct proc_dir_entry *proc_root_kcore; 31 + 30 32 static int open_kcore(struct inode * inode, struct file * filp) 31 33 { 32 34 return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; ··· 36 34 37 35 static ssize_t read_kcore(struct file *, char __user *, size_t, loff_t *); 38 36 39 - const struct file_operations proc_kcore_operations = { 37 + static const struct file_operations proc_kcore_operations = { 40 38 .read = read_kcore, 41 39 .open = open_kcore, 42 40 }; ··· 401 399 402 400 return acc; 403 401 } 402 + 403 + static int __init proc_kcore_init(void) 404 + { 405 + proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, &proc_kcore_operations); 406 + if (proc_root_kcore) 407 + proc_root_kcore->size = 408 + (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE; 409 + return 0; 410 + } 411 + module_init(proc_kcore_init);
-8
fs/proc/proc_misc.c
··· 188 188 }; 189 189 #endif /* CONFIG_PROC_PAGE_MONITOR */ 190 190 191 - struct proc_dir_entry *proc_root_kcore; 192 - 193 191 void __init proc_misc_init(void) 194 192 { 195 193 proc_symlink("mounts", NULL, "self/mounts"); 196 194 197 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 196 #ifdef CONFIG_PROC_PAGE_MONITOR 205 197 proc_create("kpagecount", S_IRUSR, NULL, &proc_kpagecount_operations); 206 198 proc_create("kpageflags", S_IRUSR, NULL, &proc_kpageflags_operations);
-4
include/linux/proc_fs.h
··· 97 97 98 98 #ifdef CONFIG_PROC_FS 99 99 100 - extern struct proc_dir_entry *proc_root_kcore; 101 - 102 100 extern spinlock_t proc_subdir_lock; 103 101 104 102 extern void proc_root_init(void); ··· 135 137 */ 136 138 extern int proc_readdir(struct file *, void *, filldir_t); 137 139 extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *); 138 - 139 - extern const struct file_operations proc_kcore_operations; 140 140 141 141 extern int pid_ns_prepare_proc(struct pid_namespace *ns); 142 142 extern void pid_ns_release_proc(struct pid_namespace *ns);