On Mon, 2014-10-13 at 16:13 -0700, Chris Leech wrote: > Hi, this is the start of a conversion from directly reading sysfs to using > libudev for finding devices and their attributes for libhbalinux. I wanted to > see what others felt about this before continuing any further, so please > comment away. > > The sysfs scanning code in libhbalinux has a number of problems in the > assumptions it makes. I was motivated to look at this because of fcoeadm > refusing to display fcoe over non-PCI network interfaces. Beyond that, virtio > devices in a VM that do have a parent PCI device also were not detected > correctly; the existing readlink calls to walk the device tree aren't enough > to > find the true device path outside of the narrow case of what libhbalinux is > expecting. For virtio_net, the net device parent is not a PCI-device but a > virtio channel. The next parent up is a virtual PCI device, however finding > it > involves resolving another symlink (libhbalinux doesn't have the full device > path like it thinks). >
Yeah currently fcoeadm hard fails in case the FCoE real netdev is not attached to the PCI device, the fcoeadm/libhbalinux depends on PCI device to pull its attributes and then display them. We could ignore such cases instead failing hard on them but as you said below to better align with sysfs-rules.txt guideline, we are better off not using direct sysfs access all together. So I'm for the change with the series to remove such direct sysfs accesses and instead use libudev. I skimmed through changes and looks good to me. Thanks, Vasu > These specific cases could be improved on by replacing the readlink calls with > realpath, but it would still fall short of the guidelines in sysfs-rules.txt. > And libudev already takes care of the details, so why not use it? > > Chris Leech (6): > add libudev to the build > scan for fc_host with libudev > use libudev to read fc_host attributes > move pci scanning to sub-function > read most pci attributes with libudev > use libudev for finding parents > > Makefile.am | 6 +- > adapt_impl.h | 2 +- > configure.ac | 4 + > libhbalinux.spec.in | 2 +- > lport.c | 511 > ++++++++++++++++++++++++++-------------------------- > 5 files changed, 265 insertions(+), 260 deletions(-) > _______________________________________________ fcoe-devel mailing list [email protected] http://lists.open-fcoe.org/mailman/listinfo/fcoe-devel
