From: Florian Fainelli <f.fainelli@gmail.com>
To: David Decotigny <decot@googlers.com>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Eric Dumazet <edumazet@google.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Weilong Chen <chenweilong@huawei.com>,
Jiri Pirko <jiri@resnulli.us>,
Michael Dalton <mwdalton@google.com>,
Al Viro <viro@ZenIV.linux.org.uk>, Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH v1] net-sysfs: expose permanent hardware address in sysfs
Date: Tue, 06 May 2014 22:24:49 -0700 [thread overview]
Message-ID: <5369C3A1.2070502@gmail.com> (raw)
In-Reply-To: <cd90d330753ff145d209240a72caafac32f5e750.1399347193.git.decot@googlers.com>
Le 05/05/2014 20:34, David Decotigny a écrit :
> Tested:
> grep . /sys/class/net/*/*addr*
Please also include the relevant sysfs documentation changes in
Documentation/ABI/testing/sysfs-class-net.
Thanks!
>
> Signed-off-by: David Decotigny <decot@googlers.com>
> ---
> net/core/net-sysfs.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
> index 1cac29e..bf57024 100644
> --- a/net/core/net-sysfs.c
> +++ b/net/core/net-sysfs.c
> @@ -127,6 +127,20 @@ static ssize_t address_show(struct device *dev, struct device_attribute *attr,
> }
> static DEVICE_ATTR_RO(address);
>
> +static ssize_t perm_addr_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + struct net_device *net = to_net_dev(dev);
> + ssize_t ret = -EINVAL;
> +
> + read_lock(&dev_base_lock);
> + if (dev_isalive(net))
> + ret = sysfs_format_mac(buf, net->perm_addr, net->addr_len);
> + read_unlock(&dev_base_lock);
> + return ret;
> +}
> +static DEVICE_ATTR_RO(perm_addr);
> +
> static ssize_t broadcast_show(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> @@ -391,6 +405,7 @@ static struct attribute *net_class_attrs[] = {
> &dev_attr_addr_len.attr,
> &dev_attr_link_mode.attr,
> &dev_attr_address.attr,
> + &dev_attr_perm_addr.attr,
> &dev_attr_broadcast.attr,
> &dev_attr_speed.attr,
> &dev_attr_duplex.attr,
>
next prev parent reply other threads:[~2014-05-07 5:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1399347193.git.decot@googlers.com>
2014-05-06 3:34 ` [PATCH v1] net-sysfs: expose permanent hardware address in sysfs David Decotigny
2014-05-07 5:24 ` Florian Fainelli [this message]
2014-05-07 20:16 ` David Miller
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=5369C3A1.2070502@gmail.com \
--to=f.fainelli@gmail.com \
--cc=chenweilong@huawei.com \
--cc=davem@davemloft.net \
--cc=decot@googlers.com \
--cc=ebiederm@xmission.com \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=jiri@resnulli.us \
--cc=linux-kernel@vger.kernel.org \
--cc=mwdalton@google.com \
--cc=netdev@vger.kernel.org \
--cc=tj@kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/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.