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>
This commit is contained in:
Alexey Dobriyan 2008-10-06 04:17:48 +04:00
parent 74e2e8e8ce
commit b6aa44ab69
3 changed files with 13 additions and 14 deletions

View File

@ -69,17 +69,6 @@ static const struct file_operations proc_zoneinfo_file_operations = {
.release = seq_release, .release = seq_release,
}; };
static int vmstat_open(struct inode *inode, struct file *file)
{
return seq_open(file, &vmstat_op);
}
static const struct file_operations proc_vmstat_file_operations = {
.open = vmstat_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
static int diskstats_open(struct inode *inode, struct file *file) static int diskstats_open(struct inode *inode, struct file *file)
{ {
@ -245,7 +234,6 @@ void __init proc_misc_init(void)
proc_symlink("mounts", NULL, "self/mounts"); proc_symlink("mounts", NULL, "self/mounts");
/* And now for trickier ones */ /* And now for trickier ones */
proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations);
proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations);
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
proc_create("diskstats", 0, NULL, &proc_diskstats_operations); proc_create("diskstats", 0, NULL, &proc_diskstats_operations);

View File

@ -55,7 +55,6 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
}; };
extern const struct seq_operations zoneinfo_op; extern const struct seq_operations zoneinfo_op;
extern const struct seq_operations vmstat_op;
extern int sysctl_stat_interval; extern int sysctl_stat_interval;
#ifdef CONFIG_VM_EVENT_COUNTERS #ifdef CONFIG_VM_EVENT_COUNTERS

View File

@ -858,13 +858,24 @@ static void vmstat_stop(struct seq_file *m, void *arg)
m->private = NULL; m->private = NULL;
} }
const struct seq_operations vmstat_op = { static const struct seq_operations vmstat_op = {
.start = vmstat_start, .start = vmstat_start,
.next = vmstat_next, .next = vmstat_next,
.stop = vmstat_stop, .stop = vmstat_stop,
.show = vmstat_show, .show = vmstat_show,
}; };
static int vmstat_open(struct inode *inode, struct file *file)
{
return seq_open(file, &vmstat_op);
}
static const struct file_operations proc_vmstat_file_operations = {
.open = vmstat_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
@ -938,6 +949,7 @@ static int __init setup_vmstat(void)
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations);
proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops);
proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations);
#endif #endif
return 0; return 0;
} }