@@ -75,4 +75,8 @@
#define __must_check __attribute__((__warn_unused_result__))
#endif
+#define container_of(ptr, type, member) ({ \
+ typeof( ((type *)0)->member ) *__mptr = (ptr); \
+ (type *)( (char *)__mptr - offsetof(type,member) );})
+
#endif /* __XEN_TOOLS_COMMON_MACROS__ */
@@ -125,9 +125,6 @@ enum
#define max_t(type, x, y) \
({ type __x = (x); type __y = (y); __x > __y ? __x : __y; })
#define offsetof(t, m) ((unsigned long )&((t *)0)->m)
-#define container_of(ptr, type, member) ({ \
- typeof( ((type *)0)->member ) *__mptr = (ptr); \
- (type *)( (char *)__mptr - offsetof(type,member) ); })
struct domain;
@@ -27,11 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
-#define container_of(ptr, type, member) ({ \
- typeof(((type *)0)->member) *mptr = (ptr); \
- \
- (type *)((char *)mptr - offsetof(type, member)); \
-})
+#include <xen-tools/common-macros.h>
#define smp_wmb()
#define prefetch(x) __builtin_prefetch(x)
@@ -56,11 +56,6 @@
#define cf_check /* No Control Flow Integriy checking */
-#define container_of(ptr, type, member) ({ \
- typeof(((type *)0)->member) *mptr__ = (ptr); \
- (type *)((char *)mptr__ - offsetof(type, member)); \
-})
-
#define AC_(n,t) (n##t)
#define _AC(n,t) AC_(n,t)
@@ -3,6 +3,8 @@
/* Taken from Linux kernel code, but de-kernelized for userspace. */
#include <stddef.h>
+#include <xen-tools/common-macros.h>
+
#undef LIST_HEAD_INIT
#undef LIST_HEAD
#undef INIT_LIST_HEAD
@@ -15,10 +17,6 @@
#define LIST_POISON1 ((void *) 0x00100100)
#define LIST_POISON2 ((void *) 0x00200200)
-#define container_of(ptr, type, member) ({ \
- typeof( ((type *)0)->member ) *__mptr = (ptr); \
- (type *)( (char *)__mptr - offsetof(type,member) );})
-
/*
* Simple doubly linked list implementation.
*