From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrQOQ-0003VU-0F for qemu-devel@nongnu.org; Wed, 28 Oct 2015 09:03:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZrQOL-0007pQ-7v for qemu-devel@nongnu.org; Wed, 28 Oct 2015 09:03:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51261) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrQOL-0007pJ-2I for qemu-devel@nongnu.org; Wed, 28 Oct 2015 09:03:49 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id AB17BA2C30 for ; Wed, 28 Oct 2015 13:03:48 +0000 (UTC) Date: Wed, 28 Oct 2015 14:03:46 +0100 From: Igor Mammedov Message-ID: <20151028140346.711b28c1@nial.brq.redhat.com> In-Reply-To: <1445935663-31971-6-git-send-email-mst@redhat.com> References: <1445935663-31971-1-git-send-email-mst@redhat.com> <1445935663-31971-6-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 5/6] virtio-scsi: convert to virtqueue_map List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Paolo Bonzini , qemu-devel@nongnu.org On Tue, 27 Oct 2015 10:48:06 +0200 "Michael S. Tsirkin" wrote: > Note: virtqueue_map already validates input > so virtio-scsi does not have to. > > Signed-off-by: Michael S. Tsirkin Reviewed-by: Igor Mammedov > --- > hw/scsi/virtio-scsi.c | 16 ++-------------- > 1 file changed, 2 insertions(+), 14 deletions(-) > > diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c > index 1c33f14..33bd25a 100644 > --- a/hw/scsi/virtio-scsi.c > +++ b/hw/scsi/virtio-scsi.c > @@ -207,20 +207,8 @@ static void *virtio_scsi_load_request(QEMUFile *f, SCSIRequest *sreq) > assert(n < vs->conf.num_queues); > req = virtio_scsi_init_req(s, vs->cmd_vqs[n]); > qemu_get_buffer(f, (unsigned char *)&req->elem, sizeof(req->elem)); > - /* TODO: add a way for SCSIBusInfo's load_request to fail, > - * and fail migration instead of asserting here. > - * When we do, we might be able to re-enable NDEBUG below. > - */ > -#ifdef NDEBUG > -#error building with NDEBUG is not supported > -#endif > - assert(req->elem.in_num <= ARRAY_SIZE(req->elem.in_sg)); > - assert(req->elem.out_num <= ARRAY_SIZE(req->elem.out_sg)); > - > - virtqueue_map_sg(req->elem.in_sg, req->elem.in_addr, > - req->elem.in_num, 1); > - virtqueue_map_sg(req->elem.out_sg, req->elem.out_addr, > - req->elem.out_num, 0); > + > + virtqueue_map(&req->elem); > > if (virtio_scsi_parse_req(req, sizeof(VirtIOSCSICmdReq) + vs->cdb_size, > sizeof(VirtIOSCSICmdResp) + vs->sense_size) < 0) {