[scsi] Improve sense code parsing

Parse the sense data to extract the reponse code, the sense key, the
additional sense code, and the additional sense code qualifier.

Originally-implemented-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2014-06-02 02:17:28 +01:00
parent d630052e6f
commit e047811c85
5 changed files with 93 additions and 19 deletions
+2 -3
View File
@@ -551,7 +551,6 @@ static int fcpcmd_recv_rsp ( struct fcp_command *fcpcmd,
struct fcp_device *fcpdev = fcpcmd->fcpdev;
struct scsi_cmd *command = &fcpcmd->command;
struct fcp_rsp *rsp = iobuf->data;
struct scsi_sense *sense;
struct scsi_rsp response;
int rc;
@@ -607,8 +606,8 @@ static int fcpcmd_recv_rsp ( struct fcp_command *fcpcmd,
if ( rsp->flags & FCP_RSP_RESIDUAL_UNDERRUN )
response.overrun = -response.overrun;
}
if ( ( sense = fcp_rsp_sense_data ( rsp ) ) != NULL )
memcpy ( &response.sense, sense, sizeof ( response.sense ) );
scsi_parse_sense ( fcp_rsp_sense_data ( rsp ),
fcp_rsp_sense_data_len ( rsp ), &response.sense );
/* Free buffer before sending response, to minimise
* out-of-memory errors.