]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[SCSI] scsi_transport_iscsi: export iscsi class session's target_id in sysfs.
authorManish Rangankar <manish.rangankar@qlogic.com>
Fri, 23 Nov 2012 11:58:41 +0000 (06:58 -0500)
committerJames Bottomley <JBottomley@Parallels.com>
Tue, 29 Jan 2013 02:55:07 +0000 (13:55 +1100)
Signed-off-by: Manish Rangankar <manish.rangankar@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/scsi_transport_iscsi.c

index 31969f2e13ceff07e2304dd0cca84b27c655fa22..dac7f8d144942819336bf64cd1f87037a82104cd 100644 (file)
@@ -2503,6 +2503,15 @@ show_priv_session_creator(struct device *dev, struct device_attribute *attr,
 }
 static ISCSI_CLASS_ATTR(priv_sess, creator, S_IRUGO, show_priv_session_creator,
                        NULL);
+static ssize_t
+show_priv_session_target_id(struct device *dev, struct device_attribute *attr,
+                           char *buf)
+{
+       struct iscsi_cls_session *session = iscsi_dev_to_session(dev->parent);
+       return sprintf(buf, "%d\n", session->target_id);
+}
+static ISCSI_CLASS_ATTR(priv_sess, target_id, S_IRUGO,
+                       show_priv_session_target_id, NULL);
 
 #define iscsi_priv_session_attr_show(field, format)                    \
 static ssize_t                                                         \
@@ -2575,6 +2584,7 @@ static struct attribute *iscsi_session_attrs[] = {
        &dev_attr_priv_sess_creator.attr,
        &dev_attr_sess_chap_out_idx.attr,
        &dev_attr_sess_chap_in_idx.attr,
+       &dev_attr_priv_sess_target_id.attr,
        NULL,
 };
 
@@ -2638,6 +2648,8 @@ static umode_t iscsi_session_attr_is_visible(struct kobject *kobj,
                return S_IRUGO;
        else if (attr == &dev_attr_priv_sess_creator.attr)
                return S_IRUGO;
+       else if (attr == &dev_attr_priv_sess_target_id.attr)
+               return S_IRUGO;
        else {
                WARN_ONCE(1, "Invalid session attr");
                return 0;