We don't need them anymore as all pointers within vzDriver structure
are not changed during the time it exists.
Where we still need to synchronize we use virObjectLock/Unlock as far
as vzDriver is lockable object.
Signed-off-by: Maxim Nestratov <mnestratov(a)virtuozzo.com>
---
src/vz/vz_driver.c | 35 -----------------------------------
src/vz/vz_utils.h | 2 --
2 files changed, 37 deletions(-)
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index dce7a87..50da2fe 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -65,17 +65,6 @@ VIR_LOG_INIT("parallels.parallels_driver");
static int vzConnectClose(virConnectPtr conn);
static virClassPtr vzDriverConnClass;
-void
-vzDriverLock(vzConnPtr privconn)
-{
- virObjectLock(privconn->driver);
-}
-
-void
-vzDriverUnlock(vzConnPtr privconn)
-{
- virObjectUnlock(privconn->driver);
-}
static virMutex vz_driver_lock;
static vzDriverPtr vz_driver;
static vzConnPtr vz_conn_list;
@@ -235,9 +224,7 @@ vzConnectGetCapabilities(virConnectPtr conn)
vzConnPtr privconn = conn->privateData;
char *xml;
- vzDriverLock(privconn);
xml = virCapabilitiesFormatXML(privconn->driver->caps);
- vzDriverUnlock(privconn);
return xml;
}
@@ -454,10 +441,8 @@ vzConnectListDomains(virConnectPtr conn, int *ids, int maxids)
vzConnPtr privconn = conn->privateData;
int n;
- vzDriverLock(privconn);
n = virDomainObjListGetActiveIDs(privconn->driver->domains, ids, maxids,
NULL, NULL);
- vzDriverUnlock(privconn);
return n;
}
@@ -468,10 +453,8 @@ vzConnectNumOfDomains(virConnectPtr conn)
vzConnPtr privconn = conn->privateData;
int count;
- vzDriverLock(privconn);
count = virDomainObjListNumOfDomains(privconn->driver->domains, true,
NULL, NULL);
- vzDriverUnlock(privconn);
return count;
}
@@ -484,11 +467,9 @@ vzConnectListDefinedDomains(virConnectPtr conn,
vzConnPtr privconn = conn->privateData;
int n;
- vzDriverLock(privconn);
memset(names, 0, sizeof(*names) * maxnames);
n = virDomainObjListGetInactiveNames(privconn->driver->domains, names,
maxnames, NULL, NULL);
- vzDriverUnlock(privconn);
return n;
}
@@ -499,11 +480,8 @@ vzConnectNumOfDefinedDomains(virConnectPtr conn)
vzConnPtr privconn = conn->privateData;
int count;
- vzDriverLock(privconn);
count = virDomainObjListNumOfDomains(privconn->driver->domains, false,
NULL, NULL);
- vzDriverUnlock(privconn);
-
return count;
}
@@ -516,10 +494,8 @@ vzConnectListAllDomains(virConnectPtr conn,
int ret = -1;
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
- vzDriverLock(privconn);
ret = virDomainObjListExport(privconn->driver->domains, conn, domains,
NULL, flags);
- vzDriverUnlock(privconn);
return ret;
}
@@ -531,9 +507,7 @@ vzDomainLookupByID(virConnectPtr conn, int id)
virDomainPtr ret = NULL;
virDomainObjPtr dom;
- vzDriverLock(privconn);
dom = virDomainObjListFindByID(privconn->driver->domains, id);
- vzDriverUnlock(privconn);
if (dom == NULL) {
virReportError(VIR_ERR_NO_DOMAIN, NULL);
@@ -557,10 +531,7 @@ vzDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
virDomainPtr ret = NULL;
virDomainObjPtr dom;
- vzDriverLock(privconn);
-
dom = virDomainObjListFindByUUID(privconn->driver->domains, uuid);
- vzDriverUnlock(privconn);
if (dom == NULL) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -587,9 +558,7 @@ vzDomainLookupByName(virConnectPtr conn, const char *name)
virDomainPtr ret = NULL;
virDomainObjPtr dom;
- vzDriverLock(privconn);
dom = virDomainObjListFindByName(privconn->driver->domains, name);
- vzDriverUnlock(privconn);
if (dom == NULL) {
virReportError(VIR_ERR_NO_DOMAIN,
@@ -1537,7 +1506,6 @@ vzConnectRegisterCloseCallback(virConnectPtr conn,
vzConnPtr privconn = conn->privateData;
int ret = -1;
- vzDriverLock(privconn);
if (virConnectCloseCallbackDataGetCallback(privconn->closeCallback) != NULL) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("A close callback is already registered"));
@@ -1549,7 +1517,6 @@ vzConnectRegisterCloseCallback(virConnectPtr conn,
ret = 0;
cleanup:
- vzDriverUnlock(privconn);
return ret;
}
@@ -1560,7 +1527,6 @@ vzConnectUnregisterCloseCallback(virConnectPtr conn,
virConnectCloseFunc cb)
vzConnPtr privconn = conn->privateData;
int ret = -1;
- vzDriverLock(privconn);
if (virConnectCloseCallbackDataGetCallback(privconn->closeCallback) != cb) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
@@ -1572,7 +1538,6 @@ vzConnectUnregisterCloseCallback(virConnectPtr conn,
virConnectCloseFunc cb)
ret = 0;
cleanup:
- vzDriverUnlock(privconn);
return ret;
}
diff --git a/src/vz/vz_utils.h b/src/vz/vz_utils.h
index 01a680c..e6f5fef 100644
--- a/src/vz/vz_utils.h
+++ b/src/vz/vz_utils.h
@@ -116,8 +116,6 @@ virDomainObjPtr vzDomObjFromDomainRef(virDomainPtr domain);
char * vzGetOutput(const char *binary, ...)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
-void vzDriverLock(vzConnPtr driver);
-void vzDriverUnlock(vzConnPtr driver);
vzDriverPtr
vzGetDriverConnection(void);
--
2.4.3