[PATCH 3/9] qemu: Convert passing of 'tapfds' to 'qemuFDPassDirect'

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

 



Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_command.c | 15 +++++----------
 src/qemu/qemu_domain.c  |  2 +-
 src/qemu/qemu_domain.h  |  2 +-
 src/qemu/qemu_hotplug.c |  4 ++--
 4 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ed7f0eafd2..bab2b0a99b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4244,7 +4244,7 @@ qemuBuildHostNetProps(virDomainNetDef *net)
         if (netpriv->tapfds) {
             nfds = 0;
             for (n = netpriv->tapfds; n; n = n->next) {
-                virBufferAsprintf(&buf, "%s:", qemuFDPassGetPath(n->data));
+                virBufferAsprintf(&buf, "%s:", qemuFDPassDirectGetPath(n->data));
                 nfds++;
             }

@@ -8738,16 +8738,13 @@ qemuBuildInterfaceConnect(virDomainObj *vm,

     /* 'vhostfd' is set to true in all cases when we need to process tapfds */
     if (vhostfd) {
-        g_autofree char *prefix = g_strdup_printf("tapfd-%s", net->info.alias);
         size_t i;

         for (i = 0; i < tapfdSize; i++) {
-            g_autoptr(qemuFDPass) pass = qemuFDPassNewDirect(prefix, priv);
-            g_autofree char *suffix = g_strdup_printf("%zu", i);
+            g_autofree char *name = g_strdup_printf("tapfd-%s%zu", net->info.alias, i);
             int fd = tapfd[i]; /* we want to keep the array intact for security labeling*/

-            qemuFDPassAddFD(pass, &fd, suffix);
-            netpriv->tapfds = g_slist_prepend(netpriv->tapfds, g_steal_pointer(&pass));
+            netpriv->tapfds = g_slist_prepend(netpriv->tapfds, qemuFDPassDirectNew(name, &fd));
         }

         netpriv->tapfds = g_slist_reverse(netpriv->tapfds);
@@ -8911,10 +8908,8 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver,
         virNetDevSetMTU(net->ifname, net->mtu) < 0)
         goto cleanup;

-    for (n = netpriv->tapfds; n; n = n->next) {
-        if (qemuFDPassTransferCommand(n->data, cmd) < 0)
-            return -1;
-    }
+    for (n = netpriv->tapfds; n; n = n->next)
+        qemuFDPassDirectTransferCommand(n->data, cmd);

     for (n = netpriv->vhostfds; n; n = n->next)
         qemuFDPassDirectTransferCommand(n->data, cmd);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index eba556a6e7..f83ee55246 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1054,7 +1054,7 @@ qemuDomainNetworkPrivateClearFDs(qemuDomainNetworkPrivate *priv)
     g_clear_pointer(&priv->slirpfd, qemuFDPassFree);
     g_clear_pointer(&priv->vdpafd, qemuFDPassFree);
     g_slist_free_full(g_steal_pointer(&priv->vhostfds), (GDestroyNotify) qemuFDPassDirectFree);
-    g_slist_free_full(g_steal_pointer(&priv->tapfds), (GDestroyNotify) qemuFDPassFree);
+    g_slist_free_full(g_steal_pointer(&priv->tapfds), (GDestroyNotify) qemuFDPassDirectFree);
 }


diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 9475c30e0c..521df8ca01 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -404,7 +404,7 @@ struct _qemuDomainNetworkPrivate {

     /* file descriptor transfer helpers */
     qemuFDPass *slirpfd;
-    GSList *tapfds;
+    GSList *tapfds; /* qemuFDPassDirect */
     GSList *vhostfds; /* qemuFDPassDirect */
     qemuFDPass *vdpafd;
 };
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index da0896a671..4ebb3c5818 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1373,7 +1373,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
     qemuDomainObjEnterMonitor(driver, vm);

     for (n = netpriv->tapfds; n; n = n->next) {
-        if (qemuFDPassTransferMonitor(n->data, priv->mon) < 0) {
+        if (qemuFDPassDirectTransferMonitor(n->data, priv->mon) < 0) {
             qemuDomainObjExitMonitor(vm);
             goto cleanup;
         }
@@ -1525,7 +1525,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
                  netdev_name);

     for (n = netpriv->tapfds; n; n = n->next)
-        qemuFDPassTransferMonitorRollback(n->data, priv->mon);
+        qemuFDPassDirectTransferMonitorRollback(n->data, priv->mon);

     for (n = netpriv->vhostfds; n; n = n->next)
         qemuFDPassDirectTransferMonitorRollback(n->data, priv->mon);
-- 
2.35.3




[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