Commit 9e9c1e7d authored by Dan Williams's avatar Dan Williams Committed by Greg Kroah-Hartman

atm: expose ATM device index in sysfs

commit e7a46b4d upstream.

It's currently exposed only through /proc which, besides requiring
screen-scraping, doesn't allow userspace to distinguish between two
identical ATM adapters with different ATM indexes.  The ATM device index
is required when using PPPoATM on a system with multiple ATM adapters.
Signed-off-by: default avatarDan Williams <dcbw@redhat.com>
Reviewed-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Tested-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a4401a63
...@@ -57,6 +57,14 @@ static ssize_t show_atmaddress(struct device *cdev, ...@@ -57,6 +57,14 @@ static ssize_t show_atmaddress(struct device *cdev,
return pos - buf; return pos - buf;
} }
static ssize_t show_atmindex(struct device *cdev,
struct device_attribute *attr, char *buf)
{
struct atm_dev *adev = to_atm_dev(cdev);
return sprintf(buf, "%d\n", adev->number);
}
static ssize_t show_carrier(struct device *cdev, static ssize_t show_carrier(struct device *cdev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
...@@ -97,6 +105,7 @@ static ssize_t show_link_rate(struct device *cdev, ...@@ -97,6 +105,7 @@ static ssize_t show_link_rate(struct device *cdev,
static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL); static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL);
static DEVICE_ATTR(atmindex, S_IRUGO, show_atmindex, NULL);
static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL); static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
static DEVICE_ATTR(type, S_IRUGO, show_type, NULL); static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL); static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
...@@ -104,6 +113,7 @@ static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL); ...@@ -104,6 +113,7 @@ static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
static struct device_attribute *atm_attrs[] = { static struct device_attribute *atm_attrs[] = {
&dev_attr_atmaddress, &dev_attr_atmaddress,
&dev_attr_address, &dev_attr_address,
&dev_attr_atmindex,
&dev_attr_carrier, &dev_attr_carrier,
&dev_attr_type, &dev_attr_type,
&dev_attr_link_rate, &dev_attr_link_rate,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment