Skip to content

Commit

Permalink
proc: move /proc/zoneinfo boilerplate to mm/vmstat.c
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Christoph Lameter <cl@linux-foundation.org>
  • Loading branch information
Alexey Dobriyan committed Oct 23, 2008
1 parent b6aa44a commit 5c9fe62
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
13 changes: 0 additions & 13 deletions fs/proc/proc_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,6 @@
#include <asm/div64.h>
#include "internal.h"

static int zoneinfo_open(struct inode *inode, struct file *file)
{
return seq_open(file, &zoneinfo_op);
}

static const struct file_operations proc_zoneinfo_file_operations = {
.open = zoneinfo_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};

#ifdef CONFIG_BLOCK
static int diskstats_open(struct inode *inode, struct file *file)
{
Expand Down Expand Up @@ -234,7 +222,6 @@ void __init proc_misc_init(void)
proc_symlink("mounts", NULL, "self/mounts");

/* And now for trickier ones */
proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations);
#ifdef CONFIG_BLOCK
proc_create("diskstats", 0, NULL, &proc_diskstats_operations);
#endif
Expand Down
1 change: 0 additions & 1 deletion include/linux/vmstat.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
NR_VM_EVENT_ITEMS
};

extern const struct seq_operations zoneinfo_op;
extern int sysctl_stat_interval;

#ifdef CONFIG_VM_EVENT_COUNTERS
Expand Down
15 changes: 14 additions & 1 deletion mm/vmstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,14 +795,26 @@ static int zoneinfo_show(struct seq_file *m, void *arg)
return 0;
}

const struct seq_operations zoneinfo_op = {
static const struct seq_operations zoneinfo_op = {
.start = frag_start, /* iterate over all zones. The same as in
* fragmentation. */
.next = frag_next,
.stop = frag_stop,
.show = zoneinfo_show,
};

static int zoneinfo_open(struct inode *inode, struct file *file)
{
return seq_open(file, &zoneinfo_op);
}

static const struct file_operations proc_zoneinfo_file_operations = {
.open = zoneinfo_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};

static void *vmstat_start(struct seq_file *m, loff_t *pos)
{
unsigned long *v;
Expand Down Expand Up @@ -950,6 +962,7 @@ static int __init setup_vmstat(void)
proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations);
proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops);
proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations);
proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations);
#endif
return 0;
}
Expand Down

0 comments on commit 5c9fe62

Please sign in to comment.