[PATCH] REPORT SUPPORTED OPCODES: Only return opcodes supported by the backend.

Ronnie Sahlberg <[email protected]>
Newsgroups org.kernel.vger.stgt
Message-ID <[email protected]>
Signed-off-by: Ronnie Sahlberg <[email protected]>
---
 usr/spc.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/usr/spc.c b/usr/spc.c
index 88fdf7d..9faa705 100644
--- a/usr/spc.c
+++ b/usr/spc.c
@@ -739,6 +739,9 @@ static int report_opcodes_all(struct scsi_cmd *cmd, int rctd,
 		if (ops[i].cmd_perform == spc_illegal_op)
 			continue;
 
+		if (!is_bs_support_opcode(cmd->dev->bst, i))
+			continue;
+
 		/* this command does not take a service action, so just
 		   report the opcode
 		*/
@@ -826,6 +829,9 @@ static int report_opcode_one(struct scsi_cmd *cmd, int rctd, uint8_t opcode,
 
 	ops = cmd->dev->dev_type_template.ops;
 
+	if (!is_bs_support_opcode(cmd->dev->bst, opcode))
+		return SAM_STAT_CHECK_CONDITION;
+
 	if ((is_service_action && !ops[opcode].service_actions)
 	||  (!is_service_action && ops[opcode].service_actions)) {
 		return SAM_STAT_CHECK_CONDITION;
-- 
1.7.3.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.