Commit 5c9fe6281b75832e8d2555ec8700ea763d9a865e

Authored by Alexey Dobriyan
1 parent b6aa44ab69

proc: move /proc/zoneinfo boilerplate to mm/vmstat.c

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Christoph Lameter <cl@linux-foundation.org>

Showing 3 changed files with 14 additions and 15 deletions Side-by-side Diff

... ... @@ -57,18 +57,6 @@
57 57 #include <asm/div64.h>
58 58 #include "internal.h"
59 59  
60   -static int zoneinfo_open(struct inode *inode, struct file *file)
61   -{
62   - return seq_open(file, &zoneinfo_op);
63   -}
64   -
65   -static const struct file_operations proc_zoneinfo_file_operations = {
66   - .open = zoneinfo_open,
67   - .read = seq_read,
68   - .llseek = seq_lseek,
69   - .release = seq_release,
70   -};
71   -
72 60 #ifdef CONFIG_BLOCK
73 61 static int diskstats_open(struct inode *inode, struct file *file)
74 62 {
... ... @@ -234,7 +222,6 @@
234 222 proc_symlink("mounts", NULL, "self/mounts");
235 223  
236 224 /* And now for trickier ones */
237   - proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations);
238 225 #ifdef CONFIG_BLOCK
239 226 proc_create("diskstats", 0, NULL, &proc_diskstats_operations);
240 227 #endif
include/linux/vmstat.h
... ... @@ -54,7 +54,6 @@
54 54 NR_VM_EVENT_ITEMS
55 55 };
56 56  
57   -extern const struct seq_operations zoneinfo_op;
58 57 extern int sysctl_stat_interval;
59 58  
60 59 #ifdef CONFIG_VM_EVENT_COUNTERS
... ... @@ -795,7 +795,7 @@
795 795 return 0;
796 796 }
797 797  
798   -const struct seq_operations zoneinfo_op = {
  798 +static const struct seq_operations zoneinfo_op = {
799 799 .start = frag_start, /* iterate over all zones. The same as in
800 800 * fragmentation. */
801 801 .next = frag_next,
... ... @@ -803,6 +803,18 @@
803 803 .show = zoneinfo_show,
804 804 };
805 805  
  806 +static int zoneinfo_open(struct inode *inode, struct file *file)
  807 +{
  808 + return seq_open(file, &zoneinfo_op);
  809 +}
  810 +
  811 +static const struct file_operations proc_zoneinfo_file_operations = {
  812 + .open = zoneinfo_open,
  813 + .read = seq_read,
  814 + .llseek = seq_lseek,
  815 + .release = seq_release,
  816 +};
  817 +
806 818 static void *vmstat_start(struct seq_file *m, loff_t *pos)
807 819 {
808 820 unsigned long *v;
... ... @@ -950,6 +962,7 @@
950 962 proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations);
951 963 proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops);
952 964 proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations);
  965 + proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations);
953 966 #endif
954 967 return 0;
955 968 }