Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/vbox/Makefile.inc.am | 2 ++
src/vbox/vbox_V6_0.c | 13 +++++++++++++
src/vbox/vbox_common.h | 2 ++
src/vbox/vbox_storage.c | 2 ++
src/vbox/vbox_tmpl.c | 9 ++++++++-
src/vbox/vbox_uniformed_api.h | 1 +
6 files changed, 28 insertions(+), 1 deletion(-)
create mode 100644 src/vbox/vbox_V6_0.c
diff --git a/src/vbox/Makefile.inc.am b/src/vbox/Makefile.inc.am
index 9d827eff97..fdc6537d51 100644
--- a/src/vbox/Makefile.inc.am
+++ b/src/vbox/Makefile.inc.am
@@ -7,6 +7,8 @@ VBOX_DRIVER_SOURCES = \
vbox/vbox_snapshot_conf.h \
vbox/vbox_V5_2.c \
vbox/vbox_CAPI_v5_2.h \
+ vbox/vbox_CAPI_v6_0.h \
+ vbox/vbox_V6_0.c \
vbox/vbox_common.c \
vbox/vbox_common.h \
vbox/vbox_uniformed_api.h \
diff --git a/src/vbox/vbox_V6_0.c b/src/vbox/vbox_V6_0.c
new file mode 100644
index 0000000000..4e4db6326f
--- /dev/null
+++ b/src/vbox/vbox_V6_0.c
@@ -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"
diff --git a/src/vbox/vbox_common.h b/src/vbox/vbox_common.h
index 9ea984276d..7c29d92789 100644
--- a/src/vbox/vbox_common.h
+++ b/src/vbox/vbox_common.h
@@ -431,6 +431,8 @@ typedef nsISupports IKeyboard;
result = 0; \
if (uVersion >= 5001051 && uVersion < 5002051) { \
vbox52InstallUniformedAPI(&gVBoxAPI); \
+ } else if (uVersion >= 6000000 && uVersion < 6000051) { \
+ vbox60InstallUniformedAPI(&gVBoxAPI); \
} else { \
result = -1; \
} \
diff --git a/src/vbox/vbox_storage.c b/src/vbox/vbox_storage.c
index e0b82f4bd8..83172ee1fe 100644
--- a/src/vbox/vbox_storage.c
+++ b/src/vbox/vbox_storage.c
@@ -882,6 +882,8 @@ virStorageDriverPtr vboxGetStorageDriver(uint32_t uVersion)
*/
if (uVersion >= 5001051 && uVersion < 5002051) {
vbox52InstallUniformedAPI(&gVBoxAPI);
+ } else if (uVersion >= 6000000 && uVersion < 6000051) {
+ vbox60InstallUniformedAPI(&gVBoxAPI);
} else {
return NULL;
}
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 5bf305db4d..9ac7f88b0f 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -51,8 +51,10 @@
/* This one changes from version to version. */
#if VBOX_API_VERSION == 5002000
# include "vbox_CAPI_v5_2.h"
+#elif VBOX_API_VERSION == 6000000
+# include "vbox_CAPI_v6_0.h"
#else
-# error "Unsupport VBOX_API_VERSION"
+# error "Unsupported VBOX_API_VERSION"
#endif
/* 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,
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,
writable, automount);
+#endif
}
static nsresult
diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h
index a4468711fc..9ab3afc4d5 100644
--- a/src/vbox/vbox_uniformed_api.h
+++ b/src/vbox/vbox_uniformed_api.h
@@ -556,3 +556,4 @@ virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn,
/* Version specified functions for installing uniformed API */
void vbox52InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
+void vbox60InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
--
2.25.2