[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 09/11] vz: remove vzDriverLock/Unlock function



We don't need them anymore as all pointers within vzConn structure
are not changed during the time it exists.

Signed-off-by: Maxim Nestratov <mnestratov virtuozzo com>
---
 src/vz/vz_driver.c | 31 -------------------------------
 src/vz/vz_utils.h  |  2 --
 2 files changed, 33 deletions(-)

diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 42b0c02..b069671 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 vzConnClass;
 
-void
-vzDriverLock(vzConnPtr driver)
-{
-    virObjectLock(driver);
-}
-
-void
-vzDriverUnlock(vzConnPtr driver)
-{
-    virObjectUnlock(driver);
-}
 static virMutex vz_driver_lock;
 static vzConnPtr vz_driver;
 
@@ -222,9 +211,7 @@ vzConnectGetCapabilities(virConnectPtr conn ATTRIBUTE_UNUSED)
         return NULL;
     char *xml;
 
-    vzDriverLock(privconn);
     xml = virCapabilitiesFormatXML(privconn->caps);
-    vzDriverUnlock(privconn);
     virObjectUnref(privconn);
     return xml;
 }
@@ -409,10 +396,8 @@ vzConnectListDomains(virConnectPtr conn ATTRIBUTE_UNUSED, int *ids, int maxids)
     if (!privconn)
         return -1;
 
-    vzDriverLock(privconn);
     n = virDomainObjListGetActiveIDs(privconn->domains, ids, maxids,
                                      NULL, NULL);
-    vzDriverUnlock(privconn);
 
     virObjectUnref(privconn);
     return n;
@@ -426,10 +411,8 @@ vzConnectNumOfDomains(virConnectPtr conn ATTRIBUTE_UNUSED)
     if (!privconn)
         return -1;
 
-    vzDriverLock(privconn);
     count = virDomainObjListNumOfDomains(privconn->domains, true,
                                          NULL, NULL);
-    vzDriverUnlock(privconn);
 
     virObjectUnref(privconn);
     return count;
@@ -445,11 +428,9 @@ vzConnectListDefinedDomains(virConnectPtr conn ATTRIBUTE_UNUSED,
     if (!privconn)
         return -1;
 
-    vzDriverLock(privconn);
     memset(names, 0, sizeof(*names) * maxnames);
     n = virDomainObjListGetInactiveNames(privconn->domains, names,
                                          maxnames, NULL, NULL);
-    vzDriverUnlock(privconn);
 
     virObjectUnref(privconn);
     return n;
@@ -463,10 +444,8 @@ vzConnectNumOfDefinedDomains(virConnectPtr conn ATTRIBUTE_UNUSED)
     if (!privconn)
         return -1;
 
-    vzDriverLock(privconn);
     count = virDomainObjListNumOfDomains(privconn->domains, false,
                                          NULL, NULL);
-    vzDriverUnlock(privconn);
     virObjectUnref(privconn);
     return count;
 }
@@ -482,10 +461,8 @@ vzConnectListAllDomains(virConnectPtr conn,
         return -1;
 
     virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
-    vzDriverLock(privconn);
     ret = virDomainObjListExport(privconn->domains, conn, domains,
                                  NULL, flags);
-    vzDriverUnlock(privconn);
 
     virObjectUnref(privconn);
     return ret;
@@ -497,13 +474,11 @@ vzDomainLookupByID(virConnectPtr conn, int id)
     virDomainPtr ret = NULL;
     virDomainObjPtr dom;
 
-    vzDriverLock(privconn);
     vzConnPtr privconn = vzGetConnection();
     if (!privconn)
         return NULL;
 
     dom = virDomainObjListFindByID(privconn->domains, id);
-    vzDriverUnlock(privconn);
 
     if (dom == NULL) {
         virReportError(VIR_ERR_NO_DOMAIN, NULL);
@@ -527,13 +502,11 @@ vzDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
     virDomainPtr ret = NULL;
     virDomainObjPtr dom;
 
-    vzDriverLock(privconn);
     vzConnPtr privconn = vzGetConnection();
     if (!privconn)
         return NULL;
 
     dom = virDomainObjListFindByUUID(privconn->domains, uuid);
-    vzDriverUnlock(privconn);
 
     if (dom == NULL) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -563,9 +536,7 @@ vzDomainLookupByName(virConnectPtr conn, const char *name)
     virDomainPtr ret = NULL;
     virDomainObjPtr dom;
 
-    vzDriverLock(privconn);
     dom = virDomainObjListFindByName(privconn->domains, name);
-    vzDriverUnlock(privconn);
 
     if (dom == NULL) {
         virReportError(VIR_ERR_NO_DOMAIN,
@@ -736,7 +707,6 @@ vzDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
     if (flags & VIR_DOMAIN_DEFINE_VALIDATE)
         parse_flags |= VIR_DOMAIN_DEF_PARSE_VALIDATE;
 
-    vzDriverLock(privconn);
     if ((def = virDomainDefParseString(xml, privconn->caps, privconn->xmlopt,
                                        parse_flags)) == NULL)
         goto cleanup;
@@ -808,7 +778,6 @@ vzDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
              virObjectUnlock(newdom);
     }
     virDomainDefFree(def);
-    vzDriverUnlock(privconn);
     virObjectUnref(privconn);
     return retdom;
 }
diff --git a/src/vz/vz_utils.h b/src/vz/vz_utils.h
index 406ddd9..73b493f 100644
--- a/src/vz/vz_utils.h
+++ b/src/vz/vz_utils.h
@@ -102,8 +102,6 @@ virDomainObjPtr vzDomObjFromDomainRef(virDomainPtr domain);
 
 char * vzGetOutput(const char *binary, ...)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
-void vzDriverLock(vzConnPtr driver);
-void vzDriverUnlock(vzConnPtr driver);
 
 vzConnPtr
 vzGetConnection(void);
-- 
2.4.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]