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 /block | |
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>
Diffstat (limited to 'block')
-rw-r--r-- | block/genhd.c | 15 |
1 files changed, 14 insertions, 1 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 | } |