vmalloc.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 int map_vm_area(struct vm_struct *area, pgprot_t prot,
  39. struct page ***pages);
  40. extern void unmap_vm_area(struct vm_struct *area);
  41. /*
  42. * Internals. Dont't use..
  43. */
  44. extern rwlock_t vmlist_lock;
  45. extern struct vm_struct *vmlist;
  46. #endif /* _LINUX_VMALLOC_H */