diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-08-24 06:25:44 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-24 06:25:54 -0400 |
commit | 5f9ece02401116b29eb04396b99ea092acb75dd8 (patch) | |
tree | e10386e2dc63c275646b4eb0bed857da7bf86c6a /tools/perf/util/include/linux/kernel.h | |
parent | 9f51e24ee8b5a1595b6a5ac0c2be278a16488e75 (diff) | |
parent | 422bef879e84104fee6dc68ded0e371dbeb5f88e (diff) |
Merge commit 'v2.6.31-rc7' into x86/cleanups
Merge reason: we were on -rc1 before - go up to -rc7
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/include/linux/kernel.h')
-rw-r--r-- | tools/perf/util/include/linux/kernel.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/perf/util/include/linux/kernel.h b/tools/perf/util/include/linux/kernel.h new file mode 100644 index 000000000000..a6b87390cb52 --- /dev/null +++ b/tools/perf/util/include/linux/kernel.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef PERF_LINUX_KERNEL_H_ | ||
2 | #define PERF_LINUX_KERNEL_H_ | ||
3 | |||
4 | #ifndef offsetof | ||
5 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) | ||
6 | #endif | ||
7 | |||
8 | #ifndef container_of | ||
9 | /** | ||
10 | * container_of - cast a member of a structure out to the containing structure | ||
11 | * @ptr: the pointer to the member. | ||
12 | * @type: the type of the container struct this is embedded in. | ||
13 | * @member: the name of the member within the struct. | ||
14 | * | ||
15 | */ | ||
16 | #define container_of(ptr, type, member) ({ \ | ||
17 | const typeof(((type *)0)->member) * __mptr = (ptr); \ | ||
18 | (type *)((char *)__mptr - offsetof(type, member)); }) | ||
19 | #endif | ||
20 | |||
21 | #ifndef max | ||
22 | #define max(x, y) ({ \ | ||
23 | typeof(x) _max1 = (x); \ | ||
24 | typeof(y) _max2 = (y); \ | ||
25 | (void) (&_max1 == &_max2); \ | ||
26 | _max1 > _max2 ? _max1 : _max2; }) | ||
27 | #endif | ||
28 | |||
29 | #endif | ||