vbox: Rewrite vboxConnectGetCapabilities

This commit is contained in:
Taowei 2014-08-11 18:06:13 +08:00 committed by Michal Privoznik
parent 82513be8ba
commit 30a95f30ef
3 changed files with 19 additions and 10 deletions

View File

@ -463,3 +463,14 @@ vboxConnectGetMaxVcpus(virConnectPtr conn, const char *type ATTRIBUTE_UNUSED)
VBOX_RELEASE(systemProperties);
return ret;
}
char *vboxConnectGetCapabilities(virConnectPtr conn)
{
VBOX_OBJECT_CHECK(conn, char *, NULL);
vboxDriverLock(data);
ret = virCapabilitiesFormatXML(data->caps);
vboxDriverUnlock(data);
return ret;
}

View File

@ -256,6 +256,11 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml);
static int vboxDomainCreate(virDomainPtr dom);
static int vboxDomainUndefineFlags(virDomainPtr dom, unsigned int flags);
#if VBOX_API_VERSION > 2002000 && VBOX_API_VERSION < 4000000
/* Since vboxConnectGetCapabilities has been rewritten,
* vboxDriverLock and vboxDriverUnlock only be used in code for
* 3.x release. */
static void vboxDriverLock(vboxGlobalData *data)
{
virMutexLock(&data->lock);
@ -266,6 +271,8 @@ static void vboxDriverUnlock(vboxGlobalData *data)
virMutexUnlock(&data->lock);
}
#endif
#if VBOX_API_VERSION == 2002000
static void nsIDtoChar(unsigned char *uuid, const nsID *iid)
@ -914,16 +921,6 @@ vboxSocketParseAddrUtf16(vboxGlobalData *data, const PRUnichar *utf16,
return result;
}
static char *vboxConnectGetCapabilities(virConnectPtr conn) {
VBOX_OBJECT_CHECK(conn, char *, NULL);
vboxDriverLock(data);
ret = virCapabilitiesFormatXML(data->caps);
vboxDriverUnlock(data);
return ret;
}
static int vboxConnectListDomains(virConnectPtr conn, int *ids, int nids)
{
VBOX_OBJECT_CHECK(conn, int, -1);

View File

@ -233,6 +233,7 @@ int vboxConnectIsSecure(virConnectPtr conn);
int vboxConnectIsEncrypted(virConnectPtr conn);
int vboxConnectIsAlive(virConnectPtr conn);
int vboxConnectGetMaxVcpus(virConnectPtr conn, const char *type);
char *vboxConnectGetCapabilities(virConnectPtr conn);
/* Version specified functions for installing uniformed API */
void vbox22InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);