diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-06 04:55:38 -0400 |
---|---|---|
committer | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-23 09:57:37 -0400 |
commit | 31d85ab28e71b0c938e0ef48af45747e80d99b53 (patch) | |
tree | 1cd97bee97abb008dd3591da2a001e3e85356fb6 | |
parent | 5c9fe6281b75832e8d2555ec8700ea763d9a865e (diff) |
proc: move /proc/diskstats boilerplate to block/genhd.c
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r-- | block/genhd.c | 15 | ||||
-rw-r--r-- | fs/proc/proc_misc.c | 16 | ||||
-rw-r--r-- | include/linux/genhd.h | 2 |
3 files changed, 14 insertions, 19 deletions
diff --git a/block/genhd.c b/block/genhd.c index 15f4d2b12c48..4e5e7493f676 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -1005,15 +1005,28 @@ static int diskstats_show(struct seq_file *seqf, void *v) | |||
1005 | return 0; | 1005 | return 0; |
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | const struct seq_operations diskstats_op = { | 1008 | static const struct seq_operations diskstats_op = { |
1009 | .start = disk_seqf_start, | 1009 | .start = disk_seqf_start, |
1010 | .next = disk_seqf_next, | 1010 | .next = disk_seqf_next, |
1011 | .stop = disk_seqf_stop, | 1011 | .stop = disk_seqf_stop, |
1012 | .show = diskstats_show | 1012 | .show = diskstats_show |
1013 | }; | 1013 | }; |
1014 | 1014 | ||
1015 | static int diskstats_open(struct inode *inode, struct file *file) | ||
1016 | { | ||
1017 | return seq_open(file, &diskstats_op); | ||
1018 | } | ||
1019 | |||
1020 | static const struct file_operations proc_diskstats_operations = { | ||
1021 | .open = diskstats_open, | ||
1022 | .read = seq_read, | ||
1023 | .llseek = seq_lseek, | ||
1024 | .release = seq_release, | ||
1025 | }; | ||
1026 | |||
1015 | static int __init proc_genhd_init(void) | 1027 | static int __init proc_genhd_init(void) |
1016 | { | 1028 | { |
1029 | proc_create("diskstats", 0, NULL, &proc_diskstats_operations); | ||
1017 | proc_create("partitions", 0, NULL, &proc_partitions_operations); | 1030 | proc_create("partitions", 0, NULL, &proc_partitions_operations); |
1018 | return 0; | 1031 | return 0; |
1019 | } | 1032 | } |
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 8f3a6f085c5f..7c22831efd94 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -57,19 +57,6 @@ | |||
57 | #include <asm/div64.h> | 57 | #include <asm/div64.h> |
58 | #include "internal.h" | 58 | #include "internal.h" |
59 | 59 | ||
60 | #ifdef CONFIG_BLOCK | ||
61 | static int diskstats_open(struct inode *inode, struct file *file) | ||
62 | { | ||
63 | return seq_open(file, &diskstats_op); | ||
64 | } | ||
65 | static const struct file_operations proc_diskstats_operations = { | ||
66 | .open = diskstats_open, | ||
67 | .read = seq_read, | ||
68 | .llseek = seq_lseek, | ||
69 | .release = seq_release, | ||
70 | }; | ||
71 | #endif | ||
72 | |||
73 | #ifdef CONFIG_MODULES | 60 | #ifdef CONFIG_MODULES |
74 | extern const struct seq_operations modules_op; | 61 | extern const struct seq_operations modules_op; |
75 | static int modules_open(struct inode *inode, struct file *file) | 62 | static int modules_open(struct inode *inode, struct file *file) |
@@ -222,9 +209,6 @@ void __init proc_misc_init(void) | |||
222 | proc_symlink("mounts", NULL, "self/mounts"); | 209 | proc_symlink("mounts", NULL, "self/mounts"); |
223 | 210 | ||
224 | /* And now for trickier ones */ | 211 | /* And now for trickier ones */ |
225 | #ifdef CONFIG_BLOCK | ||
226 | proc_create("diskstats", 0, NULL, &proc_diskstats_operations); | ||
227 | #endif | ||
228 | #ifdef CONFIG_MODULES | 212 | #ifdef CONFIG_MODULES |
229 | proc_create("modules", 0, NULL, &proc_modules_operations); | 213 | proc_create("modules", 0, NULL, &proc_modules_operations); |
230 | #endif | 214 | #endif |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 074a4fdf4365..e439e6aed832 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -25,8 +25,6 @@ extern struct device_type part_type; | |||
25 | extern struct kobject *block_depr; | 25 | extern struct kobject *block_depr; |
26 | extern struct class block_class; | 26 | extern struct class block_class; |
27 | 27 | ||
28 | extern const struct seq_operations diskstats_op; | ||
29 | |||
30 | enum { | 28 | enum { |
31 | /* These three have identical behaviour; use the second one if DOS FDISK gets | 29 | /* These three have identical behaviour; use the second one if DOS FDISK gets |
32 | confused about extended/logical partitions starting past cylinder 1023. */ | 30 | confused about extended/logical partitions starting past cylinder 1023. */ |