Received: from eggs.gnu.org ([2001:4830:134:3::10]:43186) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WlFWe-0003pH-Jf for qemu-devel@nongnu.org; Fri, 16 May 2014 06:38:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WlFWU-0004Zx-Rb for qemu-devel@nongnu.org; Fri, 16 May 2014 06:38:04 -0400 Received: from mail-ee0-x235.google.com ([2a00:1450:4013:c00::235]:45970) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WlFWU-0004Zp-KW for qemu-devel@nongnu.org; Fri, 16 May 2014 06:37:54 -0400 Received: by mail-ee0-f53.google.com with SMTP id c13so1410902eek.40 for ; Fri, 16 May 2014 03:37:53 -0700 (PDT) Received: from playground.station (net-37-117-141-58.cust.vodafonedsl.it. [37.117.141.58]) by mx.google.com with ESMTPSA id s9sm19109582eew.5.2014.05.16.03.37.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 May 2014 03:37:52 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 16 May 2014 12:37:35 +0200 Message-Id: <1400236664-32334-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1400236664-32334-1-git-send-email-pbonzini@redhat.com> References: <1400236664-32334-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 02/11] scsi: Improve error messages more List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 --- hw/scsi/scsi-disk.c | 11 ++++++----- hw/scsi/scsi-generic.c | 8 ++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index d2e532e..4bcef55 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -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; } diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 8d92e0d..3733d2c 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -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) { -- 1.8.3.1