aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2020-11-25 14:06:36 +0400
committerMichael S. Tsirkin <mst@redhat.com>2020-12-08 13:48:58 -0500
commit3d22bd27acd93281354b10c6bf787b720685eb80 (patch)
treeb3507c0334955890db1e070adb278eb092cc4c12
parent7fa1d61695d92661c4800a7ee727ab7ae15a170b (diff)
libvhost-user: drop qemu/osdep.h dependency
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20201125100640.366523-5-marcandre.lureau@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--contrib/libvhost-user/libvhost-user-glib.c10
1 files changed, 8 insertions, 2 deletions
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);