• Alex Chiang's avatar
    PCI: create function symlinks in /sys/bus/pci/slots/N/ · 75568f80
    Alex Chiang authored
    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
    
    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
    
    The original form of this patch was written by Matthew Wilcox,
    and was enhanced to include links from the sysfs slots/ directory
    pointing back at the device functions.
    
    Cc: willy@linux.intel.com
    Signed-off-by: default avatarAlex Chiang <achiang@hp.com>
    Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
    75568f80
pci-sysfs.c 30 KB