[libvirt] [PATCH 4/4] Rename a bunch of internal methods to clarify their meaning

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

 



This renames a lot of the methods in the remote driver client
to more accurately reflect their responsibility of IO handling
vs message handling.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 src/remote_internal.c |   86 ++++++++++++++++++++++++------------------------
 1 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/src/remote_internal.c b/src/remote_internal.c
index 76032ae..389a595 100644
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -6314,10 +6314,10 @@ error:
 
 
 static int
-processCallWrite(virConnectPtr conn,
-                 struct private_data *priv,
-                 int in_open /* if we are in virConnectOpen */,
-                 const char *bytes, int len)
+remoteIOWriteBuffer(virConnectPtr conn,
+                    struct private_data *priv,
+                    int in_open /* if we are in virConnectOpen */,
+                    const char *bytes, int len)
 {
     int ret;
 
@@ -6355,10 +6355,10 @@ processCallWrite(virConnectPtr conn,
 
 
 static int
-processCallRead(virConnectPtr conn,
-                struct private_data *priv,
-                int in_open /* if we are in virConnectOpen */,
-                char *bytes, int len)
+remoteIOReadBuffer(virConnectPtr conn,
+                   struct private_data *priv,
+                   int in_open /* if we are in virConnectOpen */,
+                   char *bytes, int len)
 {
     int ret;
 
@@ -6409,10 +6409,10 @@ processCallRead(virConnectPtr conn,
 
 
 static int
-processCallSendOne(virConnectPtr conn,
-                   struct private_data *priv,
-                   int in_open,
-                   struct remote_thread_call *thecall)
+remoteIOWriteMessage(virConnectPtr conn,
+                     struct private_data *priv,
+                     int in_open,
+                     struct remote_thread_call *thecall)
 {
 #if HAVE_SASL
     if (priv->saslconn) {
@@ -6438,9 +6438,9 @@ processCallSendOne(virConnectPtr conn,
             thecall->bufferOffset = thecall->bufferLength;
         }
 
-        ret = processCallWrite(conn, priv, in_open,
-                               priv->saslEncoded + priv->saslEncodedOffset,
-                               priv->saslEncodedLength - priv->saslEncodedOffset);
+        ret = remoteIOWriteBuffer(conn, priv, in_open,
+                                  priv->saslEncoded + priv->saslEncodedOffset,
+                                  priv->saslEncodedLength - priv->saslEncodedOffset);
         if (ret < 0)
             return ret;
         priv->saslEncodedOffset += ret;
@@ -6453,9 +6453,9 @@ processCallSendOne(virConnectPtr conn,
     } else {
 #endif
         int ret;
-        ret = processCallWrite(conn, priv, in_open,
-                               thecall->buffer + thecall->bufferOffset,
-                               thecall->bufferLength - thecall->bufferOffset);
+        ret = remoteIOWriteBuffer(conn, priv, in_open,
+                                  thecall->buffer + thecall->bufferOffset,
+                                  thecall->bufferLength - thecall->bufferOffset);
         if (ret < 0)
             return ret;
         thecall->bufferOffset += ret;
@@ -6472,8 +6472,8 @@ processCallSendOne(virConnectPtr conn,
 
 
 static int
-processCallSend(virConnectPtr conn, struct private_data *priv,
-                int in_open) {
+remoteIOHandleOutput(virConnectPtr conn, struct private_data *priv,
+                     int in_open) {
     struct remote_thread_call *thecall = priv->waitDispatch;
 
     while (thecall &&
@@ -6484,7 +6484,7 @@ processCallSend(virConnectPtr conn, struct private_data *priv,
         return -1; /* Shouldn't happen, but you never know... */
 
     while (thecall) {
-        int ret = processCallSendOne(conn, priv, in_open, thecall);
+        int ret = remoteIOWriteMessage(conn, priv, in_open, thecall);
         if (ret < 0)
             return ret;
 
@@ -6498,7 +6498,7 @@ processCallSend(virConnectPtr conn, struct private_data *priv,
 }
 
 static int
-processCallRecvSome(virConnectPtr conn, struct private_data *priv,
+remoteIOReadMessage(virConnectPtr conn, struct private_data *priv,
                     int in_open) {
     unsigned int wantData;
 
@@ -6514,8 +6514,8 @@ processCallRecvSome(virConnectPtr conn, struct private_data *priv,
             char encoded[8192];
             unsigned int encodedLen = sizeof(encoded);
             int ret, err;
-            ret = processCallRead(conn, priv, in_open,
-                                  encoded, encodedLen);
+            ret = remoteIOReadBuffer(conn, priv, in_open,
+                                     encoded, encodedLen);
             if (ret < 0)
                 return -1;
             if (ret == 0)
@@ -6550,9 +6550,9 @@ processCallRecvSome(virConnectPtr conn, struct private_data *priv,
 #endif
         int ret;
 
-        ret = processCallRead(conn, priv, in_open,
-                              priv->buffer + priv->bufferOffset,
-                              wantData);
+        ret = remoteIOReadBuffer(conn, priv, in_open,
+                                 priv->buffer + priv->bufferOffset,
+                                 wantData);
         if (ret < 0)
             return -1;
         if (ret == 0)
@@ -6568,8 +6568,8 @@ processCallRecvSome(virConnectPtr conn, struct private_data *priv,
 
 
 static int
-processCallRecvLen(virConnectPtr conn, struct private_data *priv,
-                   int in_open) {
+remoteIODecodeMessageLength(virConnectPtr conn, struct private_data *priv,
+                            int in_open) {
     XDR xdr;
     unsigned int len;
 
@@ -6769,14 +6769,14 @@ processCallDispatchMessage(virConnectPtr conn, struct private_data *priv,
 
 
 static int
-processCallRecv(virConnectPtr conn, struct private_data *priv,
-                int in_open)
+remoteIOHandleInput(virConnectPtr conn, struct private_data *priv,
+                    int in_open)
 {
     /* Read as much data as is available, until we get
      * EAGAIN
      */
     for (;;) {
-        int ret = processCallRecvSome(conn, priv, in_open);
+        int ret = remoteIOReadMessage(conn, priv, in_open);
 
         if (ret < 0)
             return -1;
@@ -6786,7 +6786,7 @@ processCallRecv(virConnectPtr conn, struct private_data *priv,
         /* Check for completion of our goal */
         if (priv->bufferOffset == priv->bufferLength) {
             if (priv->bufferOffset == 4) {
-                ret = processCallRecvLen(conn, priv, in_open);
+                ret = remoteIODecodeMessageLength(conn, priv, in_open);
                 if (ret < 0)
                     return -1;
 
@@ -6818,10 +6818,10 @@ processCallRecv(virConnectPtr conn, struct private_data *priv,
  * to someone else.
  */
 static int
-processCalls(virConnectPtr conn,
-             struct private_data *priv,
-             int in_open,
-             struct remote_thread_call *thiscall)
+remoteIOEventLoop(virConnectPtr conn,
+                  struct private_data *priv,
+                  int in_open,
+                  struct remote_thread_call *thiscall)
 {
     struct pollfd fds[2];
     int ret;
@@ -6871,12 +6871,12 @@ processCalls(virConnectPtr conn,
         }
 
         if (fds[0].revents & POLLOUT) {
-            if (processCallSend(conn, priv, in_open) < 0)
+            if (remoteIOHandleOutput(conn, priv, in_open) < 0)
                 goto error;
         }
 
         if (fds[0].revents & POLLIN) {
-            if (processCallRecv(conn, priv, in_open) < 0)
+            if (remoteIOHandleInput(conn, priv, in_open) < 0)
                 goto error;
         }
 
@@ -7068,9 +7068,9 @@ remoteIO(virConnectPtr conn,
     if (priv->watch >= 0)
         virEventUpdateHandle(priv->watch, 0);
 
-    rv = processCalls(conn, priv,
-                      flags & REMOTE_CALL_IN_OPEN ? 1 : 0,
-                      thiscall);
+    rv = remoteIOEventLoop(conn, priv,
+                           flags & REMOTE_CALL_IN_OPEN ? 1 : 0,
+                           thiscall);
 
     if (priv->watch >= 0)
         virEventUpdateHandle(priv->watch, VIR_EVENT_HANDLE_READABLE);
@@ -7225,7 +7225,7 @@ remoteDomainEventFired(int watch,
         goto done;
     }
 
-    if (processCallRecv(conn, priv, 0) < 0)
+    if (remoteIOHandleInput(conn, priv, 0) < 0)
         DEBUG0("Something went wrong during async message processing");
 
 done:
-- 
1.6.2.5


-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
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]