[PATCH v2 1/2] util: Deduplicate code in virNetlinkEventServiceStopAll

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

 



Commit 15a71e60 introduced the virNetlinkEventServiceStopAll function, and
the code in virNetlinkEventServiceStop is copied to this function. can use
virNetlinkEventServiceStop instead.
---
 src/util/virnetlink.c | 25 +++----------------------
 1 file changed, 3 insertions(+), 22 deletions(-)

diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index 92ecf77..fad1e8e 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -775,32 +775,13 @@ virNetlinkEventServiceStop(unsigned int protocol)
 int
 virNetlinkEventServiceStopAll(void)
 {
-    size_t i, j;
+    size_t i;
     virNetlinkEventSrvPrivatePtr srv = NULL;
 
     VIR_INFO("stopping all netlink event services");
 
-    for (i = 0; i < MAX_LINKS; i++) {
-        srv = server[i];
-        if (!srv)
-            continue;
-
-        virNetlinkEventServerLock(srv);
-        nl_close(srv->netlinknh);
-        virNetlinkFree(srv->netlinknh);
-        virEventRemoveHandle(srv->eventwatch);
-
-        for (j = 0; j < srv->handlesCount; j++) {
-            if (srv->handles[j].deleted == VIR_NETLINK_HANDLE_VALID)
-                virNetlinkEventRemoveClientPrimitive(j, i);
-        }
-
-        server[i] = NULL;
-        virNetlinkEventServerUnlock(srv);
-
-        virMutexDestroy(&srv->lock);
-        VIR_FREE(srv);
-    }
+    for (i = 0; i < MAX_LINKS; i++)
+        virNetlinkEventServiceStop(i);
 
     return 0;
 }
-- 
2.8.3


--
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]
  Powered by Linux