lib: parse Information sense descriptor type

The Information descriptor type is defined in SPC-5 (r17 4.4.2.2) and
may be used to provide the data offset on COMPARE_AND_WRITE miscompare.

Signed-off-by: David Disseldorp <ddiss@suse.de>
This commit is contained in:
David Disseldorp
2020-10-14 20:43:11 +02:00
parent 02b9b01fa1
commit 6eb4b7b6e5
2 changed files with 9 additions and 0 deletions

View File

@@ -281,8 +281,10 @@ struct scsi_sense {
unsigned sense_specific:1;
unsigned ill_param_in_cdb:1;
unsigned bit_pointer_valid:1;
unsigned info_valid:1;
unsigned char bit_pointer;
uint16_t field_pointer;
uint64_t information;
};
struct scsi_data {

View File

@@ -330,6 +330,13 @@ static void parse_sense_descriptors(struct scsi_sense *sense, const uint8_t *sb,
if (addl_len < 4)
break;
switch (p[0]) {
case 0:
/* Information descriptor with VALID flag */
if (addl_len == 0x0a && p[2] & 0x80) {
sense->info_valid = 1;
sense->information = scsi_get_uint64(p + 4);
}
break;
case 2:
/* Sense key specific sense data descriptor */
if (addl_len == 0x06)