[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <AANLkTi=xgNPueEBiJ6R8E0D2LRnOFggVAJ17KZtDG3Lw@mail.gmail.com>
Date: Fri, 27 Aug 2010 09:54:34 +0200
From: Kay Sievers <kay.sievers@...y.org>
To: "Loke, Chetan" <Chetan.Loke@...scout.com>
Cc: Stephen Hemminger <shemminger@...tta.com>,
Matt Domsch <Matt_Domsch@...l.com>, Narendra_K@...l.com,
netdev@...r.kernel.org, Charles_Rose@...l.com,
Jordan_Hargrave@...l.com, linux-pci@...r.kernel.org,
linux-hotplug@...r.kernel.org
Subject: Re: [PATCH] Add firmware label support to iproute2
On Thu, Aug 26, 2010 at 17:38, Loke, Chetan <Chetan.Loke@...scout.com> wrote:
> Sorry, my bad.
> I agree w/ your recommendation then -
> 1) stuff it in ifalias(or create a new alias if net_device::ifalias is
> used for snmp etc).
>
> But how do we consume it?
> 1.1) spit it out via sysfs? But Doc/sysfsrules.txt says "Accessing
> /sys/class/net/eth0/device is a bug in the application"
You walk up the parent devices of the netdev until you find the one
you are looking for. The "device" link is broken by design and might
just point to the first parent device. The kernel is free to insert
devices into the device tree if needed, and then the device link
target may change.
/sys/class/net/eth0 is a symlink pointing to a location the
/sys/devices tree, like:
../../devices/pci0000:00/0000:00:19.0/net/eth0
One of the parent devices of the eth0 device has this attribute., but
you can never be sure that it's just the next parent (broken concept
of the device link), you have to walk up the chain of parents.
You can just use udev to that automatically and extract the value, and
pass it with the event for the eth0 device.
Kay
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists