qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: hch@lst.de
Subject: [Qemu-devel] [PATCH v4 14/24] scsi: introduce scsi_req_new
Date: Mon, 23 May 2011 18:08:59 +0200	[thread overview]
Message-ID: <1306166949-19698-15-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1306166949-19698-1-git-send-email-pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 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 777b598..608ad67 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 a6dc706..17c8968 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 36cb64c..2d66ef4 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 1375e82..c52e394 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -377,7 +377,7 @@ static int usb_msd_handle_data(USBDevice *dev, USBPacket *p)
                     s->tag, cbw.flags, cbw.cmd_len, s->data_len);
             s->residue = 0;
             s->scsi_len = 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.  */
-- 
1.7.4.4

  parent reply	other threads:[~2011-05-23 16:10 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23 16:08 [Qemu-devel] [PATCH v4 00/24] SCSI subsystem improvements Paolo Bonzini
2011-05-23 16:08 ` [Qemu-devel] [PATCH v4 01/24] scsi: add tracing of scsi requests Paolo Bonzini
2011-05-23 16:08 ` [Qemu-devel] [PATCH v4 02/24] scsi-generic: Remove bogus double complete Paolo Bonzini
2011-05-23 16:08 ` [Qemu-devel] [PATCH v4 03/24] scsi: introduce scsi_req_data Paolo Bonzini
2011-05-23 16:08 ` [Qemu-devel] [PATCH v4 04/24] scsi: introduce SCSIBusOps Paolo Bonzini
2011-05-23 19:35   ` Blue Swirl
2011-05-23 16:08 ` [Qemu-devel] [PATCH v4 05/24] scsi: reference-count requests Paolo Bonzini
2011-05-23 16:08 ` [Qemu-devel] [PATCH v4 06/24] lsi: extract lsi_find_by_tag Paolo Bonzini
2011-05-23 16:08 ` [Qemu-devel] [PATCH v4 07/24] scsi: Use 'SCSIRequest' directly Paolo Bonzini
2011-05-23 16:08 ` [Qemu-devel] [PATCH v4 08/24] scsi: commonize purging requests Paolo Bonzini
2011-05-23 16:08 ` [Qemu-devel] [PATCH v4 09/24] scsi: introduce scsi_req_abort Paolo Bonzini
2011-05-23 16:08 ` [Qemu-devel] [PATCH v4 10/24] scsi: introduce scsi_req_cancel Paolo Bonzini
2011-05-23 16:08 ` [Qemu-devel] [PATCH v4 11/24] scsi: use scsi_req_complete Paolo Bonzini
2011-05-23 16:08 ` [Qemu-devel] [PATCH v4 12/24] scsi: Update sense code handling Paolo Bonzini
2011-05-23 16:08 ` [Qemu-devel] [PATCH v4 13/24] scsi: do not call send_command directly Paolo Bonzini
2011-05-23 16:08 ` Paolo Bonzini [this message]
2011-05-23 16:09 ` [Qemu-devel] [PATCH v4 15/24] scsi: introduce scsi_req_continue Paolo Bonzini
2011-05-23 16:09 ` [Qemu-devel] [PATCH v4 16/24] scsi: introduce scsi_req_get_buf Paolo Bonzini
2011-05-23 16:09 ` [Qemu-devel] [PATCH v4 17/24] scsi: Implement 'get_sense' callback Paolo Bonzini
2011-05-23 16:09 ` [Qemu-devel] [PATCH v4 18/24] scsi-disk: add data direction checking Paolo Bonzini
2011-05-23 16:09 ` [Qemu-devel] [PATCH v4 19/24] scsi: make write_data return void Paolo Bonzini
2011-05-23 16:09 ` [Qemu-devel] [PATCH v4 20/24] scsi-generic: Handle queue full Paolo Bonzini
2011-05-23 16:09 ` [Qemu-devel] [PATCH v4 21/24] esp: rename sense to status Paolo Bonzini
2011-05-23 16:09 ` [Qemu-devel] [PATCH v4 22/24] scsi: split command_complete callback in two Paolo Bonzini
2011-05-23 19:38   ` Blue Swirl
2011-05-24  7:32     ` Paolo Bonzini
2011-05-23 16:09 ` [Qemu-devel] [PATCH v4 23/24] scsi: rename arguments to the new callbacks Paolo Bonzini
2011-05-23 16:09 ` [Qemu-devel] [PATCH v4 24/24] scsi: ignore LUN field in the CDB Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1306166949-19698-15-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=hch@lst.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).