mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
scsi: inline sg_io_sense_from_errno() into the callers.
Currently sg_io_sense_from_errno() converts the two input parameters 'errno' and 'io_hdr' into sense code and SCSI status. Having split the function off into scsi_sense_from_errno() and scsi_sense_from_host_status(), both of which are available generically, we now inline the logic in the callers so that scsi-disk and scsi-generic will be able to pass host_status to the HBA. Signed-off-by: Hannes Reinecke <hare@suse.de> Message-Id: <20201116184041.60465-7-hare@suse.de> [Put together from "scsi-disk: Add sg_io callback to evaluate status" and what remains of "scsi: split sg_io_sense_from_errno() in two functions", with many other fixes. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
9738c65720
commit
a108557bbf
5 changed files with 75 additions and 44 deletions
23
scsi/utils.c
23
scsi/utils.c
|
@ -658,26 +658,3 @@ int scsi_sense_from_host_status(uint8_t host_status,
|
|||
}
|
||||
return GOOD;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LINUX
|
||||
int sg_io_sense_from_errno(int errno_value, struct sg_io_hdr *io_hdr,
|
||||
SCSISense *sense)
|
||||
{
|
||||
if (errno_value != 0) {
|
||||
return scsi_sense_from_errno(errno_value, sense);
|
||||
} else {
|
||||
int status = scsi_sense_from_host_status(io_hdr->host_status, sense);
|
||||
if (status) {
|
||||
return status;
|
||||
} else if (io_hdr->driver_status & SG_ERR_DRIVER_TIMEOUT) {
|
||||
return BUSY;
|
||||
} else if (io_hdr->status) {
|
||||
return io_hdr->status;
|
||||
} else if (io_hdr->driver_status & SG_ERR_DRIVER_SENSE) {
|
||||
return CHECK_CONDITION;
|
||||
} else {
|
||||
return GOOD;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue