• Kay Sievers's avatar
    sysfs: create optimal relative symlink targets · 2f90a851
    Kay Sievers authored
    Instead of walking from the source down to the root of sysfs, and back
    to the target, we stop at the first directory the source and the target
    share.
    
    This link:
      /devices/pci0000:00/0000:00:1d.7/usb1/1-0:1.0/ep_81
    
    pointed to:
      ../../../../../devices/pci0000:00/0000:00:1d.0/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81
    
    now it just points to:
      usb_endpoint/usbdev1.1_ep81
    
    Thanks to Denis Cheng for bringing this up, and sending the initial patch.
    
    CC: Denis Cheng <crquan@gmail.com>
    Signed-off-by: default avatarKay Sievers <kay.sievers@vrfy.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    2f90a851
symlink.c 4.01 KB