aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2008-10-05 19:50:47 -0400
committerAlexey Dobriyan <adobriyan@gmail.com>2008-10-23 07:48:28 -0400
commit5f6a6a9c4e4d790aae55cb412a7643329057c5e0 (patch)
tree06b984b29e2e100874a4627ba6e22eb3e96a2640 /mm
parent7b3c3a50a3e0ea46815150d420fa276ac254572b (diff)
proc: move /proc/vmallocinfo to mm/vmalloc.c
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Acked-by: Christoph Lameter <cl@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/vmalloc.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 65ae576030da..036536945dd9 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -15,6 +15,7 @@
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/proc_fs.h>
18#include <linux/seq_file.h> 19#include <linux/seq_file.h>
19#include <linux/debugobjects.h> 20#include <linux/debugobjects.h>
20#include <linux/kallsyms.h> 21#include <linux/kallsyms.h>
@@ -1718,11 +1719,41 @@ static int s_show(struct seq_file *m, void *p)
1718 return 0; 1719 return 0;
1719} 1720}
1720 1721
1721const struct seq_operations vmalloc_op = { 1722static const struct seq_operations vmalloc_op = {
1722 .start = s_start, 1723 .start = s_start,
1723 .next = s_next, 1724 .next = s_next,
1724 .stop = s_stop, 1725 .stop = s_stop,
1725 .show = s_show, 1726 .show = s_show,
1726}; 1727};
1728
1729static int vmalloc_open(struct inode *inode, struct file *file)
1730{
1731 unsigned int *ptr = NULL;
1732 int ret;
1733
1734 if (NUMA_BUILD)
1735 ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL);
1736 ret = seq_open(file, &vmalloc_op);
1737 if (!ret) {
1738 struct seq_file *m = file->private_data;
1739 m->private = ptr;
1740 } else
1741 kfree(ptr);
1742 return ret;
1743}
1744
1745static const struct file_operations proc_vmalloc_operations = {
1746 .open = vmalloc_open,
1747 .read = seq_read,
1748 .llseek = seq_lseek,
1749 .release = seq_release_private,
1750};
1751
1752static int __init proc_vmalloc_init(void)
1753{
1754 proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations);
1755 return 0;
1756}
1757module_init(proc_vmalloc_init);
1727#endif 1758#endif
1728 1759