aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2011-05-27 00:51:54 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-27 13:07:21 -0400
commite7a46b4d0839c2a3aa2e0ae0b145f293f6738498 (patch)
treece38143b070fb4f5ed96e93bd5a8e3324016653e /net/atm
parent58bf2dbccc5aca12df77e2328f478e239a68bdd5 (diff)
atm: expose ATM device index in sysfs
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: Dan Williams <dcbw@redhat.com> Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com> Tested-by: David Woodhouse <dwmw2@infradead.org> Cc: stable@kernel.org Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm')
-rw-r--r--net/atm/atm_sysfs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c
index f7fa67c78766..f49da5814bc3 100644
--- a/net/atm/atm_sysfs.c
+++ b/net/atm/atm_sysfs.c
@@ -59,6 +59,14 @@ static ssize_t show_atmaddress(struct device *cdev,
59 return pos - buf; 59 return pos - buf;
60} 60}
61 61
62static ssize_t show_atmindex(struct device *cdev,
63 struct device_attribute *attr, char *buf)
64{
65 struct atm_dev *adev = to_atm_dev(cdev);
66
67 return sprintf(buf, "%d\n", adev->number);
68}
69
62static ssize_t show_carrier(struct device *cdev, 70static ssize_t show_carrier(struct device *cdev,
63 struct device_attribute *attr, char *buf) 71 struct device_attribute *attr, char *buf)
64{ 72{
@@ -99,6 +107,7 @@ static ssize_t show_link_rate(struct device *cdev,
99 107
100static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); 108static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
101static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL); 109static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL);
110static DEVICE_ATTR(atmindex, S_IRUGO, show_atmindex, NULL);
102static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL); 111static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
103static DEVICE_ATTR(type, S_IRUGO, show_type, NULL); 112static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
104static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL); 113static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
@@ -106,6 +115,7 @@ static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
106static struct device_attribute *atm_attrs[] = { 115static struct device_attribute *atm_attrs[] = {
107 &dev_attr_atmaddress, 116 &dev_attr_atmaddress,
108 &dev_attr_address, 117 &dev_attr_address,
118 &dev_attr_atmindex,
109 &dev_attr_carrier, 119 &dev_attr_carrier,
110 &dev_attr_type, 120 &dev_attr_type,
111 &dev_attr_link_rate, 121 &dev_attr_link_rate,