diff options
author | Manish Rangankar <manish.rangankar@qlogic.com> | 2012-11-23 06:58:41 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-01-28 21:55:07 -0500 |
commit | 930a9f046cfc68ae239f7e411179c1f7ced9d987 (patch) | |
tree | adfd280c9a9ef695a8e3dba432ae155a76e99416 /drivers/scsi/scsi_transport_iscsi.c | |
parent | 3dd4849c257af317cd33bcecf7d17b75dabf7540 (diff) |
[SCSI] scsi_transport_iscsi: export iscsi class session's target_id in sysfs.
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>
Diffstat (limited to 'drivers/scsi/scsi_transport_iscsi.c')
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 31969f2e13ce..dac7f8d14494 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -2503,6 +2503,15 @@ show_priv_session_creator(struct device *dev, struct device_attribute *attr, | |||
2503 | } | 2503 | } |
2504 | static ISCSI_CLASS_ATTR(priv_sess, creator, S_IRUGO, show_priv_session_creator, | 2504 | static ISCSI_CLASS_ATTR(priv_sess, creator, S_IRUGO, show_priv_session_creator, |
2505 | NULL); | 2505 | NULL); |
2506 | static ssize_t | ||
2507 | show_priv_session_target_id(struct device *dev, struct device_attribute *attr, | ||
2508 | char *buf) | ||
2509 | { | ||
2510 | struct iscsi_cls_session *session = iscsi_dev_to_session(dev->parent); | ||
2511 | return sprintf(buf, "%d\n", session->target_id); | ||
2512 | } | ||
2513 | static ISCSI_CLASS_ATTR(priv_sess, target_id, S_IRUGO, | ||
2514 | show_priv_session_target_id, NULL); | ||
2506 | 2515 | ||
2507 | #define iscsi_priv_session_attr_show(field, format) \ | 2516 | #define iscsi_priv_session_attr_show(field, format) \ |
2508 | static ssize_t \ | 2517 | static ssize_t \ |
@@ -2575,6 +2584,7 @@ static struct attribute *iscsi_session_attrs[] = { | |||
2575 | &dev_attr_priv_sess_creator.attr, | 2584 | &dev_attr_priv_sess_creator.attr, |
2576 | &dev_attr_sess_chap_out_idx.attr, | 2585 | &dev_attr_sess_chap_out_idx.attr, |
2577 | &dev_attr_sess_chap_in_idx.attr, | 2586 | &dev_attr_sess_chap_in_idx.attr, |
2587 | &dev_attr_priv_sess_target_id.attr, | ||
2578 | NULL, | 2588 | NULL, |
2579 | }; | 2589 | }; |
2580 | 2590 | ||
@@ -2638,6 +2648,8 @@ static umode_t iscsi_session_attr_is_visible(struct kobject *kobj, | |||
2638 | return S_IRUGO; | 2648 | return S_IRUGO; |
2639 | else if (attr == &dev_attr_priv_sess_creator.attr) | 2649 | else if (attr == &dev_attr_priv_sess_creator.attr) |
2640 | return S_IRUGO; | 2650 | return S_IRUGO; |
2651 | else if (attr == &dev_attr_priv_sess_target_id.attr) | ||
2652 | return S_IRUGO; | ||
2641 | else { | 2653 | else { |
2642 | WARN_ONCE(1, "Invalid session attr"); | 2654 | WARN_ONCE(1, "Invalid session attr"); |
2643 | return 0; | 2655 | return 0; |