From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34548) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3pdj-0001sP-9u for qemu-devel@nongnu.org; Wed, 14 Sep 2011 09:36:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R3pdd-0002zM-CA for qemu-devel@nongnu.org; Wed, 14 Sep 2011 09:36:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44384) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3pdd-0002zA-52 for qemu-devel@nongnu.org; Wed, 14 Sep 2011 09:36:29 -0400 Date: Wed, 14 Sep 2011 19:06:08 +0530 From: Amit Shah Message-ID: <20110914133608.GA4568@amit-x200.redhat.com> References: <6e1dec08756974efdcc495462e620249c53bd1b5.1315985199.git.amit.shah@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 1/3] virtio-serial-bus: add port arg to discard_vq_data() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu list , Juan Quintela On (Wed) 14 Sep 2011 [14:52:50], Markus Armbruster wrote: > Amit Shah writes: > > > To discard throttled data as well as maintain statistics of bytes > > received and discarded, discard_vq_data() will need the port associated > > with the vq. > > > > Signed-off-by: Amit Shah > > --- > > hw/virtio-serial-bus.c | 9 +++++---- > > 1 files changed, 5 insertions(+), 4 deletions(-) > > > > diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c > > index a4825b9..6838d73 100644 > > --- a/hw/virtio-serial-bus.c > > +++ b/hw/virtio-serial-bus.c > > @@ -114,7 +114,8 @@ static size_t write_to_port(VirtIOSerialPort *port, > > return offset; > > } > > > > -static void discard_vq_data(VirtQueue *vq, VirtIODevice *vdev) > > +static void discard_vq_data(VirtIOSerialPort *port, VirtQueue *vq, > > + VirtIODevice *vdev) > > { > > VirtQueueElement elem; > > > > Two of three callers pass port, port->ovq, &port->vser->vdev. Third one > isn't as obvious, but could be the same (didn't check thoroughly). > Makes me wonder whether parameters vq and vdev are really needed. Because port can be NULL (when a port has been hot-unplugged but guest continues to send data, or when a malicious guest sends data to a non-existent port). Amit