From: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Anthony Liguori <anthony@codemonkey.ws>,
mdroth <mdroth@linux.vnet.ibm.com>
Subject: [Qemu-devel] [RFC PATCH v3 4/5] net: port vde onto glib
Date: Mon, 8 Apr 2013 13:36:07 +0800 [thread overview]
Message-ID: <1365399368-26967-5-git-send-email-pingfank@linux.vnet.ibm.com> (raw)
In-Reply-To: <1365399368-26967-1-git-send-email-pingfank@linux.vnet.ibm.com>
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
net/vde.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/net/vde.c b/net/vde.c
index 4dea32d..be5a032 100644
--- a/net/vde.c
+++ b/net/vde.c
@@ -60,6 +60,16 @@ static ssize_t vde_receive(NetClientState *nc, const uint8_t *buf, size_t size)
return ret;
}
+static gboolean vde_handler(gpointer data)
+{
+ NetClientSource *nsrc = (NetClientSource *)data;
+
+ if (nsrc->gfd.revents & G_IO_IN) {
+ vde_to_qemu(nsrc->opaque);
+ }
+ return true;
+}
+
static void vde_cleanup(NetClientState *nc)
{
VDEState *s = DO_UPCAST(VDEState, nc, nc);
@@ -83,6 +93,7 @@ static int net_vde_init(NetClientState *peer, const char *model,
VDECONN *vde;
char *init_group = (char *)group;
char *init_sock = (char *)sock;
+ NetClientSource *nsrc;
struct vde_open_args args = {
.port = port,
@@ -104,7 +115,9 @@ static int net_vde_init(NetClientState *peer, const char *model,
s->vde = vde;
- qemu_set_fd_handler(vde_datafd(s->vde), vde_to_qemu, NULL, s);
+ nsrc = net_source_new(vde_datafd(vde), vde_handler, s);
+ nc.nsrc = nsrc;
+ nsrc->gfd.events = G_IO_IN;
return 0;
}
--
1.7.4.4
next prev parent reply other threads:[~2013-04-08 5:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-08 5:36 [Qemu-devel] [RFC PATCH v3 0/5] port network layer onto glib Liu Ping Fan
2013-04-08 5:36 ` [Qemu-devel] [RFC PATCH v3 1/5] net: introduce glib function for network Liu Ping Fan
2013-04-09 14:03 ` Stefan Hajnoczi
2013-04-08 5:36 ` [Qemu-devel] [RFC PATCH v3 2/5] net: port tap onto glib Liu Ping Fan
2013-04-08 5:36 ` [Qemu-devel] [RFC PATCH v3 3/5] net: resolve race of tap backend and its peer Liu Ping Fan
2013-04-08 5:36 ` Liu Ping Fan [this message]
2013-04-08 5:36 ` [Qemu-devel] [RFC PATCH v3 5/5] net: port socket to glib Liu Ping Fan
2013-04-09 15:22 ` [Qemu-devel] [RFC PATCH v3 0/5] port network layer onto glib Stefan Hajnoczi
2013-04-10 7:47 ` liu ping fan
2013-04-10 11:55 ` Stefan Hajnoczi
2013-04-11 9:13 ` liu ping fan
2013-04-11 11:44 ` Stefan Hajnoczi
2013-04-11 12:05 ` liu ping fan
2013-04-12 7:44 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1365399368-26967-5-git-send-email-pingfank@linux.vnet.ibm.com \
--to=pingfank@linux.vnet.ibm.com \
--cc=anthony@codemonkey.ws \
--cc=mdroth@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).