datapath: Remove reciprocal_div compat code.
[sliver-openvswitch.git] / datapath / linux / compat / include / linux / slab.h
1 #ifndef __LINUX_SLAB_WRAPPER_H
2 #define __LINUX_SLAB_WRAPPER_H 1
3
4 #include_next <linux/slab.h>
5
6 #ifndef HAVE_KMEMDUP
7 extern void *kmemdup(const void *src, size_t len, gfp_t gfp);
8 #endif
9
10 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
11 #define kmem_cache_create(n, s, a, f, c) kmem_cache_create(n, s, a, f, c, NULL)
12 #endif
13
14 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
15 static inline void *rpl_kzalloc(size_t size, gfp_t flags)
16 {
17         return kzalloc(size, flags & ~__GFP_ZERO);
18 }
19 #define kzalloc rpl_kzalloc
20
21 static inline void *rpl_kmalloc(size_t size, gfp_t flags)
22 {
23         if (flags & __GFP_ZERO)
24                 return kzalloc(size, flags);
25
26         return kmalloc(size, flags);
27 }
28 #define kmalloc rpl_kmalloc
29 #endif
30
31 #endif