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

[libvirt] [PATCH 11/12] server rpc: Remove APIs for manipulating filters on locked client



We don't need to add or remove filters when client object is already
locked anymore. There's no reason to keep the *Locked variants of those
APIs.
---
 src/rpc/virnetserverclient.c |   39 ++++++++++++---------------------------
 1 file changed, 12 insertions(+), 27 deletions(-)

diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index f3eb61a..a56031c 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -218,20 +218,21 @@ static void virNetServerClientUpdateEvent(virNetServerClientPtr client)
 }
 
 
-static int
-virNetServerClientAddFilterLocked(virNetServerClientPtr client,
-                                  virNetServerClientFilterFunc func,
-                                  void *opaque)
+int virNetServerClientAddFilter(virNetServerClientPtr client,
+                                virNetServerClientFilterFunc func,
+                                void *opaque)
 {
     virNetServerClientFilterPtr filter;
     virNetServerClientFilterPtr *place;
-    int ret = -1;
+    int ret;
 
     if (VIR_ALLOC(filter) < 0) {
         virReportOOMError();
-        goto cleanup;
+        return -1;
     }
 
+    virNetServerClientLock(client);
+
     filter->id = client->nextFilterID++;
     filter->func = func;
     filter->opaque = opaque;
@@ -243,28 +244,18 @@ virNetServerClientAddFilterLocked(virNetServerClientPtr client,
 
     ret = filter->id;
 
-cleanup:
-    return ret;
-}
-
-int virNetServerClientAddFilter(virNetServerClientPtr client,
-                                virNetServerClientFilterFunc func,
-                                void *opaque)
-{
-    int ret;
-
-    virNetServerClientLock(client);
-    ret = virNetServerClientAddFilterLocked(client, func, opaque);
     virNetServerClientUnlock(client);
+
     return ret;
 }
 
-static void
-virNetServerClientRemoveFilterLocked(virNetServerClientPtr client,
-                                     int filterID)
+void virNetServerClientRemoveFilter(virNetServerClientPtr client,
+                                    int filterID)
 {
     virNetServerClientFilterPtr tmp, prev;
 
+    virNetServerClientLock(client);
+
     prev = NULL;
     tmp = client->filters;
     while (tmp) {
@@ -280,13 +271,7 @@ virNetServerClientRemoveFilterLocked(virNetServerClientPtr client,
         prev = tmp;
         tmp = tmp->next;
     }
-}
 
-void virNetServerClientRemoveFilter(virNetServerClientPtr client,
-                                    int filterID)
-{
-    virNetServerClientLock(client);
-    virNetServerClientRemoveFilterLocked(client, filterID);
     virNetServerClientUnlock(client);
 }
 
-- 
1.7.10.2


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