Re: [PATCH] PCI: create function symlinks in /sys/bus/pci/slots/N/

From: Alex Chiang
Date: Wed Mar 10 2010 - 13:15:52 EST


Hello Kenji-san,

* Kenji Kaneshige <kaneshige.kenji@xxxxxxxxxxxxxx>:
> Alex Chiang wrote:
>> Create convenience symlinks in sysfs, linking slots to device
>> functions, and vice versa. These links make it easier for users to
>> figure out which devices actually live in what slots.
>>
>> For example:
>>
>> sapphire:/sys/bus/pci/slots # ls
>> 1 10 2 3 4 5 6 7 8 9
>>
>> sapphire:/sys/bus/pci/slots # ls -l 3
>> total 0
>> -r--r--r-- 1 root root 65536 Aug 18 14:10 address
>> lrwxrwxrwx 1 root root 0 Aug 18 14:10 function0 ->
>> ../../../../devices/pci0000:23/0000:23:01.0
>> lrwxrwxrwx 1 root root 0 Aug 18 14:10 function1 ->
>> ../../../../devices/pci0000:23/0000:23:01.1
>>
>
> I usually get the similar information like the followings. Is
> it not enough for you?
>
> # /sbin/lspci -s `cat /sys/bus/pci/slots/1/address`
> 40:00.0 Ethernet controller: Intel Corporation 82571EB Gigabit Ethernet Controller (rev 06)
> 40:00.1 Ethernet controller: Intel Corporation 82571EB Gigabit Ethernet Controller (rev 06)
>
>> sapphire:/sys/bus/pci/slots # ls -l 3/function0/slot
>> lrwxrwxrwx 1 root root 0 Aug 18 14:13 3/function0/slot ->
>> ../../../bus/pci/slots/3
>
> IIRC, the latest 'lspci' command shows physical slot
> information (you added this useful feature, didn't you?). Is it
> not enough for you?

You're right, it's certainly possible to get all that information
using lspci (and yes, I did add the physical slot information ;).

I just thought that these symlinks would be quite convenient, so
that you don't have to traverse around in the sysfs tree quite so
much if you want to find other properties of your physical
device, such as net:ethX, etc.

However, I talked with my manageability userspace team and they
do not really need the links either.

I'll leave it up to Jesse. I think this is a useful feature, I
don't think it's too hard to support as a kernel ABI, but I also
agree that it's not entirely necessary.

Thanks.
/ac

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/