diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-05 19:50:47 -0400 |
---|---|---|
committer | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-23 07:48:28 -0400 |
commit | 5f6a6a9c4e4d790aae55cb412a7643329057c5e0 (patch) | |
tree | 06b984b29e2e100874a4627ba6e22eb3e96a2640 | |
parent | 7b3c3a50a3e0ea46815150d420fa276ac254572b (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>
-rw-r--r-- | fs/proc/proc_misc.c | 28 | ||||
-rw-r--r-- | include/linux/vmalloc.h | 2 | ||||
-rw-r--r-- | mm/vmalloc.c | 33 |
3 files changed, 32 insertions, 31 deletions
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 1d6d5c5cc2a8..fd41a032456b 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -132,31 +132,6 @@ static const struct file_operations proc_modules_operations = { | |||
132 | }; | 132 | }; |
133 | #endif | 133 | #endif |
134 | 134 | ||
135 | #ifdef CONFIG_MMU | ||
136 | static int vmalloc_open(struct inode *inode, struct file *file) | ||
137 | { | ||
138 | unsigned int *ptr = NULL; | ||
139 | int ret; | ||
140 | |||
141 | if (NUMA_BUILD) | ||
142 | ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL); | ||
143 | ret = seq_open(file, &vmalloc_op); | ||
144 | if (!ret) { | ||
145 | struct seq_file *m = file->private_data; | ||
146 | m->private = ptr; | ||
147 | } else | ||
148 | kfree(ptr); | ||
149 | return ret; | ||
150 | } | ||
151 | |||
152 | static const struct file_operations proc_vmalloc_operations = { | ||
153 | .open = vmalloc_open, | ||
154 | .read = seq_read, | ||
155 | .llseek = seq_lseek, | ||
156 | .release = seq_release_private, | ||
157 | }; | ||
158 | #endif | ||
159 | |||
160 | #ifdef CONFIG_PROC_PAGE_MONITOR | 135 | #ifdef CONFIG_PROC_PAGE_MONITOR |
161 | #define KPMSIZE sizeof(u64) | 136 | #define KPMSIZE sizeof(u64) |
162 | #define KPMMASK (KPMSIZE - 1) | 137 | #define KPMMASK (KPMSIZE - 1) |
@@ -295,9 +270,6 @@ void __init proc_misc_init(void) | |||
295 | proc_symlink("mounts", NULL, "self/mounts"); | 270 | proc_symlink("mounts", NULL, "self/mounts"); |
296 | 271 | ||
297 | /* And now for trickier ones */ | 272 | /* And now for trickier ones */ |
298 | #ifdef CONFIG_MMU | ||
299 | proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations); | ||
300 | #endif | ||
301 | proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); | 273 | proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); |
302 | proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); | 274 | proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); |
303 | proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations); | 275 | proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations); |
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 4c28c4d564e2..307b88577eaa 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h | |||
@@ -103,6 +103,4 @@ extern void free_vm_area(struct vm_struct *area); | |||
103 | extern rwlock_t vmlist_lock; | 103 | extern rwlock_t vmlist_lock; |
104 | extern struct vm_struct *vmlist; | 104 | extern struct vm_struct *vmlist; |
105 | 105 | ||
106 | extern const struct seq_operations vmalloc_op; | ||
107 | |||
108 | #endif /* _LINUX_VMALLOC_H */ | 106 | #endif /* _LINUX_VMALLOC_H */ |
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 | ||
1721 | const struct seq_operations vmalloc_op = { | 1722 | static 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 | |||
1729 | static 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 | |||
1745 | static 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 | |||
1752 | static int __init proc_vmalloc_init(void) | ||
1753 | { | ||
1754 | proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations); | ||
1755 | return 0; | ||
1756 | } | ||
1757 | module_init(proc_vmalloc_init); | ||
1727 | #endif | 1758 | #endif |
1728 | 1759 | ||