vbox: add support for v4.2.20+ and v4.3.4+

Bugs have been found in the VirtualBox API C bindings. These bugs have
been fixed in versions 4.2.20 and 4.3.4. However, the changes in the
C bindings are incompatible with the vbox_CAPI_v4_2.h and vbox_CAPI_v4_3.h
files which are bundled in libvirt source code.
This is why the following patch adds vbox_CAPI_v4_2_20.h and
vbox_CAPI_v4_3_4.h.

The actual underlying problem here is that until now,
libvirt assumed that VirtualBox API can only change between minor
versions (4.2 -> 4.3), but we have a case here where it changed
(or got fixed) between patch versions (4.2.18 -> 4.2.20).

This patch makes the VBOX_API_VERSION represent the full API
version number (i.e 4002 => 4002000) so there are specific version
numbers for Vbox 4.2.20 (4002020) and 4.3.4 (4003004)
This commit is contained in:
Jean-Baptiste Rouault 2013-12-24 09:39:38 +00:00 committed by Matthias Bolte
parent 7f0fd42741
commit bb85da2cb1
15 changed files with 19664 additions and 294 deletions

View File

@ -660,7 +660,9 @@ VBOX_DRIVER_SOURCES = \
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_3.c vbox/vbox_CAPI_v4_3.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_DRIVER_EXTRA_DIST = \
vbox/vbox_tmpl.c vbox/README \

9001
src/vbox/vbox_CAPI_v4_2_20.h Normal file

File diff suppressed because it is too large Load Diff

10321
src/vbox/vbox_CAPI_v4_3_4.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@
#include <config.h>
/** The API Version */
#define VBOX_API_VERSION 2002
#define VBOX_API_VERSION 2002000
/** Version specific prefix. */
#define NAME(name) vbox22##name

View File

@ -30,7 +30,7 @@
#include <config.h>
/** The API Version */
#define VBOX_API_VERSION 3000
#define VBOX_API_VERSION 3000000
/** Version specific prefix. */
#define NAME(name) vbox30##name

View File

@ -30,7 +30,7 @@
#include <config.h>
/** The API Version */
#define VBOX_API_VERSION 3001
#define VBOX_API_VERSION 3001000
/** Version specific prefix. */
#define NAME(name) vbox31##name

View File

@ -30,7 +30,7 @@
#include <config.h>
/** The API Version */
#define VBOX_API_VERSION 3002
#define VBOX_API_VERSION 3002000
/** Version specific prefix. */
#define NAME(name) vbox32##name

View File

@ -30,7 +30,7 @@
#include <config.h>
/** The API Version */
#define VBOX_API_VERSION 4000
#define VBOX_API_VERSION 4000000
/** Version specific prefix. */
#define NAME(name) vbox40##name

View File

@ -30,7 +30,7 @@
#include <config.h>
/** The API Version */
#define VBOX_API_VERSION 4001
#define VBOX_API_VERSION 4001000
/** Version specific prefix. */
#define NAME(name) vbox41##name

View File

@ -6,7 +6,7 @@
#include <config.h>
/** The API Version */
#define VBOX_API_VERSION 4002
#define VBOX_API_VERSION 4002000
/** Version specific prefix. */
#define NAME(name) vbox42##name

13
src/vbox/vbox_V4_2_20.c Normal file
View File

@ -0,0 +1,13 @@
/** @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"

View File

@ -6,7 +6,7 @@
#include <config.h>
/** The API Version */
#define VBOX_API_VERSION 4003
#define VBOX_API_VERSION 4003000
/** Version specific prefix. */
#define NAME(name) vbox43##name

13
src/vbox/vbox_V4_3_4.c Normal file
View File

@ -0,0 +1,13 @@
/** @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"

View File

@ -64,9 +64,15 @@ extern virStorageDriver vbox41StorageDriver;
extern virDriver vbox42Driver;
extern virNetworkDriver vbox42NetworkDriver;
extern virStorageDriver vbox42StorageDriver;
extern virDriver vbox42_20Driver;
extern virNetworkDriver vbox42_20NetworkDriver;
extern virStorageDriver vbox42_20StorageDriver;
extern virDriver vbox43Driver;
extern virNetworkDriver vbox43NetworkDriver;
extern virStorageDriver vbox43StorageDriver;
extern virDriver vbox43_4Driver;
extern virNetworkDriver vbox43_4NetworkDriver;
extern virStorageDriver vbox43_4StorageDriver;
static virDriver vboxDriverDummy;
@ -130,16 +136,26 @@ int vboxRegister(void) {
driver = &vbox41Driver;
networkDriver = &vbox41NetworkDriver;
storageDriver = &vbox41StorageDriver;
} else if (uVersion >= 4001051 && uVersion < 4002051) {
} else if (uVersion >= 4001051 && uVersion < 4002020) {
VIR_DEBUG("VirtualBox API version: 4.2");
driver = &vbox42Driver;
networkDriver = &vbox42NetworkDriver;
storageDriver = &vbox42StorageDriver;
} else if (uVersion >= 4002051 && uVersion < 4003051) {
} 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;
} else if (uVersion >= 4002051 && uVersion < 4003004) {
VIR_DEBUG("VirtualBox API version: 4.3");
driver = &vbox43Driver;
networkDriver = &vbox43NetworkDriver;
storageDriver = &vbox43StorageDriver;
} 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;
} else {
VIR_DEBUG("Unsupported VirtualBox API version: %u", uVersion);
}

File diff suppressed because it is too large Load Diff