From patchwork Tue May 3 16:50:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 93852 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B6DD4B6F35 for ; Wed, 4 May 2011 02:54:52 +1000 (EST) Received: from localhost ([::1]:57179 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHIs6-0002AG-0b for incoming@patchwork.ozlabs.org; Tue, 03 May 2011 12:54:50 -0400 Received: from eggs.gnu.org ([140.186.70.92]:43047) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHIoG-0004Mj-8x for qemu-devel@nongnu.org; Tue, 03 May 2011 12:50:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QHIoF-0000Fo-Ao for qemu-devel@nongnu.org; Tue, 03 May 2011 12:50:52 -0400 Received: from mail-ww0-f41.google.com ([74.125.82.41]:49444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHIoF-0000Ec-5K for qemu-devel@nongnu.org; Tue, 03 May 2011 12:50:51 -0400 Received: by mail-ww0-f41.google.com with SMTP id 18so3445492wwi.4 for ; Tue, 03 May 2011 09:50:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:subject:date:message-id:x-mailer :in-reply-to:references; bh=3mBqTjFVW1Hc56vuAFRv8pIorLaZo2wrGzXzITfqCw0=; b=oQQCh/hUeqBvR4bGFhfPTi1LuuyoiTF7DupcPFd86noLWNLCegWyEsStnxCjzuB2xs APiyrPGgSS2f9mQxLnDPsXbCRDrZIjoxshhZBx/T21TSkmMANG1Fr0/fm/fCzzA9todW S8zsvMPX9wpDpTtEH//ou5H930Fx5GGCe9J5E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; b=gRvoAgeayx/9VvYfQgC5RacsZlhcOgaGxK5IrE1HcDvobmnMP6yL8REryU4r6/hcCs uX6y/Cq0uODDTvCFznyTmvPlgIU10jL1Gqo9j9BkGCfkbsP+N3ui3g8t59wSayNwSKp7 eajViLfE2oxC9q2lMQ51OPi2kHNlrPrvggfvs= Received: by 10.227.32.132 with SMTP id c4mr75446wbd.15.1304441450693; Tue, 03 May 2011 09:50:50 -0700 (PDT) Received: from localhost.localdomain (93-34-184-88.ip51.fastwebnet.it [93.34.184.88]) by mx.google.com with ESMTPS id bs4sm167243wbb.52.2011.05.03.09.50.49 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 May 2011 09:50:50 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 3 May 2011 18:50:26 +0200 Message-Id: <1304441432-27434-15-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1304441432-27434-1-git-send-email-pbonzini@redhat.com> References: <1304441432-27434-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.41 Subject: [Qemu-devel] [PATCH 14/20] scsi: introduce scsi_req_new X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Paolo Bonzini --- hw/esp.c | 2 +- hw/lsi53c895a.c | 3 +-- hw/scsi-bus.c | 5 +++++ hw/scsi.h | 1 + hw/spapr_vscsi.c | 2 +- hw/usb-msd.c | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/esp.c b/hw/esp.c index 3a65aed..ad364b5 100644 --- a/hw/esp.c +++ b/hw/esp.c @@ -244,7 +244,7 @@ static void do_busid_cmd(ESPState *s, uint8_t *buf, uint8_t busid) DPRINTF("do_busid_cmd: busid 0x%x\n", busid); lun = busid & 7; - s->current_req = s->current_dev->info->alloc_req(s->current_dev, 0, lun); + s->current_req = scsi_req_new(s->current_dev, 0, lun); datalen = scsi_req_enqueue(s->current_req, buf); s->ti_size = datalen; if (datalen != 0) { diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c index 0bc2d73..5319125 100644 --- a/hw/lsi53c895a.c +++ b/hw/lsi53c895a.c @@ -788,8 +788,7 @@ static void lsi_do_command(LSIState *s) assert(s->current == NULL); s->current = qemu_mallocz(sizeof(lsi_request)); s->current->tag = s->select_tag; - s->current->req = dev->info->alloc_req(dev, s->current->tag, - s->current_lun); + s->current->req = scsi_req_new(dev, s->current->tag, s->current_lun); n = scsi_req_enqueue(s->current->req, buf); if (n > 0) { diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c index e09906a..17bd961 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -146,6 +146,11 @@ SCSIRequest *scsi_req_alloc(size_t size, SCSIDevice *d, uint32_t tag, uint32_t l return req; } +SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun) +{ + return d->info->alloc_req(d, tag, lun); +} + int32_t scsi_req_enqueue(SCSIRequest *req, uint8_t *buf) { assert(!req->enqueued); diff --git a/hw/scsi.h b/hw/scsi.h index c36c5cc..e44c194 100644 --- a/hw/scsi.h +++ b/hw/scsi.h @@ -143,6 +143,7 @@ int scsi_build_sense(SCSISense sense, uint8_t *buf, int len, int fixed); int scsi_sense_valid(SCSISense sense); SCSIRequest *scsi_req_alloc(size_t size, SCSIDevice *d, uint32_t tag, uint32_t lun); +SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun); int32_t scsi_req_enqueue(SCSIRequest *req, uint8_t *buf); void scsi_req_free(SCSIRequest *req); SCSIRequest *scsi_req_ref(SCSIRequest *req); diff --git a/hw/spapr_vscsi.c b/hw/spapr_vscsi.c index 307a17f..1bb4bf4 100644 --- a/hw/spapr_vscsi.c +++ b/hw/spapr_vscsi.c @@ -653,7 +653,7 @@ static int vscsi_queue_cmd(VSCSIState *s, vscsi_req *req) req->sdev = sdev; req->lun = lun; - req->sreq = sdev->info->alloc_req(sdev, req->qtag, lun); + req->sreq = scsi_req_new(sdev, req->qtag, lun); n = scsi_req_enqueue(req->sreq, srp->cmd.cdb); dprintf("VSCSI: Queued command tag 0x%x CMD 0x%x ID %d LUN %d ret: %d\n", diff --git a/hw/usb-msd.c b/hw/usb-msd.c index e833809..f55aef8 100644 --- a/hw/usb-msd.c +++ b/hw/usb-msd.c @@ -376,7 +376,7 @@ static int usb_msd_handle_data(USBDevice *dev, USBPacket *p) DPRINTF("Command tag 0x%x flags %08x len %d data %d\n", s->tag, cbw.flags, cbw.cmd_len, s->data_len); s->residue = 0; - s->req = s->scsi_dev->info->alloc_req(s->scsi_dev, s->tag, 0); + s->req = scsi_req_new(s->scsi_dev, s->tag, 0); scsi_req_enqueue(s->req, cbw.cmd); /* ??? Should check that USB and SCSI data transfer directions match. */