[PATCH 2/3] Switch SSC to use the new sense_data_add_info() helper.

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

 



Signed-off-by: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>
---
 usr/bs_ssc.c |   17 ++++-------------
 1 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/usr/bs_ssc.c b/usr/bs_ssc.c
index 93d08a6..16671c3 100644
--- a/usr/bs_ssc.c
+++ b/usr/bs_ssc.c
@@ -45,15 +45,12 @@
 #define SENSE_ILI	0X20
 
 static void ssc_sense_data_build(struct scsi_cmd *cmd, uint8_t key,
-				 uint16_t asc, uint8_t *info, int info_len)
+				 uint16_t asc, uint32_t info)
 {
 	/* TODO: support descriptor format */
 
 	sense_data_build(cmd, key, asc);
-	if (info_len) {
-		memcpy(cmd->sense_buffer + 3, info, 4);
-		cmd->sense_buffer[0] |= 0x80;
-	}
+	sense_data_add_info(cmd, info);
 }
 
 static inline uint32_t ssc_get_block_length(struct scsi_lu *lu)
@@ -317,10 +314,6 @@ static int resp_var_read(struct scsi_cmd *cmd, uint8_t *buf, uint32_t length,
 	*transferred = 0;
 
 	if (length != h->blk_sz) {
-		uint8_t info[4];
-		int val = length - h->blk_sz;
-
-		put_unaligned_be32(val, info);
 
 		if (h->blk_type == BLK_EOD)
 			sense_data_build(cmd, 0x40 | BLANK_CHECK,
@@ -328,7 +321,7 @@ static int resp_var_read(struct scsi_cmd *cmd, uint8_t *buf, uint32_t length,
 		else
 			ssc_sense_data_build(cmd, NO_SENSE | 0x20,
 					     NO_ADDITIONAL_SENSE,
-					     info, sizeof(info));
+					     length - h->blk_sz);
 
 		if (length > h->blk_sz)
 			scsi_set_in_resid_by_actual(cmd, length - h->blk_sz);
@@ -377,12 +370,10 @@ static int resp_fixed_read(struct scsi_cmd *cmd, uint8_t *buf, uint32_t length,
 
 	for (i = 0; i < count; i++) {
 		if (h->blk_type == BLK_FILEMARK) {
-			uint8_t info[4];
 
 			eprintf("Oops - found filemark\n");
-			put_unaligned_be32(count - i, info);
 			ssc_sense_data_build(cmd, NO_SENSE | SENSE_FILEMARK,
-					     ASC_MARK, info, sizeof(info));
+					     ASC_MARK, count - i);
 			skip_next_header(cmd->dev);
 			result = SAM_STAT_CHECK_CONDITION;
 			goto out;
-- 
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