Blame view
include/linux/vmalloc.h
4.76 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 |
#ifndef _LINUX_VMALLOC_H #define _LINUX_VMALLOC_H #include <linux/spinlock.h> |
db64fe022 mm: rewrite vmap ... |
5 |
#include <linux/init.h> |
1da177e4c Linux-2.6.12-rc2 |
6 |
#include <asm/page.h> /* pgprot_t */ |
605d9288b mm: VM_flags comm... |
7 |
struct vm_area_struct; /* vma defining user mapping in mm_types.h */ |
833423143 [PATCH] mm: intro... |
8 |
|
605d9288b mm: VM_flags comm... |
9 |
/* bits in flags of vmalloc's vm_struct below */ |
1da177e4c Linux-2.6.12-rc2 |
10 11 12 |
#define VM_IOREMAP 0x00000001 /* ioremap() and friends */ #define VM_ALLOC 0x00000002 /* vmalloc() */ #define VM_MAP 0x00000004 /* vmap()ed pages */ |
833423143 [PATCH] mm: intro... |
13 |
#define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */ |
8757d5fa6 [PATCH] mm: fix o... |
14 |
#define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */ |
f5252e009 mm: avoid null po... |
15 |
#define VM_UNLIST 0x00000020 /* vm_struct is not listed in vmlist */ |
1da177e4c Linux-2.6.12-rc2 |
16 |
/* bits [20..32] reserved for arch specific ioremap internals */ |
fd195c49f [PATCH] arm: allo... |
17 18 19 20 21 22 23 |
/* * Maximum alignment for ioremap() regions. * Can be overriden by arch-specific value. */ #ifndef IOREMAP_MAX_ORDER #define IOREMAP_MAX_ORDER (7 + PAGE_SHIFT) /* 128 pages */ #endif |
1da177e4c Linux-2.6.12-rc2 |
24 |
struct vm_struct { |
2b4ac44e7 [PATCH] vmalloc: ... |
25 |
struct vm_struct *next; |
1da177e4c Linux-2.6.12-rc2 |
26 27 28 29 30 |
void *addr; unsigned long size; unsigned long flags; struct page **pages; unsigned int nr_pages; |
ffa71f33a x86, ioremap: Fix... |
31 |
phys_addr_t phys_addr; |
230169693 vmallocinfo: add ... |
32 |
void *caller; |
1da177e4c Linux-2.6.12-rc2 |
33 34 35 36 37 |
}; /* * Highlevel APIs for driver use */ |
db64fe022 mm: rewrite vmap ... |
38 39 40 41 42 43 44 45 46 47 48 49 |
extern void vm_unmap_ram(const void *mem, unsigned int count); extern void *vm_map_ram(struct page **pages, unsigned int count, int node, pgprot_t prot); extern void vm_unmap_aliases(void); #ifdef CONFIG_MMU extern void __init vmalloc_init(void); #else static inline void vmalloc_init(void) { } #endif |
1da177e4c Linux-2.6.12-rc2 |
50 |
extern void *vmalloc(unsigned long size); |
e1ca7788d mm: add vzalloc()... |
51 |
extern void *vzalloc(unsigned long size); |
833423143 [PATCH] mm: intro... |
52 |
extern void *vmalloc_user(unsigned long size); |
930fc45a4 [PATCH] vmalloc_node |
53 |
extern void *vmalloc_node(unsigned long size, int node); |
e1ca7788d mm: add vzalloc()... |
54 |
extern void *vzalloc_node(unsigned long size, int node); |
1da177e4c Linux-2.6.12-rc2 |
55 56 |
extern void *vmalloc_exec(unsigned long size); extern void *vmalloc_32(unsigned long size); |
833423143 [PATCH] mm: intro... |
57 |
extern void *vmalloc_32_user(unsigned long size); |
dd0fc66fb [PATCH] gfp flags... |
58 |
extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot); |
d0a21265d mm: unify module_... |
59 60 61 |
extern void *__vmalloc_node_range(unsigned long size, unsigned long align, unsigned long start, unsigned long end, gfp_t gfp_mask, pgprot_t prot, int node, void *caller); |
b3bdda02a vmalloc: add cons... |
62 |
extern void vfree(const void *addr); |
1da177e4c Linux-2.6.12-rc2 |
63 64 65 |
extern void *vmap(struct page **pages, unsigned int count, unsigned long flags, pgprot_t prot); |
b3bdda02a vmalloc: add cons... |
66 |
extern void vunmap(const void *addr); |
833423143 [PATCH] mm: intro... |
67 68 69 |
extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, unsigned long pgoff); |
1eeb66a1b move die notifier... |
70 |
void vmalloc_sync_all(void); |
1da177e4c Linux-2.6.12-rc2 |
71 72 73 74 |
/* * Lowlevel-APIs (not for driver use!) */ |
9585116ba i386: fix iounmap... |
75 76 77 78 79 80 |
static inline size_t get_vm_area_size(const struct vm_struct *area) { /* return actual size without guard page */ return area->size - PAGE_SIZE; } |
1da177e4c Linux-2.6.12-rc2 |
81 |
extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags); |
230169693 vmallocinfo: add ... |
82 83 |
extern struct vm_struct *get_vm_area_caller(unsigned long size, unsigned long flags, void *caller); |
1da177e4c Linux-2.6.12-rc2 |
84 85 |
extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, unsigned long start, unsigned long end); |
c29686129 vmalloc: add __ge... |
86 87 88 89 |
extern struct vm_struct *__get_vm_area_caller(unsigned long size, unsigned long flags, unsigned long start, unsigned long end, void *caller); |
b3bdda02a vmalloc: add cons... |
90 |
extern struct vm_struct *remove_vm_area(const void *addr); |
c19c03fc7 [POWERPC] unmap_v... |
91 |
|
1da177e4c Linux-2.6.12-rc2 |
92 93 |
extern int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages); |
b554cb426 NOMMU: support SM... |
94 |
#ifdef CONFIG_MMU |
8fc489850 vmalloc: add un/m... |
95 96 97 |
extern int map_kernel_range_noflush(unsigned long start, unsigned long size, pgprot_t prot, struct page **pages); extern void unmap_kernel_range_noflush(unsigned long addr, unsigned long size); |
c19c03fc7 [POWERPC] unmap_v... |
98 |
extern void unmap_kernel_range(unsigned long addr, unsigned long size); |
b554cb426 NOMMU: support SM... |
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
#else static inline int map_kernel_range_noflush(unsigned long start, unsigned long size, pgprot_t prot, struct page **pages) { return size >> PAGE_SHIFT; } static inline void unmap_kernel_range_noflush(unsigned long addr, unsigned long size) { } static inline void unmap_kernel_range(unsigned long addr, unsigned long size) { } #endif |
1da177e4c Linux-2.6.12-rc2 |
115 |
|
5f4352fbf Allocate and free... |
116 |
/* Allocate/destroy a 'vmalloc' VM area. */ |
cd12909cb xen: map foreign ... |
117 |
extern struct vm_struct *alloc_vm_area(size_t size, pte_t **ptes); |
5f4352fbf Allocate and free... |
118 |
extern void free_vm_area(struct vm_struct *area); |
69beeb1d3 mm: make vread() ... |
119 120 121 |
/* for /dev/kmem */ extern long vread(char *buf, char *addr, unsigned long count); extern long vwrite(char *buf, char *addr, unsigned long count); |
1da177e4c Linux-2.6.12-rc2 |
122 123 124 125 126 |
/* * Internals. Dont't use.. */ extern rwlock_t vmlist_lock; extern struct vm_struct *vmlist; |
be9b7335e mm: add vm_area_a... |
127 |
extern __init void vm_area_add_early(struct vm_struct *vm); |
c0c0a2937 vmalloc: add @ali... |
128 |
extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); |
1da177e4c Linux-2.6.12-rc2 |
129 |
|
4f8b02b4e vmalloc: pcpu_get... |
130 |
#ifdef CONFIG_SMP |
b554cb426 NOMMU: support SM... |
131 |
# ifdef CONFIG_MMU |
ca23e405e vmalloc: implemen... |
132 133 |
struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets, const size_t *sizes, int nr_vms, |
ec3f64fc9 mm: remove gfp ma... |
134 |
size_t align); |
ca23e405e vmalloc: implemen... |
135 136 |
void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms); |
b554cb426 NOMMU: support SM... |
137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# else static inline struct vm_struct ** pcpu_get_vm_areas(const unsigned long *offsets, const size_t *sizes, int nr_vms, size_t align) { return NULL; } static inline void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms) { } # endif |
4f8b02b4e vmalloc: pcpu_get... |
151 |
#endif |
ca23e405e vmalloc: implemen... |
152 |
|
1da177e4c Linux-2.6.12-rc2 |
153 |
#endif /* _LINUX_VMALLOC_H */ |