mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-25 21:02:22 +00:00
vbox: add support for version 6.1 SDK
Changes in the API: - APIs related to the graphics adapter are no longer on the IMachine interface, but on a IGraphicsAdapter interface - The LaunchVMProcess method takes a list of env variables instead of a single variable containing a concatenated list. Since we only ever pass a single env variable, we can simply stuff it straight into a list. - The DHCP server start method no longer needs the network name Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
a030a78c69
commit
622c5e4099
@ -9,6 +9,8 @@ VBOX_DRIVER_SOURCES = \
|
||||
vbox/vbox_CAPI_v5_2.h \
|
||||
vbox/vbox_CAPI_v6_0.h \
|
||||
vbox/vbox_V6_0.c \
|
||||
vbox/vbox_CAPI_v6_1.h \
|
||||
vbox/vbox_V6_1.c \
|
||||
vbox/vbox_common.c \
|
||||
vbox/vbox_common.h \
|
||||
vbox/vbox_uniformed_api.h \
|
||||
|
13
src/vbox/vbox_V6_1.c
Normal file
13
src/vbox/vbox_V6_1.c
Normal file
@ -0,0 +1,13 @@
|
||||
/** @file vbox_V6_1.c
|
||||
* C file to include support for multiple versions of VirtualBox
|
||||
* at runtime.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/** The API Version */
|
||||
#define VBOX_API_VERSION 6001000
|
||||
/** Version specific prefix. */
|
||||
#define NAME(name) vbox61##name
|
||||
|
||||
#include "vbox_tmpl.c"
|
@ -433,6 +433,8 @@ typedef nsISupports IKeyboard;
|
||||
vbox52InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else if (uVersion >= 6000000 && uVersion < 6000051) { \
|
||||
vbox60InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else if (uVersion >= 6000051 && uVersion < 6001051) { \
|
||||
vbox61InstallUniformedAPI(&gVBoxAPI); \
|
||||
} else { \
|
||||
result = -1; \
|
||||
} \
|
||||
|
@ -884,6 +884,8 @@ virStorageDriverPtr vboxGetStorageDriver(uint32_t uVersion)
|
||||
vbox52InstallUniformedAPI(&gVBoxAPI);
|
||||
} else if (uVersion >= 6000000 && uVersion < 6000051) {
|
||||
vbox60InstallUniformedAPI(&gVBoxAPI);
|
||||
} else if (uVersion >= 6000051 && uVersion < 6001051) {
|
||||
vbox61InstallUniformedAPI(&gVBoxAPI);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -53,6 +53,8 @@
|
||||
# include "vbox_CAPI_v5_2.h"
|
||||
#elif VBOX_API_VERSION == 6000000
|
||||
# include "vbox_CAPI_v6_0.h"
|
||||
#elif VBOX_API_VERSION == 6001000
|
||||
# include "vbox_CAPI_v6_1.h"
|
||||
#else
|
||||
# error "Unsupported VBOX_API_VERSION"
|
||||
#endif
|
||||
@ -753,8 +755,14 @@ _machineLaunchVMProcess(vboxDriverPtr data,
|
||||
PRUnichar *sessionType, PRUnichar *env,
|
||||
IProgress **progress)
|
||||
{
|
||||
#if VBOX_API_VERSION >= 6001000
|
||||
PRUnichar *envlist[] = { env };
|
||||
return machine->vtbl->LaunchVMProcess(machine, data->vboxSession,
|
||||
sessionType, 1, envlist, progress);
|
||||
#else
|
||||
return machine->vtbl->LaunchVMProcess(machine, data->vboxSession,
|
||||
sessionType, env, progress);
|
||||
#endif
|
||||
}
|
||||
|
||||
static nsresult
|
||||
@ -914,51 +922,123 @@ _machineSetBootOrder(IMachine *machine, PRUint32 position, PRUint32 device)
|
||||
static nsresult
|
||||
_machineGetVRAMSize(IMachine *machine, PRUint32 *VRAMSize)
|
||||
{
|
||||
#if VBOX_API_VERSION >= 6001000
|
||||
IGraphicsAdapter *ga;
|
||||
nsresult ret;
|
||||
ret = machine->vtbl->GetGraphicsAdapter(machine, &ga);
|
||||
if (NS_FAILED(ret))
|
||||
return ret;
|
||||
return ga->vtbl->GetVRAMSize(ga, VRAMSize);
|
||||
#else
|
||||
return machine->vtbl->GetVRAMSize(machine, VRAMSize);
|
||||
#endif
|
||||
}
|
||||
|
||||
static nsresult
|
||||
_machineSetVRAMSize(IMachine *machine, PRUint32 VRAMSize)
|
||||
{
|
||||
#if VBOX_API_VERSION >= 6001000
|
||||
IGraphicsAdapter *ga;
|
||||
nsresult ret;
|
||||
ret = machine->vtbl->GetGraphicsAdapter(machine, &ga);
|
||||
if (NS_FAILED(ret))
|
||||
return ret;
|
||||
return ga->vtbl->SetVRAMSize(ga, VRAMSize);
|
||||
#else
|
||||
return machine->vtbl->SetVRAMSize(machine, VRAMSize);
|
||||
#endif
|
||||
}
|
||||
|
||||
static nsresult
|
||||
_machineGetMonitorCount(IMachine *machine, PRUint32 *monitorCount)
|
||||
{
|
||||
#if VBOX_API_VERSION >= 6001000
|
||||
IGraphicsAdapter *ga;
|
||||
nsresult ret;
|
||||
ret = machine->vtbl->GetGraphicsAdapter(machine, &ga);
|
||||
if (NS_FAILED(ret))
|
||||
return ret;
|
||||
return ga->vtbl->GetMonitorCount(ga, monitorCount);
|
||||
#else
|
||||
return machine->vtbl->GetMonitorCount(machine, monitorCount);
|
||||
#endif
|
||||
}
|
||||
|
||||
static nsresult
|
||||
_machineSetMonitorCount(IMachine *machine, PRUint32 monitorCount)
|
||||
{
|
||||
#if VBOX_API_VERSION >= 6001000
|
||||
IGraphicsAdapter *ga;
|
||||
nsresult ret;
|
||||
ret = machine->vtbl->GetGraphicsAdapter(machine, &ga);
|
||||
if (NS_FAILED(ret))
|
||||
return ret;
|
||||
return ga->vtbl->SetMonitorCount(ga, monitorCount);
|
||||
#else
|
||||
return machine->vtbl->SetMonitorCount(machine, monitorCount);
|
||||
#endif
|
||||
}
|
||||
|
||||
static nsresult
|
||||
_machineGetAccelerate3DEnabled(IMachine *machine, PRBool *accelerate3DEnabled)
|
||||
{
|
||||
#if VBOX_API_VERSION >= 6001000
|
||||
IGraphicsAdapter *ga;
|
||||
nsresult ret;
|
||||
ret = machine->vtbl->GetGraphicsAdapter(machine, &ga);
|
||||
if (NS_FAILED(ret))
|
||||
return ret;
|
||||
return ga->vtbl->GetAccelerate3DEnabled(ga, accelerate3DEnabled);
|
||||
#else
|
||||
return machine->vtbl->GetAccelerate3DEnabled(machine, accelerate3DEnabled);
|
||||
#endif
|
||||
}
|
||||
|
||||
static nsresult
|
||||
_machineSetAccelerate3DEnabled(IMachine *machine, PRBool accelerate3DEnabled)
|
||||
{
|
||||
#if VBOX_API_VERSION >= 6001000
|
||||
IGraphicsAdapter *ga;
|
||||
nsresult ret;
|
||||
ret = machine->vtbl->GetGraphicsAdapter(machine, &ga);
|
||||
if (NS_FAILED(ret))
|
||||
return ret;
|
||||
return ga->vtbl->SetAccelerate3DEnabled(ga, accelerate3DEnabled);
|
||||
#else
|
||||
return machine->vtbl->SetAccelerate3DEnabled(machine, accelerate3DEnabled);
|
||||
#endif
|
||||
}
|
||||
|
||||
static nsresult
|
||||
_machineGetAccelerate2DVideoEnabled(IMachine *machine,
|
||||
PRBool *accelerate2DVideoEnabled)
|
||||
{
|
||||
#if VBOX_API_VERSION >= 6001000
|
||||
IGraphicsAdapter *ga;
|
||||
nsresult ret;
|
||||
ret = machine->vtbl->GetGraphicsAdapter(machine, &ga);
|
||||
if (NS_FAILED(ret))
|
||||
return ret;
|
||||
return ga->vtbl->GetAccelerate2DVideoEnabled(ga, accelerate2DVideoEnabled);
|
||||
#else
|
||||
return machine->vtbl->GetAccelerate2DVideoEnabled(machine, accelerate2DVideoEnabled);
|
||||
#endif
|
||||
}
|
||||
|
||||
static nsresult
|
||||
_machineSetAccelerate2DVideoEnabled(IMachine *machine,
|
||||
PRBool accelerate2DVideoEnabled)
|
||||
{
|
||||
#if VBOX_API_VERSION >= 6001000
|
||||
IGraphicsAdapter *ga;
|
||||
nsresult ret;
|
||||
ret = machine->vtbl->GetGraphicsAdapter(machine, &ga);
|
||||
if (NS_FAILED(ret))
|
||||
return ret;
|
||||
return ga->vtbl->SetAccelerate2DVideoEnabled(ga, accelerate2DVideoEnabled);
|
||||
#else
|
||||
return machine->vtbl->SetAccelerate2DVideoEnabled(machine, accelerate2DVideoEnabled);
|
||||
#endif
|
||||
}
|
||||
|
||||
static nsresult
|
||||
@ -2058,11 +2138,16 @@ _dhcpServerSetConfiguration(IDHCPServer *dhcpServer, PRUnichar *IPAddress,
|
||||
}
|
||||
|
||||
static nsresult
|
||||
_dhcpServerStart(IDHCPServer *dhcpServer, PRUnichar *networkName,
|
||||
_dhcpServerStart(IDHCPServer *dhcpServer, PRUnichar *networkName G_GNUC_UNUSED,
|
||||
PRUnichar *trunkName, PRUnichar *trunkType)
|
||||
{
|
||||
#if VBOX_API_VERSION >= 6001000
|
||||
return dhcpServer->vtbl->Start(dhcpServer,
|
||||
trunkName, trunkType);
|
||||
#else
|
||||
return dhcpServer->vtbl->Start(dhcpServer, networkName,
|
||||
trunkName, trunkType);
|
||||
#endif
|
||||
}
|
||||
|
||||
static nsresult
|
||||
|
@ -557,3 +557,4 @@ virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn,
|
||||
/* Version specified functions for installing uniformed API */
|
||||
void vbox52InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
|
||||
void vbox60InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
|
||||
void vbox61InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
|
||||
|
Loading…
x
Reference in New Issue
Block a user