Skip to content

Commit

Permalink
atm: expose ATM device index in sysfs
Browse files Browse the repository at this point in the history
commit e7a46b4 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: Dan Williams <dcbw@redhat.com>
Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>
Tested-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
dcbw authored and gregkh committed Jun 3, 2011
1 parent 213c900 commit 9854d57
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions net/atm/atm_sysfs.c
Expand Up @@ -59,6 +59,14 @@ static ssize_t show_atmaddress(struct device *cdev,
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,
struct device_attribute *attr, char *buf)
{
Expand Down Expand Up @@ -99,13 +107,15 @@ static ssize_t show_link_rate(struct device *cdev,

static DEVICE_ATTR(address, S_IRUGO, show_address, 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(type, S_IRUGO, show_type, NULL);
static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);

static struct device_attribute *atm_attrs[] = {
&dev_attr_atmaddress,
&dev_attr_address,
&dev_attr_atmindex,
&dev_attr_carrier,
&dev_attr_type,
&dev_attr_link_rate,
Expand Down

0 comments on commit 9854d57

Please sign in to comment.