File 0166-scsi-replace-hex-constants-with-def.patch of Package qemu.20395
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Mon, 27 Nov 2017 13:45:59 +0100
Subject: scsi: replace hex constants with #defines
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Sense keys have nice #defines in scsi/constants.h, use them.
Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 9661e208f8cc94f66176db6f069a0f8adef9478d)
[LM: BSC#1154790]
Signed-off-by: Lin Ma <lma@suse.com>
---
scsi/utils.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/scsi/utils.c b/scsi/utils.c
index 61bc1a8e2b44bc924391e754ecab..ddae650a999e3bfc73a8fcc12bda 100644
--- a/scsi/utils.c
+++ b/scsi/utils.c
@@ -339,16 +339,16 @@ int scsi_convert_sense(uint8_t *in_buf, int in_len,
int scsi_sense_to_errno(int key, int asc, int ascq)
{
switch (key) {
- case 0x00: /* NO SENSE */
- case 0x01: /* RECOVERED ERROR */
- case 0x06: /* UNIT ATTENTION */
+ case NO_SENSE:
+ case RECOVERED_ERROR:
+ case UNIT_ATTENTION:
/* These sense keys are not errors */
return 0;
- case 0x0b: /* COMMAND ABORTED */
+ case ABORTED_COMMAND: /* COMMAND ABORTED */
return ECANCELED;
- case 0x02: /* NOT READY */
- case 0x05: /* ILLEGAL REQUEST */
- case 0x07: /* DATA PROTECTION */
+ case NOT_READY:
+ case ILLEGAL_REQUEST:
+ case DATA_PROTECT:
/* Parse ASCQ */
break;
default: