[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [5057] add container_of() macro to osdep.h (Gerd Hoffmann)
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [5057] add container_of() macro to osdep.h (Gerd Hoffmann) |
Date: |
Thu, 21 Aug 2008 20:11:11 +0000 |
Revision: 5057
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5057
Author: aliguori
Date: 2008-08-21 20:11:11 +0000 (Thu, 21 Aug 2008)
Log Message:
-----------
add container_of() macro to osdep.h (Gerd Hoffmann)
>From linux kernel sources, xen bits will use it, put it
into a place where others can see and use it too ;)
Signed-off-by: Gerd Hoffmann <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>
Modified Paths:
--------------
trunk/osdep.h
Modified: trunk/osdep.h
===================================================================
--- trunk/osdep.h 2008-08-21 20:08:55 UTC (rev 5056)
+++ trunk/osdep.h 2008-08-21 20:11:11 UTC (rev 5057)
@@ -23,6 +23,10 @@
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif
+#define container_of(ptr, type, member) ({ \
+ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
+ (type *)( (char *)__mptr - offsetof(type,member) );})
+
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [5057] add container_of() macro to osdep.h (Gerd Hoffmann),
Anthony Liguori <=