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

Ronnie Sahlberg ronniesahlberg at gmail.com
Fri Dec 7 05:01:03 CET 2012


Signed-off-by: Ronnie Sahlberg <ronniesahlberg at gmail.com>
---
 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 at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list