|
@@ -704,6 +704,24 @@ static unsigned char *transport_get_sense_buffer(struct se_cmd *cmd)
|
|
return cmd->sense_buffer;
|
|
return cmd->sense_buffer;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void transport_copy_sense_to_cmd(struct se_cmd *cmd, unsigned char *sense)
|
|
|
|
+{
|
|
|
|
+ unsigned char *cmd_sense_buf;
|
|
|
|
+ unsigned long flags;
|
|
|
|
+
|
|
|
|
+ spin_lock_irqsave(&cmd->t_state_lock, flags);
|
|
|
|
+ cmd_sense_buf = transport_get_sense_buffer(cmd);
|
|
|
|
+ if (!cmd_sense_buf) {
|
|
|
|
+ spin_unlock_irqrestore(&cmd->t_state_lock, flags);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ cmd->se_cmd_flags |= SCF_TRANSPORT_TASK_SENSE;
|
|
|
|
+ memcpy(cmd_sense_buf, sense, cmd->scsi_sense_length);
|
|
|
|
+ spin_unlock_irqrestore(&cmd->t_state_lock, flags);
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL(transport_copy_sense_to_cmd);
|
|
|
|
+
|
|
void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status)
|
|
void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status)
|
|
{
|
|
{
|
|
struct se_device *dev = cmd->se_dev;
|
|
struct se_device *dev = cmd->se_dev;
|