87abbec
From ba83805030e07cade8d17b5d1b4bd1d296caff1b Mon Sep 17 00:00:00 2001
87abbec
From: Paolo Bonzini <pbonzini@redhat.com>
87abbec
Date: Tue, 22 Aug 2017 09:31:36 +0200
87abbec
Subject: [PATCH 07/15] scsi: rename scsi_build_sense to scsi_convert_sense
87abbec
MIME-Version: 1.0
87abbec
Content-Type: text/plain; charset=UTF-8
87abbec
Content-Transfer-Encoding: 8bit
87abbec
87abbec
After introducing the scsi/ subdirectory, there will be a scsi_build_sense
87abbec
function that is the same as scsi_req_build_sense but without needing
87abbec
a SCSIRequest.  The existing scsi_build_sense function gets in the way,
87abbec
remove it.
87abbec
87abbec
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
87abbec
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
87abbec
---
87abbec
 hw/scsi/scsi-bus.c     | 10 +++++-----
87abbec
 hw/scsi/scsi-disk.c    |  4 ++--
87abbec
 include/hw/scsi/scsi.h |  4 ++--
87abbec
 3 files changed, 9 insertions(+), 9 deletions(-)
87abbec
87abbec
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
87abbec
index ade31c11f5..fac360e20f 100644
87abbec
--- a/hw/scsi/scsi-bus.c
87abbec
+++ b/hw/scsi/scsi-bus.c
87abbec
@@ -790,7 +790,7 @@ int scsi_req_get_sense(SCSIRequest *req, uint8_t *buf, int len)
87abbec
         return 0;
87abbec
     }
87abbec
 
87abbec
-    ret = scsi_build_sense(req->sense, req->sense_len, buf, len, true);
87abbec
+    ret = scsi_convert_sense(req->sense, req->sense_len, buf, len, true);
87abbec
 
87abbec
     /*
87abbec
      * FIXME: clearing unit attention conditions upon autosense should be done
87abbec
@@ -811,7 +811,7 @@ int scsi_req_get_sense(SCSIRequest *req, uint8_t *buf, int len)
87abbec
 
87abbec
 int scsi_device_get_sense(SCSIDevice *dev, uint8_t *buf, int len, bool fixed)
87abbec
 {
87abbec
-    return scsi_build_sense(dev->sense, dev->sense_len, buf, len, fixed);
87abbec
+    return scsi_convert_sense(dev->sense, dev->sense_len, buf, len, fixed);
87abbec
 }
87abbec
 
87abbec
 void scsi_req_build_sense(SCSIRequest *req, SCSISense sense)
87abbec
@@ -1531,12 +1531,12 @@ const struct SCSISense sense_code_SPACE_ALLOC_FAILED = {
87abbec
 };
87abbec
 
87abbec
 /*
87abbec
- * scsi_build_sense
87abbec
+ * scsi_convert_sense
87abbec
  *
87abbec
  * Convert between fixed and descriptor sense buffers
87abbec
  */
87abbec
-int scsi_build_sense(uint8_t *in_buf, int in_len,
87abbec
-                     uint8_t *buf, int len, bool fixed)
87abbec
+int scsi_convert_sense(uint8_t *in_buf, int in_len,
87abbec
+                       uint8_t *buf, int len, bool fixed)
87abbec
 {
87abbec
     bool fixed_in;
87abbec
     SCSISense sense;
87abbec
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
87abbec
index 5f1e5e8070..0a1f4ef0c7 100644
87abbec
--- a/hw/scsi/scsi-disk.c
87abbec
+++ b/hw/scsi/scsi-disk.c
87abbec
@@ -1978,8 +1978,8 @@ static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf)
87abbec
         break;
87abbec
     case REQUEST_SENSE:
87abbec
         /* Just return "NO SENSE".  */
87abbec
-        buflen = scsi_build_sense(NULL, 0, outbuf, r->buflen,
87abbec
-                                  (req->cmd.buf[1] & 1) == 0);
87abbec
+        buflen = scsi_convert_sense(NULL, 0, outbuf, r->buflen,
87abbec
+                                    (req->cmd.buf[1] & 1) == 0);
87abbec
         if (buflen < 0) {
87abbec
             goto illegal_request;
87abbec
         }
87abbec
diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
87abbec
index 6b85786dbf..6ef67fb504 100644
87abbec
--- a/include/hw/scsi/scsi.h
87abbec
+++ b/include/hw/scsi/scsi.h
87abbec
@@ -244,8 +244,8 @@ extern const struct SCSISense sense_code_SPACE_ALLOC_FAILED;
87abbec
 uint32_t scsi_data_cdb_xfer(uint8_t *buf);
87abbec
 uint32_t scsi_cdb_xfer(uint8_t *buf);
87abbec
 int scsi_cdb_length(uint8_t *buf);
87abbec
-int scsi_build_sense(uint8_t *in_buf, int in_len,
87abbec
-                     uint8_t *buf, int len, bool fixed);
87abbec
+int scsi_convert_sense(uint8_t *in_buf, int in_len,
87abbec
+                       uint8_t *buf, int len, bool fixed);
87abbec
 
87abbec
 SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, SCSIDevice *d,
87abbec
                             uint32_t tag, uint32_t lun, void *hba_private);
87abbec
-- 
87abbec
2.13.5
87abbec