[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v2 07/12] libvhost-user: export vug_source_new
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [RFC v2 07/12] libvhost-user: export vug_source_new |
Date: |
Fri, 1 Jun 2018 18:27:44 +0200 |
Simplify the creation of FD sources for other users.
Signed-off-by: Marc-André Lureau <address@hidden>
---
contrib/libvhost-user/libvhost-user-glib.h | 3 +++
contrib/libvhost-user/libvhost-user-glib.c | 15 +++++++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/contrib/libvhost-user/libvhost-user-glib.h
b/contrib/libvhost-user/libvhost-user-glib.h
index 6b2110b94c..d3200f3afc 100644
--- a/contrib/libvhost-user/libvhost-user-glib.h
+++ b/contrib/libvhost-user/libvhost-user-glib.h
@@ -29,4 +29,7 @@ void vug_init(VugDev *dev, int socket,
vu_panic_cb panic, const VuDevIface *iface);
void vug_deinit(VugDev *dev);
+GSource *vug_source_new(VugDev *dev, int fd, GIOCondition cond,
+ vu_watch_cb vu_cb, gpointer data);
+
#endif /* LIBVHOST_USER_GLIB_H */
diff --git a/contrib/libvhost-user/libvhost-user-glib.c
b/contrib/libvhost-user/libvhost-user-glib.c
index 545f089587..0e2c467f28 100644
--- a/contrib/libvhost-user/libvhost-user-glib.c
+++ b/contrib/libvhost-user/libvhost-user-glib.c
@@ -69,8 +69,8 @@ static GSourceFuncs vug_src_funcs = {
};
static GSource *
-vug_source_new(VuDev *dev, int fd, GIOCondition cond,
- vu_watch_cb vu_cb, gpointer data)
+_vug_source_new(VuDev *dev, int fd, GIOCondition cond,
+ vu_watch_cb vu_cb, gpointer data)
{
GSource *gsrc;
VugSrc *src;
@@ -95,6 +95,13 @@ vug_source_new(VuDev *dev, int fd, GIOCondition cond,
return gsrc;
}
+GSource *
+vug_source_new(VugDev *dev, int fd, GIOCondition cond,
+ vu_watch_cb vu_cb, gpointer data)
+{
+ return _vug_source_new(&dev->parent, fd, cond, vu_cb, data);
+}
+
static void
set_watch(VuDev *vu_dev, int fd, int vu_evt, vu_watch_cb cb, void *pvt)
{
@@ -106,7 +113,7 @@ set_watch(VuDev *vu_dev, int fd, int vu_evt, vu_watch_cb
cb, void *pvt)
g_assert(cb);
dev = container_of(vu_dev, VugDev, parent);
- src = vug_source_new(vu_dev, fd, vu_evt, cb, pvt);
+ src = _vug_source_new(vu_dev, fd, vu_evt, cb, pvt);
g_hash_table_replace(dev->fdmap, GINT_TO_POINTER(fd), src);
}
@@ -141,7 +148,7 @@ vug_init(VugDev *dev, int socket,
dev->fdmap = g_hash_table_new_full(NULL, NULL, NULL,
(GDestroyNotify) g_source_destroy);
- dev->src = vug_source_new(&dev->parent, socket, G_IO_IN, vug_watch, NULL);
+ dev->src = _vug_source_new(&dev->parent, socket, G_IO_IN, vug_watch, NULL);
}
void
--
2.17.1.906.g10fd178552
- Re: [Qemu-devel] [RFC v2 04/12] Add vhost-user-backend, (continued)
[Qemu-devel] [RFC v2 06/12] vhost-user: add vhost_user_input_get_config(), Marc-André Lureau, 2018/06/01
[Qemu-devel] [RFC v2 07/12] libvhost-user: export vug_source_new,
Marc-André Lureau <=
[Qemu-devel] [RFC v2 05/12] vhost-user: split vhost_user_read(), Marc-André Lureau, 2018/06/01
[Qemu-devel] [RFC v2 08/12] contrib: add vhost-user-input, Marc-André Lureau, 2018/06/01
[Qemu-devel] [RFC v2 09/12] Add vhost-input-pci, Marc-André Lureau, 2018/06/01
[Qemu-devel] [RFC v2 10/12] vhost-user: add vhost_user_gpu_set_socket(), Marc-André Lureau, 2018/06/01