.. | .. |
---|
203 | 203 | else if (len == 8 && !strncmp(str, "failfast", 8)) |
---|
204 | 204 | features |= DASD_FEATURE_FAILFAST; |
---|
205 | 205 | else { |
---|
206 | | - pr_warn("%*s is not a supported device option\n", |
---|
| 206 | + pr_warn("%.*s is not a supported device option\n", |
---|
207 | 207 | len, str); |
---|
208 | 208 | rc = -EINVAL; |
---|
209 | 209 | } |
---|
.. | .. |
---|
1642 | 1642 | dasd_path_interval_store); |
---|
1643 | 1643 | |
---|
1644 | 1644 | |
---|
| 1645 | +#define DASD_DEFINE_ATTR(_name, _func) \ |
---|
| 1646 | +static ssize_t dasd_##_name##_show(struct device *dev, \ |
---|
| 1647 | + struct device_attribute *attr, \ |
---|
| 1648 | + char *buf) \ |
---|
| 1649 | +{ \ |
---|
| 1650 | + struct ccw_device *cdev = to_ccwdev(dev); \ |
---|
| 1651 | + struct dasd_device *device = dasd_device_from_cdev(cdev); \ |
---|
| 1652 | + int val = 0; \ |
---|
| 1653 | + \ |
---|
| 1654 | + if (IS_ERR(device)) \ |
---|
| 1655 | + return -ENODEV; \ |
---|
| 1656 | + if (device->discipline && _func) \ |
---|
| 1657 | + val = _func(device); \ |
---|
| 1658 | + dasd_put_device(device); \ |
---|
| 1659 | + \ |
---|
| 1660 | + return snprintf(buf, PAGE_SIZE, "%d\n", val); \ |
---|
| 1661 | +} \ |
---|
| 1662 | +static DEVICE_ATTR(_name, 0444, dasd_##_name##_show, NULL); \ |
---|
| 1663 | + |
---|
| 1664 | +DASD_DEFINE_ATTR(ese, device->discipline->is_ese); |
---|
| 1665 | +DASD_DEFINE_ATTR(extent_size, device->discipline->ext_size); |
---|
| 1666 | +DASD_DEFINE_ATTR(pool_id, device->discipline->ext_pool_id); |
---|
| 1667 | +DASD_DEFINE_ATTR(space_configured, device->discipline->space_configured); |
---|
| 1668 | +DASD_DEFINE_ATTR(space_allocated, device->discipline->space_allocated); |
---|
| 1669 | +DASD_DEFINE_ATTR(logical_capacity, device->discipline->logical_capacity); |
---|
| 1670 | +DASD_DEFINE_ATTR(warn_threshold, device->discipline->ext_pool_warn_thrshld); |
---|
| 1671 | +DASD_DEFINE_ATTR(cap_at_warnlevel, device->discipline->ext_pool_cap_at_warnlevel); |
---|
| 1672 | +DASD_DEFINE_ATTR(pool_oos, device->discipline->ext_pool_oos); |
---|
| 1673 | + |
---|
1645 | 1674 | static struct attribute * dasd_attrs[] = { |
---|
1646 | 1675 | &dev_attr_readonly.attr, |
---|
1647 | 1676 | &dev_attr_discipline.attr, |
---|
.. | .. |
---|
1667 | 1696 | &dev_attr_path_interval.attr, |
---|
1668 | 1697 | &dev_attr_path_reset.attr, |
---|
1669 | 1698 | &dev_attr_hpf.attr, |
---|
| 1699 | + &dev_attr_ese.attr, |
---|
1670 | 1700 | NULL, |
---|
1671 | 1701 | }; |
---|
1672 | 1702 | |
---|
1673 | 1703 | static const struct attribute_group dasd_attr_group = { |
---|
1674 | 1704 | .attrs = dasd_attrs, |
---|
| 1705 | +}; |
---|
| 1706 | + |
---|
| 1707 | +static struct attribute *capacity_attrs[] = { |
---|
| 1708 | + &dev_attr_space_configured.attr, |
---|
| 1709 | + &dev_attr_space_allocated.attr, |
---|
| 1710 | + &dev_attr_logical_capacity.attr, |
---|
| 1711 | + NULL, |
---|
| 1712 | +}; |
---|
| 1713 | + |
---|
| 1714 | +static const struct attribute_group capacity_attr_group = { |
---|
| 1715 | + .name = "capacity", |
---|
| 1716 | + .attrs = capacity_attrs, |
---|
| 1717 | +}; |
---|
| 1718 | + |
---|
| 1719 | +static struct attribute *ext_pool_attrs[] = { |
---|
| 1720 | + &dev_attr_pool_id.attr, |
---|
| 1721 | + &dev_attr_extent_size.attr, |
---|
| 1722 | + &dev_attr_warn_threshold.attr, |
---|
| 1723 | + &dev_attr_cap_at_warnlevel.attr, |
---|
| 1724 | + &dev_attr_pool_oos.attr, |
---|
| 1725 | + NULL, |
---|
| 1726 | +}; |
---|
| 1727 | + |
---|
| 1728 | +static const struct attribute_group ext_pool_attr_group = { |
---|
| 1729 | + .name = "extent_pool", |
---|
| 1730 | + .attrs = ext_pool_attrs, |
---|
| 1731 | +}; |
---|
| 1732 | + |
---|
| 1733 | +static const struct attribute_group *dasd_attr_groups[] = { |
---|
| 1734 | + &dasd_attr_group, |
---|
| 1735 | + &capacity_attr_group, |
---|
| 1736 | + &ext_pool_attr_group, |
---|
| 1737 | + NULL, |
---|
1675 | 1738 | }; |
---|
1676 | 1739 | |
---|
1677 | 1740 | /* |
---|
.. | .. |
---|
1715 | 1778 | EXPORT_SYMBOL(dasd_set_feature); |
---|
1716 | 1779 | |
---|
1717 | 1780 | |
---|
1718 | | -int |
---|
1719 | | -dasd_add_sysfs_files(struct ccw_device *cdev) |
---|
| 1781 | +int dasd_add_sysfs_files(struct ccw_device *cdev) |
---|
1720 | 1782 | { |
---|
1721 | | - return sysfs_create_group(&cdev->dev.kobj, &dasd_attr_group); |
---|
| 1783 | + return sysfs_create_groups(&cdev->dev.kobj, dasd_attr_groups); |
---|
1722 | 1784 | } |
---|
1723 | 1785 | |
---|
1724 | 1786 | void |
---|
1725 | 1787 | dasd_remove_sysfs_files(struct ccw_device *cdev) |
---|
1726 | 1788 | { |
---|
1727 | | - sysfs_remove_group(&cdev->dev.kobj, &dasd_attr_group); |
---|
| 1789 | + sysfs_remove_groups(&cdev->dev.kobj, dasd_attr_groups); |
---|
1728 | 1790 | } |
---|
1729 | 1791 | |
---|
1730 | 1792 | |
---|