]> Git Repo - qemu.git/commitdiff
scsi: Improve error messages more
authorPaolo Bonzini <[email protected]>
Mon, 28 Apr 2014 10:14:57 +0000 (12:14 +0200)
committerPaolo Bonzini <[email protected]>
Mon, 28 Apr 2014 11:38:00 +0000 (13:38 +0200)
Remove the "scsi-block:" prefix for error messages as suggested
by Markus.

Improve the previous patch by making the message the same for both
scsi-block and scsi-generic, including the strerror() output in both
and making an explicit reference to SG_IO.  Also s/can not/cannot/.

Signed-off-by: Paolo Bonzini <[email protected]>
hw/scsi/scsi-disk.c
hw/scsi/scsi-generic.c

index d2e532e0ee9f6f7d9eef0cf1939dbdb66cb15756..4bcef551a62eb425edc52034d2ee9c993c1ac571 100644 (file)
@@ -2458,26 +2458,27 @@ static int scsi_block_initfn(SCSIDevice *dev)
     int rc;
 
     if (!s->qdev.conf.bs) {
-        error_report("scsi-block: drive property not set");
+        error_report("drive property not set");
         return -1;
     }
 
     /* check we are using a driver managing SG_IO (version 3 and after) */
-    rc =  bdrv_ioctl(s->qdev.conf.bs, SG_GET_VERSION_NUM, &sg_version);
+    rc = bdrv_ioctl(s->qdev.conf.bs, SG_GET_VERSION_NUM, &sg_version);
     if (rc < 0) {
-        error_report("scsi-block: can not get version number: %s",
+        error_report("cannot get SG_IO version number: %s.  "
+                     "Is this a SCSI device?",
                      strerror(-rc));
         return -1;
     }
     if (sg_version < 30000) {
-        error_report("scsi-block: scsi generic interface too old");
+        error_report("scsi generic interface too old");
         return -1;
     }
 
     /* get device type from INQUIRY data */
     rc = get_device_type(s);
     if (rc < 0) {
-        error_report("scsi-block: INQUIRY failed");
+        error_report("INQUIRY failed");
         return -1;
     }
 
index 8d92e0da1596fd8e13d8c8dd077306c905519ba0..3733d2c36c85b7fbb754d72d09b4522e57aa1db4 100644 (file)
@@ -394,6 +394,7 @@ static void scsi_destroy(SCSIDevice *s)
 
 static int scsi_generic_initfn(SCSIDevice *s)
 {
+    int rc;
     int sg_version;
     struct sg_scsi_id scsiid;
 
@@ -412,8 +413,11 @@ static int scsi_generic_initfn(SCSIDevice *s)
     }
 
     /* check we are using a driver managing SG_IO (version 3 and after */
-    if (bdrv_ioctl(s->conf.bs, SG_GET_VERSION_NUM, &sg_version) < 0) {
-        error_report("scsi generic interface not supported");
+    rc = bdrv_ioctl(s->conf.bs, SG_GET_VERSION_NUM, &sg_version);
+    if (rc < 0) {
+        error_report("cannot get SG_IO version number: %s.  "
+                     "Is this a SCSI device?",
+                     strerror(-rc));
         return -1;
     }
     if (sg_version < 30000) {
This page took 0.031265 seconds and 4 git commands to generate.