diff options
| author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-05 20:17:48 -0400 |
|---|---|---|
| committer | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-23 09:12:51 -0400 |
| commit | b6aa44ab698c7df9d951d3eb45c4fcb8ba68fb25 (patch) | |
| tree | 3ddf82053cc10e4811e77918fb00aad1c09c94c1 | |
| parent | 74e2e8e8ce7b3c0f878a349f9fa6cf2831548eef (diff) | |
proc: move /proc/vmstat boilerplate to mm/vmstat.c
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Christoph Lameter <cl@linux-foundation.org>
| -rw-r--r-- | fs/proc/proc_misc.c | 12 | ||||
| -rw-r--r-- | include/linux/vmstat.h | 1 | ||||
| -rw-r--r-- | mm/vmstat.c | 14 |
3 files changed, 13 insertions, 14 deletions
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 900331a634e..e7a301d5d43 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
| @@ -69,17 +69,6 @@ static const struct file_operations proc_zoneinfo_file_operations = { | |||
| 69 | .release = seq_release, | 69 | .release = seq_release, |
| 70 | }; | 70 | }; |
| 71 | 71 | ||
| 72 | static int vmstat_open(struct inode *inode, struct file *file) | ||
| 73 | { | ||
| 74 | return seq_open(file, &vmstat_op); | ||
| 75 | } | ||
| 76 | static const struct file_operations proc_vmstat_file_operations = { | ||
| 77 | .open = vmstat_open, | ||
| 78 | .read = seq_read, | ||
| 79 | .llseek = seq_lseek, | ||
| 80 | .release = seq_release, | ||
| 81 | }; | ||
| 82 | |||
| 83 | #ifdef CONFIG_BLOCK | 72 | #ifdef CONFIG_BLOCK |
| 84 | static int diskstats_open(struct inode *inode, struct file *file) | 73 | static int diskstats_open(struct inode *inode, struct file *file) |
| 85 | { | 74 | { |
| @@ -245,7 +234,6 @@ void __init proc_misc_init(void) | |||
| 245 | proc_symlink("mounts", NULL, "self/mounts"); | 234 | proc_symlink("mounts", NULL, "self/mounts"); |
| 246 | 235 | ||
| 247 | /* And now for trickier ones */ | 236 | /* And now for trickier ones */ |
| 248 | proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations); | ||
| 249 | proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); | 237 | proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); |
| 250 | #ifdef CONFIG_BLOCK | 238 | #ifdef CONFIG_BLOCK |
| 251 | proc_create("diskstats", 0, NULL, &proc_diskstats_operations); | 239 | proc_create("diskstats", 0, NULL, &proc_diskstats_operations); |
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 33ffd89a88a..7b68c4c1e19 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
| @@ -55,7 +55,6 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, | |||
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | extern const struct seq_operations zoneinfo_op; | 57 | extern const struct seq_operations zoneinfo_op; |
| 58 | extern const struct seq_operations vmstat_op; | ||
| 59 | extern int sysctl_stat_interval; | 58 | extern int sysctl_stat_interval; |
| 60 | 59 | ||
| 61 | #ifdef CONFIG_VM_EVENT_COUNTERS | 60 | #ifdef CONFIG_VM_EVENT_COUNTERS |
diff --git a/mm/vmstat.c b/mm/vmstat.c index d624d251946..7e1854b8186 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
| @@ -858,13 +858,24 @@ static void vmstat_stop(struct seq_file *m, void *arg) | |||
| 858 | m->private = NULL; | 858 | m->private = NULL; |
| 859 | } | 859 | } |
| 860 | 860 | ||
| 861 | const struct seq_operations vmstat_op = { | 861 | static const struct seq_operations vmstat_op = { |
| 862 | .start = vmstat_start, | 862 | .start = vmstat_start, |
| 863 | .next = vmstat_next, | 863 | .next = vmstat_next, |
| 864 | .stop = vmstat_stop, | 864 | .stop = vmstat_stop, |
| 865 | .show = vmstat_show, | 865 | .show = vmstat_show, |
| 866 | }; | 866 | }; |
| 867 | 867 | ||
| 868 | static int vmstat_open(struct inode *inode, struct file *file) | ||
| 869 | { | ||
| 870 | return seq_open(file, &vmstat_op); | ||
| 871 | } | ||
| 872 | |||
| 873 | static const struct file_operations proc_vmstat_file_operations = { | ||
| 874 | .open = vmstat_open, | ||
| 875 | .read = seq_read, | ||
| 876 | .llseek = seq_lseek, | ||
| 877 | .release = seq_release, | ||
| 878 | }; | ||
| 868 | #endif /* CONFIG_PROC_FS */ | 879 | #endif /* CONFIG_PROC_FS */ |
| 869 | 880 | ||
| 870 | #ifdef CONFIG_SMP | 881 | #ifdef CONFIG_SMP |
| @@ -938,6 +949,7 @@ static int __init setup_vmstat(void) | |||
| 938 | #ifdef CONFIG_PROC_FS | 949 | #ifdef CONFIG_PROC_FS |
| 939 | proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); | 950 | proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); |
| 940 | proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); | 951 | proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); |
| 952 | proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations); | ||
| 941 | #endif | 953 | #endif |
| 942 | return 0; | 954 | return 0; |
| 943 | } | 955 | } |
