• O
    nodedev_udev: Refactor udevGetDeviceType · 1aa0ba3c
    Osier Yang 提交于
    Checking if the "devtype" is NULL along with each "if" statements
    is bad. It wastes the performance, and also not good for reading.
    And also when the "devtype" is NULL, the logic is also not clear.
    
    This reorgnizes the logic of with "if...else" and a bunch of "else if".
    
    Other changes:
       * Change the function style.
       * Remove the useless debug statement.
       * Get rid of the goto
       * New helper udevDeviceHasProperty to simplify the logic for checking
         if a property is existing for the device.
       * Add comment to clarify "PCI devices don't set the DEVTYPE property"
       * s/sysfs path/sysfs name/, as udev_device_get_sysname returns the
         name instead of the full path. E.g. "sg0"
       * Refactor the comment for setting VIR_NODE_DEV_CAP_NET cap type
         a bit.
    1aa0ba3c
node_device_udev.c 49.1 KB