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

[libvirt] [PATCH 18/30] Remove virConnectPtr from virLibConnError



---
 src/datatypes.c |  101 ++++++++++++++++++++++++++++---------------------------
 1 files changed, 51 insertions(+), 50 deletions(-)

diff --git a/src/datatypes.c b/src/datatypes.c
index a361da6..ca20abf 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -31,8 +31,8 @@
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
-#define virLibConnError(conn, code, ...)                          \
-    virReportErrorHelper(conn, VIR_FROM_THIS, code, __FILE__,     \
+#define virLibConnError(code, ...)                                \
+    virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__,     \
                          __FUNCTION__, __LINE__, __VA_ARGS__)
 
 /************************************************************************
@@ -255,7 +255,7 @@ virUnrefConnect(virConnectPtr conn) {
     int refs;
 
     if ((!VIR_IS_CONNECT(conn))) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(-1);
     }
     virMutexLock(&conn->lock);
@@ -311,7 +311,7 @@ virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) {
     virDomainPtr ret = NULL;
 
     if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (uuid == NULL)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(NULL);
     }
     virMutexLock(&conn->lock);
@@ -340,8 +340,8 @@ virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) {
 
         if (virHashAddEntry(conn->domains, name, ret) < 0) {
             virMutexUnlock(&conn->lock);
-            virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
-                            "%s", _("failed to add domain to connection hash table"));
+            virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("failed to add domain to connection hash table"));
             goto error;
         }
         conn->refs++;
@@ -381,8 +381,8 @@ virReleaseDomain(virDomainPtr domain) {
     /* TODO search by UUID first as they are better differenciators */
     if (virHashRemoveEntry(conn->domains, domain->name, NULL) < 0) {
         virMutexUnlock(&conn->lock);
-        virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
-                        "%s", _("domain missing from connection hash table"));
+        virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("domain missing from connection hash table"));
         conn = NULL;
     }
 
@@ -418,7 +418,7 @@ virUnrefDomain(virDomainPtr domain) {
     int refs;
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(-1);
     }
     virMutexLock(&domain->conn->lock);
@@ -453,7 +453,7 @@ virGetNetwork(virConnectPtr conn, const char *name, const unsigned char *uuid) {
     virNetworkPtr ret = NULL;
 
     if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (uuid == NULL)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(NULL);
     }
     virMutexLock(&conn->lock);
@@ -481,8 +481,8 @@ virGetNetwork(virConnectPtr conn, const char *name, const unsigned char *uuid) {
 
         if (virHashAddEntry(conn->networks, name, ret) < 0) {
             virMutexUnlock(&conn->lock);
-            virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
-                            "%s", _("failed to add network to connection hash table"));
+            virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("failed to add network to connection hash table"));
             goto error;
         }
         conn->refs++;
@@ -519,8 +519,8 @@ virReleaseNetwork(virNetworkPtr network) {
     /* TODO search by UUID first as they are better differenciators */
     if (virHashRemoveEntry(conn->networks, network->name, NULL) < 0) {
         virMutexUnlock(&conn->lock);
-        virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
-                        "%s", _("network missing from connection hash table"));
+        virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("network missing from connection hash table"));
         conn = NULL;
     }
 
@@ -555,7 +555,7 @@ virUnrefNetwork(virNetworkPtr network) {
     int refs;
 
     if (!VIR_IS_CONNECTED_NETWORK(network)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(-1);
     }
     virMutexLock(&network->conn->lock);
@@ -592,7 +592,7 @@ virGetInterface(virConnectPtr conn, const char *name, const char *mac) {
     virInterfacePtr ret = NULL;
 
     if ((!VIR_IS_CONNECT(conn)) || (name == NULL)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(NULL);
     }
 
@@ -628,8 +628,9 @@ virGetInterface(virConnectPtr conn, const char *name, const char *mac) {
                  * interface, and that is unlikely to change.
                  */
                 virMutexUnlock(&conn->lock);
-                virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
-_("Failed to change interface mac address from %s to %s due to differing lengths."),
+                virLibConnError(VIR_ERR_INTERNAL_ERROR,
+                                _("Failed to change interface mac address "
+                                  "from %s to %s due to differing lengths."),
                                 ret->mac, mac);
                 ret = NULL;
                 goto error;
@@ -659,8 +660,8 @@ _("Failed to change interface mac address from %s to %s due to differing lengths
 
         if (virHashAddEntry(conn->interfaces, name, ret) < 0) {
             virMutexUnlock(&conn->lock);
-            virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
-                            "%s", _("failed to add interface to connection hash table"));
+            virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("failed to add interface to connection hash table"));
             goto error;
         }
         conn->refs++;
@@ -698,8 +699,8 @@ virReleaseInterface(virInterfacePtr iface) {
     if (virHashRemoveEntry(conn->interfaces, iface->name, NULL) < 0) {
         /* unlock before reporting error because error report grabs lock */
         virMutexUnlock(&conn->lock);
-        virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
-                        "%s", _("interface missing from connection hash table"));
+        virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("interface missing from connection hash table"));
         /* don't decr the conn refct if we weren't connected to it */
         conn = NULL;
     }
@@ -736,7 +737,7 @@ virUnrefInterface(virInterfacePtr iface) {
     int refs;
 
     if (!VIR_IS_CONNECTED_INTERFACE(iface)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(-1);
     }
     virMutexLock(&iface->conn->lock);
@@ -772,7 +773,7 @@ virGetStoragePool(virConnectPtr conn, const char *name, const unsigned char *uui
     virStoragePoolPtr ret = NULL;
 
     if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (uuid == NULL)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(NULL);
     }
     virMutexLock(&conn->lock);
@@ -800,7 +801,7 @@ virGetStoragePool(virConnectPtr conn, const char *name, const unsigned char *uui
 
         if (virHashAddEntry(conn->storagePools, name, ret) < 0) {
             virMutexUnlock(&conn->lock);
-            virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
+            virLibConnError(VIR_ERR_INTERNAL_ERROR,
                             "%s", _("failed to add storage pool to connection hash table"));
             goto error;
         }
@@ -839,8 +840,8 @@ virReleaseStoragePool(virStoragePoolPtr pool) {
     /* TODO search by UUID first as they are better differenciators */
     if (virHashRemoveEntry(conn->storagePools, pool->name, NULL) < 0) {
         virMutexUnlock(&conn->lock);
-        virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
-                        "%s", _("pool missing from connection hash table"));
+        virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("pool missing from connection hash table"));
         conn = NULL;
     }
 
@@ -875,7 +876,7 @@ virUnrefStoragePool(virStoragePoolPtr pool) {
     int refs;
 
     if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(-1);
     }
     virMutexLock(&pool->conn->lock);
@@ -912,7 +913,7 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const c
     virStorageVolPtr ret = NULL;
 
     if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (key == NULL)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(NULL);
     }
     virMutexLock(&conn->lock);
@@ -938,7 +939,7 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const c
         }
         if (virStrcpyStatic(ret->key, key) == NULL) {
             virMutexUnlock(&conn->lock);
-            virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
+            virLibConnError(VIR_ERR_INTERNAL_ERROR,
                             _("Volume key %s too large for destination"), key);
             goto error;
         }
@@ -947,8 +948,8 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const c
 
         if (virHashAddEntry(conn->storageVols, key, ret) < 0) {
             virMutexUnlock(&conn->lock);
-            virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
-                            "%s", _("failed to add storage vol to connection hash table"));
+            virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("failed to add storage vol to connection hash table"));
             goto error;
         }
         conn->refs++;
@@ -987,8 +988,8 @@ virReleaseStorageVol(virStorageVolPtr vol) {
     /* TODO search by UUID first as they are better differenciators */
     if (virHashRemoveEntry(conn->storageVols, vol->key, NULL) < 0) {
         virMutexUnlock(&conn->lock);
-        virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
-                        "%s", _("vol missing from connection hash table"));
+        virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("vol missing from connection hash table"));
         conn = NULL;
     }
 
@@ -1024,7 +1025,7 @@ virUnrefStorageVol(virStorageVolPtr vol) {
     int refs;
 
     if (!VIR_IS_CONNECTED_STORAGE_VOL(vol)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(-1);
     }
     virMutexLock(&vol->conn->lock);
@@ -1060,7 +1061,7 @@ virGetNodeDevice(virConnectPtr conn, const char *name)
     virNodeDevicePtr ret = NULL;
 
     if ((!VIR_IS_CONNECT(conn)) || (name == NULL)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(NULL);
     }
     virMutexLock(&conn->lock);
@@ -1083,7 +1084,7 @@ virGetNodeDevice(virConnectPtr conn, const char *name)
 
         if (virHashAddEntry(conn->nodeDevices, name, ret) < 0) {
             virMutexUnlock(&conn->lock);
-            virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
+            virLibConnError(VIR_ERR_INTERNAL_ERROR,
                             "%s", _("failed to add node dev to conn hash table"));
             goto error;
         }
@@ -1121,7 +1122,7 @@ virReleaseNodeDevice(virNodeDevicePtr dev) {
 
     if (virHashRemoveEntry(conn->nodeDevices, dev->name, NULL) < 0) {
         virMutexUnlock(&conn->lock);
-        virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
+        virLibConnError(VIR_ERR_INTERNAL_ERROR,
                         "%s", _("dev missing from connection hash table"));
         conn = NULL;
     }
@@ -1192,7 +1193,7 @@ virGetSecret(virConnectPtr conn, const unsigned char *uuid,
     char uuidstr[VIR_UUID_STRING_BUFLEN];
 
     if (!VIR_IS_CONNECT(conn) || uuid == NULL || usageID == NULL) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return NULL;
     }
     virMutexLock(&conn->lock);
@@ -1217,8 +1218,8 @@ virGetSecret(virConnectPtr conn, const unsigned char *uuid,
         }
         if (virHashAddEntry(conn->secrets, uuidstr, ret) < 0) {
             virMutexUnlock(&conn->lock);
-            virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
-                            "%s", _("failed to add secret to conn hash table"));
+            virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("failed to add secret to conn hash table"));
             goto error;
         }
         conn->refs++;
@@ -1256,8 +1257,8 @@ virReleaseSecret(virSecretPtr secret) {
     virUUIDFormat(secret->uuid, uuidstr);
     if (virHashRemoveEntry(conn->secrets, uuidstr, NULL) < 0) {
         virMutexUnlock(&conn->lock);
-        virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
-                        "%s", _("secret missing from connection hash table"));
+        virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("secret missing from connection hash table"));
         conn = NULL;
     }
 
@@ -1291,7 +1292,7 @@ virUnrefSecret(virSecretPtr secret) {
     int refs;
 
     if (!VIR_IS_CONNECTED_SECRET(secret)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
     virMutexLock(&secret->conn->lock);
@@ -1385,7 +1386,7 @@ virGetNWFilter(virConnectPtr conn, const char *name, const unsigned char *uuid)
     virNWFilterPtr ret = NULL;
 
     if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (uuid == NULL)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return(NULL);
     }
     virMutexLock(&conn->lock);
@@ -1413,8 +1414,8 @@ virGetNWFilter(virConnectPtr conn, const char *name, const unsigned char *uuid)
 
         if (virHashAddEntry(conn->nwfilterPools, name, ret) < 0) {
             virMutexUnlock(&conn->lock);
-            virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
-                            "%s", _("failed to add network filter pool to connection hash table"));
+            virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("failed to add network filter pool to connection hash table"));
             goto error;
         }
         conn->refs++;
@@ -1452,8 +1453,8 @@ virReleaseNWFilterPool(virNWFilterPtr pool) {
     /* TODO search by UUID first as they are better differenciators */
     if (virHashRemoveEntry(conn->nwfilterPools, pool->name, NULL) < 0) {
         virMutexUnlock(&conn->lock);
-        virLibConnError(conn, VIR_ERR_INTERNAL_ERROR,
-                        "%s", _("pool missing from connection hash table"));
+        virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("pool missing from connection hash table"));
         conn = NULL;
     }
 
@@ -1488,7 +1489,7 @@ virUnrefNWFilter(virNWFilterPtr pool) {
     int refs;
 
     if (!VIR_IS_CONNECTED_NWFILTER(pool)) {
-        virLibConnError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
     virMutexLock(&pool->conn->lock);
-- 
1.6.3.3


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