1 #ifndef _LIBLOCKDEP_LINUX_KERNEL_H_
2 #define _LIBLOCKDEP_LINUX_KERNEL_H_
4 #include <linux/export.h>
5 #include <linux/types.h>
7 #include <linux/hardirq.h>
8 #include <linux/kern_levels.h>
10 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
13 #define container_of(ptr, type, member) ({ \
14 const typeof(((type *)0)->member) * __mptr = (ptr); \
15 (type *)((char *)__mptr - offsetof(type, member)); })
18 #define max(x, y) ({ \
19 typeof(x) _max1 = (x); \
20 typeof(y) _max2 = (y); \
21 (void) (&_max1 == &_max2); \
22 _max1 > _max2 ? _max1 : _max2; })
24 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
26 static inline int lockdep_warn(int condition)
30 #define WARN_ON(x) lockdep_warn(x)
31 #define WARN_ON_ONCE(x) WARN_ON(x)
32 #define WARN(x, y...) WARN_ON(x)
35 #define uninitialized_var(x) x
38 #define list_add_tail_rcu list_add_tail
39 #define list_for_each_entry_rcu list_for_each_entry
41 #define synchronize_sched()
44 #define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
48 #define _RET_IP_ CALLER_ADDR0
52 #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })