diff mbox series

[v2,4/8] libvhost-user: drop qemu/osdep.h dependency

Message ID 20201125100640.366523-5-marcandre.lureau@redhat.com
State New
Headers show
Series libvhost-user: make it a subproject (was: "lower dependency on QEMU headers") | expand

Commit Message

Marc-André Lureau Nov. 25, 2020, 10:06 a.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 contrib/libvhost-user/libvhost-user-glib.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Stefan Hajnoczi Dec. 2, 2020, 2:20 p.m. UTC | #1
On Wed, Nov 25, 2020 at 02:06:36PM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  contrib/libvhost-user/libvhost-user-glib.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
diff mbox series

Patch

diff --git a/contrib/libvhost-user/libvhost-user-glib.c b/contrib/libvhost-user/libvhost-user-glib.c
index 0df2ec9271..efc9d814e3 100644
--- a/contrib/libvhost-user/libvhost-user-glib.c
+++ b/contrib/libvhost-user/libvhost-user-glib.c
@@ -12,10 +12,16 @@ 
  * later.  See the COPYING file in the top-level directory.
  */
 
-#include "qemu/osdep.h"
-
 #include "libvhost-user-glib.h"
 
+#ifndef container_of
+#define container_of(ptr, type, member)              \
+    __extension__({                                  \
+        void *__mptr = (void *)(ptr);                \
+        ((type *)(__mptr - offsetof(type, member))); \
+    })
+#endif
+
 /* glib event loop integration for libvhost-user and misc callbacks */
 
 G_STATIC_ASSERT((int)G_IO_IN == (int)VU_WATCH_IN);