vbox: add support for version 6.0 SDK

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2020-04-17 11:57:54 +01:00
parent 20b8658166
commit d9253a0214
6 changed files with 28 additions and 1 deletions

View File

@ -7,6 +7,8 @@ VBOX_DRIVER_SOURCES = \
vbox/vbox_snapshot_conf.h \ vbox/vbox_snapshot_conf.h \
vbox/vbox_V5_2.c \ vbox/vbox_V5_2.c \
vbox/vbox_CAPI_v5_2.h \ vbox/vbox_CAPI_v5_2.h \
vbox/vbox_CAPI_v6_0.h \
vbox/vbox_V6_0.c \
vbox/vbox_common.c \ vbox/vbox_common.c \
vbox/vbox_common.h \ vbox/vbox_common.h \
vbox/vbox_uniformed_api.h \ vbox/vbox_uniformed_api.h \

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

@ -0,0 +1,13 @@
/** @file vbox_V6_0.c
* C file to include support for multiple versions of VirtualBox
* at runtime.
*/
#include <config.h>
/** The API Version */
#define VBOX_API_VERSION 6000000
/** Version specific prefix. */
#define NAME(name) vbox60##name
#include "vbox_tmpl.c"

View File

@ -431,6 +431,8 @@ typedef nsISupports IKeyboard;
result = 0; \ result = 0; \
if (uVersion >= 5001051 && uVersion < 5002051) { \ if (uVersion >= 5001051 && uVersion < 5002051) { \
vbox52InstallUniformedAPI(&gVBoxAPI); \ vbox52InstallUniformedAPI(&gVBoxAPI); \
} else if (uVersion >= 6000000 && uVersion < 6000051) { \
vbox60InstallUniformedAPI(&gVBoxAPI); \
} else { \ } else { \
result = -1; \ result = -1; \
} \ } \

View File

@ -882,6 +882,8 @@ virStorageDriverPtr vboxGetStorageDriver(uint32_t uVersion)
*/ */
if (uVersion >= 5001051 && uVersion < 5002051) { if (uVersion >= 5001051 && uVersion < 5002051) {
vbox52InstallUniformedAPI(&gVBoxAPI); vbox52InstallUniformedAPI(&gVBoxAPI);
} else if (uVersion >= 6000000 && uVersion < 6000051) {
vbox60InstallUniformedAPI(&gVBoxAPI);
} else { } else {
return NULL; return NULL;
} }

View File

@ -51,8 +51,10 @@
/* This one changes from version to version. */ /* This one changes from version to version. */
#if VBOX_API_VERSION == 5002000 #if VBOX_API_VERSION == 5002000
# include "vbox_CAPI_v5_2.h" # include "vbox_CAPI_v5_2.h"
#elif VBOX_API_VERSION == 6000000
# include "vbox_CAPI_v6_0.h"
#else #else
# error "Unsupport VBOX_API_VERSION" # error "Unsupported VBOX_API_VERSION"
#endif #endif
/* Include this *last* or we'll get the wrong vbox_CAPI_*.h. */ /* Include this *last* or we'll get the wrong vbox_CAPI_*.h. */
@ -729,8 +731,13 @@ _machineCreateSharedFolder(IMachine *machine, PRUnichar *name,
PRUnichar *hostPath, PRBool writable, PRUnichar *hostPath, PRBool writable,
PRBool automount G_GNUC_UNUSED) PRBool automount G_GNUC_UNUSED)
{ {
#if VBOX_API_VERSION >= 6000000
return machine->vtbl->CreateSharedFolder(machine, name, hostPath,
writable, automount, NULL);
#else
return machine->vtbl->CreateSharedFolder(machine, name, hostPath, return machine->vtbl->CreateSharedFolder(machine, name, hostPath,
writable, automount); writable, automount);
#endif
} }
static nsresult static nsresult

View File

@ -556,3 +556,4 @@ virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn,
/* Version specified functions for installing uniformed API */ /* Version specified functions for installing uniformed API */
void vbox52InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI); void vbox52InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
void vbox60InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);