[PATCH 6/2] event: rename confusing variable in test, remote drivers

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

 



Since the introduction of network events, any driver that uses
a single event state object to track both domain and network
events should not include 'domain' in the name of that object.

* src/test/test_driver.c (_testConn):
s/domainEventState/eventState/, and fix all callers.
* src/remote/remote_driver.c (private_data): Likewise.

Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
---
 src/remote/remote_driver.c | 39 +++++++++++++++------------------------
 src/test/test_driver.c     | 32 +++++++++++++-------------------
 2 files changed, 28 insertions(+), 43 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index b952e57..f311544 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -93,7 +93,7 @@ struct private_data {
     char *hostname;             /* Original hostname */
     bool serverKeepAlive;       /* Does server support keepalive protocol? */

-    virObjectEventStatePtr domainEventState;
+    virObjectEventStatePtr eventState;
 };

 enum {
@@ -890,7 +890,7 @@ doRemoteOpen(virConnectPtr conn,
             goto failed;
     }

-    if (!(priv->domainEventState = virObjectEventStateNew()))
+    if (!(priv->eventState = virObjectEventStateNew()))
         goto failed;

     /* Successful. */
@@ -1095,8 +1095,8 @@ doRemoteClose(virConnectPtr conn, struct private_data *priv)
     /* See comment for remoteType. */
     VIR_FREE(priv->type);

-    virObjectEventStateFree(priv->domainEventState);
-    priv->domainEventState = NULL;
+    virObjectEventStateFree(priv->eventState);
+    priv->eventState = NULL;

     return ret;
 }
@@ -2927,8 +2927,7 @@ remoteConnectNetworkEventRegisterAny(virConnectPtr conn,

     remoteDriverLock(priv);

-    if ((count = virNetworkEventStateRegisterID(conn,
-                                                priv->domainEventState,
+    if ((count = virNetworkEventStateRegisterID(conn, priv->eventState,
                                                 net, eventID,
                                                 VIR_OBJECT_EVENT_CALLBACK(callback),
                                                 opaque, freecb,
@@ -2943,8 +2942,7 @@ remoteConnectNetworkEventRegisterAny(virConnectPtr conn,
         if (call(conn, priv, 0, REMOTE_PROC_CONNECT_NETWORK_EVENT_REGISTER_ANY,
                  (xdrproc_t) xdr_remote_connect_network_event_register_any_args, (char *) &args,
                  (xdrproc_t) xdr_void, (char *)NULL) == -1) {
-            virObjectEventStateDeregisterID(conn,
-                                            priv->domainEventState,
+            virObjectEventStateDeregisterID(conn, priv->eventState,
                                             callbackID);
             goto done;
         }
@@ -2970,15 +2968,13 @@ remoteConnectNetworkEventDeregisterAny(virConnectPtr conn,

     remoteDriverLock(priv);

-    if ((eventID = virObjectEventStateEventID(conn,
-                                              priv->domainEventState,
+    if ((eventID = virObjectEventStateEventID(conn, priv->eventState,
                                               callbackID)) < 0) {
         virReportError(VIR_ERR_RPC, _("unable to find callback ID %d"), callbackID);
         goto done;
     }

-    if ((count = virObjectEventStateDeregisterID(conn,
-                                                 priv->domainEventState,
+    if ((count = virObjectEventStateDeregisterID(conn, priv->eventState,
                                                  callbackID)) < 0) {
         virReportError(VIR_ERR_RPC, _("unable to find callback ID %d"), callbackID);
         goto done;
@@ -4421,7 +4417,7 @@ static int remoteConnectDomainEventRegister(virConnectPtr conn,

     remoteDriverLock(priv);

-    if ((count = virDomainEventStateRegister(conn, priv->domainEventState,
+    if ((count = virDomainEventStateRegister(conn, priv->eventState,
                                              callback, opaque, freecb)) < 0)
          goto done;

@@ -4449,8 +4445,7 @@ static int remoteConnectDomainEventDeregister(virConnectPtr conn,

     remoteDriverLock(priv);

-    if ((count = virDomainEventStateDeregister(conn,
-                                               priv->domainEventState,
+    if ((count = virDomainEventStateDeregister(conn, priv->eventState,
                                                callback)) < 0)
         goto done;

@@ -5226,8 +5221,7 @@ static int remoteConnectDomainEventRegisterAny(virConnectPtr conn,

     remoteDriverLock(priv);

-    if ((count = virDomainEventStateRegisterID(conn,
-                                               priv->domainEventState,
+    if ((count = virDomainEventStateRegisterID(conn, priv->eventState,
                                                dom, eventID,
                                                callback, opaque, freecb,
                                                &callbackID)) < 0)
@@ -5241,8 +5235,7 @@ static int remoteConnectDomainEventRegisterAny(virConnectPtr conn,
         if (call(conn, priv, 0, REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER_ANY,
                  (xdrproc_t) xdr_remote_connect_domain_event_register_any_args, (char *) &args,
                  (xdrproc_t) xdr_void, (char *)NULL) == -1) {
-            virObjectEventStateDeregisterID(conn,
-                                            priv->domainEventState,
+            virObjectEventStateDeregisterID(conn, priv->eventState,
                                             callbackID);
             goto done;
         }
@@ -5267,15 +5260,13 @@ static int remoteConnectDomainEventDeregisterAny(virConnectPtr conn,

     remoteDriverLock(priv);

-    if ((eventID = virObjectEventStateEventID(conn,
-                                              priv->domainEventState,
+    if ((eventID = virObjectEventStateEventID(conn, priv->eventState,
                                               callbackID)) < 0) {
         virReportError(VIR_ERR_RPC, _("unable to find callback ID %d"), callbackID);
         goto done;
     }

-    if ((count = virObjectEventStateDeregisterID(conn,
-                                                 priv->domainEventState,
+    if ((count = virObjectEventStateDeregisterID(conn, priv->eventState,
                                                  callbackID)) < 0) {
         virReportError(VIR_ERR_RPC, _("unable to find callback ID %d"), callbackID);
         goto done;
@@ -6811,7 +6802,7 @@ done:
 static void
 remoteDomainEventQueue(struct private_data *priv, virObjectEventPtr event)
 {
-    virObjectEventStateQueue(priv->domainEventState, event);
+    virObjectEventStateQueue(priv->eventState, event);
 }

 /* get_nonnull_domain and get_nonnull_network turn an on-wire
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index b8bd6f4..da76666 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -100,7 +100,7 @@ struct _testConn {
     int numCells;
     testCell cells[MAX_CELLS];

-    virObjectEventStatePtr domainEventState;
+    virObjectEventStatePtr eventState;
 };
 typedef struct _testConn testConn;
 typedef struct _testConn *testConnPtr;
@@ -714,7 +714,7 @@ testOpenDefault(virConnectPtr conn)

     conn->privateData = privconn;

-    if (!(privconn->domainEventState = virObjectEventStateNew()))
+    if (!(privconn->eventState = virObjectEventStateNew()))
         goto error;

     if (!(privconn->domains = virDomainObjListNew()))
@@ -828,7 +828,7 @@ error:
     virStoragePoolObjListFree(&privconn->pools);
     virNodeDeviceObjListFree(&privconn->devs);
     virObjectUnref(privconn->caps);
-    virObjectEventStateFree(privconn->domainEventState);
+    virObjectEventStateFree(privconn->eventState);
     virMutexDestroy(&privconn->lock);
     conn->privateData = NULL;
     virDomainDefFree(domdef);
@@ -1386,7 +1386,7 @@ testOpenFromFile(virConnectPtr conn, const char *file)
     if (!(privconn->xmlopt = testBuildXMLConfig()))
         goto error;

-    if (!(privconn->domainEventState = virObjectEventStateNew()))
+    if (!(privconn->eventState = virObjectEventStateNew()))
         goto error;

     if (!(doc = virXMLParseFileCtxt(file, &ctxt))) {
@@ -1432,7 +1432,7 @@ testOpenFromFile(virConnectPtr conn, const char *file)
     virInterfaceObjListFree(&privconn->ifaces);
     virStoragePoolObjListFree(&privconn->pools);
     VIR_FREE(privconn->path);
-    virObjectEventStateFree(privconn->domainEventState);
+    virObjectEventStateFree(privconn->eventState);
     testDriverUnlock(privconn);
     VIR_FREE(privconn);
     conn->privateData = NULL;
@@ -1505,7 +1505,7 @@ static int testConnectClose(virConnectPtr conn)
     virNetworkObjListFree(&privconn->networks);
     virInterfaceObjListFree(&privconn->ifaces);
     virStoragePoolObjListFree(&privconn->pools);
-    virObjectEventStateFree(privconn->domainEventState);
+    virObjectEventStateFree(privconn->eventState);
     VIR_FREE(privconn->path);

     testDriverUnlock(privconn);
@@ -6036,8 +6036,7 @@ testConnectDomainEventRegister(virConnectPtr conn,
     int ret = 0;

     testDriverLock(driver);
-    if (virDomainEventStateRegister(conn,
-                                    driver->domainEventState,
+    if (virDomainEventStateRegister(conn, driver->eventState,
                                     callback, opaque, freecb) < 0)
         ret = -1;
     testDriverUnlock(driver);
@@ -6054,8 +6053,7 @@ testConnectDomainEventDeregister(virConnectPtr conn,
     int ret = 0;

     testDriverLock(driver);
-    if (virDomainEventStateDeregister(conn,
-                                      driver->domainEventState,
+    if (virDomainEventStateDeregister(conn, driver->eventState,
                                       callback) < 0)
         ret = -1;
     testDriverUnlock(driver);
@@ -6076,8 +6074,7 @@ testConnectDomainEventRegisterAny(virConnectPtr conn,
     int ret;

     testDriverLock(driver);
-    if (virDomainEventStateRegisterID(conn,
-                                      driver->domainEventState,
+    if (virDomainEventStateRegisterID(conn, driver->eventState,
                                       dom, eventID,
                                       callback, opaque, freecb, &ret) < 0)
         ret = -1;
@@ -6094,8 +6091,7 @@ testConnectDomainEventDeregisterAny(virConnectPtr conn,
     int ret = 0;

     testDriverLock(driver);
-    if (virObjectEventStateDeregisterID(conn,
-                                        driver->domainEventState,
+    if (virObjectEventStateDeregisterID(conn, driver->eventState,
                                         callbackID) < 0)
         ret = -1;
     testDriverUnlock(driver);
@@ -6116,8 +6112,7 @@ testConnectNetworkEventRegisterAny(virConnectPtr conn,
     int ret;

     testDriverLock(driver);
-    if (virNetworkEventStateRegisterID(conn,
-                                       driver->domainEventState,
+    if (virNetworkEventStateRegisterID(conn, driver->eventState,
                                        net, eventID,
                                        VIR_OBJECT_EVENT_CALLBACK(callback),
                                        opaque, freecb, &ret) < 0)
@@ -6135,8 +6130,7 @@ testConnectNetworkEventDeregisterAny(virConnectPtr conn,
     int ret = 0;

     testDriverLock(driver);
-    if (virObjectEventStateDeregisterID(conn,
-                                        driver->domainEventState,
+    if (virObjectEventStateDeregisterID(conn, driver->eventState,
                                         callbackID) < 0)
         ret = -1;
     testDriverUnlock(driver);
@@ -6149,7 +6143,7 @@ testConnectNetworkEventDeregisterAny(virConnectPtr conn,
 static void testObjectEventQueue(testConnPtr driver,
                                  virObjectEventPtr event)
 {
-    virObjectEventStateQueue(driver->domainEventState, event);
+    virObjectEventStateQueue(driver->eventState, event);
 }

 static virDrvOpenStatus testSecretOpen(virConnectPtr conn,
-- 
1.8.4.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]