[PATCH 1/3] Add new function sense_data_add_info() that can adds the info field to the sense buffer.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>
---
 usr/scsi.c |    8 ++++++++
 usr/tgtd.h |    1 +
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/usr/scsi.c b/usr/scsi.c
index 6f41b0b..18bfd7b 100644
--- a/usr/scsi.c
+++ b/usr/scsi.c
@@ -78,6 +78,14 @@ void sense_data_build(struct scsi_cmd *cmd, uint8_t key, uint16_t asc)
 	}
 }
 
+void sense_data_add_info(struct scsi_cmd *cmd, uint32_t info)
+{
+	uint32_t i = htonl(info);
+
+	cmd->sense_buffer[0] |= 0x80;
+	memcpy(cmd->sense_buffer + 3, &i, 4);
+}
+
 #define        TGT_INVALID_DEV_ID      ~0ULL
 
 static uint64_t __scsi_get_devid(uint8_t *p)
diff --git a/usr/tgtd.h b/usr/tgtd.h
index 662ce61..747db51 100644
--- a/usr/tgtd.h
+++ b/usr/tgtd.h
@@ -320,6 +320,7 @@ extern int lu_prevent_removal(struct scsi_lu *lu);
 extern uint64_t scsi_get_devid(int lid, uint8_t *pdu);
 extern int scsi_cmd_perform(int host_no, struct scsi_cmd *cmd);
 extern void sense_data_build(struct scsi_cmd *cmd, uint8_t key, uint16_t asc);
+extern void sense_data_add_info(struct scsi_cmd *cmd, uint32_t info);
 extern uint64_t scsi_rw_offset(uint8_t *scb);
 extern uint32_t scsi_rw_count(uint8_t *scb);
 extern int scsi_is_io_opcode(unsigned char op);
-- 
1.7.3.1

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux