OSDN Git Service

libvhost-user: drop qemu/osdep.h dependency
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 25 Nov 2020 10:06:36 +0000 (14:06 +0400)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 8 Dec 2020 18:48:58 +0000 (13:48 -0500)
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>
contrib/libvhost-user/libvhost-user-glib.c

index 0df2ec9..efc9d81 100644 (file)
  * 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);