|
@@ -356,35 +356,6 @@ end:
|
|
|
return G_SOURCE_REMOVE;
|
|
|
}
|
|
|
|
|
|
-static gboolean slave_read(QIOChannel *ioc, GIOCondition condition,
|
|
|
- gpointer opaque);
|
|
|
-
|
|
|
-/*
|
|
|
- * This updates the read handler to use a new event loop context.
|
|
|
- * Event sources are removed from the previous context : this ensures
|
|
|
- * that events detected in the previous context are purged. They will
|
|
|
- * be re-detected and processed in the new context.
|
|
|
- */
|
|
|
-static void slave_update_read_handler(struct vhost_dev *dev,
|
|
|
- GMainContext *ctxt)
|
|
|
-{
|
|
|
- struct vhost_user *u = dev->opaque;
|
|
|
-
|
|
|
- if (!u->slave_ioc) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (u->slave_src) {
|
|
|
- g_source_destroy(u->slave_src);
|
|
|
- g_source_unref(u->slave_src);
|
|
|
- }
|
|
|
-
|
|
|
- u->slave_src = qio_channel_add_watch_source(u->slave_ioc,
|
|
|
- G_IO_IN | G_IO_HUP,
|
|
|
- slave_read, dev, NULL,
|
|
|
- ctxt);
|
|
|
-}
|
|
|
-
|
|
|
static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg)
|
|
|
{
|
|
|
struct vhost_user *u = dev->opaque;
|
|
@@ -406,7 +377,6 @@ static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg)
|
|
|
* be prepared for re-entrancy. So we create a new one and switch chr
|
|
|
* to use it.
|
|
|
*/
|
|
|
- slave_update_read_handler(dev, ctxt);
|
|
|
qemu_chr_be_update_read_handlers(chr->chr, ctxt);
|
|
|
qemu_chr_fe_add_watch(chr, G_IO_IN | G_IO_HUP, vhost_user_read_cb, &data);
|
|
|
|
|
@@ -418,7 +388,6 @@ static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg)
|
|
|
* context that have been processed by the nested loop are purged.
|
|
|
*/
|
|
|
qemu_chr_be_update_read_handlers(chr->chr, prev_ctxt);
|
|
|
- slave_update_read_handler(dev, NULL);
|
|
|
|
|
|
g_main_loop_unref(loop);
|
|
|
g_main_context_unref(ctxt);
|
|
@@ -1809,7 +1778,9 @@ static int vhost_setup_slave_channel(struct vhost_dev *dev)
|
|
|
return -ECONNREFUSED;
|
|
|
}
|
|
|
u->slave_ioc = ioc;
|
|
|
- slave_update_read_handler(dev, NULL);
|
|
|
+ u->slave_src = qio_channel_add_watch_source(u->slave_ioc,
|
|
|
+ G_IO_IN | G_IO_HUP,
|
|
|
+ slave_read, dev, NULL, NULL);
|
|
|
|
|
|
if (reply_supported) {
|
|
|
msg.hdr.flags |= VHOST_USER_NEED_REPLY_MASK;
|