mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-10 07:50:04 +00:00
scsi: target: Rename struct sense_info to sense_detail
This helps distinguish it from the SCSI sense INFORMATION field. Link: https://lore.kernel.org/r/20201031233211.5207-2-ddiss@suse.de Reviewed-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: David Disseldorp <ddiss@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
bba84aecca
commit
b455233dcc
@ -3094,14 +3094,14 @@ bool transport_wait_for_tasks(struct se_cmd *cmd)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(transport_wait_for_tasks);
|
EXPORT_SYMBOL(transport_wait_for_tasks);
|
||||||
|
|
||||||
struct sense_info {
|
struct sense_detail {
|
||||||
u8 key;
|
u8 key;
|
||||||
u8 asc;
|
u8 asc;
|
||||||
u8 ascq;
|
u8 ascq;
|
||||||
bool add_sector_info;
|
bool add_sector_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct sense_info sense_info_table[] = {
|
static const struct sense_detail sense_detail_table[] = {
|
||||||
[TCM_NO_SENSE] = {
|
[TCM_NO_SENSE] = {
|
||||||
.key = NOT_READY
|
.key = NOT_READY
|
||||||
},
|
},
|
||||||
@ -3261,39 +3261,39 @@ static const struct sense_info sense_info_table[] = {
|
|||||||
*/
|
*/
|
||||||
static void translate_sense_reason(struct se_cmd *cmd, sense_reason_t reason)
|
static void translate_sense_reason(struct se_cmd *cmd, sense_reason_t reason)
|
||||||
{
|
{
|
||||||
const struct sense_info *si;
|
const struct sense_detail *sd;
|
||||||
u8 *buffer = cmd->sense_buffer;
|
u8 *buffer = cmd->sense_buffer;
|
||||||
int r = (__force int)reason;
|
int r = (__force int)reason;
|
||||||
u8 key, asc, ascq;
|
u8 key, asc, ascq;
|
||||||
bool desc_format = target_sense_desc_format(cmd->se_dev);
|
bool desc_format = target_sense_desc_format(cmd->se_dev);
|
||||||
|
|
||||||
if (r < ARRAY_SIZE(sense_info_table) && sense_info_table[r].key)
|
if (r < ARRAY_SIZE(sense_detail_table) && sense_detail_table[r].key)
|
||||||
si = &sense_info_table[r];
|
sd = &sense_detail_table[r];
|
||||||
else
|
else
|
||||||
si = &sense_info_table[(__force int)
|
sd = &sense_detail_table[(__force int)
|
||||||
TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE];
|
TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE];
|
||||||
|
|
||||||
key = si->key;
|
key = sd->key;
|
||||||
if (reason == TCM_CHECK_CONDITION_UNIT_ATTENTION) {
|
if (reason == TCM_CHECK_CONDITION_UNIT_ATTENTION) {
|
||||||
if (!core_scsi3_ua_for_check_condition(cmd, &key, &asc,
|
if (!core_scsi3_ua_for_check_condition(cmd, &key, &asc,
|
||||||
&ascq)) {
|
&ascq)) {
|
||||||
cmd->scsi_status = SAM_STAT_BUSY;
|
cmd->scsi_status = SAM_STAT_BUSY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (si->asc == 0) {
|
} else if (sd->asc == 0) {
|
||||||
WARN_ON_ONCE(cmd->scsi_asc == 0);
|
WARN_ON_ONCE(cmd->scsi_asc == 0);
|
||||||
asc = cmd->scsi_asc;
|
asc = cmd->scsi_asc;
|
||||||
ascq = cmd->scsi_ascq;
|
ascq = cmd->scsi_ascq;
|
||||||
} else {
|
} else {
|
||||||
asc = si->asc;
|
asc = sd->asc;
|
||||||
ascq = si->ascq;
|
ascq = sd->ascq;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd->se_cmd_flags |= SCF_EMULATED_TASK_SENSE;
|
cmd->se_cmd_flags |= SCF_EMULATED_TASK_SENSE;
|
||||||
cmd->scsi_status = SAM_STAT_CHECK_CONDITION;
|
cmd->scsi_status = SAM_STAT_CHECK_CONDITION;
|
||||||
cmd->scsi_sense_length = TRANSPORT_SENSE_BUFFER;
|
cmd->scsi_sense_length = TRANSPORT_SENSE_BUFFER;
|
||||||
scsi_build_sense_buffer(desc_format, buffer, key, asc, ascq);
|
scsi_build_sense_buffer(desc_format, buffer, key, asc, ascq);
|
||||||
if (si->add_sector_info)
|
if (sd->add_sector_info)
|
||||||
WARN_ON_ONCE(scsi_set_sense_information(buffer,
|
WARN_ON_ONCE(scsi_set_sense_information(buffer,
|
||||||
cmd->scsi_sense_length,
|
cmd->scsi_sense_length,
|
||||||
cmd->bad_sector) < 0);
|
cmd->bad_sector) < 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user