slob_def.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef __LINUX_SLOB_DEF_H
  2. #define __LINUX_SLOB_DEF_H
  3. void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
  4. static inline void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags)
  5. {
  6. return kmem_cache_alloc_node(cachep, flags, -1);
  7. }
  8. void *__kmalloc_node(size_t size, gfp_t flags, int node);
  9. static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
  10. {
  11. return __kmalloc_node(size, flags, node);
  12. }
  13. /**
  14. * kmalloc - allocate memory
  15. * @size: how many bytes of memory are required.
  16. * @flags: the type of memory to allocate (see kcalloc).
  17. *
  18. * kmalloc is the normal method of allocating memory
  19. * in the kernel.
  20. */
  21. static inline void *kmalloc(size_t size, gfp_t flags)
  22. {
  23. return __kmalloc_node(size, flags, -1);
  24. }
  25. static inline void *__kmalloc(size_t size, gfp_t flags)
  26. {
  27. return kmalloc(size, flags);
  28. }
  29. /**
  30. * kzalloc - allocate memory. The memory is set to zero.
  31. * @size: how many bytes of memory are required.
  32. * @flags: the type of memory to allocate (see kcalloc).
  33. */
  34. static inline void *kzalloc(size_t size, gfp_t flags)
  35. {
  36. return __kzalloc(size, flags);
  37. }
  38. #endif /* __LINUX_SLOB_DEF_H */