ia64/xen-unstable

view linux-2.6-xen-sparse/drivers/xen/util.c @ 14100:e47738923a05

[LINUX] Purge include <linux/config.h>. It has been obsolete for some time now.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
author Ian Campbell <ian.campbell@xensource.com>
date Fri Feb 23 16:56:45 2007 +0000 (2007-02-23)
parents c5ff7671b9f2
children 5e65a86c8982
line source
1 #include <linux/mm.h>
2 #include <linux/module.h>
3 #include <linux/slab.h>
4 #include <linux/vmalloc.h>
5 #include <asm/uaccess.h>
6 #include <xen/driver_util.h>
8 static int f(pte_t *pte, struct page *pmd_page, unsigned long addr, void *data)
9 {
10 /* apply_to_page_range() does all the hard work. */
11 return 0;
12 }
14 struct vm_struct *alloc_vm_area(unsigned long size)
15 {
16 struct vm_struct *area;
18 area = get_vm_area(size, VM_IOREMAP);
19 if (area == NULL)
20 return NULL;
22 /*
23 * This ensures that page tables are constructed for this region
24 * of kernel virtual address space and mapped into init_mm.
25 */
26 if (apply_to_page_range(&init_mm, (unsigned long)area->addr,
27 area->size, f, NULL)) {
28 free_vm_area(area);
29 return NULL;
30 }
32 /* Map page directories into every address space. */
33 #ifdef CONFIG_X86
34 vmalloc_sync_all();
35 #endif
37 return area;
38 }
39 EXPORT_SYMBOL_GPL(alloc_vm_area);
41 void free_vm_area(struct vm_struct *area)
42 {
43 struct vm_struct *ret;
44 ret = remove_vm_area(area->addr);
45 BUG_ON(ret != area);
46 kfree(area);
47 }
48 EXPORT_SYMBOL_GPL(free_vm_area);