diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-05 20:13:52 -0400 |
---|---|---|
committer | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-23 08:12:04 -0400 |
commit | 8f32f7e5ac2ed11b0659b6b55af926f3d58ffd9d (patch) | |
tree | fa577deb5c664169ba3f7715006657fb7834ac32 /mm | |
parent | 5f6a6a9c4e4d790aae55cb412a7643329057c5e0 (diff) |
proc: move /proc/buddyinfo boilerplate to mm/vmstat.c
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/vmstat.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/mm/vmstat.c b/mm/vmstat.c index 9343227c5c60..f45d7245a282 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * Copyright (C) 2006 Silicon Graphics, Inc., | 8 | * Copyright (C) 2006 Silicon Graphics, Inc., |
9 | * Christoph Lameter <christoph@lameter.com> | 9 | * Christoph Lameter <christoph@lameter.com> |
10 | */ | 10 | */ |
11 | 11 | #include <linux/fs.h> | |
12 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
13 | #include <linux/err.h> | 13 | #include <linux/err.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
@@ -384,7 +384,7 @@ void zone_statistics(struct zone *preferred_zone, struct zone *z) | |||
384 | #endif | 384 | #endif |
385 | 385 | ||
386 | #ifdef CONFIG_PROC_FS | 386 | #ifdef CONFIG_PROC_FS |
387 | 387 | #include <linux/proc_fs.h> | |
388 | #include <linux/seq_file.h> | 388 | #include <linux/seq_file.h> |
389 | 389 | ||
390 | static char * const migratetype_names[MIGRATE_TYPES] = { | 390 | static char * const migratetype_names[MIGRATE_TYPES] = { |
@@ -581,13 +581,25 @@ static int pagetypeinfo_show(struct seq_file *m, void *arg) | |||
581 | return 0; | 581 | return 0; |
582 | } | 582 | } |
583 | 583 | ||
584 | const struct seq_operations fragmentation_op = { | 584 | static const struct seq_operations fragmentation_op = { |
585 | .start = frag_start, | 585 | .start = frag_start, |
586 | .next = frag_next, | 586 | .next = frag_next, |
587 | .stop = frag_stop, | 587 | .stop = frag_stop, |
588 | .show = frag_show, | 588 | .show = frag_show, |
589 | }; | 589 | }; |
590 | 590 | ||
591 | static int fragmentation_open(struct inode *inode, struct file *file) | ||
592 | { | ||
593 | return seq_open(file, &fragmentation_op); | ||
594 | } | ||
595 | |||
596 | static const struct file_operations fragmentation_file_operations = { | ||
597 | .open = fragmentation_open, | ||
598 | .read = seq_read, | ||
599 | .llseek = seq_lseek, | ||
600 | .release = seq_release, | ||
601 | }; | ||
602 | |||
591 | const struct seq_operations pagetypeinfo_op = { | 603 | const struct seq_operations pagetypeinfo_op = { |
592 | .start = frag_start, | 604 | .start = frag_start, |
593 | .next = frag_next, | 605 | .next = frag_next, |
@@ -898,9 +910,11 @@ static int __cpuinit vmstat_cpuup_callback(struct notifier_block *nfb, | |||
898 | 910 | ||
899 | static struct notifier_block __cpuinitdata vmstat_notifier = | 911 | static struct notifier_block __cpuinitdata vmstat_notifier = |
900 | { &vmstat_cpuup_callback, NULL, 0 }; | 912 | { &vmstat_cpuup_callback, NULL, 0 }; |
913 | #endif | ||
901 | 914 | ||
902 | static int __init setup_vmstat(void) | 915 | static int __init setup_vmstat(void) |
903 | { | 916 | { |
917 | #ifdef CONFIG_SMP | ||
904 | int cpu; | 918 | int cpu; |
905 | 919 | ||
906 | refresh_zone_stat_thresholds(); | 920 | refresh_zone_stat_thresholds(); |
@@ -908,7 +922,10 @@ static int __init setup_vmstat(void) | |||
908 | 922 | ||
909 | for_each_online_cpu(cpu) | 923 | for_each_online_cpu(cpu) |
910 | start_cpu_timer(cpu); | 924 | start_cpu_timer(cpu); |
925 | #endif | ||
926 | #ifdef CONFIG_PROC_FS | ||
927 | proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); | ||
928 | #endif | ||
911 | return 0; | 929 | return 0; |
912 | } | 930 | } |
913 | module_init(setup_vmstat) | 931 | module_init(setup_vmstat) |
914 | #endif | ||