On 11.08.2014 12:06, Taowei wrote:
---
src/vbox/vbox_common.c | 11 +++++++++++
src/vbox/vbox_tmpl.c | 16 ++++++----------
src/vbox/vbox_uniformed_api.h | 1 +
3 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index cb73f97..eaefe81 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -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;
+}
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index deb3067..7f9b4cc 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -256,6 +256,10 @@ 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 rewriten,
+ * vboxDiverLock and Unlock only be used in 3.* */
+
s/rewriten/rewritten/
s/vboxDiverLock/vboxDriverLock/ we are not locking any diver but the
driver :-P
static void vboxDriverLock(vboxGlobalData *data)
{
virMutexLock(&data->lock);
@@ -266,6 +270,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 +920,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);
diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h
index 2cc0674..e49b881 100644
--- a/src/vbox/vbox_uniformed_api.h
+++ b/src/vbox/vbox_uniformed_api.h
@@ -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);
Michal