]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - tools/lib/lockdep/uinclude/linux/kernel.h
4a31ebe1a377c065e0c3c27e81c2fe85ed43115b
[mirror_ubuntu-artful-kernel.git] / tools / lib / lockdep / uinclude / linux / kernel.h
1 #ifndef _LIBLOCKDEP_LINUX_KERNEL_H_
2 #define _LIBLOCKDEP_LINUX_KERNEL_H_
3
4 #include <linux/export.h>
5 #include <linux/types.h>
6 #include <linux/rcu.h>
7 #include <linux/hardirq.h>
8 #include <linux/kern_levels.h>
9 #include <linux/err.h>
10
11 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
12
13 #ifndef container_of
14 #define container_of(ptr, type, member) ({ \
15 const typeof(((type *)0)->member) * __mptr = (ptr); \
16 (type *)((char *)__mptr - offsetof(type, member)); })
17 #endif
18
19 #define max(x, y) ({ \
20 typeof(x) _max1 = (x); \
21 typeof(y) _max2 = (y); \
22 (void) (&_max1 == &_max2); \
23 _max1 > _max2 ? _max1 : _max2; })
24
25 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
26
27 static inline int lockdep_warn(int condition)
28 {
29 return condition;
30 }
31 #define WARN_ON(x) lockdep_warn(x)
32 #define WARN_ON_ONCE(x) WARN_ON(x)
33 #define WARN(x, y...) WARN_ON(x)
34
35 #define likely(x) (x)
36 #define uninitialized_var(x) x
37 #define __init
38 #define noinline
39 #define list_add_tail_rcu list_add_tail
40 #define list_for_each_entry_rcu list_for_each_entry
41 #define barrier()
42 #define synchronize_sched()
43
44 #ifndef CALLER_ADDR0
45 #define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
46 #endif
47
48 #ifndef _RET_IP_
49 #define _RET_IP_ CALLER_ADDR0
50 #endif
51
52 #ifndef _THIS_IP_
53 #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
54 #endif
55
56 #define pr_err(format, ...) fprintf (stderr, format, ## __VA_ARGS__)
57 #define pr_warn pr_err
58
59 #define current_gfp_context(k) 0
60
61 #endif