From 8bb7ddb78a1c68f2408a66a61c748330903fd5f2 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Thu, 17 Aug 2017 20:55:14 +0200 Subject: libvhost-user: add glib source helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This file implements a bridge from the vu_init API of libvhost-user to GSource, so that libvhost-user can be used inside a GLib main loop. Signed-off-by: Marc-André Lureau Reviewed-by: Paolo Bonzini --- contrib/libvhost-user/libvhost-user-glib.h | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 contrib/libvhost-user/libvhost-user-glib.h (limited to 'contrib/libvhost-user/libvhost-user-glib.h') diff --git a/contrib/libvhost-user/libvhost-user-glib.h b/contrib/libvhost-user/libvhost-user-glib.h new file mode 100644 index 0000000000..6b2110b94c --- /dev/null +++ b/contrib/libvhost-user/libvhost-user-glib.h @@ -0,0 +1,32 @@ +/* + * Vhost User library + * + * Copyright (c) 2016 Nutanix Inc. All rights reserved. + * Copyright (c) 2017 Red Hat, Inc. + * + * Authors: + * Marc-André Lureau + * Felipe Franciosi + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * later. See the COPYING file in the top-level directory. + */ + +#ifndef LIBVHOST_USER_GLIB_H +#define LIBVHOST_USER_GLIB_H + +#include +#include "libvhost-user.h" + +typedef struct VugDev { + VuDev parent; + + GHashTable *fdmap; /* fd -> gsource */ + GSource *src; +} VugDev; + +void vug_init(VugDev *dev, int socket, + vu_panic_cb panic, const VuDevIface *iface); +void vug_deinit(VugDev *dev); + +#endif /* LIBVHOST_USER_GLIB_H */ -- cgit 1.4.1