scsi: replace hex constants with #defines

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>
This commit is contained in:
Paolo Bonzini 2017-11-27 13:45:59 +01:00
parent f68d98b21f
commit 9661e208f8

View file

@ -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) int scsi_sense_to_errno(int key, int asc, int ascq)
{ {
switch (key) { switch (key) {
case 0x00: /* NO SENSE */ case NO_SENSE:
case 0x01: /* RECOVERED ERROR */ case RECOVERED_ERROR:
case 0x06: /* UNIT ATTENTION */ case UNIT_ATTENTION:
/* These sense keys are not errors */ /* These sense keys are not errors */
return 0; return 0;
case 0x0b: /* COMMAND ABORTED */ case ABORTED_COMMAND: /* COMMAND ABORTED */
return ECANCELED; return ECANCELED;
case 0x02: /* NOT READY */ case NOT_READY:
case 0x05: /* ILLEGAL REQUEST */ case ILLEGAL_REQUEST:
case 0x07: /* DATA PROTECTION */ case DATA_PROTECT:
/* Parse ASCQ */ /* Parse ASCQ */
break; break;
default: default: