[PATCH 3/4] Modify all the function calls for API in virnetlink.c

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

 



This patch fixes the function prototype in all the callers
of for API in virnetlink.c

Signed-off-by: Tang Chen <tangchen@xxxxxxxxxxxxxx>
---
 daemon/libvirtd.c                |   12 +++++++++---
 src/util/virnetdev.c             |    6 ++++--
 src/util/virnetdevmacvlan.c      |   12 +++++++-----
 src/util/virnetdevvportprofile.c |    7 ++++---
 4 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 8c434a0..72ae207 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1290,8 +1290,14 @@ int main(int argc, char **argv) {
         goto cleanup;
     }
 
-    /* Register the netlink event service */
-    if (virNetlinkEventServiceStart() < 0) {
+    /* Register the netlink event service for NETLINK_ROUTE */
+    if (virNetlinkEventServiceStart(NETLINK_ROUTE, 0) < 0) {
+        ret = VIR_DAEMON_ERR_NETWORK;
+        goto cleanup;
+    }
+
+    /* Register the netlink event service for NETLINK_KOBJECT_UEVENT */
+    if (virNetlinkEventServiceStart(NETLINK_KOBJECT_UEVENT, 1) < 0) {
         ret = VIR_DAEMON_ERR_NETWORK;
         goto cleanup;
     }
@@ -1305,7 +1311,7 @@ int main(int argc, char **argv) {
                 0, "shutdown", NULL, NULL);
 
 cleanup:
-    virNetlinkEventServiceStop();
+    virNetlinkEventServiceStopAll();
     virNetServerProgramFree(remoteProgram);
     virNetServerProgramFree(qemuProgram);
     virNetServerClose(srv);
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index cd44bf4..8b01090 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -1278,7 +1278,8 @@ virNetDevLinkDump(const char *ifname, int ifindex,
             goto buffer_too_small;
     }
 
-    if (virNetlinkCommand(nl_msg, recvbuf, &recvbuflen, src_pid, dst_pid) < 0)
+    if (virNetlinkCommand(nl_msg, recvbuf, &recvbuflen,
+                          src_pid, dst_pid, NETLINK_ROUTE, 0) < 0)
         goto cleanup;
 
     if (recvbuflen < NLMSG_LENGTH(0) || *recvbuf == NULL)
@@ -1406,7 +1407,8 @@ virNetDevSetVfConfig(const char *ifname, int ifindex, int vf,
         }
     }
 
-    if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, 0, pid) < 0)
+    if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, 0, pid,
+                          NETLINK_ROUTE, 0) < 0)
         goto cleanup;
 
     if (recvbuflen < NLMSG_LENGTH(0) || recvbuf == NULL)
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index 559fac5..685b2e7 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -149,7 +149,8 @@ virNetDevMacVLanCreate(const char *ifname,
 
     nla_nest_end(nl_msg, linkinfo);
 
-    if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, 0, 0) < 0) {
+    if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, 0, 0,
+                          NETLINK_ROUTE, 0) < 0) {
         goto cleanup;
     }
 
@@ -237,7 +238,8 @@ int virNetDevMacVLanDelete(const char *ifname)
     if (nla_put(nl_msg, IFLA_IFNAME, strlen(ifname)+1, ifname) < 0)
         goto buffer_too_small;
 
-    if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, 0, 0) < 0) {
+    if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, 0, 0,
+                          NETLINK_ROUTE, 0) < 0) {
         goto cleanup;
     }
 
@@ -757,7 +759,7 @@ virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname,
 {
     virNetlinkCallbackDataPtr calld = NULL;
 
-    if (virtPortProfile && virNetlinkEventServiceIsRunning()) {
+    if (virtPortProfile && virNetlinkEventServiceIsRunning(NETLINK_ROUTE)) {
         if (VIR_ALLOC(calld) < 0)
             goto memory_error;
         if ((calld->cr_ifname = strdup(ifname)) == NULL)
@@ -774,7 +776,7 @@ virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname,
 
         if (virNetlinkEventAddClient(virNetDevMacVLanVPortProfileCallback,
                                      virNetDevMacVLanVPortProfileDestroyCallback,
-                                     calld, macaddress) < 0)
+                                     calld, macaddress, NETLINK_ROUTE) < 0)
             goto error;
     }
 
@@ -1000,7 +1002,7 @@ int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname,
             ret = -1;
     }
 
-    virNetlinkEventRemoveClient(0, macaddr);
+    virNetlinkEventRemoveClient(0, macaddr, NETLINK_ROUTE);
 
     return ret;
 }
diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c
index 089ec8a..ce550f3 100644
--- a/src/util/virnetdevvportprofile.c
+++ b/src/util/virnetdevvportprofile.c
@@ -386,13 +386,14 @@ virNetDevVPortProfileOpSetLink(const char *ifname, int ifindex,
     }
 
     if (!nltarget_kernel) {
-        if ((src_pid = virNetlinkEventServiceLocalPid()) < 0)
+        if ((src_pid = virNetlinkEventServiceLocalPid(NETLINK_ROUTE)) < 0)
             goto cleanup;
         if ((dst_pid = virNetDevVPortProfileGetLldpadPid()) == 0)
             goto cleanup;
     }
 
-    if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, src_pid, dst_pid) < 0)
+    if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen,
+                          src_pid, dst_pid, NETLINK_ROUTE, 0) < 0)
         goto cleanup;
 
     if (recvbuflen < NLMSG_LENGTH(0) || recvbuf == NULL)
@@ -549,7 +550,7 @@ virNetDevVPortProfileOpCommon(const char *ifname, int ifindex,
         return 0;
 
     if (!nltarget_kernel &&
-        (((src_pid = virNetlinkEventServiceLocalPid()) < 0) ||
+        (((src_pid = virNetlinkEventServiceLocalPid(NETLINK_ROUTE)) < 0) ||
          ((dst_pid = virNetDevVPortProfileGetLldpadPid()) == 0))) {
         rc = -1;
         goto cleanup;
-- 
1.7.10.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]