diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2007-05-30 21:57:08 +0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-06-01 20:02:51 +0400 |
commit | 1819dc8143eff2a5850af274bcf8bcbc3e73ec76 (patch) | |
tree | c185162d0d340432926b086cc0946e8a9e76e025 /drivers | |
parent | 239a7dc2fea4d079bc3090b5514497a5ced400d3 (diff) | |
download | linux-1819dc8143eff2a5850af274bcf8bcbc3e73ec76.tar.xz |
[SCSI] iscsi_transport: export hw address
Add hw address sysfs file.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 4fbd8e1a0695..1ba98d255fac 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -32,7 +32,7 @@ #define ISCSI_SESSION_ATTRS 11 #define ISCSI_CONN_ATTRS 11 -#define ISCSI_HOST_ATTRS 0 +#define ISCSI_HOST_ATTRS 1 #define ISCSI_TRANSPORT_VERSION "2.0-724" struct iscsi_internal { @@ -1197,6 +1197,25 @@ static ISCSI_CLASS_ATTR(priv_sess, field, S_IRUGO, show_priv_session_##field, \ NULL) iscsi_priv_session_attr(recovery_tmo, "%d"); +/* + * iSCSI host attrs + */ +#define iscsi_host_attr_show(param) \ +static ssize_t \ +show_host_param_##param(struct class_device *cdev, char *buf) \ +{ \ + struct Scsi_Host *shost = transport_class_to_shost(cdev); \ + struct iscsi_internal *priv = to_iscsi_internal(shost->transportt); \ + return priv->iscsi_transport->get_host_param(shost, param, buf); \ +} + +#define iscsi_host_attr(field, param) \ + iscsi_host_attr_show(param) \ +static ISCSI_CLASS_ATTR(host, field, S_IRUGO, show_host_param_##param, \ + NULL); + +iscsi_host_attr(hwaddress, ISCSI_HOST_PARAM_HWADDRESS); + #define SETUP_PRIV_SESSION_RD_ATTR(field) \ do { \ priv->session_attrs[count] = &class_device_attr_priv_sess_##field; \ @@ -1220,6 +1239,14 @@ do { \ } \ } while (0) +#define SETUP_HOST_RD_ATTR(field, param_flag) \ +do { \ + if (tt->host_param_mask & param_flag) { \ + priv->host_attrs[count] = &class_device_attr_host_##field; \ + count++; \ + } \ +} while (0) + static int iscsi_session_match(struct attribute_container *cont, struct device *dev) { @@ -1321,9 +1348,13 @@ iscsi_register_transport(struct iscsi_transport *tt) priv->t.host_attrs.ac.class = &iscsi_host_class.class; priv->t.host_attrs.ac.match = iscsi_host_match; priv->t.host_size = sizeof(struct iscsi_host); - priv->host_attrs[0] = NULL; transport_container_register(&priv->t.host_attrs); + SETUP_HOST_RD_ATTR(hwaddress, ISCSI_HOST_HWADDRESS); + BUG_ON(count > ISCSI_HOST_ATTRS); + priv->host_attrs[count] = NULL; + count = 0; + /* connection parameters */ priv->conn_cont.ac.attrs = &priv->conn_attrs[0]; priv->conn_cont.ac.class = &iscsi_connection_class.class; |