diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2011-07-25 20:48:44 +0200 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-08-27 16:36:12 +0200 |
commit | b78dbba0053c6f14384d55b929d21b85d03c38bb (patch) | |
tree | 1d9515de2d7dd44fc0538cbaca1041731aef2636 /drivers/scsi | |
parent | [SCSI] iscsi class: sysfs group is_visible callout for session attrs (diff) | |
download | linux-b78dbba0053c6f14384d55b929d21b85d03c38bb.tar.xz linux-b78dbba0053c6f14384d55b929d21b85d03c38bb.zip |
[SCSI] iscsi class: remove iface param mask
We can replace the iface param mask with the
attr_is_visible callback.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_os.c | 27 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 45 |
2 files changed, 37 insertions, 35 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 3022c1534156..df6da3cb124d 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -141,17 +141,6 @@ static struct iscsi_transport qla4xxx_iscsi_transport = { .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS | ISCSI_HOST_INITIATOR_NAME, - .iface_param_mask = ISCSI_NET_IPV4_ADDR | - ISCSI_NET_IPV4_SUBNET | - ISCSI_NET_IPV4_GW | - ISCSI_NET_IPV4_BOOTPROTO | - ISCSI_NET_IFACE_ENABLE | - ISCSI_NET_IPV6_LINKLOCAL | - ISCSI_NET_IPV6_ADDR | - ISCSI_NET_IPV6_ROUTER | - ISCSI_NET_IPV6_ADDR_AUTOCFG | - ISCSI_NET_IPV6_LINKLOCAL_AUTOCFG | - ISCSI_NET_IFACE_ENABLE, .tgt_dscvr = qla4xxx_tgt_dscvr, .attr_is_visible = ql4_attr_is_visible, .get_conn_param = qla4xxx_conn_get_param, @@ -178,6 +167,22 @@ static mode_t ql4_attr_is_visible(int param_type, int param) default: return 0; } + case ISCSI_NET_PARAM: + switch (param) { + case ISCSI_NET_PARAM_IPV4_ADDR: + case ISCSI_NET_PARAM_IPV4_SUBNET: + case ISCSI_NET_PARAM_IPV4_GW: + case ISCSI_NET_PARAM_IPV4_BOOTPROTO: + case ISCSI_NET_PARAM_IFACE_ENABLE: + case ISCSI_NET_PARAM_IPV6_LINKLOCAL: + case ISCSI_NET_PARAM_IPV6_ADDR: + case ISCSI_NET_PARAM_IPV6_ROUTER: + case ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG: + case ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG: + return S_IRUGO; + default: + return 0; + } } return 0; diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 75d7f6e93b67..a8dd85dc77b1 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -329,45 +329,42 @@ static mode_t iscsi_iface_attr_is_visible(struct kobject *kobj, struct device *dev = container_of(kobj, struct device, kobj); struct iscsi_iface *iface = iscsi_dev_to_iface(dev); struct iscsi_transport *t = iface->transport; + int param; if (attr == &dev_attr_iface_enabled.attr) - return (t->iface_param_mask & ISCSI_NET_IFACE_ENABLE) ? - S_IRUGO : 0; + param = ISCSI_NET_PARAM_IFACE_ENABLE; else if (attr == &dev_attr_iface_vlan.attr) - return (t->iface_param_mask & ISCSI_NET_VLAN_ID) ? S_IRUGO : 0; - - if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { + param = ISCSI_NET_PARAM_VLAN_ID; + else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { if (attr == &dev_attr_ipv4_iface_ipaddress.attr) - return (t->iface_param_mask & ISCSI_NET_IPV4_ADDR) ? - S_IRUGO : 0; + param = ISCSI_NET_PARAM_IPV4_ADDR; else if (attr == &dev_attr_ipv4_iface_gateway.attr) - return (t->iface_param_mask & ISCSI_NET_IPV4_GW) ? - S_IRUGO : 0; + param = ISCSI_NET_PARAM_IPV4_GW; else if (attr == &dev_attr_ipv4_iface_subnet.attr) - return (t->iface_param_mask & ISCSI_NET_IPV4_SUBNET) ? - S_IRUGO : 0; + param = ISCSI_NET_PARAM_IPV4_SUBNET; else if (attr == &dev_attr_ipv4_iface_bootproto.attr) - return (t->iface_param_mask & ISCSI_NET_IPV4_BOOTPROTO) ? - S_IRUGO : 0; + param = ISCSI_NET_PARAM_IPV4_BOOTPROTO; + else + return 0; } else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV6) { if (attr == &dev_attr_ipv6_iface_ipaddress.attr) - return (t->iface_param_mask & ISCSI_NET_IPV6_ADDR) ? - S_IRUGO : 0; + param = ISCSI_NET_PARAM_IPV6_ADDR; else if (attr == &dev_attr_ipv6_iface_link_local_addr.attr) - return (t->iface_param_mask & ISCSI_NET_IPV6_LINKLOCAL) ? - S_IRUGO : 0; + param = ISCSI_NET_PARAM_IPV6_LINKLOCAL; else if (attr == &dev_attr_ipv6_iface_router_addr.attr) - return (t->iface_param_mask & ISCSI_NET_IPV6_ROUTER) ? - S_IRUGO : 0; + param = ISCSI_NET_PARAM_IPV6_ROUTER; else if (attr == &dev_attr_ipv6_iface_ipaddr_autocfg.attr) - return (t->iface_param_mask & ISCSI_NET_IPV6_ADDR_AUTOCFG) ? - S_IRUGO : 0; + param = ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG; else if (attr == &dev_attr_ipv6_iface_linklocal_autocfg.attr) - return (t->iface_param_mask & ISCSI_NET_IPV6_LINKLOCAL_AUTOCFG) ? - S_IRUGO : 0; + param = ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG; + else + return 0; + } else { + WARN_ONCE(1, "Invalid iface attr"); + return 0; } - return 0; + return t->attr_is_visible(ISCSI_NET_PARAM, param); } static struct attribute *iscsi_iface_attrs[] = { |