mirror of
https://github.com/mii443/qemu.git
synced 2025-12-16 17:18:49 +00:00
scsi: provide general-purpose functions to manage sense data
Extract the common parts of scsi_sense_buf_to_errno, scsi_convert_sense
and scsi_target_send_command's REQUEST SENSE handling into two new
functions scsi_parse_sense_buf and scsi_build_sense_buf.
Fix a bug in scsi_target_send_command along the way; the length was
written in buf[10] rather than buf[7].
Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Fixes: b07fbce634 ("scsi-bus: correct responses for INQUIRY and REQUEST SENSE")
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
@@ -31,6 +31,9 @@ typedef struct SCSISense {
|
||||
} SCSISense;
|
||||
|
||||
int scsi_build_sense(uint8_t *buf, SCSISense sense);
|
||||
SCSISense scsi_parse_sense_buf(const uint8_t *in_buf, int in_len);
|
||||
int scsi_build_sense_buf(uint8_t *buf, size_t max_size, SCSISense sense,
|
||||
bool fixed_sense);
|
||||
|
||||
/*
|
||||
* Predefined sense codes
|
||||
|
||||
Reference in New Issue
Block a user