aboutsummaryrefslogtreecommitdiff
path: root/osdep.h
diff options
context:
space:
mode:
Diffstat (limited to 'osdep.h')
-rw-r--r--osdep.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/osdep.h b/osdep.h
index 6312e7a2e4..09ebace5b3 100644
--- a/osdep.h
+++ b/osdep.h
@@ -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