1. 18 6月, 2013 2 次提交
    • O
      nodedev_udev: changes missed by commit 1aa0ba3c · bf5fbf8f
      Osier Yang 提交于
      bf5fbf8f
    • 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
  2. 14 6月, 2013 1 次提交
  3. 21 5月, 2013 1 次提交
  4. 11 5月, 2013 1 次提交
    • L
      util: move virFile* functions from virutil.c to virfile.c · bfe7721d
      Laine Stump 提交于
      These all existed before virfile.c was created, and for some reason
      weren't moved.
      
      This is mostly straightfoward, although the syntax rule prohibiting
      write() had to be changed to have an exception for virfile.c instead
      of virutil.c.
      
      This movement pointed out that there is a function called
      virBuildPath(), and another almost identical function called
      virFileBuildPath(). They really should be a single function, which
      I'll take care of as soon as I figure out what the arglist should look
      like.
      bfe7721d
  5. 09 5月, 2013 1 次提交
  6. 08 5月, 2013 1 次提交
  7. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
  8. 26 4月, 2013 1 次提交
    • E
      build: avoid unsafe functions in libgen.h · 1fbf1905
      Eric Blake 提交于
      POSIX says that both basename() and dirname() may return static
      storage (aka they need not be thread-safe); and that they may but
      not must modify their input argument.  Furthermore, <libgen.h>
      is not available on all platforms.  For these reasons, you should
      never use these functions in a multi-threaded library.
      
      Gnulib instead recommends a way to avoid the portability nightmare:
      gnulib's "dirname.h" provides useful thread-safe counterparts.  The
      obvious dir_name() and base_name() are GPL (because they malloc(),
      but call exit() on failure) so we can't use them; but the LGPL
      variants mdir_name() (malloc's or returns NULL) and last_component
      (always points into the incoming string without modifying it,
      differing from basename semantics only on corner cases like the
      empty string that we shouldn't be hitting in the first place) are
      already in use in libvirt.  This finishes the swap over to the safe
      functions.
      
      * cfg.mk (sc_prohibit_libgen): New rule.
      * src/util/vircgroup.c: Fix offenders.
      * src/parallels/parallels_storage.c (parallelsPoolAddByDomain):
      Likewise.
      * src/parallels/parallels_network.c (parallelsGetBridgedNetInfo):
      Likewise.
      * src/node_device/node_device_udev.c (udevProcessSCSIHost)
      (udevProcessSCSIDevice): Likewise.
      * src/storage/storage_backend_disk.c
      (virStorageBackendDiskDeleteVol): Likewise.
      * src/util/virpci.c (virPCIGetDeviceAddressFromSysfsLink):
      Likewise.
      * src/util/virstoragefile.h (_virStorageFileMetadata): Avoid false
      positive.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1fbf1905
  9. 24 4月, 2013 4 次提交
  10. 04 4月, 2013 1 次提交
    • D
      Add support for SD cards in nodedev driver · e2b373e6
      Daniel P. Berrange 提交于
      The nodedev driver currently only detects harddisk, cdrom
      and floppy devices. This adds support for SD cards, which
      are common storage for ARM devices, eg the Google ChromeBook
      
      <device>
        <name>block_mmcblk0_0xb1c7c08b</name>
        <parent>computer</parent>
        <capability type='storage'>
          <block>/dev/mmcblk0</block>
          <drive_type>sd</drive_type>
          <serial>0xb1c7c08b</serial>
          <size>15758000128</size>
          <logical_block_size>512</logical_block_size>
          <num_blocks>30777344</num_blocks>
        </capability>
      </device>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      e2b373e6
  11. 25 3月, 2013 2 次提交
    • O
      nodedev: Fix the improper logic when enumerating SRIOV VF · 9a3ff01d
      Osier Yang 提交于
      virPCIGetVirtualFunctions returns 0 even if there is no "virtfn"
      entry under the device sysfs path.
      
      And virPCIGetVirtualFunctions returns -1 when it fails to get
      the PCI config space of one VF, however, with keeping the
      the VFs already detected.
      
      That's why udevProcessPCI and gather_pci_cap use logic like:
      
      if (!virPCIGetVirtualFunctions(syspath,
                                     &data->pci_dev.virtual_functions,
                                     &data->pci_dev.num_virtual_functions) ||
          data->pci_dev.num_virtual_functions > 0)
          data->pci_dev.flags |= VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION;
      
      to tag the PCI device with "virtual_function" cap.
      
      However, this results in a VF will aslo get "virtual_function" cap.
      
      This patch fixes it by:
        * Ignoring the VF which has failure of getting PCI config space
          (given that the successfully detected VFs are kept , it makes
          sense to not give up on the failure of one VF too) with a warning,
          so virPCIGetVirtualFunctions will not return -1 except out of memory.
      
        * Free the allocated *virtual_functions when out of memory
      
      And thus the logic can be changed to:
      
          /* Out of memory */
          int ret = virPCIGetVirtualFunctions(syspath,
                                              &data->pci_dev.virtual_functions,
                                              &data->pci_dev.num_virtual_functions);
      
          if (ret < 0 )
              goto out;
          if (data->pci_dev.num_virtual_functions > 0)
              data->pci_dev.flags |= VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION;
      9a3ff01d
    • O
      nodedev: Refactor the helpers · 4360a098
      Osier Yang 提交于
      This adds two util functions (virIsCapableFCHost and virIsCapableVport),
      and rename helper check_fc_host_linux as detect_scsi_host_caps,
      check_capable_vport_linux is removed, as it's abstracted to the util
      function virIsCapableVport. detect_scsi_host_caps nows detect both
      the fc_host and vport_ops capabilities. "stat(2)" is replaced with
      "access(2)" for saving.
      
      * src/util/virutil.h:
        - Declare virIsCapableFCHost and virIsCapableVport
      * src/util/virutil.c:
        - Implement virIsCapableFCHost and virIsCapableVport
      * src/node_device/node_device_linux_sysfs.c:
        - Remove check_capable_vport_linux
        - Rename check_fc_host_linux as detect_scsi_host_caps, and refactor
          it a bit to detect both fc_host and vport_os capabilities
      * src/node_device/node_device_driver.h:
        - Change/remove the related declarations
      * src/node_device/node_device_udev.c: (Use detect_scsi_host_caps)
      * src/node_device/node_device_hal.c: (Likewise)
      * src/node_device/node_device_driver.c (Likewise)
      4360a098
  12. 12 2月, 2013 1 次提交
  13. 06 2月, 2013 1 次提交
  14. 21 12月, 2012 7 次提交
  15. 04 12月, 2012 2 次提交
  16. 30 11月, 2012 1 次提交
  17. 02 11月, 2012 1 次提交
  18. 28 9月, 2012 2 次提交
  19. 21 9月, 2012 1 次提交
  20. 17 9月, 2012 1 次提交
    • O
      list: Implement listAllNodeDevices · c68cd62a
      Osier Yang 提交于
      This simply implements listAllNodeDevices using helper virNodeDeviceList
      
      src/node_device/node_device_driver.h:
        * Declare nodeListAllNodeDevices.
      
      src/node_device/node_device_driver.c:
        * Implement nodeListAllNodeDevices.
      
      src/node_device/node_device_hal.c:
        * Hook listAllNodeDevices to nodeListAllNodeDevices.
      
      src/node_device/node_device_udev.c
        * Hook listAllNodeDevices to nodeListAllNodeDevices.
      c68cd62a
  21. 23 7月, 2012 1 次提交
    • O
      Desert the FSF address in copyright · f9ce7dad
      Osier Yang 提交于
      Per the FSF address could be changed from time to time, and GNU
      recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)
      
        You should have received a copy of the GNU General Public License
        along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
      
      This patch removes the explicit FSF address, and uses above instead
      (of course, with inserting 'Lesser' before 'General').
      
      Except a bunch of files for security driver, all others are changed
      automatically, the copyright for securify files are not complete,
      that's why to do it manually:
      
        src/security/security_selinux.h
        src/security/security_driver.h
        src/security/security_selinux.c
        src/security/security_apparmor.h
        src/security/security_apparmor.c
        src/security/security_driver.c
      f9ce7dad
  22. 19 7月, 2012 1 次提交
  23. 10 4月, 2012 1 次提交
    • E
      build: avoid s390 compiler warnings · 9011a494
      Eric Blake 提交于
      I noticed these compiler warnings when building for the s390 architecture.
      
      * src/node_device/node_device_udev.c (udevDeviceMonitorStartup):
      Mark unused variable.
      * src/nodeinfo.c (linuxNodeInfoCPUPopulate): Avoid unused variable.
      9011a494
  24. 30 3月, 2012 1 次提交
  25. 27 9月, 2011 1 次提交
  26. 08 9月, 2011 1 次提交
  27. 16 8月, 2011 1 次提交