netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Bjørn Mork" <bjorn@mork.no>
To: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Cc: systemd-devel@lists.freedesktop.org, netdev@vger.kernel.org
Subject: Re: [PATCH] Use dev_port for the ID of a network device.
Date: Tue, 01 Jul 2014 08:45:56 +0200	[thread overview]
Message-ID: <87egy54lwb.fsf@nemi.mork.no> (raw)
In-Reply-To: <1404160596-25859-1-git-send-email-cascardo@linux.vnet.ibm.com> (Thadeu Lima de Souza Cascardo's message of "Mon, 30 Jun 2014 17:36:36 -0300")

Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com> writes:

> diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
> index c80c30a..6de9c98 100644
> --- a/src/udev/udev-builtin-net_id.c
> +++ b/src/udev/udev-builtin-net_id.c
> @@ -186,9 +186,14 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) {
>                  return -ENOENT;
>  
>          /* kernel provided multi-device index */
> -        attr = udev_device_get_sysattr_value(dev, "dev_id");
> -        if (attr)
> +        attr = udev_device_get_sysattr_value(dev, "dev_port");
> +        if (attr) {
>                  dev_id = strtol(attr, NULL, 16);
> +        } else {
> +                attr = udev_device_get_sysattr_value(dev, "dev_id");
> +                if (attr)
> +                        dev_id = strtol(attr, NULL, 16);
> +        }
>  
>          /* compose a name based on the raw kernel's PCI bus, slot numbers */
>          s = names->pci_path;

Note that the base of the new attribute is 10, not 16:

bjorn@nemi:/usr/local/src/git/linux$ git grep dev_port net/core/
net/core/net-sysfs.c:NETDEVICE_SHOW_RO(dev_port, fmt_dec);
net/core/net-sysfs.c:   &dev_attr_dev_port.attr,
bjorn@nemi:/usr/local/src/git/linux$ git grep dev_id net/core/
net/core/net-sysfs.c:NETDEVICE_SHOW_RO(dev_id, fmt_hex);
net/core/net-sysfs.c:   &dev_attr_dev_id.attr,



Bjørn

  parent reply	other threads:[~2014-07-01  6:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-30 20:36 [PATCH] Use dev_port for the ID of a network device Thadeu Lima de Souza Cascardo
2014-07-01  0:33 ` Kay Sievers
2014-07-01 12:32   ` [systemd-devel] " Thadeu Lima de Souza Cascardo
2014-07-01 12:45     ` Tom Gundersen
2014-07-01 12:59       ` Kay Sievers
2014-07-01 13:18         ` Amir Vadai
2014-07-01  6:45 ` Bjørn Mork [this message]
2014-07-01  7:40   ` Bjørn Mork
2014-07-01 12:25     ` Thadeu Lima de Souza Cascardo
2014-07-01 12:26   ` Thadeu Lima de Souza Cascardo

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=87egy54lwb.fsf@nemi.mork.no \
    --to=bjorn@mork.no \
    --cc=cascardo@linux.vnet.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=systemd-devel@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).