diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2011-07-25 14:48:44 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-08-27 10:36:12 -0400 |
commit | b78dbba0053c6f14384d55b929d21b85d03c38bb (patch) | |
tree | 1d9515de2d7dd44fc0538cbaca1041731aef2636 /drivers/scsi/scsi_transport_iscsi.c | |
parent | 1d063c17298d7cd26cfe350f1e93e1727b4aa53f (diff) |
[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.c | 45 |
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, | |||
329 | struct device *dev = container_of(kobj, struct device, kobj); | 329 | struct device *dev = container_of(kobj, struct device, kobj); |
330 | struct iscsi_iface *iface = iscsi_dev_to_iface(dev); | 330 | struct iscsi_iface *iface = iscsi_dev_to_iface(dev); |
331 | struct iscsi_transport *t = iface->transport; | 331 | struct iscsi_transport *t = iface->transport; |
332 | int param; | ||
332 | 333 | ||
333 | if (attr == &dev_attr_iface_enabled.attr) | 334 | if (attr == &dev_attr_iface_enabled.attr) |
334 | return (t->iface_param_mask & ISCSI_NET_IFACE_ENABLE) ? | 335 | param = ISCSI_NET_PARAM_IFACE_ENABLE; |
335 | S_IRUGO : 0; | ||
336 | else if (attr == &dev_attr_iface_vlan.attr) | 336 | else if (attr == &dev_attr_iface_vlan.attr) |
337 | return (t->iface_param_mask & ISCSI_NET_VLAN_ID) ? S_IRUGO : 0; | 337 | param = ISCSI_NET_PARAM_VLAN_ID; |
338 | 338 | else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { | |
339 | if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { | ||
340 | if (attr == &dev_attr_ipv4_iface_ipaddress.attr) | 339 | if (attr == &dev_attr_ipv4_iface_ipaddress.attr) |
341 | return (t->iface_param_mask & ISCSI_NET_IPV4_ADDR) ? | 340 | param = ISCSI_NET_PARAM_IPV4_ADDR; |
342 | S_IRUGO : 0; | ||
343 | else if (attr == &dev_attr_ipv4_iface_gateway.attr) | 341 | else if (attr == &dev_attr_ipv4_iface_gateway.attr) |
344 | return (t->iface_param_mask & ISCSI_NET_IPV4_GW) ? | 342 | param = ISCSI_NET_PARAM_IPV4_GW; |
345 | S_IRUGO : 0; | ||
346 | else if (attr == &dev_attr_ipv4_iface_subnet.attr) | 343 | else if (attr == &dev_attr_ipv4_iface_subnet.attr) |
347 | return (t->iface_param_mask & ISCSI_NET_IPV4_SUBNET) ? | 344 | param = ISCSI_NET_PARAM_IPV4_SUBNET; |
348 | S_IRUGO : 0; | ||
349 | else if (attr == &dev_attr_ipv4_iface_bootproto.attr) | 345 | else if (attr == &dev_attr_ipv4_iface_bootproto.attr) |
350 | return (t->iface_param_mask & ISCSI_NET_IPV4_BOOTPROTO) ? | 346 | param = ISCSI_NET_PARAM_IPV4_BOOTPROTO; |
351 | S_IRUGO : 0; | 347 | else |
348 | return 0; | ||
352 | } else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV6) { | 349 | } else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV6) { |
353 | if (attr == &dev_attr_ipv6_iface_ipaddress.attr) | 350 | if (attr == &dev_attr_ipv6_iface_ipaddress.attr) |
354 | return (t->iface_param_mask & ISCSI_NET_IPV6_ADDR) ? | 351 | param = ISCSI_NET_PARAM_IPV6_ADDR; |
355 | S_IRUGO : 0; | ||
356 | else if (attr == &dev_attr_ipv6_iface_link_local_addr.attr) | 352 | else if (attr == &dev_attr_ipv6_iface_link_local_addr.attr) |
357 | return (t->iface_param_mask & ISCSI_NET_IPV6_LINKLOCAL) ? | 353 | param = ISCSI_NET_PARAM_IPV6_LINKLOCAL; |
358 | S_IRUGO : 0; | ||
359 | else if (attr == &dev_attr_ipv6_iface_router_addr.attr) | 354 | else if (attr == &dev_attr_ipv6_iface_router_addr.attr) |
360 | return (t->iface_param_mask & ISCSI_NET_IPV6_ROUTER) ? | 355 | param = ISCSI_NET_PARAM_IPV6_ROUTER; |
361 | S_IRUGO : 0; | ||
362 | else if (attr == &dev_attr_ipv6_iface_ipaddr_autocfg.attr) | 356 | else if (attr == &dev_attr_ipv6_iface_ipaddr_autocfg.attr) |
363 | return (t->iface_param_mask & ISCSI_NET_IPV6_ADDR_AUTOCFG) ? | 357 | param = ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG; |
364 | S_IRUGO : 0; | ||
365 | else if (attr == &dev_attr_ipv6_iface_linklocal_autocfg.attr) | 358 | else if (attr == &dev_attr_ipv6_iface_linklocal_autocfg.attr) |
366 | return (t->iface_param_mask & ISCSI_NET_IPV6_LINKLOCAL_AUTOCFG) ? | 359 | param = ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG; |
367 | S_IRUGO : 0; | 360 | else |
361 | return 0; | ||
362 | } else { | ||
363 | WARN_ONCE(1, "Invalid iface attr"); | ||
364 | return 0; | ||
368 | } | 365 | } |
369 | 366 | ||
370 | return 0; | 367 | return t->attr_is_visible(ISCSI_NET_PARAM, param); |
371 | } | 368 | } |
372 | 369 | ||
373 | static struct attribute *iscsi_iface_attrs[] = { | 370 | static struct attribute *iscsi_iface_attrs[] = { |