[PATCH 1/4] tgt: Add ua_sense_add_it_nexus function

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

 



Add function to allow setting of unit attention on the nexus_id and
logical unit provided.

Signed-off-by: Mike Anderson <andmike@xxxxxxxxxxxxxxxxxx>
---
 usr/target.c |   27 +++++++++++++++++++++++++++
 usr/tgtd.h   |    2 ++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/usr/target.c b/usr/target.c
index 49c241d..79798ad 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -234,6 +234,33 @@ void ua_sense_add_other_it_nexus(uint64_t itn_id, struct scsi_lu *lu,
 	}
 }
 
+void ua_sense_add_it_nexus(uint64_t itn_id, struct scsi_lu *lu,
+				 uint16_t asc)
+{
+	struct it_nexus *itn;
+	struct it_nexus_lu_info *itn_lu;
+	int ret;
+
+	list_for_each_entry(itn, &lu->tgt->it_nexus_list, nexus_siblings) {
+
+		if (itn->itn_id == itn_id) {
+			list_for_each_entry(itn_lu, &itn->it_nexus_lu_info_list,
+					    lu_info_siblings) {
+
+				if (itn_lu->lu == lu) {
+					ret = ua_sense_add(itn_lu, asc);
+					if (ret)
+						eprintf("fail to add ua %"
+							PRIu64 " %" PRIu64
+							"\n", lu->lun, itn_id);
+					break;
+				}
+			}
+			break;
+		}
+	}
+}
+
 int it_nexus_create(int tid, uint64_t itn_id, int host_no, char *info)
 {
 	int i, ret;
diff --git a/usr/tgtd.h b/usr/tgtd.h
index 69386e2..3a328e6 100644
--- a/usr/tgtd.h
+++ b/usr/tgtd.h
@@ -282,6 +282,8 @@ extern int ua_sense_del(struct scsi_cmd *cmd, int del);
 extern void ua_sense_clear(struct it_nexus_lu_info *itn_lu, uint16_t asc);
 extern void ua_sense_add_other_it_nexus(uint64_t itn_id, struct scsi_lu *lu,
 					uint16_t asc);
+extern void ua_sense_add_it_nexus(uint64_t itn_id, struct scsi_lu *lu,
+					uint16_t asc);
 
 extern uint64_t scsi_get_devid(int lid, uint8_t *pdu);
 extern int scsi_cmd_perform(int host_no, struct scsi_cmd *cmd);
-- 
1.7.2.3

--
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