[PATCH 1/7] vbox: drop support for VirtualBox 4.x releases

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

 



Support for all the 4.x releases was ended by VirtualBox maintainers in
Dec 2015. Even the "newest" 4.3.40 of those is only supported on old
versions of Linux (Ubuntu <= 13.03, RHEL <= 6, SLES <= 11), which are all
discontinued hosts from Libvirt's POV.

We can thus reasonably drop all 4.x support from the libvirt VirtualBox
driver.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 src/vbox/Makefile.inc.am      |   6 -
 src/vbox/vbox_V4_0.c          |  37 ------
 src/vbox/vbox_V4_1.c          |  37 ------
 src/vbox/vbox_V4_2.c          |  13 --
 src/vbox/vbox_V4_2_20.c       |  13 --
 src/vbox/vbox_V4_3.c          |  13 --
 src/vbox/vbox_V4_3_4.c        |  13 --
 src/vbox/vbox_common.h        |  14 +--
 src/vbox/vbox_storage.c       |  14 +--
 src/vbox/vbox_tmpl.c          | 218 +---------------------------------
 src/vbox/vbox_uniformed_api.h |  10 +-
 11 files changed, 7 insertions(+), 381 deletions(-)
 delete mode 100644 src/vbox/vbox_V4_0.c
 delete mode 100644 src/vbox/vbox_V4_1.c
 delete mode 100644 src/vbox/vbox_V4_2.c
 delete mode 100644 src/vbox/vbox_V4_2_20.c
 delete mode 100644 src/vbox/vbox_V4_3.c
 delete mode 100644 src/vbox/vbox_V4_3_4.c

diff --git a/src/vbox/Makefile.inc.am b/src/vbox/Makefile.inc.am
index 8c76f84e82..6438998a87 100644
--- a/src/vbox/Makefile.inc.am
+++ b/src/vbox/Makefile.inc.am
@@ -5,17 +5,11 @@ VBOX_DRIVER_SOURCES = \
 	vbox/vbox_driver.h \
 	vbox/vbox_snapshot_conf.c \
 	vbox/vbox_snapshot_conf.h \
-	vbox/vbox_V4_0.c \
 	vbox/vbox_CAPI_v4_0.h \
-	vbox/vbox_V4_1.c \
 	vbox/vbox_CAPI_v4_1.h \
-	vbox/vbox_V4_2.c \
 	vbox/vbox_CAPI_v4_2.h \
-	vbox/vbox_V4_2_20.c \
 	vbox/vbox_CAPI_v4_2_20.h \
-	vbox/vbox_V4_3.c \
 	vbox/vbox_CAPI_v4_3.h \
-	vbox/vbox_V4_3_4.c \
 	vbox/vbox_CAPI_v4_3_4.h \
 	vbox/vbox_V5_0.c \
 	vbox/vbox_CAPI_v5_0.h \
diff --git a/src/vbox/vbox_V4_0.c b/src/vbox/vbox_V4_0.c
deleted file mode 100644
index e4dc13a92b..0000000000
--- a/src/vbox/vbox_V4_0.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/** @file vbox_V4_0.c
- * C file to include support for multiple versions of VirtualBox
- * at runtime.
- */
-
-/*
- * Copyright (C) 2008-2009 Sun Microsystems, Inc.
- *
- * This file is part of a free software library; you can redistribute
- * it and/or modify it under the terms of the GNU Lesser General
- * Public License version 2.1 as published by the Free Software
- * Foundation and shipped in the "COPYING.LESSER" file with this library.
- * The library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY of any kind.
- *
- * Sun LGPL Disclaimer: For the avoidance of doubt, except that if
- * any license choice other than GPL or LGPL is available it will
- * apply instead, Sun elects to use only the Lesser General Public
- * License version 2.1 (LGPLv2) at this time for any software where
- * a choice of LGPL license versions is made available with the
- * language indicating that LGPLv2 or any later version may be used,
- * or where a choice of which version of the LGPL is applied is
- * otherwise unspecified.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include <config.h>
-
-/** The API Version */
-#define VBOX_API_VERSION 4000000
-/** Version specific prefix. */
-#define NAME(name) vbox40##name
-
-#include "vbox_tmpl.c"
diff --git a/src/vbox/vbox_V4_1.c b/src/vbox/vbox_V4_1.c
deleted file mode 100644
index b3e8eda209..0000000000
--- a/src/vbox/vbox_V4_1.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/** @file vbox_V4_0.c
- * C file to include support for multiple versions of VirtualBox
- * at runtime.
- */
-
-/*
- * Copyright (C) 2008-2009 Sun Microsystems, Inc.
- *
- * This file is part of a free software library; you can redistribute
- * it and/or modify it under the terms of the GNU Lesser General
- * Public License version 2.1 as published by the Free Software
- * Foundation and shipped in the "COPYING.LESSER" file with this library.
- * The library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY of any kind.
- *
- * Sun LGPL Disclaimer: For the avoidance of doubt, except that if
- * any license choice other than GPL or LGPL is available it will
- * apply instead, Sun elects to use only the Lesser General Public
- * License version 2.1 (LGPLv2) at this time for any software where
- * a choice of LGPL license versions is made available with the
- * language indicating that LGPLv2 or any later version may be used,
- * or where a choice of which version of the LGPL is applied is
- * otherwise unspecified.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include <config.h>
-
-/** The API Version */
-#define VBOX_API_VERSION 4001000
-/** Version specific prefix. */
-#define NAME(name) vbox41##name
-
-#include "vbox_tmpl.c"
diff --git a/src/vbox/vbox_V4_2.c b/src/vbox/vbox_V4_2.c
deleted file mode 100644
index 00b1e42d38..0000000000
--- a/src/vbox/vbox_V4_2.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/** @file vbox_V4_2.c
- * C file to include support for multiple versions of VirtualBox
- * at runtime.
- */
-
-#include <config.h>
-
-/** The API Version */
-#define VBOX_API_VERSION 4002000
-/** Version specific prefix. */
-#define NAME(name) vbox42##name
-
-#include "vbox_tmpl.c"
diff --git a/src/vbox/vbox_V4_2_20.c b/src/vbox/vbox_V4_2_20.c
deleted file mode 100644
index 73a2f644d2..0000000000
--- a/src/vbox/vbox_V4_2_20.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/** @file vbox_V4_2_20.c
- * C file to include support for multiple versions of VirtualBox
- * at runtime.
- */
-
-#include <config.h>
-
-/** The API Version */
-#define VBOX_API_VERSION 4002020
-/** Version specific prefix. */
-#define NAME(name) vbox42_20##name
-
-#include "vbox_tmpl.c"
diff --git a/src/vbox/vbox_V4_3.c b/src/vbox/vbox_V4_3.c
deleted file mode 100644
index 97810ddfcf..0000000000
--- a/src/vbox/vbox_V4_3.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/** @file vbox_V4_3.c
- * C file to include support for multiple versions of VirtualBox
- * at runtime.
- */
-
-#include <config.h>
-
-/** The API Version */
-#define VBOX_API_VERSION 4003000
-/** Version specific prefix. */
-#define NAME(name) vbox43##name
-
-#include "vbox_tmpl.c"
diff --git a/src/vbox/vbox_V4_3_4.c b/src/vbox/vbox_V4_3_4.c
deleted file mode 100644
index 19ee5ef2a2..0000000000
--- a/src/vbox/vbox_V4_3_4.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/** @file vbox_V4_3_4.c
- * C file to include support for multiple versions of VirtualBox
- * at runtime.
- */
-
-#include <config.h>
-
-/** The API Version */
-#define VBOX_API_VERSION 4003004
-/** Version specific prefix. */
-#define NAME(name) vbox43_4##name
-
-#include "vbox_tmpl.c"
diff --git a/src/vbox/vbox_common.h b/src/vbox/vbox_common.h
index c67f6fba42..f3b9afad8f 100644
--- a/src/vbox/vbox_common.h
+++ b/src/vbox/vbox_common.h
@@ -430,19 +430,7 @@ typedef nsISupports IKeyboard;
 # define installUniformedAPI(gVBoxAPI, result) \
     do { \
         result = 0; \
-        if (uVersion >= 3002051 && uVersion < 4000051) { \
-            vbox40InstallUniformedAPI(&gVBoxAPI); \
-        } else if (uVersion >= 4000051 && uVersion < 4001051) { \
-            vbox41InstallUniformedAPI(&gVBoxAPI); \
-        } else if (uVersion >= 4001051 && uVersion < 4002020) { \
-            vbox42InstallUniformedAPI(&gVBoxAPI); \
-        } else if (uVersion >= 4002020 && uVersion < 4002051) { \
-            vbox42_20InstallUniformedAPI(&gVBoxAPI); \
-        } else if (uVersion >= 4002051 && uVersion < 4003004) { \
-            vbox43InstallUniformedAPI(&gVBoxAPI); \
-        } else if (uVersion >= 4003004 && uVersion < 4003051) { \
-            vbox43_4InstallUniformedAPI(&gVBoxAPI); \
-        } else if (uVersion >= 4003051 && uVersion < 5000051) { \
+        if (uVersion >= 5000000 && uVersion < 5000051) { \
             vbox50InstallUniformedAPI(&gVBoxAPI); \
         } else if (uVersion >= 5000051 && uVersion < 5001051) { \
             vbox51InstallUniformedAPI(&gVBoxAPI); \
diff --git a/src/vbox/vbox_storage.c b/src/vbox/vbox_storage.c
index ae16094dbe..f879e287cb 100644
--- a/src/vbox/vbox_storage.c
+++ b/src/vbox/vbox_storage.c
@@ -884,19 +884,7 @@ virStorageDriverPtr vboxGetStorageDriver(uint32_t uVersion)
     /* Install gVBoxAPI according to the vbox API version.
      * Return -1 for unsupported version.
      */
-    if (uVersion >= 3002051 && uVersion < 4000051) {
-        vbox40InstallUniformedAPI(&gVBoxAPI);
-    } else if (uVersion >= 4000051 && uVersion < 4001051) {
-        vbox41InstallUniformedAPI(&gVBoxAPI);
-    } else if (uVersion >= 4001051 && uVersion < 4002020) {
-        vbox42InstallUniformedAPI(&gVBoxAPI);
-    } else if (uVersion >= 4002020 && uVersion < 4002051) {
-        vbox42_20InstallUniformedAPI(&gVBoxAPI);
-    } else if (uVersion >= 4002051 && uVersion < 4003004) {
-        vbox43InstallUniformedAPI(&gVBoxAPI);
-    } else if (uVersion >= 4003004 && uVersion < 4003051) {
-        vbox43_4InstallUniformedAPI(&gVBoxAPI);
-    } else if (uVersion >= 4003051 && uVersion < 5000051) {
+    if (uVersion >= 5000000 && uVersion < 5000051) {
         vbox50InstallUniformedAPI(&gVBoxAPI);
     } else if (uVersion >= 5000051 && uVersion < 5001051) {
         vbox51InstallUniformedAPI(&gVBoxAPI);
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 53d4fd7e18..00e00c0491 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -49,19 +49,7 @@
 #include "virutil.h"
 
 /* This one changes from version to version. */
-#if VBOX_API_VERSION == 4000000
-# include "vbox_CAPI_v4_0.h"
-#elif VBOX_API_VERSION == 4001000
-# include "vbox_CAPI_v4_1.h"
-#elif VBOX_API_VERSION == 4002000
-# include "vbox_CAPI_v4_2.h"
-#elif VBOX_API_VERSION == 4002020
-# include "vbox_CAPI_v4_2_20.h"
-#elif VBOX_API_VERSION == 4003000
-# include "vbox_CAPI_v4_3.h"
-#elif VBOX_API_VERSION == 4003004
-# include "vbox_CAPI_v4_3_4.h"
-#elif VBOX_API_VERSION == 5000000
+#if VBOX_API_VERSION == 5000000
 # include "vbox_CAPI_v5_0.h"
 #elif VBOX_API_VERSION == 5001000
 # include "vbox_CAPI_v5_1.h"
@@ -74,11 +62,7 @@
 /* Include this *last* or we'll get the wrong vbox_CAPI_*.h. */
 #include "vbox_glue.h"
 
-#if VBOX_API_VERSION < 4003000
-typedef IUSBController IUSBCommon;
-#else /* VBOX_API_VERSION >= 4003000 */
 typedef IUSBDeviceFilters IUSBCommon;
-#endif /* VBOX_API_VERSION >= 4003000 */
 
 
 #include "vbox_uniformed_api.h"
@@ -313,9 +297,6 @@ _vboxDomainSnapshotRestore(virDomainPtr dom,
                           ISnapshot *snapshot)
 {
     vboxDriverPtr data = dom->conn->privateData;
-#if VBOX_API_VERSION < 5000000
-    IConsole *console = NULL;
-#endif /*VBOX_API_VERSION < 5000000*/
     IProgress *progress = NULL;
     PRUint32 state;
     nsresult rc;
@@ -348,10 +329,6 @@ _vboxDomainSnapshotRestore(virDomainPtr dom,
     }
 
     rc = machine->vtbl->LockMachine(machine, data->vboxSession, LockType_Write);
-#if VBOX_API_VERSION < 5000000
-    if (NS_SUCCEEDED(rc))
-        rc = data->vboxSession->vtbl->GetConsole(data->vboxSession, &console);
-#endif /*VBOX_API_VERSION < 5000000*/
     if (NS_FAILED(rc)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("could not open VirtualBox session with domain %s"),
@@ -359,11 +336,7 @@ _vboxDomainSnapshotRestore(virDomainPtr dom,
         goto cleanup;
     }
 
-#if VBOX_API_VERSION < 5000000
-    rc = console->vtbl->RestoreSnapshot(console, snapshot, &progress);
-#elif VBOX_API_VERSION >= 5000000  /*VBOX_API_VERSION < 5000000*/
     rc = machine->vtbl->RestoreSnapshot(machine, snapshot, &progress);
-#endif /*VBOX_API_VERSION >= 5000000*/
 
     if (NS_FAILED(rc) || !progress) {
         if (rc == VBOX_E_INVALID_VM_STATE) {
@@ -389,9 +362,6 @@ _vboxDomainSnapshotRestore(virDomainPtr dom,
 
  cleanup:
     VBOX_RELEASE(progress);
-#if VBOX_API_VERSION < 5000000
-    VBOX_RELEASE(console);
-#endif /*VBOX_API_VERSION < 5000000*/
     data->vboxSession->vtbl->UnlockMachine(data->vboxSession);
     vboxIIDUnalloc(&domiid);
     return ret;
@@ -449,20 +419,12 @@ _deleteConfig(IMachine *machine)
                                                  SAFEARRAY **media,
                                                  IProgress **progress);
 
-# if VBOX_API_VERSION < 4003000
-    ((IMachine_Delete)machine->vtbl->Delete)(machine, &safeArray, &progress);
-# else
     ((IMachine_Delete)machine->vtbl->DeleteConfig)(machine, &safeArray, &progress);
-# endif
 #else
     /* XPCOM doesn't like NULL as an array, even when the array size is 0.
      * Instead pass it a dummy array to avoid passing NULL. */
     IMedium *array[] = { NULL };
-# if VBOX_API_VERSION < 4003000
-    machine->vtbl->Delete(machine, 0, array, &progress);
-# else
     machine->vtbl->DeleteConfig(machine, 0, array, &progress);
-# endif
 #endif
     if (progress != NULL) {
         progress->vtbl->WaitForCompletion(progress, -1);
@@ -472,10 +434,9 @@ _deleteConfig(IMachine *machine)
 
 static int _pfnInitialize(vboxDriverPtr driver)
 {
+    nsresult rc;
     if (!(driver->pFuncs = g_pfnGetFunctions(VBOX_XPCOMC_VERSION)))
         return -1;
-#if VBOX_API_VERSION == 4002020 || VBOX_API_VERSION >= 4004004
-    nsresult rc;
 
     rc = driver->pFuncs->pfnClientInitialize(IVIRTUALBOXCLIENT_IID_STR,
                                              &driver->vboxClient);
@@ -486,10 +447,6 @@ static int _pfnInitialize(vboxDriverPtr driver)
         driver->vboxClient->vtbl->GetVirtualBox(driver->vboxClient, &driver->vboxObj);
         driver->vboxClient->vtbl->GetSession(driver->vboxClient, &driver->vboxSession);
     }
-#else
-    driver->pFuncs->pfnComInitialize(IVIRTUALBOX_IID_STR, &driver->vboxObj,
-                                     ISESSION_IID_STR, &driver->vboxSession);
-#endif
 
     return 0;
 }
@@ -497,15 +454,11 @@ static int _pfnInitialize(vboxDriverPtr driver)
 static void _pfnUninitialize(vboxDriverPtr data)
 {
     if (data->pFuncs) {
-#if VBOX_API_VERSION == 4002020 || VBOX_API_VERSION >= 4003004
         VBOX_RELEASE(data->vboxObj);
         VBOX_RELEASE(data->vboxSession);
         VBOX_RELEASE(data->vboxClient);
 
         data->pFuncs->pfnClientUninitialize();
-#else
-        data->pFuncs->pfnComUninitialize();
-#endif
     }
 }
 
@@ -664,16 +617,6 @@ _virtualboxCreateMachine(vboxDriverPtr data, virDomainDefPtr def, IMachine **mac
     VBOX_UTF8_TO_UTF16(def->name, &machineNameUtf16);
     vboxIIDFromUUID(&iid, def->uuid);
     {
-#if VBOX_API_VERSION >= 4000000 && VBOX_API_VERSION < 4002000
-        PRBool override = PR_FALSE;
-        rc = data->vboxObj->vtbl->CreateMachine(data->vboxObj,
-                                                NULL,
-                                                machineNameUtf16,
-                                                NULL,
-                                                iid.value,
-                                                override,
-                                                machine);
-#else /* VBOX_API_VERSION >= 4002000 */
         char *createFlags = NULL;
         PRUnichar *createFlagsUtf16 = NULL;
 
@@ -691,7 +634,6 @@ _virtualboxCreateMachine(vboxDriverPtr data, virDomainDefPtr def, IMachine **mac
                                                 machine);
  cleanup:
         VIR_FREE(createFlags);
-#endif /* VBOX_API_VERSION >= 4002000 */
     }
     VBOX_UTF16_FREE(machineNameUtf16);
     vboxIIDUnalloc(&iid);
@@ -702,16 +644,11 @@ static nsresult
 _virtualboxCreateHardDisk(IVirtualBox *vboxObj, PRUnichar *format,
                           PRUnichar *location, IMedium **medium)
 {
-    /* In vbox 2.2 and 3.0, this function will create a IHardDisk object.
-     * In vbox 3.1 and later, this function will create a IMedium object.
+    /* This function will create a IMedium object.
      */
-#if VBOX_API_VERSION < 5000000
-    return vboxObj->vtbl->CreateHardDisk(vboxObj, format, location, medium);
-#elif VBOX_API_VERSION >= 5000000 /*VBOX_API_VERSION >= 5000000*/
     return vboxObj->vtbl->CreateMedium(vboxObj, format, location,
                                        AccessMode_ReadWrite,
                                        DeviceType_HardDisk, medium);
-#endif /*VBOX_API_VERSION >= 5000000*/
 }
 
 static nsresult
@@ -727,12 +664,8 @@ _virtualboxFindHardDisk(IVirtualBox *vboxObj,
                         PRUint32 accessMode ATTRIBUTE_UNUSED,
                         IMedium **medium)
 {
-#if VBOX_API_VERSION < 4002000
-    return vboxObj->vtbl->FindMedium(vboxObj, location, deviceType, medium);
-#else /* VBOX_API_VERSION >= 4002000 */
     return vboxObj->vtbl->OpenMedium(vboxObj, location, deviceType, accessMode,
                                      PR_FALSE, medium);
-#endif /* VBOX_API_VERSION >= 4002000 */
 }
 
 static nsresult
@@ -742,25 +675,15 @@ _virtualboxOpenMedium(IVirtualBox *vboxObj,
                       PRUint32 accessMode,
                       IMedium **medium)
 {
-#if VBOX_API_VERSION == 4000000
-    return vboxObj->vtbl->OpenMedium(vboxObj, location, deviceType, accessMode,
-                                     medium);
-#elif VBOX_API_VERSION >= 4001000
     return vboxObj->vtbl->OpenMedium(vboxObj, location, deviceType, accessMode,
                                      false, medium);
-#endif
 }
 
 static nsresult
 _virtualboxGetHardDiskByIID(IVirtualBox *vboxObj, vboxIID *iid, IMedium **medium)
 {
-#if VBOX_API_VERSION >= 4000000 && VBOX_API_VERSION < 4002000
-    return vboxObj->vtbl->FindMedium(vboxObj, iid->value, DeviceType_HardDisk,
-                                     medium);
-#else /* VBOX_API_VERSION >= 4002000 */
     return vboxObj->vtbl->OpenMedium(vboxObj, iid->value, DeviceType_HardDisk,
                                      AccessMode_ReadWrite, PR_FALSE, medium);
-#endif /* VBOX_API_VERSION >= 4002000 */
 }
 
 static nsresult
@@ -927,11 +850,7 @@ _machineGetVRDEServer(IMachine *machine, IVRDEServer **VRDEServer)
 static nsresult
 _machineGetUSBCommon(IMachine *machine, IUSBCommon **USBCommon)
 {
-#if VBOX_API_VERSION < 4003000
-    return machine->vtbl->GetUSBController(machine, USBCommon);
-#else
     return machine->vtbl->GetUSBDeviceFilters(machine, USBCommon);
-#endif
 }
 
 static nsresult
@@ -1101,9 +1020,6 @@ _sessionGetMachine(ISession *session, IMachine **machine)
 static nsresult
 _consoleSaveState(IConsole *console, IProgress **progress)
 {
-#if VBOX_API_VERSION < 5000000
-    return console->vtbl->SaveState(console, progress);
-#else /*VBOX_API_VERSION < 5000000*/
     IMachine *machine;
     nsresult rc;
 
@@ -1116,8 +1032,6 @@ _consoleSaveState(IConsole *console, IProgress **progress)
                        _("unable to get machine from console. (error %d)"), rc);
 
     return rc;
-
-#endif /*VBOX_API_VERSION >= 5000000*/
 }
 
 static nsresult
@@ -1162,9 +1076,6 @@ static nsresult
 _consoleTakeSnapshot(IConsole *console, PRUnichar *name,
                      PRUnichar *description, IProgress **progress)
 {
-#if VBOX_API_VERSION < 5000000
-    return console->vtbl->TakeSnapshot(console, name, description, progress);
-#else
     IMachine *machine;
     nsresult rc;
     PRUnichar *id = NULL;
@@ -1180,15 +1091,11 @@ _consoleTakeSnapshot(IConsole *console, PRUnichar *name,
 
     VBOX_RELEASE(machine);
     return rc;
-#endif /* VBOX_API_VERSION >= 5000000 */
 }
 
 static nsresult
 _consoleDeleteSnapshot(IConsole *console, vboxIID *iid, IProgress **progress)
 {
-#if VBOX_API_VERSION < 5000000 /* VBOX_API_VERSION < 5000000 */
-    return console->vtbl->DeleteSnapshot(console, iid->value, progress);
-#else /* VBOX_API_VERSION >= 5000000 */
     IMachine *machine;
     nsresult rc;
 
@@ -1203,7 +1110,6 @@ _consoleDeleteSnapshot(IConsole *console, vboxIID *iid, IProgress **progress)
     VBOX_RELEASE(machine);
 
     return rc;
-#endif /* VBOX_API_VERSION >= 5000000 */
 }
 
 static nsresult
@@ -1252,13 +1158,8 @@ static nsresult
 _systemPropertiesGetMaxNetworkAdapters(ISystemProperties *systemProperties, PRUint32 chipset ATTRIBUTE_UNUSED,
                                        PRUint32 *maxNetworkAdapters)
 {
-#if VBOX_API_VERSION < 4001000
-    return systemProperties->vtbl->GetNetworkAdapterCount(systemProperties,
-                                                          maxNetworkAdapters);
-#else  /* VBOX_API_VERSION >= 4000000 */
     return systemProperties->vtbl->GetMaxNetworkAdapters(systemProperties, chipset,
                                                          maxNetworkAdapters);
-#endif /* VBOX_API_VERSION >= 4000000 */
 }
 
 static nsresult
@@ -1396,58 +1297,6 @@ _networkAdapterSetMACAddress(INetworkAdapter *adapter, PRUnichar *MACAddress)
     return adapter->vtbl->SetMACAddress(adapter, MACAddress);
 }
 
-#if VBOX_API_VERSION < 4001000
-
-static nsresult
-_networkAdapterGetBridgedInterface(INetworkAdapter *adapter, PRUnichar **hostInterface)
-{
-    return adapter->vtbl->GetHostInterface(adapter, hostInterface);
-}
-
-static nsresult
-_networkAdapterSetBridgedInterface(INetworkAdapter *adapter, PRUnichar *hostInterface)
-{
-    return adapter->vtbl->SetHostInterface(adapter, hostInterface);
-}
-
-static nsresult
-_networkAdapterGetHostOnlyInterface(INetworkAdapter *adapter, PRUnichar **hostOnlyInterface)
-{
-    return adapter->vtbl->GetHostInterface(adapter, hostOnlyInterface);
-}
-
-static nsresult
-_networkAdapterSetHostOnlyInterface(INetworkAdapter *adapter, PRUnichar *hostOnlyInterface)
-{
-    return adapter->vtbl->SetHostInterface(adapter, hostOnlyInterface);
-}
-
-static nsresult
-_networkAdapterAttachToBridgedInterface(INetworkAdapter *adapter)
-{
-    return adapter->vtbl->AttachToBridgedInterface(adapter);
-}
-
-static nsresult
-_networkAdapterAttachToInternalNetwork(INetworkAdapter *adapter)
-{
-    return adapter->vtbl->AttachToInternalNetwork(adapter);
-}
-
-static nsresult
-_networkAdapterAttachToHostOnlyInterface(INetworkAdapter *adapter)
-{
-    return adapter->vtbl->AttachToHostOnlyInterface(adapter);
-}
-
-static nsresult
-_networkAdapterAttachToNAT(INetworkAdapter *adapter)
-{
-    return adapter->vtbl->AttachToNAT(adapter);
-}
-
-#else /* VBOX_API_VERSION >= 4001000 */
-
 static nsresult
 _networkAdapterGetBridgedInterface(INetworkAdapter *adapter, PRUnichar **bridgedInterface)
 {
@@ -1496,8 +1345,6 @@ _networkAdapterAttachToNAT(INetworkAdapter *adapter)
     return adapter->vtbl->SetAttachmentType(adapter, NetworkAttachmentType_NAT);
 }
 
-#endif /* VBOX_API_VERSION >= 4001000 */
-
 static nsresult
 _serialPortGetEnabled(ISerialPort *port, PRBool *enabled)
 {
@@ -1764,14 +1611,6 @@ static nsresult
 _usbCommonEnable(IUSBCommon *USBCommon ATTRIBUTE_UNUSED)
 {
     nsresult rc = 0;
-#if VBOX_API_VERSION < 4003000
-    USBCommon->vtbl->SetEnabled(USBCommon, 1);
-# if VBOX_API_VERSION < 4002000
-    rc = USBCommon->vtbl->SetEnabledEhci(USBCommon, 1);
-# else /* VBOX_API_VERSION >= 4002000 */
-    rc = USBCommon->vtbl->SetEnabledEHCI(USBCommon, 1);
-# endif /* VBOX_API_VERSION >= 4002000 */
-#endif /* VBOX_API_VERSION >= 4003000 */
     /* We don't need to set usb enabled for vbox 4.3 and later */
     return rc;
 }
@@ -1779,12 +1618,8 @@ _usbCommonEnable(IUSBCommon *USBCommon ATTRIBUTE_UNUSED)
 static nsresult
 _usbCommonGetEnabled(IUSBCommon *USBCommon ATTRIBUTE_UNUSED, PRBool *enabled)
 {
-#if VBOX_API_VERSION < 4003000
-    return USBCommon->vtbl->GetEnabled(USBCommon, enabled);
-#else /* VBOX_API_VERSION >= 4003000 */
     *enabled = true;
     return 0;
-#endif /* VBOX_API_VERSION >= 4003000 */
 }
 
 static nsresult
@@ -1921,26 +1756,14 @@ _mediumCreateDiffStorage(IMedium *medium ATTRIBUTE_UNUSED,
                          PRUint32 *variant ATTRIBUTE_UNUSED,
                          IProgress **progress ATTRIBUTE_UNUSED)
 {
-#if VBOX_API_VERSION < 4003000
-    if (variantSize == 0)
-        return 0;
-    if (variantSize > 1)
-        VIR_WARN("Only one variant is available in current version");
-    return medium->vtbl->CreateDiffStorage(medium, target, variant[0], progress);
-#else /* VBOX_API_VERSION >= 4003000 */
     return medium->vtbl->CreateDiffStorage(medium, target, variantSize, variant, progress);
-#endif /* VBOX_API_VERSION >= 4003000 */
 }
 
 static nsresult
 _mediumCreateBaseStorage(IMedium *medium, PRUint64 logicalSize,
                            PRUint32 variant, IProgress **progress)
 {
-#if VBOX_API_VERSION < 4003000
-    return medium->vtbl->CreateBaseStorage(medium, logicalSize, variant, progress);
-#else
     return medium->vtbl->CreateBaseStorage(medium, logicalSize, 1, &variant, progress);
-#endif
 }
 
 static nsresult
@@ -2075,20 +1898,11 @@ _displayGetScreenResolution(IDisplay *display ATTRIBUTE_UNUSED,
                             PRInt32 *xOrigin ATTRIBUTE_UNUSED,
                             PRInt32 *yOrigin ATTRIBUTE_UNUSED)
 {
-#if VBOX_API_VERSION < 4003000
-    return display->vtbl->GetScreenResolution(display, screenId, width,
-                                              height, bitsPerPixel);
-#elif VBOX_API_VERSION < 5000000 /* VBOX_API_VERSION >= 4003000 */
-    return display->vtbl->GetScreenResolution(display, screenId, width,
-                                              height, bitsPerPixel,
-                                              xOrigin, yOrigin);
-#else /*VBOX_API_VERSION >= 5000000 */
     PRUint32 gms;
 
     return display->vtbl->GetScreenResolution(display, screenId, width,
                                               height, bitsPerPixel,
                                               xOrigin, yOrigin, &gms);
-#endif /* VBOX_API_VERSION >= 5000000 */
 }
 
 static nsresult
@@ -2097,15 +1911,9 @@ _displayTakeScreenShotPNGToArray(IDisplay *display, PRUint32 screenId,
                                  PRUint32 *screenDataSize,
                                  PRUint8** screenData)
 {
-#if VBOX_API_VERSION >= 5000000
     return display->vtbl->TakeScreenShotToArray(display, screenId, width,
                                                 height, BitmapFormat_PNG,
                                                 screenDataSize, screenData);
-#else /* VBOX_API_VERSION < 5000000 */
-    return display->vtbl->TakeScreenShotPNGToArray(display, screenId, width,
-                                                   height, screenDataSize,
-                                                   screenData);
-#endif /* VBOX_API_VERSION >= 5000000 */
 }
 
 static nsresult
@@ -2197,31 +2005,19 @@ static nsresult
 _hnInterfaceEnableStaticIPConfig(IHostNetworkInterface *hni, PRUnichar *IPAddress,
                                  PRUnichar *networkMask)
 {
-#if VBOX_API_VERSION < 4002000
-    return hni->vtbl->EnableStaticIpConfig(hni, IPAddress, networkMask);
-#else
     return hni->vtbl->EnableStaticIPConfig(hni, IPAddress, networkMask);
-#endif
 }
 
 static nsresult
 _hnInterfaceEnableDynamicIPConfig(IHostNetworkInterface *hni)
 {
-#if VBOX_API_VERSION < 4002000
-    return hni->vtbl->EnableDynamicIpConfig(hni);
-#else
     return hni->vtbl->EnableDynamicIPConfig(hni);
-#endif
 }
 
 static nsresult
 _hnInterfaceDHCPRediscover(IHostNetworkInterface *hni)
 {
-#if VBOX_API_VERSION < 4002000
-    return hni->vtbl->DhcpRediscover(hni);
-#else
     return hni->vtbl->DHCPRediscover(hni);
-#endif
 }
 
 static nsresult
@@ -2695,15 +2491,7 @@ void NAME(InstallUniformedAPI)(vboxUniformedAPI *pVBoxAPI)
     pVBoxAPI->UIKeyboard = _UIKeyboard;
     pVBoxAPI->machineStateChecker = _machineStateChecker;
 
-#if VBOX_API_VERSION >= 4001000
     pVBoxAPI->chipsetType = 1;
-#else /* VBOX_API_VERSION < 4001000 */
-    pVBoxAPI->chipsetType = 0;
-#endif /* VBOX_API_VERSION < 4001000 */
 
-#if VBOX_API_VERSION >= 4002000
     pVBoxAPI->vboxSnapshotRedefine = 1;
-#else /* VBOX_API_VERSION < 4002000 */
-    pVBoxAPI->vboxSnapshotRedefine = 0;
-#endif /* VBOX_API_VERSION < 4002000 */
 }
diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h
index 5f3df5fb87..3a74830752 100644
--- a/src/vbox/vbox_uniformed_api.h
+++ b/src/vbox/vbox_uniformed_api.h
@@ -85,9 +85,9 @@ struct _vboxDriver {
     PCVBOXXPCOM pFuncs;
     IVirtualBox *vboxObj;
     ISession *vboxSession;
-# if VBOX_API_VERSION == 4002020 || VBOX_API_VERSION >= 4003004
+#ifdef VBOX_API_VERSION
     IVirtualBoxClient *vboxClient;
-# endif
+#endif
 
     unsigned long version;
 
@@ -556,12 +556,6 @@ virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn,
                                     const unsigned char *uuid);
 
 /* Version specified functions for installing uniformed API */
-void vbox40InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
-void vbox41InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
-void vbox42InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
-void vbox42_20InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
-void vbox43InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
-void vbox43_4InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
 void vbox50InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
 void vbox51InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
 void vbox52InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
-- 
2.20.1

--
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]

  Powered by Linux