Patchwork [RFC,02/12] continuation: Fix container_of() redefinition

login
register
mail settings
Submitter Stefan Hajnoczi
Date Jan. 22, 2011, 9:29 a.m.
Message ID <1295688567-25496-3-git-send-email-stefanha@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/80000/
State New
Headers show

Comments

Stefan Hajnoczi - Jan. 22, 2011, 9:29 a.m.
QEMU already has a visible container_of() macro definition.  Avoid the
compiler error.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 continuation.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Patch

diff --git a/continuation.h b/continuation.h
index 585788e..112df65 100644
--- a/continuation.h
+++ b/continuation.h
@@ -45,8 +45,10 @@  int cc_release(struct continuation *cc);
 int cc_swap(struct continuation *from, struct continuation *to);
 
 #define offset_of(type, member) ((unsigned long)(&((type *)0)->member))
+#ifndef container_of
 #define container_of(obj, type, member) \
         (type *)(((char *)obj) - offset_of(type, member))
+#endif
 
 #endif
 /*