Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/linux/slab.h
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | |||||
#define SLAB_HWCACHE_ALIGN (1 << 0) | #define SLAB_HWCACHE_ALIGN (1 << 0) | ||||
#define SLAB_TYPESAFE_BY_RCU (1 << 1) | #define SLAB_TYPESAFE_BY_RCU (1 << 1) | ||||
#define SLAB_RECLAIM_ACCOUNT (1 << 2) | #define SLAB_RECLAIM_ACCOUNT (1 << 2) | ||||
#define SLAB_DESTROY_BY_RCU \ | #define SLAB_DESTROY_BY_RCU \ | ||||
SLAB_TYPESAFE_BY_RCU | SLAB_TYPESAFE_BY_RCU | ||||
#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) | |||||
static inline gfp_t | static inline gfp_t | ||||
linux_check_m_flags(gfp_t flags) | linux_check_m_flags(gfp_t flags) | ||||
{ | { | ||||
const gfp_t m = M_NOWAIT | M_WAITOK; | const gfp_t m = M_NOWAIT | M_WAITOK; | ||||
/* make sure either M_NOWAIT or M_WAITOK is set */ | /* make sure either M_NOWAIT or M_WAITOK is set */ | ||||
if ((flags & m) == 0) | if ((flags & m) == 0) | ||||
flags |= M_NOWAIT; | flags |= M_NOWAIT; | ||||
Show All 26 Lines | |||||
static inline void * | static inline void * | ||||
vmalloc_32(size_t size) | vmalloc_32(size_t size) | ||||
{ | { | ||||
return (contigmalloc(size, M_KMALLOC, M_WAITOK, 0, UINT_MAX, 1, 1)); | return (contigmalloc(size, M_KMALLOC, M_WAITOK, 0, UINT_MAX, 1, 1)); | ||||
} | } | ||||
static inline void * | static inline void * | ||||
kmalloc_array(size_t n, size_t size, gfp_t flags) | kmalloc_array(size_t n, size_t size, gfp_t flags) | ||||
{ | |||||
return (mallocarray(n, size, M_KMALLOC, linux_check_m_flags(flags))); | |||||
} | |||||
static inline void * | |||||
kvmalloc_array(size_t n, size_t size, gfp_t flags) | |||||
{ | { | ||||
return (mallocarray(n, size, M_KMALLOC, linux_check_m_flags(flags))); | return (mallocarray(n, size, M_KMALLOC, linux_check_m_flags(flags))); | ||||
} | } | ||||
static inline void * | static inline void * | ||||
krealloc(void *ptr, size_t size, gfp_t flags) | krealloc(void *ptr, size_t size, gfp_t flags) | ||||
{ | { | ||||
return (realloc(ptr, size, M_KMALLOC, linux_check_m_flags(flags))); | return (realloc(ptr, size, M_KMALLOC, linux_check_m_flags(flags))); | ||||
Show All 39 Lines |