Add vmem_zalloc support.
git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@60 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
This commit is contained in:
parent
8d0f1ee907
commit
4fd2f7eea5
|
@ -55,8 +55,8 @@ extern int kmem_warning_flag;
|
||||||
_ptr_; \
|
_ptr_; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define kmem_alloc(size, flags) __kmem_alloc(size, flags, kmalloc)
|
#define kmem_alloc(size, flags) __kmem_alloc((size), (flags), kmalloc)
|
||||||
#define kmem_zalloc(size, flags) __kmem_alloc(size, flags, kzalloc)
|
#define kmem_zalloc(size, flags) __kmem_alloc((size), (flags), kzalloc)
|
||||||
|
|
||||||
#define kmem_free(ptr, size) \
|
#define kmem_free(ptr, size) \
|
||||||
({ \
|
({ \
|
||||||
|
@ -69,9 +69,10 @@ extern int kmem_warning_flag;
|
||||||
#define __vmem_alloc(size, flags) \
|
#define __vmem_alloc(size, flags) \
|
||||||
({ void *_ptr_; \
|
({ void *_ptr_; \
|
||||||
\
|
\
|
||||||
BUG_ON(flags != KM_SLEEP); \
|
BUG_ON(!(flags & KM_SLEEP)); \
|
||||||
\
|
\
|
||||||
_ptr_ = (void *)vmalloc((size)); \
|
_ptr_ = (void *)__vmalloc((size), ((flags) | \
|
||||||
|
__GFP_HIGHMEM), PAGE_KERNEL); \
|
||||||
if (_ptr_ == NULL) { \
|
if (_ptr_ == NULL) { \
|
||||||
printk("spl: Warning vmem_alloc(%d, 0x%x) failed at %s:%d " \
|
printk("spl: Warning vmem_alloc(%d, 0x%x) failed at %s:%d " \
|
||||||
"(%ld/%ld)\n", (int)(size), (int)(flags), \
|
"(%ld/%ld)\n", (int)(size), (int)(flags), \
|
||||||
|
@ -86,7 +87,9 @@ extern int kmem_warning_flag;
|
||||||
_ptr_; \
|
_ptr_; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define vmem_alloc(size, flags) __vmem_alloc(size, flags)
|
#define vmem_alloc(size, flags) __vmem_alloc((size), (flags))
|
||||||
|
#define vmem_zalloc(size, flags) __vmem_alloc((size), ((flags) | \
|
||||||
|
__GFP_ZERO))
|
||||||
|
|
||||||
#define vmem_free(ptr, size) \
|
#define vmem_free(ptr, size) \
|
||||||
({ \
|
({ \
|
||||||
|
@ -98,15 +101,19 @@ extern int kmem_warning_flag;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define kmem_alloc(size, flags) kmalloc(size, flags)
|
#define kmem_alloc(size, flags) kmalloc((size), (flags))
|
||||||
#define kmem_zalloc(size, flags) kzalloc(size, flags)
|
#define kmem_zalloc(size, flags) kzalloc((size), (flags))
|
||||||
#define kmem_free(ptr, size) \
|
#define kmem_free(ptr, size) \
|
||||||
({ \
|
({ \
|
||||||
BUG_ON(!(ptr) || (size) < 0); \
|
BUG_ON(!(ptr) || (size) < 0); \
|
||||||
kfree(ptr); \
|
kfree(ptr); \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define vmem_alloc(size, flags) vmalloc(size)
|
#define vmem_alloc(size, flags) __vmalloc((size), ((flags) | \
|
||||||
|
__GFP_HIGHMEM), PAGE_KERNEL)
|
||||||
|
#define vmem_zalloc(size, flags) __vmalloc((size), ((flags) | \
|
||||||
|
__GFP_HIGHMEM | __GFP_ZERO) \
|
||||||
|
PAGE_KERNEL)
|
||||||
#define vmem_free(ptr, size) \
|
#define vmem_free(ptr, size) \
|
||||||
({ \
|
({ \
|
||||||
BUG_ON(!(ptr) || (size) < 0); \
|
BUG_ON(!(ptr) || (size) < 0); \
|
||||||
|
|
Loading…
Reference in New Issue