]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Tue Feb 14 14:58:35 EST 2007 Mark McLoughlin <markmc@redhat.com
authorMark McLoughlin <markmc@redhat.com>
Wed, 14 Feb 2007 15:59:40 +0000 (15:59 +0000)
committerMark McLoughlin <markmc@redhat.com>
Wed, 14 Feb 2007 15:59:40 +0000 (15:59 +0000)
        * src/hash.c, src/internal.h: Re-name virConnect->domains_mux
        to virConnect->hashes_mux since it will also be used to
        protect the networks hash.

ChangeLog
src/hash.c
src/internal.h

index b8f429c8bf920ab21693e4e0b835bbc73f4dcb76..f33dffe65b748e04fa520d22cd283a947c98395b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
+Tue Feb 14 14:58:35 EST 2007 Mark McLoughlin <markmc@redhat.com
+
+       * src/hash.c, src/internal.h: Re-name virConnect->domains_mux
+       to virConnect->hashes_mux since it will also be used to
+       protect the networks hash.
+       
 Tue Feb 14 14:57:52 EST 2007 Mark McLoughlin <markmc@redhat.com
 
-       * src/conf.c: qemudSaveConfig() will always report a
+       * qemud/conf.c: qemudSaveConfig() will always report a
        more specific error, so we should avoid overwriting
        this error.
        
index 882468d274ed3602c57634ac2c1f9cb610a5bf5c..b0f478541967fde45f44d88efef741a5a1e89f88 100644 (file)
@@ -660,8 +660,8 @@ virGetConnect(void) {
     ret->domains = virHashCreate(20);
     if (ret->domains == NULL)
         goto failed;
-    ret->domains_mux = xmlNewMutex();
-    if (ret->domains_mux == NULL)
+    ret->hashes_mux = xmlNewMutex();
+    if (ret->hashes_mux == NULL)
         goto failed;
 
     ret->uses = 1;
@@ -671,8 +671,8 @@ failed:
     if (ret != NULL) {
        if (ret->domains != NULL)
            virHashFree(ret->domains, (virHashDeallocator) virDomainFreeName);
-       if (ret->domains_mux != NULL)
-           xmlFreeMutex(ret->domains_mux);
+       if (ret->hashes_mux != NULL)
+           xmlFreeMutex(ret->hashes_mux);
         free(ret);
     }
     return(NULL);
@@ -691,22 +691,22 @@ int
 virFreeConnect(virConnectPtr conn) {
     int ret;
 
-    if ((!VIR_IS_CONNECT(conn)) || (conn->domains_mux == NULL)) {
+    if ((!VIR_IS_CONNECT(conn)) || (conn->hashes_mux == NULL)) {
         virHashError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(-1);
     }
-    xmlMutexLock(conn->domains_mux);
+    xmlMutexLock(conn->hashes_mux);
     conn->uses--;
     ret = conn->uses;
     if (ret > 0) {
-       xmlMutexUnlock(conn->domains_mux);
+       xmlMutexUnlock(conn->hashes_mux);
        return(ret);
     }
 
     if (conn->domains != NULL)
         virHashFree(conn->domains, (virHashDeallocator) virDomainFreeName);
-    if (conn->domains_mux != NULL)
-        xmlFreeMutex(conn->domains_mux);
+    if (conn->hashes_mux != NULL)
+        xmlFreeMutex(conn->hashes_mux);
     free(conn);
     return(0);
 }
@@ -729,11 +729,11 @@ virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) {
     virDomainPtr ret = NULL;
 
     if ((!VIR_IS_CONNECT(conn)) || ((name == NULL) && (uuid == NULL)) ||
-        (conn->domains_mux == NULL)) {
+        (conn->hashes_mux == NULL)) {
         virHashError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(NULL);
     }
-    xmlMutexLock(conn->domains_mux);
+    xmlMutexLock(conn->hashes_mux);
 
     /* TODO search by UUID first as they are better differenciators */
 
@@ -771,11 +771,11 @@ virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) {
     conn->uses++;
 done:
     ret->uses++;
-    xmlMutexUnlock(conn->domains_mux);
+    xmlMutexUnlock(conn->hashes_mux);
     return(ret);
 
 error:
-    xmlMutexUnlock(conn->domains_mux);
+    xmlMutexUnlock(conn->hashes_mux);
     if (ret != NULL) {
        if (ret->name != NULL)
            free(ret->name );
@@ -799,11 +799,11 @@ virFreeDomain(virConnectPtr conn, virDomainPtr domain) {
     int ret = 0;
 
     if ((!VIR_IS_CONNECT(conn)) || (!VIR_IS_CONNECTED_DOMAIN(domain)) ||
-        (domain->conn != conn) || (conn->domains_mux == NULL)) {
+        (domain->conn != conn) || (conn->hashes_mux == NULL)) {
         virHashError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(-1);
     }
-    xmlMutexLock(conn->domains_mux);
+    xmlMutexLock(conn->hashes_mux);
 
     /*
      * decrement the count for the domain
@@ -839,13 +839,13 @@ virFreeDomain(virConnectPtr conn, virDomainPtr domain) {
     
     if (conn->domains != NULL)
         virHashFree(conn->domains, (virHashDeallocator) virDomainFreeName);
-    if (conn->domains_mux != NULL)
-        xmlFreeMutex(conn->domains_mux);
+    if (conn->hashes_mux != NULL)
+        xmlFreeMutex(conn->hashes_mux);
     free(conn);
     return(0);
 
 done:
-    xmlMutexUnlock(conn->domains_mux);
+    xmlMutexUnlock(conn->hashes_mux);
     return(ret);
 }
 
@@ -870,7 +870,7 @@ virGetDomainByID(virConnectPtr conn, int id) {
         virHashError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(NULL);
     }
-    xmlMutexLock(conn->domains_mux);
+    xmlMutexLock(conn->hashes_mux);
 
     table = conn->domains;
     if ((table == NULL) || (table->nbElems == 0))
@@ -890,7 +890,7 @@ virGetDomainByID(virConnectPtr conn, int id) {
        }
     }
 done:
-    xmlMutexUnlock(conn->domains_mux);
+    xmlMutexUnlock(conn->hashes_mux);
     return(ret);
 }
 /*
index a5e30c3d5d482c34769b2866e7df05f44b72d929..27c57f1c506028893aa16f2632416922826b34af 100644 (file)
@@ -125,7 +125,7 @@ struct _virConnect {
     void *userData;         /* the user data */
 
     /* misc */
-    xmlMutexPtr domains_mux;/* a mutex to protect the domain hash table */
+    xmlMutexPtr hashes_mux;/* a mutex to protect the domain hash table */
     virHashTablePtr domains;/* hash table for known domains */
     int flags;              /* a set of connection flags */
 };