1. 24 11月, 2016 2 次提交
    • D
      vbox: get rid of g_pVBoxGlobalData · 63586535
      Dawid Zamirski 提交于
      now that we have a new global vboxDriver object, remove the old
      vboxGlobalData struct and all references to it.
      63586535
    • D
      vbox: change how vbox API is initialized. · 04518c36
      Dawid Zamirski 提交于
      * add vboxDriver object to serve as a singleton global object that
        holds references to IVirtualBox and ISession to be shared among
        multiple connections. The vbox_driver is instantiated only once in
        the first call vboxGetDriverConnection function that is guarded by
        a mutex.
      
      * call vbox API initialize only when the first connection is
        established, and likewise uninitialize when last connection
        disconnects. The prevents each subsequent connection from overwriting
        IVirtualBox/ISession instances of any other active connection that
        led to libvirtd segfaults. The virConnectOpen and virConnectClose
        implementations are guarded by mutex on the global vbox_driver_lock
        where the global vbox_driver object counts connectios and decides
        when it's safe to call vbox's init/uninit routines.
      
      * add IVirutalBoxClient to vboxDriver and use it to in tandem with newer
        pfnClientInitialize/pfnClientUninitalize APIs for vbox versions that
        support it, to avoid usage of the old pfnComInitialize/Uninitialize.
      04518c36
  2. 08 11月, 2016 1 次提交
  3. 24 6月, 2016 1 次提交
  4. 08 3月, 2016 1 次提交
    • M
      _virtualboxCreateMachine: Avoid unbounded stack · 18f231e6
      Michal Privoznik 提交于
      If the stars are in the right position and you're building with
      VBox >= 4.2.0 it will happen that compiler thinks an array
      allocated on the stack may be unbounded:
      
      In file included from vbox/vbox_V4_2.c:13:0:
      vbox/vbox_tmpl.c: In function '_virtualboxCreateMachine':
      vbox/vbox_tmpl.c:2811:1: error: stack usage might be unbounded [-Werror=stack-usage=]
       _virtualboxCreateMachine(vboxGlobalData *data, virDomainDefPtr def, IMachine **machine, char *uuidstr ATTRIBUTE_UNUSED)
       ^
      
      Well, given how the variable is declared, I had some hard time
      seeing it is actually bounded. Surprisingly compiler does not
      complain because of -Wframe-larger-than. This is because
      variable length arrays do not count into that warning.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      18f231e6
  5. 03 3月, 2016 1 次提交
    • M
      Initialize couple of variables. · bde6e002
      Michal Privoznik 提交于
      While trying to build with -Os couple of compile errors showed
      up.
      
      conf/domain_conf.c: In function 'virDomainChrRemove':
      conf/domain_conf.c:13666:24: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           virDomainChrDefPtr ret, **arrPtr = NULL;
                              ^
      Compiler fails to see that @ret is used only if set in the loop,
      but whatever, there's no harm in initializing the variable.
      
      In vboxAttachDrivesNew and _vboxAttachDrivesOld compiler thinks
      that @rc may be used uninitialized. Well, not directly, but maybe
      after some optimization. Yet again, no harm in initializing a
      variable.
      
      In file included from ./util/virthread.h:26:0,
                       from ./datatypes.h:28,
                       from vbox/vbox_tmpl.c:43,
                       from vbox/vbox_V3_1.c:37:
      vbox/vbox_tmpl.c: In function '_vboxAttachDrivesOld':
      ./util/virerror.h:181:5: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           virReportErrorHelper(VIR_FROM_THIS, code, __FILE__,              \
           ^
      In file included from vbox/vbox_V3_1.c:37:0:
      vbox/vbox_tmpl.c:1041:14: note: 'rc' was declared here
           nsresult rc;
                    ^
      Yet again, one uninitialized variable:
      
      qemu/qemu_driver.c: In function 'qemuDomainBlockCommit':
      qemu/qemu_driver.c:17194:9: error: 'baseSource' may be used uninitialized in this function [-Werror=maybe-uninitialized]
               qemuDomainPrepareDiskChainElement(driver, vm, baseSource,
               ^
      
      And another one:
      
      storage/storage_backend_logical.c: In function 'virStorageBackendLogicalMatchPoolSource.isra.2':
      storage/storage_backend_logical.c:618:33: error: 'thisSource' may be used uninitialized in this function [-Werror=maybe-uninitialized]
                             thisSource->devices[j].path))
                                       ^
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      bde6e002
  6. 11 2月, 2016 4 次提交
  7. 15 5月, 2015 1 次提交
  8. 08 4月, 2015 1 次提交
  9. 19 11月, 2014 1 次提交
  10. 15 11月, 2014 1 次提交
  11. 29 10月, 2014 18 次提交
    • E
      maint: avoid static zero init in drivers · ec81cf89
      Eric Blake 提交于
      C guarantees that static variables are zero-initialized.  Some older
      compilers (and also gcc -fno-zero-initialized-in-bss) create larger
      binaries if you explicitly zero-initialize a static variable.
      
      * src/libxl/libxl_driver.c: Fix initialization.
      * src/lxc/lxc_controller.c: Likewise.
      * src/openvz/openvz_util.c (openvzKBPerPages): Likewise.
      * src/phyp/phyp_driver.c: Likewise.
      * src/remote/remote_driver.c: Likewise.
      * src/test/test_driver.c: Likewise.
      * src/uml/uml_driver.c: Likewise.
      * src/vbox/vbox_XPCOMCGlue.c: Likewise.
      * src/vbox/vbox_tmpl.c: Likewise.
      * src/xen/xen_driver.c: Likewise.
      * src/xen/xen_hypervisor.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ec81cf89
    • T
      vbox: Remove unused things in vbox_tmpl.c · 2f055b00
      Taowei Luo 提交于
      After rewriting the whole driver, Only version specified code is
      remained in vbox_tmpl.c. So, this patch removes those unused macros
      header files in vbox_tmpl.c.
      2f055b00
    • T
      vbox: New storage driver · 5892944f
      Taowei Luo 提交于
      This patch provides the new stroage driver for vbox. The work
      is similar with patch 87dea4fc and the next b4022de3.
      5892944f
    • T
      vbox: Rewrite vboxStorageVolGetPath · 013aa081
      Taowei Luo 提交于
      013aa081
    • T
      vbox: Rewrite vboxStorageVolGetXMLDesc · 4df7b206
      Taowei Luo 提交于
      4df7b206
    • T
      vbox: Rewrite vboxStorageVolGetInfo · 80f35e6e
      Taowei Luo 提交于
      80f35e6e
    • T
      vbox: Rewrite vboxStorageVolDelete · 1c2c3906
      Taowei Luo 提交于
      The API on IHardDiskAttachment is merged into IMediumAttachment.
      So, we don't need it anymore.
      1c2c3906
    • T
      vbox: Make IMediumAttachment work with vbox2.2 and 3.0 · 3d33e388
      Taowei Luo 提交于
      The GetMedium will always return a IHardDisk object them.
      In 2.2 and 3.0, it is what GetHardDisk exactly do. In 3.1 and later,
      The IMedium is same as IHardDisk.
      3d33e388
    • T
      vbox: Rewrite vboxStorageVolCreateXML · 0cd409cd
      Taowei Luo 提交于
      If the <path> in target element is not given, libvirt will put the
      new volume in ~/.VirtualBox by default.
      0cd409cd
    • T
      vbox: Make CreateHardDisk support all vbox versions · 382e655d
      Taowei Luo 提交于
      The CreateHardDiskMedium only support create HardDisk for medium
      type, and it only works when vbox version >= 3.1. This patch make
      the function workable with all vbox versions and rename it as
      CreateHardDisk.
      
      In vbox 2.2 and 3.0 this function will create a IHardDisk object.
      In vbox later than 3.0, this function will create a IMedium object.
      382e655d
    • T
      vbox: Rewrite vboxStorageVolLookupByPath · fc41e003
      Taowei Luo 提交于
      fc41e003
    • T
      vbox: Make FindMedium support old vbox versions · 1599319c
      Taowei Luo 提交于
      In old version, function FindMedium in UIVirtualBox doesn't work
      for vbox2.2 and 3.0. We assume it will not be used when vbox in
      these versions.
      
      But when rewriting vboxStorageVolLookupByPath, we found it was
      compatibe to use FindMedium to get a IHardDisk object, even in
      vbox old versions. To achieve this, first make FindMedium call
      FindHardDisk when VBOX_API_VERSION < 4000000.
      Then change the argument type **IMedium to **IHardDisk. (As the
      rules in heriachy, we can't transfer a IHardDisk to match
      IMedium in output)
      
      In vbox 2.2 and 3.0, the caller must be aware that they will get
      a IHardDisk object in return.
      1599319c
    • T
      vbox: Rewrite vboxStorageVolLookupByKey · f67ae174
      Taowei Luo 提交于
      f67ae174
    • T
      vbox: Rewrite vboxStorageVolLookupByName · 8a8fa504
      Taowei Luo 提交于
      8a8fa504
    • T
      vbox: Rewrite vboxStoragePoolListVolumes · c3c8cd4f
      Taowei Luo 提交于
      c3c8cd4f
    • T
      vbox: Rewrite vboxStoragePoolNumOfVolumes · ce381d37
      Taowei Luo 提交于
      We use typedef IMedium IHardDisk to make IHardDisk hierachy from
      IMedium (Actually it did on vbox 2.2 and 3.0's C++ API).
      So when calling
          VBOX_MEDIUM_FUNC_ARG*(IHardDisk, func, args)
      we can directly replace it to
          gVBoxAPI.UIMedium.func(IHardDisk, args)
      
      When dealing with this two types, we get some rules from it's
      hierachy relationship.
      
      When using IHardDisk and IMedium as input, we can't transfer a
      IMedium to IHardDisk. Like:
          gVBoxAPI.UIHardDisk.func(IHardDisk *hardDisk, args)
          Here, we can't put a *IMedium as a argument.
      
      When using IHardDisk and IMedium as output, we can't transfer a
      IHardDisk to IMedium. Like:
          gVBoxAPI.UIMachine.GetMedium(IMedium **out)
          Here, we can't put a **IHardDisk as a argument. If this case
          do happen, we either change the API to GetHardDisk or write a
          new one.
      ce381d37
    • T
      vbox: Rewrite vbox-independent functions · 459886d4
      Taowei Luo 提交于
      This patch rewrites the following functions
          *vboxStorageOpen
          *vboxStorageClose
          *vboxConnectNumOfStoragePools
          *vboxConnectListStoragePools
          *vboxStoragePoolLookupByName
      
      These functions do not call any vbox API, so I directly move it
      from vbox_tmpl.c to vbox_storage.c
      
      A small improvement is made on vboxConnectListStoragePools.
      The if condition nnames == 1 is modified to nnames > 0. So if the
      caller put more than one slot to get active storage pools, the new
      function will return exactly one, while the old one would only
      return 0.
      459886d4
    • T
      vbox: Remove VBOX_OBJECT_CHECK macro · a6b1cde3
      Taowei Luo 提交于
      We should follow the rules that CHECK macro only do checking works.
      But this VBOX_OBJECT_CHECK and VBOX_OBJECT_HOST_CHECK declared some
      varibles at the same time, which broke the rule. So the patch
      removed this macros and dispatched it in source code.
      
      The storage driver is still not rewriten at this point. So, I
      remains the VBOX_OBJECT_CHECK macro in vbox_tmpl.c. But this will
      finally be removed in patch 'vbox: Remove unused things in vbox_tmpl.c'
      a6b1cde3
  12. 23 10月, 2014 1 次提交
  13. 03 10月, 2014 7 次提交