vmalloc.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef _LINUX_VMALLOC_H
  2. #define _LINUX_VMALLOC_H
  3. #include <linux/spinlock.h>
  4. #include <asm/page.h> /* pgprot_t */
  5. /* bits in vm_struct->flags */
  6. #define VM_IOREMAP 0x00000001 /* ioremap() and friends */
  7. #define VM_ALLOC 0x00000002 /* vmalloc() */
  8. #define VM_MAP 0x00000004 /* vmap()ed pages */
  9. /* bits [20..32] reserved for arch specific ioremap internals */
  10. struct vm_struct {
  11. void *addr;
  12. unsigned long size;
  13. unsigned long flags;
  14. struct page **pages;
  15. unsigned int nr_pages;
  16. unsigned long phys_addr;
  17. struct vm_struct *next;
  18. };
  19. /*
  20. * Highlevel APIs for driver use
  21. */
  22. extern void *vmalloc(unsigned long size);
  23. extern void *vmalloc_exec(unsigned long size);
  24. extern void *vmalloc_32(unsigned long size);
  25. extern void *__vmalloc(unsigned long size, unsigned int __nocast gfp_mask, pgprot_t prot);
  26. extern void *__vmalloc_area(struct vm_struct *area, unsigned int __nocast gfp_mask, pgprot_t prot);
  27. extern void vfree(void *addr);
  28. extern void *vmap(struct page **pages, unsigned int count,
  29. unsigned long flags, pgprot_t prot);
  30. extern void vunmap(void *addr);
  31. /*
  32. * Lowlevel-APIs (not for driver use!)
  33. */
  34. extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);
  35. extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
  36. unsigned long start, unsigned long end);
  37. extern struct vm_struct *remove_vm_area(void *addr);
  38. extern struct vm_struct *__remove_vm_area(void *addr);
  39. extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
  40. struct page ***pages);
  41. extern void unmap_vm_area(struct vm_struct *area);
  42. /*
  43. * Internals. Dont't use..
  44. */
  45. extern rwlock_t vmlist_lock;
  46. extern struct vm_struct *vmlist;
  47. #endif /* _LINUX_VMALLOC_H */