]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/proc/proc_misc.c
vmalloc: show vmalloced areas via /proc/vmallocinfo
[linux-2.6-omap-h63xx.git] / fs / proc / proc_misc.c
index 2686592dbcb2b01b29108da7587361afce9fa6c3..441a32f0e5f2f4460c243ad17ea29249bbd38728 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/interrupt.h>
 #include <linux/swap.h>
 #include <linux/slab.h>
+#include <linux/genhd.h>
 #include <linux/smp.h>
 #include <linux/signal.h>
 #include <linux/module.h>
@@ -222,7 +223,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
 #undef K
 }
 
-extern struct seq_operations fragmentation_op;
+extern const struct seq_operations fragmentation_op;
 static int fragmentation_open(struct inode *inode, struct file *file)
 {
        (void)inode;
@@ -236,7 +237,7 @@ static const struct file_operations fragmentation_file_operations = {
        .release        = seq_release,
 };
 
-extern struct seq_operations pagetypeinfo_op;
+extern const struct seq_operations pagetypeinfo_op;
 static int pagetypeinfo_open(struct inode *inode, struct file *file)
 {
        return seq_open(file, &pagetypeinfo_op);
@@ -249,7 +250,7 @@ static const struct file_operations pagetypeinfo_file_ops = {
        .release        = seq_release,
 };
 
-extern struct seq_operations zoneinfo_op;
+extern const struct seq_operations zoneinfo_op;
 static int zoneinfo_open(struct inode *inode, struct file *file)
 {
        return seq_open(file, &zoneinfo_op);
@@ -274,7 +275,7 @@ static int version_read_proc(char *page, char **start, off_t off,
        return proc_calc_metrics(page, start, off, count, eof, len);
 }
 
-extern struct seq_operations cpuinfo_op;
+extern const struct seq_operations cpuinfo_op;
 static int cpuinfo_open(struct inode *inode, struct file *file)
 {
        return seq_open(file, &cpuinfo_op);
@@ -327,7 +328,7 @@ static void devinfo_stop(struct seq_file *f, void *v)
        /* Nothing to do */
 }
 
-static struct seq_operations devinfo_ops = {
+static const struct seq_operations devinfo_ops = {
        .start = devinfo_start,
        .next  = devinfo_next,
        .stop  = devinfo_stop,
@@ -346,7 +347,7 @@ static const struct file_operations proc_devinfo_operations = {
        .release        = seq_release,
 };
 
-extern struct seq_operations vmstat_op;
+extern const struct seq_operations vmstat_op;
 static int vmstat_open(struct inode *inode, struct file *file)
 {
        return seq_open(file, &vmstat_op);
@@ -377,7 +378,6 @@ static int stram_read_proc(char *page, char **start, off_t off,
 #endif
 
 #ifdef CONFIG_BLOCK
-extern struct seq_operations partitions_op;
 static int partitions_open(struct inode *inode, struct file *file)
 {
        return seq_open(file, &partitions_op);
@@ -389,7 +389,6 @@ static const struct file_operations proc_partitions_operations = {
        .release        = seq_release,
 };
 
-extern struct seq_operations diskstats_op;
 static int diskstats_open(struct inode *inode, struct file *file)
 {
        return seq_open(file, &diskstats_op);
@@ -403,7 +402,7 @@ static const struct file_operations proc_diskstats_operations = {
 #endif
 
 #ifdef CONFIG_MODULES
-extern struct seq_operations modules_op;
+extern const struct seq_operations modules_op;
 static int modules_open(struct inode *inode, struct file *file)
 {
        return seq_open(file, &modules_op);
@@ -430,7 +429,7 @@ static const struct file_operations proc_slabinfo_operations = {
 };
 
 #ifdef CONFIG_DEBUG_SLAB_LEAK
-extern struct seq_operations slabstats_op;
+extern const struct seq_operations slabstats_op;
 static int slabstats_open(struct inode *inode, struct file *file)
 {
        unsigned long *n = kzalloc(PAGE_SIZE, GFP_KERNEL);
@@ -457,6 +456,20 @@ static const struct file_operations proc_slabstats_operations = {
 #endif
 #endif
 
+#ifdef CONFIG_MMU
+static int vmalloc_open(struct inode *inode, struct file *file)
+{
+       return seq_open(file, &vmalloc_op);
+}
+
+static const struct file_operations proc_vmalloc_operations = {
+       .open           = vmalloc_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = seq_release,
+};
+#endif
+
 static int show_stat(struct seq_file *p, void *v)
 {
        int i;
@@ -604,7 +617,7 @@ static void int_seq_stop(struct seq_file *f, void *v)
 }
 
 
-static struct seq_operations int_seq_ops = {
+static const struct seq_operations int_seq_ops = {
        .start = int_seq_start,
        .next  = int_seq_next,
        .stop  = int_seq_stop,
@@ -869,6 +882,9 @@ void __init proc_misc_init(void)
 #ifdef CONFIG_DEBUG_SLAB_LEAK
        create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations);
 #endif
+#endif
+#ifdef CONFIG_MMU
+       proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations);
 #endif
        create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations);
        create_seq_entry("pagetypeinfo", S_IRUGO, &pagetypeinfo_file_ops);