Re: [PATCH 4/5] install vbox api register in vbox_driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23.06.2014 06:25, Taowei wrote:
Register pVBoxAPI in vbox_common.c with the current vbox
version.

---
  src/vbox/vbox_driver.c |   35 +++++++++++++++++++++++++++++++----
  1 file changed, 31 insertions(+), 4 deletions(-)

diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c
index 7d004b2..4eb3c04 100644
--- a/src/vbox/vbox_driver.c
+++ b/src/vbox/vbox_driver.c
@@ -39,6 +39,9 @@
  #include "vbox_glue.h"
  #include "virerror.h"
  #include "virutil.h"
+#include "domain_event.h"
+#include "domain_conf.h"
+#include "vbox_common.h"

  #define VIR_FROM_THIS VIR_FROM_VBOX

@@ -47,33 +50,43 @@ VIR_LOG_INIT("vbox.vbox_driver");
  extern virDriver vbox22Driver;
  extern virNetworkDriver vbox22NetworkDriver;
  extern virStorageDriver vbox22StorageDriver;
+extern vboxUniformedAPI vbox22UniformedAPI;

I assume as the code is rewritten, these vbox22StorageDriver and vbox22NetworkDriver and others will go away, right?

  extern virDriver vbox30Driver;
  extern virNetworkDriver vbox30NetworkDriver;
  extern virStorageDriver vbox30StorageDriver;
+extern vboxUniformedAPI vbox30UniformedAPI;
  extern virDriver vbox31Driver;
  extern virNetworkDriver vbox31NetworkDriver;
  extern virStorageDriver vbox31StorageDriver;
+extern vboxUniformedAPI vbox31UniformedAPI;
  extern virDriver vbox32Driver;
  extern virNetworkDriver vbox32NetworkDriver;
  extern virStorageDriver vbox32StorageDriver;
+extern vboxUniformedAPI vbox32UniformedAPI;
  extern virDriver vbox40Driver;
  extern virNetworkDriver vbox40NetworkDriver;
  extern virStorageDriver vbox40StorageDriver;
+extern vboxUniformedAPI vbox40UniformedAPI;
  extern virDriver vbox41Driver;
  extern virNetworkDriver vbox41NetworkDriver;
  extern virStorageDriver vbox41StorageDriver;
+extern vboxUniformedAPI vbox41UniformedAPI;
  extern virDriver vbox42Driver;
  extern virNetworkDriver vbox42NetworkDriver;
  extern virStorageDriver vbox42StorageDriver;
+extern vboxUniformedAPI vbox42UniformedAPI;
  extern virDriver vbox42_20Driver;
  extern virNetworkDriver vbox42_20NetworkDriver;
  extern virStorageDriver vbox42_20StorageDriver;
+extern vboxUniformedAPI vbox42_20UniformedAPI;
  extern virDriver vbox43Driver;
  extern virNetworkDriver vbox43NetworkDriver;
  extern virStorageDriver vbox43StorageDriver;
+extern vboxUniformedAPI vbox43UniformedAPI;
  extern virDriver vbox43_4Driver;
  extern virNetworkDriver vbox43_4NetworkDriver;
  extern virStorageDriver vbox43_4StorageDriver;
+extern vboxUniformedAPI vbox43_4UniformedAPI;

  static virDriver vboxDriverDummy;

@@ -84,6 +97,7 @@ int vboxRegister(void)
      virDriverPtr        driver;
      virNetworkDriverPtr networkDriver;
      virStorageDriverPtr storageDriver;
+    vboxUniformedAPI *vboxAPI;
      uint32_t            uVersion;

      /*
@@ -95,6 +109,7 @@ int vboxRegister(void)
      driver        = &vboxDriverDummy;
      networkDriver = &vbox22NetworkDriver;
      storageDriver = &vbox22StorageDriver;
+    vboxAPI       = &vbox22UniformedAPI;

      /* Init the glue and get the API version. */
      if (VBoxCGlueInit(&uVersion) == 0) {
@@ -113,51 +128,61 @@ int vboxRegister(void)
              driver        = &vbox22Driver;
              networkDriver = &vbox22NetworkDriver;
              storageDriver = &vbox22StorageDriver;
+            vboxAPI       = &vbox22UniformedAPI;
          } else if (uVersion >= 2002051 && uVersion < 3000051) {
              VIR_DEBUG("VirtualBox API version: 3.0");
              driver        = &vbox30Driver;
              networkDriver = &vbox30NetworkDriver;
              storageDriver = &vbox30StorageDriver;
+            vboxAPI       = &vbox30UniformedAPI;
          } else if (uVersion >= 3000051 && uVersion < 3001051) {
              VIR_DEBUG("VirtualBox API version: 3.1");
              driver        = &vbox31Driver;
              networkDriver = &vbox31NetworkDriver;
              storageDriver = &vbox31StorageDriver;
+            vboxAPI       = &vbox31UniformedAPI;
          } else if (uVersion >= 3001051 && uVersion < 3002051) {
              VIR_DEBUG("VirtualBox API version: 3.2");
              driver        = &vbox32Driver;
              networkDriver = &vbox32NetworkDriver;
              storageDriver = &vbox32StorageDriver;
+            vboxAPI       = &vbox32UniformedAPI;
          } else if (uVersion >= 3002051 && uVersion < 4000051) {
              VIR_DEBUG("VirtualBox API version: 4.0");
              driver        = &vbox40Driver;
              networkDriver = &vbox40NetworkDriver;
              storageDriver = &vbox40StorageDriver;
+            vboxAPI       = &vbox40UniformedAPI;
          } else if (uVersion >= 4000051 && uVersion < 4001051) {
              VIR_DEBUG("VirtualBox API version: 4.1");
              driver        = &vbox41Driver;
              networkDriver = &vbox41NetworkDriver;
              storageDriver = &vbox41StorageDriver;
+            vboxAPI       = &vbox41UniformedAPI;
          } else if (uVersion >= 4001051 && uVersion < 4002020) {
              VIR_DEBUG("VirtualBox API version: 4.2");
              driver        = &vbox42Driver;
              networkDriver = &vbox42NetworkDriver;
              storageDriver = &vbox42StorageDriver;
+            vboxAPI       = &vbox42UniformedAPI;
          } else if (uVersion >= 4002020 && uVersion < 4002051) {
-           VIR_DEBUG("VirtualBox API version: 4.2.20 or higher");
-           driver         = &vbox42_20Driver;
-           networkDriver  = &vbox42_20NetworkDriver;
-           storageDriver  = &vbox42_20StorageDriver;
+            VIR_DEBUG("VirtualBox API version: 4.2.20 or higher");
+            driver         = &vbox42_20Driver;
+            networkDriver  = &vbox42_20NetworkDriver;
+            storageDriver  = &vbox42_20StorageDriver;
+            vboxAPI        = &vbox42_20UniformedAPI;
          } else if (uVersion >= 4002051 && uVersion < 4003004) {
              VIR_DEBUG("VirtualBox API version: 4.3");
              driver        = &vbox43Driver;
              networkDriver = &vbox43NetworkDriver;
              storageDriver = &vbox43StorageDriver;
+            vboxAPI       = &vbox43UniformedAPI;
          } else if (uVersion >= 4003004 && uVersion < 4003051) {
              VIR_DEBUG("VirtualBox API version: 4.3.4 or higher");
              driver        = &vbox43_4Driver;
              networkDriver = &vbox43_4NetworkDriver;
              storageDriver = &vbox43_4StorageDriver;
+            vboxAPI       = &vbox43_4UniformedAPI;
          } else {
              VIR_DEBUG("Unsupported VirtualBox API version: %u", uVersion);
          }
@@ -172,6 +197,8 @@ int vboxRegister(void)
      if (virRegisterStorageDriver(storageDriver) < 0)
          return -1;

+    vboxRegisterUniformedAPI(vboxAPI);
+
      return 0;
  }



--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]