In preparation for handling sense codes and their qualifiers as a single
16-bits sense code field, with the values defined as macros in
include/scsi/scsi_sense.h, modify the definition of the structures
scsi_failure and scsi_sense_hdr to introduce a 16-bits sense_code field
as a union with the existing 8-bits asc and ascq fields.
This temporary modification allows accessing either the asc and ascq
fields individually, or their combination as the 16-bits sense_code field.
The helper functions scsi_sense_asc(), scsi_sense_ascq() are defined to
allow accessing the 8-bits ASC and ASCQ values from the sense_code filed
of struct scsi_sense_hdr. The helper functions scsi_failure_asc() and
scsi_failure_ascq() provide the same for the sense code field of struct
scsi_failure.
The helper functions scsi_set_sense_buffer() and scsi_set_sense() are also
added to wrap calls to scsi_build_sense_buffer() and scsi_build_sense()
using a 16-bits sense code aregument instead of the 8-bits ASC and ASCQ
arguments.
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260908090308.1085097-1-dlemoal@kernel.org?part=5