Blame view

include/linux/vmalloc.h 2.69 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
  #ifndef _LINUX_VMALLOC_H
  #define _LINUX_VMALLOC_H
  
  #include <linux/spinlock.h>
  #include <asm/page.h>		/* pgprot_t */
833423143   Nick Piggin   [PATCH] mm: intro...
6
  struct vm_area_struct;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
7
8
9
10
  /* bits in vm_struct->flags */
  #define VM_IOREMAP	0x00000001	/* ioremap() and friends */
  #define VM_ALLOC	0x00000002	/* vmalloc() */
  #define VM_MAP		0x00000004	/* vmap()ed pages */
833423143   Nick Piggin   [PATCH] mm: intro...
11
  #define VM_USERMAP	0x00000008	/* suitable for remap_vmalloc_range */
8757d5fa6   Jan Kiszka   [PATCH] mm: fix o...
12
  #define VM_VPAGES	0x00000010	/* buffer for pages was vmalloc'ed */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13
  /* bits [20..32] reserved for arch specific ioremap internals */
fd195c49f   Deepak Saxena   [PATCH] arm: allo...
14
15
16
17
18
19
20
  /*
   * 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   Linus Torvalds   Linux-2.6.12-rc2
21
  struct vm_struct {
2b4ac44e7   Eric Dumazet   [PATCH] vmalloc: ...
22
23
  	/* keep next,addr,size together to speedup lookups */
  	struct vm_struct	*next;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
24
25
26
27
28
29
  	void			*addr;
  	unsigned long		size;
  	unsigned long		flags;
  	struct page		**pages;
  	unsigned int		nr_pages;
  	unsigned long		phys_addr;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
30
31
32
33
34
35
  };
  
  /*
   *	Highlevel APIs for driver use
   */
  extern void *vmalloc(unsigned long size);
833423143   Nick Piggin   [PATCH] mm: intro...
36
  extern void *vmalloc_user(unsigned long size);
930fc45a4   Christoph Lameter   [PATCH] vmalloc_node
37
  extern void *vmalloc_node(unsigned long size, int node);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
38
39
  extern void *vmalloc_exec(unsigned long size);
  extern void *vmalloc_32(unsigned long size);
833423143   Nick Piggin   [PATCH] mm: intro...
40
  extern void *vmalloc_32_user(unsigned long size);
dd0fc66fb   Al Viro   [PATCH] gfp flags...
41
  extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot);
930fc45a4   Christoph Lameter   [PATCH] vmalloc_node
42
43
  extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask,
  				pgprot_t prot);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
44
45
46
47
48
  extern void vfree(void *addr);
  
  extern void *vmap(struct page **pages, unsigned int count,
  			unsigned long flags, pgprot_t prot);
  extern void vunmap(void *addr);
833423143   Nick Piggin   [PATCH] mm: intro...
49
50
51
  
  extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr,
  							unsigned long pgoff);
1eeb66a1b   Christoph Hellwig   move die notifier...
52
  void vmalloc_sync_all(void);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
53
54
55
56
   
  /*
   *	Lowlevel-APIs (not for driver use!)
   */
9585116ba   Jeremy Fitzhardinge   i386: fix iounmap...
57
58
59
60
61
62
  
  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   Linus Torvalds   Linux-2.6.12-rc2
63
64
65
  extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);
  extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
  					unsigned long start, unsigned long end);
930fc45a4   Christoph Lameter   [PATCH] vmalloc_node
66
  extern struct vm_struct *get_vm_area_node(unsigned long size,
52fd24ca1   Giridhar Pemmasani   [PATCH] __vmalloc...
67
68
  					  unsigned long flags, int node,
  					  gfp_t gfp_mask);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
69
  extern struct vm_struct *remove_vm_area(void *addr);
c19c03fc7   Benjamin Herrenschmidt   [POWERPC] unmap_v...
70

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
71
72
  extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
  			struct page ***pages);
c19c03fc7   Benjamin Herrenschmidt   [POWERPC] unmap_v...
73
  extern void unmap_kernel_range(unsigned long addr, unsigned long size);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
74

5f4352fbf   Jeremy Fitzhardinge   Allocate and free...
75
76
77
  /* Allocate/destroy a 'vmalloc' VM area. */
  extern struct vm_struct *alloc_vm_area(size_t size);
  extern void free_vm_area(struct vm_struct *area);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
78
79
80
81
82
83
84
  /*
   *	Internals.  Dont't use..
   */
  extern rwlock_t vmlist_lock;
  extern struct vm_struct *vmlist;
  
  #endif /* _LINUX_VMALLOC_H */