summaryrefslogtreecommitdiff
path: root/drivers/scsi/scsi_transport_iscsi.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2011-07-25 22:48:44 +0400
committerJames Bottomley <JBottomley@Parallels.com>2011-08-27 18:36:12 +0400
commitb78dbba0053c6f14384d55b929d21b85d03c38bb (patch)
tree1d9515de2d7dd44fc0538cbaca1041731aef2636 /drivers/scsi/scsi_transport_iscsi.c
parent1d063c17298d7cd26cfe350f1e93e1727b4aa53f (diff)
downloadlinux-b78dbba0053c6f14384d55b929d21b85d03c38bb.tar.xz
[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/scsi_transport_iscsi.c')
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c45
1 files changed, 21 insertions, 24 deletions
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[] = {