diff options
| author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-05 20:15:36 -0400 |
|---|---|---|
| committer | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-23 08:33:29 -0400 |
| commit | 74e2e8e8ce7b3c0f878a349f9fa6cf2831548eef (patch) | |
| tree | 1de0e09b982c8c152f93b74842587e4c56df5484 | |
| parent | 8f32f7e5ac2ed11b0659b6b55af926f3d58ffd9d (diff) | |
proc: move /proc/pagetypeinfo boilerplate to mm/vmstat.c
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
| -rw-r--r-- | fs/proc/proc_misc.c | 13 | ||||
| -rw-r--r-- | include/linux/vmstat.h | 1 | ||||
| -rw-r--r-- | mm/vmstat.c | 15 |
3 files changed, 14 insertions, 15 deletions
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index a35e50659b8d..900331a634ef 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
| @@ -57,18 +57,6 @@ | |||
| 57 | #include <asm/div64.h> | 57 | #include <asm/div64.h> |
| 58 | #include "internal.h" | 58 | #include "internal.h" |
| 59 | 59 | ||
| 60 | static int pagetypeinfo_open(struct inode *inode, struct file *file) | ||
| 61 | { | ||
| 62 | return seq_open(file, &pagetypeinfo_op); | ||
| 63 | } | ||
| 64 | |||
| 65 | static const struct file_operations pagetypeinfo_file_ops = { | ||
| 66 | .open = pagetypeinfo_open, | ||
| 67 | .read = seq_read, | ||
| 68 | .llseek = seq_lseek, | ||
| 69 | .release = seq_release, | ||
| 70 | }; | ||
| 71 | |||
| 72 | static int zoneinfo_open(struct inode *inode, struct file *file) | 60 | static int zoneinfo_open(struct inode *inode, struct file *file) |
| 73 | { | 61 | { |
| 74 | return seq_open(file, &zoneinfo_op); | 62 | return seq_open(file, &zoneinfo_op); |
| @@ -257,7 +245,6 @@ void __init proc_misc_init(void) | |||
| 257 | proc_symlink("mounts", NULL, "self/mounts"); | 245 | proc_symlink("mounts", NULL, "self/mounts"); |
| 258 | 246 | ||
| 259 | /* And now for trickier ones */ | 247 | /* And now for trickier ones */ |
| 260 | proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); | ||
| 261 | proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations); | 248 | proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations); |
| 262 | proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); | 249 | proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); |
| 263 | #ifdef CONFIG_BLOCK | 250 | #ifdef CONFIG_BLOCK |
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index d4551f206409..33ffd89a88ac 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
| @@ -54,7 +54,6 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, | |||
| 54 | NR_VM_EVENT_ITEMS | 54 | NR_VM_EVENT_ITEMS |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | extern const struct seq_operations pagetypeinfo_op; | ||
| 58 | extern const struct seq_operations zoneinfo_op; | 57 | extern const struct seq_operations zoneinfo_op; |
| 59 | extern const struct seq_operations vmstat_op; | 58 | extern const struct seq_operations vmstat_op; |
| 60 | extern int sysctl_stat_interval; | 59 | extern int sysctl_stat_interval; |
diff --git a/mm/vmstat.c b/mm/vmstat.c index f45d7245a282..d624d251946d 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
| @@ -600,13 +600,25 @@ static const struct file_operations fragmentation_file_operations = { | |||
| 600 | .release = seq_release, | 600 | .release = seq_release, |
| 601 | }; | 601 | }; |
| 602 | 602 | ||
| 603 | const struct seq_operations pagetypeinfo_op = { | 603 | static const struct seq_operations pagetypeinfo_op = { |
| 604 | .start = frag_start, | 604 | .start = frag_start, |
| 605 | .next = frag_next, | 605 | .next = frag_next, |
| 606 | .stop = frag_stop, | 606 | .stop = frag_stop, |
| 607 | .show = pagetypeinfo_show, | 607 | .show = pagetypeinfo_show, |
| 608 | }; | 608 | }; |
| 609 | 609 | ||
| 610 | static int pagetypeinfo_open(struct inode *inode, struct file *file) | ||
| 611 | { | ||
| 612 | return seq_open(file, &pagetypeinfo_op); | ||
| 613 | } | ||
| 614 | |||
| 615 | static const struct file_operations pagetypeinfo_file_ops = { | ||
| 616 | .open = pagetypeinfo_open, | ||
| 617 | .read = seq_read, | ||
| 618 | .llseek = seq_lseek, | ||
| 619 | .release = seq_release, | ||
| 620 | }; | ||
| 621 | |||
| 610 | #ifdef CONFIG_ZONE_DMA | 622 | #ifdef CONFIG_ZONE_DMA |
| 611 | #define TEXT_FOR_DMA(xx) xx "_dma", | 623 | #define TEXT_FOR_DMA(xx) xx "_dma", |
| 612 | #else | 624 | #else |
| @@ -925,6 +937,7 @@ static int __init setup_vmstat(void) | |||
| 925 | #endif | 937 | #endif |
| 926 | #ifdef CONFIG_PROC_FS | 938 | #ifdef CONFIG_PROC_FS |
| 927 | proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); | 939 | proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); |
| 940 | proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); | ||
| 928 | #endif | 941 | #endif |
| 929 | return 0; | 942 | return 0; |
| 930 | } | 943 | } |
