diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2025-04-10 17:42:52 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2025-04-17 18:23:07 +0200 |
commit | 08b462dd9970a88d7f0e7c61ca48502463b0b78d (patch) | |
tree | c389dba57538c747448b0438916fc631e5c16b06 | |
parent | 8bdd3a0308ba8e8d20240ac06de8615959bcf00e (diff) | |
download | qemu-08b462dd9970a88d7f0e7c61ca48502463b0b78d.zip qemu-08b462dd9970a88d7f0e7c61ca48502463b0b78d.tar.gz qemu-08b462dd9970a88d7f0e7c61ca48502463b0b78d.tar.bz2 |
scsi: add conversion from ENODEV to sense
This is mostly for completeness; I noticed it because ENODEV is used internally
within scsi-disk.c, but when scsi_sense_from_errno(ENODEV) is called the resulting
sense is never used and instead scsi_sense_from_host_status() is called later
by scsi_req_complete_failed().
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | scsi/utils.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/scsi/utils.c b/scsi/utils.c index 357b036..545956f 100644 --- a/scsi/utils.c +++ b/scsi/utils.c @@ -587,20 +587,27 @@ int scsi_sense_from_errno(int errno_value, SCSISense *sense) return GOOD; case EDOM: return TASK_SET_FULL; +#if ENODEV != ENOMEDIUM + case ENODEV: + /* + * Some of the BSDs have ENODEV and ENOMEDIUM as synonyms. For + * everyone else, give a more severe sense code for ENODEV. + */ +#endif #ifdef CONFIG_LINUX /* These errno mapping are specific to Linux. For more information: * - scsi_check_sense and scsi_decide_disposition in drivers/scsi/scsi_error.c * - scsi_result_to_blk_status in drivers/scsi/scsi_lib.c * - blk_errors[] in block/blk-core.c */ + case EREMOTEIO: + *sense = SENSE_CODE(TARGET_FAILURE); + return CHECK_CONDITION; case EBADE: return RESERVATION_CONFLICT; case ENODATA: *sense = SENSE_CODE(READ_ERROR); return CHECK_CONDITION; - case EREMOTEIO: - *sense = SENSE_CODE(TARGET_FAILURE); - return CHECK_CONDITION; #endif case ENOMEDIUM: *sense = SENSE_CODE(NO_MEDIUM); |