kernel.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef _LIBLOCKDEP_LINUX_KERNEL_H_
  2. #define _LIBLOCKDEP_LINUX_KERNEL_H_
  3. #include <linux/export.h>
  4. #include <linux/types.h>
  5. #include <linux/rcu.h>
  6. #include <linux/hardirq.h>
  7. #include <linux/kern_levels.h>
  8. #ifndef container_of
  9. #define container_of(ptr, type, member) ({ \
  10. const typeof(((type *)0)->member) * __mptr = (ptr); \
  11. (type *)((char *)__mptr - offsetof(type, member)); })
  12. #endif
  13. #define max(x, y) ({ \
  14. typeof(x) _max1 = (x); \
  15. typeof(y) _max2 = (y); \
  16. (void) (&_max1 == &_max2); \
  17. _max1 > _max2 ? _max1 : _max2; })
  18. #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
  19. #define WARN_ON(x) (x)
  20. #define WARN_ON_ONCE(x) (x)
  21. #define likely(x) (x)
  22. #define WARN(x, y...) (x)
  23. #define uninitialized_var(x) x
  24. #define __init
  25. #define noinline
  26. #define list_add_tail_rcu list_add_tail
  27. #define list_for_each_entry_rcu list_for_each_entry
  28. #define barrier()
  29. #define synchronize_sched()
  30. #ifndef CALLER_ADDR0
  31. #define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
  32. #endif
  33. #ifndef _RET_IP_
  34. #define _RET_IP_ CALLER_ADDR0
  35. #endif
  36. #ifndef _THIS_IP_
  37. #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
  38. #endif
  39. #endif