scsi: introduce sg_io_sense_from_errno

Move more knowledge of SG_IO out of hw/scsi/scsi-generic.c, for
reusability.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2017-08-22 09:43:14 +02:00
parent a3760467c6
commit 1ead6b4e24
3 changed files with 46 additions and 34 deletions

View file

@ -116,6 +116,9 @@ int scsi_cdb_length(uint8_t *buf);
#define SG_ERR_DID_TIME_OUT 0x03
#define SG_ERR_DRIVER_SENSE 0x08
int sg_io_sense_from_errno(int errno_value, struct sg_io_hdr *io_hdr,
SCSISense *sense);
#endif
#endif