mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
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>
This commit is contained in:
parent
8bdd3a0308
commit
08b462dd99
1 changed files with 10 additions and 3 deletions
13
scsi/utils.c
13
scsi/utils.c
|
@ -587,20 +587,27 @@ int scsi_sense_from_errno(int errno_value, SCSISense *sense)
|
||||||
return GOOD;
|
return GOOD;
|
||||||
case EDOM:
|
case EDOM:
|
||||||
return TASK_SET_FULL;
|
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
|
#ifdef CONFIG_LINUX
|
||||||
/* These errno mapping are specific to Linux. For more information:
|
/* These errno mapping are specific to Linux. For more information:
|
||||||
* - scsi_check_sense and scsi_decide_disposition in drivers/scsi/scsi_error.c
|
* - scsi_check_sense and scsi_decide_disposition in drivers/scsi/scsi_error.c
|
||||||
* - scsi_result_to_blk_status in drivers/scsi/scsi_lib.c
|
* - scsi_result_to_blk_status in drivers/scsi/scsi_lib.c
|
||||||
* - blk_errors[] in block/blk-core.c
|
* - blk_errors[] in block/blk-core.c
|
||||||
*/
|
*/
|
||||||
|
case EREMOTEIO:
|
||||||
|
*sense = SENSE_CODE(TARGET_FAILURE);
|
||||||
|
return CHECK_CONDITION;
|
||||||
case EBADE:
|
case EBADE:
|
||||||
return RESERVATION_CONFLICT;
|
return RESERVATION_CONFLICT;
|
||||||
case ENODATA:
|
case ENODATA:
|
||||||
*sense = SENSE_CODE(READ_ERROR);
|
*sense = SENSE_CODE(READ_ERROR);
|
||||||
return CHECK_CONDITION;
|
return CHECK_CONDITION;
|
||||||
case EREMOTEIO:
|
|
||||||
*sense = SENSE_CODE(TARGET_FAILURE);
|
|
||||||
return CHECK_CONDITION;
|
|
||||||
#endif
|
#endif
|
||||||
case ENOMEDIUM:
|
case ENOMEDIUM:
|
||||||
*sense = SENSE_CODE(NO_MEDIUM);
|
*sense = SENSE_CODE(NO_MEDIUM);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue