Commit 8591cf43224980a0bc9216a4e50b0a740f8cba35
1 parent
fe2510426a
Exists in
master
and in
7 other branches
proc: move /proc/cpuinfo code to fs/proc/cpuinfo.c
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Showing 3 changed files with 25 additions and 14 deletions Side-by-side Diff
fs/proc/Makefile
fs/proc/cpuinfo.c
1 | +#include <linux/fs.h> | |
2 | +#include <linux/init.h> | |
3 | +#include <linux/proc_fs.h> | |
4 | +#include <linux/seq_file.h> | |
5 | + | |
6 | +extern const struct seq_operations cpuinfo_op; | |
7 | +static int cpuinfo_open(struct inode *inode, struct file *file) | |
8 | +{ | |
9 | + return seq_open(file, &cpuinfo_op); | |
10 | +} | |
11 | + | |
12 | +static const struct file_operations proc_cpuinfo_operations = { | |
13 | + .open = cpuinfo_open, | |
14 | + .read = seq_read, | |
15 | + .llseek = seq_lseek, | |
16 | + .release = seq_release, | |
17 | +}; | |
18 | + | |
19 | +static int __init proc_cpuinfo_init(void) | |
20 | +{ | |
21 | + proc_create("cpuinfo", 0, NULL, &proc_cpuinfo_operations); | |
22 | + return 0; | |
23 | +} | |
24 | +module_init(proc_cpuinfo_init); |
fs/proc/proc_misc.c
... | ... | @@ -94,19 +94,6 @@ |
94 | 94 | .release = seq_release, |
95 | 95 | }; |
96 | 96 | |
97 | -extern const struct seq_operations cpuinfo_op; | |
98 | -static int cpuinfo_open(struct inode *inode, struct file *file) | |
99 | -{ | |
100 | - return seq_open(file, &cpuinfo_op); | |
101 | -} | |
102 | - | |
103 | -static const struct file_operations proc_cpuinfo_operations = { | |
104 | - .open = cpuinfo_open, | |
105 | - .read = seq_read, | |
106 | - .llseek = seq_lseek, | |
107 | - .release = seq_release, | |
108 | -}; | |
109 | - | |
110 | 97 | static int vmstat_open(struct inode *inode, struct file *file) |
111 | 98 | { |
112 | 99 | return seq_open(file, &vmstat_op); |
... | ... | @@ -532,7 +519,6 @@ |
532 | 519 | proc_symlink("mounts", NULL, "self/mounts"); |
533 | 520 | |
534 | 521 | /* And now for trickier ones */ |
535 | - proc_create("cpuinfo", 0, NULL, &proc_cpuinfo_operations); | |
536 | 522 | #ifdef CONFIG_BLOCK |
537 | 523 | proc_create("partitions", 0, NULL, &proc_partitions_operations); |
538 | 524 | #endif |