[stgt] [PATCH 1/2] Take 2: Implement smc INITIALIZE ELEMENT STATUS

Mark Harvey markh794 at gmail.com
Wed Aug 20 03:08:18 CEST 2008


Added test for SCSI RESERVATION.

Still implemented as a no-op.

(Attached patch due to gmail web mangling whitespaces).


commit de9949ce821ed1bca9d60e8d98ec806c3c80ec6b
Author: Mark Harvey <markh794 at gmail.com>
Date:   Wed Aug 20 10:48:57 2008 +1000

    Implement smc INITIALIZE ELEMENT STATUS op code as NO-OP

    Re-submit Richard Sharpe's patch in git format

    Added test for reservation.

    Reported-by: Richard Sharpe <realrichardsharpe at gmail.com>
    Signed-off-by: Mark Harvey <markh794 at gmail.com>

diff --git a/usr/smc.c b/usr/smc.c
index 9d7f681..e735deb 100644
--- a/usr/smc.c
+++ b/usr/smc.c
@@ -225,6 +225,24 @@ static int build_element_descriptors(uint8_t *data, struct
list_head *head,
 }

 /**
+ * smc_initialize_element_status - INITIALIZE ELEMENT STATUS op code
+ *
+ * Some backup libraries seem to require this.
+ *
+ * Support the SCSI op code INITIALIZE_ELEMENT_STATUS
+ * Ref: smc3r10a, 6.2
+ */
+static int smc_initialize_element_status(int host_no, struct scsi_cmd *cmd)
+{
+       scsi_set_in_resid_by_actual(cmd, 0);
+
+       if (device_reserved(cmd))
+               return SAM_STAT_RESERVATION_CONFLICT;
+       else
+               return SAM_STAT_GOOD;
+}
+
+/**
  * smc_read_element_status  -  READ ELEMENT STATUS op code
  *
  * Support the SCSI op code READ ELEMENT STATUS
@@ -748,7 +766,7 @@ struct device_type_template smc_template = {
                {spc_illegal_op,},
                {spc_illegal_op,},
                {spc_illegal_op,},
-               {spc_illegal_op,},
+               {smc_initialize_element_status,},

                {spc_illegal_op,},
                {spc_illegal_op,},
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Implement-smc-INITIALIZE-ELEMENT-STATUS-op-code-as-N.patch
Type: application/octet-stream
Size: 1497 bytes
Desc: not available
URL: <http://lists.wpkg.org/pipermail/stgt/attachments/20080820/4d9bb16e/attachment.obj>


More information about the stgt mailing list