From: Dan Williams <dcbw@redhat.com>
To: netdev@vger.kernel.org
Cc: Chas Williams <chas@cmf.nrl.navy.mil>,
David Woodhouse <dwmw2@infradead.org>,
stable@kernel.org
Subject: [PATCH] atm: expose ATM device index in sysfs
Date: Thu, 26 May 2011 12:47:36 -0500 [thread overview]
Message-ID: <1306432057.3151.10.camel@dcbw.foobar.com> (raw)
It's current 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>
---
PS: -> stable too since it's a minimal change with no backwards
incompatibility and I'd like to rely on this attribute in NetworkManager
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c
index f7fa67c..e5edbde 100644
--- a/net/atm/atm_sysfs.c
+++ b/net/atm/atm_sysfs.c
@@ -59,6 +59,16 @@ 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)
+{
+ char *pos = buf;
+ struct atm_dev *adev = to_atm_dev(cdev);
+
+ pos += sprintf(pos, "%d\n", adev->number);
+ return pos - buf;
+}
+
static ssize_t show_carrier(struct device *cdev,
struct device_attribute *attr, char *buf)
{
@@ -99,6 +109,7 @@ 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);
@@ -106,6 +117,7 @@ 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,
next reply other threads:[~2011-05-26 17:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-26 17:47 Dan Williams [this message]
2011-05-26 17:55 ` [PATCH] atm: expose ATM device index in sysfs Eric Dumazet
2011-05-26 18:35 ` Dan Williams
2011-05-27 14:51 ` [PATCH v2] " Dan Williams
2011-05-27 14:57 ` Eric Dumazet
2011-05-27 15:05 ` David Woodhouse
2011-05-27 17:07 ` David Miller
2011-05-26 19:06 ` [stable] [PATCH] " Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1306432057.3151.10.camel@dcbw.foobar.com \
--to=dcbw@redhat.com \
--cc=chas@cmf.nrl.navy.mil \
--cc=dwmw2@infradead.org \
--cc=netdev@vger.kernel.org \
--cc=stable@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.