scsi: introduce scsi_sense_from_errno()

The new function is an extension of the switch statement in scsi-disk.c
which also includes the errno cases only found in sg_io_sense_from_errno.
This allows us to consolidate the errno handling.

Extracted from a patch by Hannes Reinecke <hare@suse.de>.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini
2021-02-24 16:30:09 +01:00
parent 424740def9
commit d7a84021db
3 changed files with 51 additions and 47 deletions

View File

@ -135,4 +135,6 @@ int sg_io_sense_from_errno(int errno_value, struct sg_io_hdr *io_hdr,
SCSISense *sense);
#endif
int scsi_sense_from_errno(int errno_value, SCSISense *sense);
#endif