Received: from eggs.gnu.org ([208.118.235.92]:47485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxCuI-0000gD-T2 for qemu-devel@nongnu.org; Fri, 03 Aug 2012 04:06:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SxCuC-000729-Vm for qemu-devel@nongnu.org; Fri, 03 Aug 2012 04:06:50 -0400 Received: from mail-gh0-f173.google.com ([209.85.160.173]:61078) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxCuC-0006kT-Qr for qemu-devel@nongnu.org; Fri, 03 Aug 2012 04:06:44 -0400 Received: by mail-gh0-f173.google.com with SMTP id r14so497947ghr.4 for ; Fri, 03 Aug 2012 01:06:44 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 3 Aug 2012 10:06:14 +0200 Message-Id: <1343981180-23817-5-git-send-email-pbonzini@redhat.com> In-Reply-To: <1343981180-23817-1-git-send-email-pbonzini@redhat.com> References: <1343981180-23817-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 04/10] scsi-disk: fix compilation with DEBUG_SCSI List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Reported-by: Gerhard Wiesinger Signed-off-by: Paolo Bonzini --- hw/scsi-disk.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index e2ec177..a9c7279 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -447,7 +447,7 @@ static void scsi_write_complete(void * opaque, int ret) return; } else { scsi_init_iovec(r, SCSI_DMA_BUF_SIZE); - DPRINTF("Write complete tag=0x%x more=%d\n", r->req.tag, r->qiov.size); + DPRINTF("Write complete tag=0x%x more=%zd\n", r->req.tag, r->qiov.size); scsi_req_data(&r->req, r->qiov.size); } @@ -1277,7 +1277,7 @@ static void scsi_disk_emulate_read_data(SCSIRequest *req) int buflen = r->iov.iov_len; if (buflen) { - DPRINTF("Read buf_len=%zd\n", buflen); + DPRINTF("Read buf_len=%d\n", buflen); r->iov.iov_len = 0; r->started = true; scsi_req_data(&r->req, buflen); @@ -1455,7 +1455,7 @@ static void scsi_disk_emulate_write_data(SCSIRequest *req) if (r->iov.iov_len) { int buflen = r->iov.iov_len; - DPRINTF("Write buf_len=%zd\n", buflen); + DPRINTF("Write buf_len=%d\n", buflen); r->iov.iov_len = 0; scsi_req_data(&r->req, buflen); return; @@ -2093,23 +2093,24 @@ static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun, const SCSIReqOps *ops; uint8_t command; + command = buf[0]; + ops = scsi_disk_reqops_dispatch[command]; + if (!ops) { + ops = &scsi_disk_emulate_reqops; + } + req = scsi_req_alloc(ops, &s->qdev, tag, lun, hba_private); + #ifdef DEBUG_SCSI - DPRINTF("Command: lun=%d tag=0x%x data=0x%02x", lun, buf[0]); + DPRINTF("Command: lun=%d tag=0x%x data=0x%02x", lun, tag, buf[0]); { int i; - for (i = 1; i < r->req.cmd.len; i++) { + for (i = 1; i < req->cmd.len; i++) { printf(" 0x%02x", buf[i]); } printf("\n"); } #endif - command = buf[0]; - ops = scsi_disk_reqops_dispatch[command]; - if (!ops) { - ops = &scsi_disk_emulate_reqops; - } - req = scsi_req_alloc(ops, &s->qdev, tag, lun, hba_private); return req; } -- 1.7.10.4