[PATCH RFC 13/48] virNetClientStreamNew: Track origin stream

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

 



This has no real added value right now,
but is going to be very helpful later.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/remote/remote_driver.c   | 6 ++++--
 src/rpc/gendispatch.pl       | 2 +-
 src/rpc/virnetclientstream.c | 6 +++++-
 src/rpc/virnetclientstream.h | 3 ++-
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index bfd8e8e..e80ec58 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -5760,7 +5760,8 @@ remoteDomainMigratePrepareTunnel3(virConnectPtr dconn,
     memset(&args, 0, sizeof(args));
     memset(&ret, 0, sizeof(ret));
 
-    if (!(netst = virNetClientStreamNew(priv->remoteProgram,
+    if (!(netst = virNetClientStreamNew(st,
+                                        priv->remoteProgram,
                                         REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3,
                                         priv->counter)))
         goto done;
@@ -6684,7 +6685,8 @@ remoteDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
         goto cleanup;
     }
 
-    if (!(netst = virNetClientStreamNew(priv->remoteProgram,
+    if (!(netst = virNetClientStreamNew(st,
+                                        priv->remoteProgram,
                                         REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3_PARAMS,
                                         priv->counter)))
         goto cleanup;
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index 173189c..e608812 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -1738,7 +1738,7 @@ elsif ($mode eq "client") {
 
         if ($call->{streamflag} ne "none") {
             print "\n";
-            print "    if (!(netst = virNetClientStreamNew(priv->remoteProgram, $call->{constname}, priv->counter)))\n";
+            print "    if (!(netst = virNetClientStreamNew(st, priv->remoteProgram, $call->{constname}, priv->counter)))\n";
             print "        goto done;\n";
             print "\n";
             print "    if (virNetClientAddStream(priv->client, netst) < 0) {\n";
diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c
index 34989a9..8920395 100644
--- a/src/rpc/virnetclientstream.c
+++ b/src/rpc/virnetclientstream.c
@@ -36,6 +36,8 @@ VIR_LOG_INIT("rpc.netclientstream");
 struct _virNetClientStream {
     virObjectLockable parent;
 
+    virStreamPtr stream; /* Reverse pointer to parent stream */
+
     virNetClientProgramPtr prog;
     int proc;
     unsigned serial;
@@ -133,7 +135,8 @@ virNetClientStreamEventTimer(int timer ATTRIBUTE_UNUSED, void *opaque)
 }
 
 
-virNetClientStreamPtr virNetClientStreamNew(virNetClientProgramPtr prog,
+virNetClientStreamPtr virNetClientStreamNew(virStreamPtr stream,
+                                            virNetClientProgramPtr prog,
                                             int proc,
                                             unsigned serial)
 {
@@ -145,6 +148,7 @@ virNetClientStreamPtr virNetClientStreamNew(virNetClientProgramPtr prog,
     if (!(st = virObjectLockableNew(virNetClientStreamClass)))
         return NULL;
 
+    st->stream = stream;
     st->prog = prog;
     st->proc = proc;
     st->serial = serial;
diff --git a/src/rpc/virnetclientstream.h b/src/rpc/virnetclientstream.h
index a0d2be9..e278dab 100644
--- a/src/rpc/virnetclientstream.h
+++ b/src/rpc/virnetclientstream.h
@@ -32,7 +32,8 @@ typedef virNetClientStream *virNetClientStreamPtr;
 typedef void (*virNetClientStreamEventCallback)(virNetClientStreamPtr stream,
                                                 int events, void *opaque);
 
-virNetClientStreamPtr virNetClientStreamNew(virNetClientProgramPtr prog,
+virNetClientStreamPtr virNetClientStreamNew(virStreamPtr stream,
+                                            virNetClientProgramPtr prog,
                                             int proc,
                                             unsigned serial);
 
-- 
2.8.4

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