From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MqNu4-0007nN-6N for qemu-devel@nongnu.org; Wed, 23 Sep 2009 05:12:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MqNty-0007ky-VU for qemu-devel@nongnu.org; Wed, 23 Sep 2009 05:12:47 -0400 Received: from [199.232.76.173] (port=49415 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MqNty-0007kr-Mo for qemu-devel@nongnu.org; Wed, 23 Sep 2009 05:12:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10859) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MqNty-00067r-9A for qemu-devel@nongnu.org; Wed, 23 Sep 2009 05:12:42 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8N9CekD004771 for ; Wed, 23 Sep 2009 05:12:40 -0400 Message-ID: <4AB9E684.1080500@redhat.com> Date: Wed, 23 Sep 2009 11:12:36 +0200 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 4/4] virtio-console: Add a in-qemu api for open/read/write/close ports References: <1253636627-12746-1-git-send-email-amit.shah@redhat.com> <1253636627-12746-2-git-send-email-amit.shah@redhat.com> <1253636627-12746-3-git-send-email-amit.shah@redhat.com> <1253636627-12746-4-git-send-email-amit.shah@redhat.com> <1253636627-12746-5-git-send-email-amit.shah@redhat.com> In-Reply-To: <1253636627-12746-5-git-send-email-amit.shah@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amit Shah Cc: qemu-devel@nongnu.org > diff --git a/hw/virtio-console.c b/hw/virtio-console.c > index d750c8e..c41f13c 100644 > --- a/hw/virtio-console.c > +++ b/hw/virtio-console.c > @@ -58,6 +58,11 @@ struct VirtIOConsolePort { > + size_t (*read_callback)(const uint8_t *buf, const size_t len); > + if (port->read_callback) { > + ret = port->read_callback(buf, len); > + } else if (port->hd) { > + ret = qemu_chr_write(port->hd, buf, len); > } > - return qemu_chr_write(port->hd, buf, len); No. port->info->data_for_you() again ;) > +/* Functions for use inside qemu to open and read from/write to ports */ > +VirtIOConsolePort *virtio_console_open(uint32_t id, > + size_t(*read_callback)(const uint8_t*buf, > + const size_t len)) Anyone who wants talk using a port should be a port driver. cheers, Gerd