From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ME4Pf-0007CL-8T for qemu-devel@nongnu.org; Tue, 09 Jun 2009 12:43:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ME4PZ-00073v-BI for qemu-devel@nongnu.org; Tue, 09 Jun 2009 12:43:02 -0400 Received: from [199.232.76.173] (port=49858 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ME4PY-00073s-2x for qemu-devel@nongnu.org; Tue, 09 Jun 2009 12:42:56 -0400 Received: from mx2.redhat.com ([66.187.237.31]:35526) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1ME4PX-0007uR-LQ for qemu-devel@nongnu.org; Tue, 09 Jun 2009 12:42:55 -0400 From: Amit Shah Date: Tue, 9 Jun 2009 22:12:47 +0530 Message-Id: <1244565768-9103-3-git-send-email-amit.shah@redhat.com> In-Reply-To: <1244565768-9103-2-git-send-email-amit.shah@redhat.com> References: <1244565768-9103-1-git-send-email-amit.shah@redhat.com> <1244565768-9103-2-git-send-email-amit.shah@redhat.com> Subject: [Qemu-devel] [PATCH] qdev: add virtserial char drv init hacks List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: Amit Shah , qemu-devel@nongnu.org Signed-off-by: Amit Shah --- hw/qdev.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index 689cf4c..661bcde 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -172,9 +172,13 @@ CharDriverState *qdev_init_chardev(DeviceState *dev) { static int next_serial; static int next_virtconsole; + static int next_virtserial; + /* FIXME: This is a nasty hack that needs to go away. */ - if (strncmp(dev->type->name, "virtio", 6) == 0) { + if (strncmp(dev->name, "virtio-console", 14) == 0) { return virtcon_hds[next_virtconsole++]; + } else if (strncmp(dev->name, "virtio-serial", 13) == 0) { + return virtio_serial_hds[next_virtserial++]; } else { return serial_hds[next_serial++]; } -- 1.6.0.6