[libvirt PATCH v3 15/18] util: make virCommandSetSendBuffer testable

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

 



Add a private function to peek at the list of send buffers in virCommand
so that it is testable

Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
---
 src/libvirt_private.syms  |  1 +
 src/util/vircommand.c     | 16 ++++++++--------
 src/util/vircommand.h     |  8 ++++++++
 src/util/vircommandpriv.h |  4 ++++
 4 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 0b0ccbafe5..bf24d65b08 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2080,6 +2080,7 @@ virCommandNewArgs;
 virCommandNewVAList;
 virCommandNonblockingFDs;
 virCommandPassFD;
+virCommandPeekSendBuffers;
 virCommandRawStatus;
 virCommandRequireHandshake;
 virCommandRun;
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index bbfbe19706..014bab9196 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -77,14 +77,6 @@ struct _virCommandFD {
     unsigned int flags;
 };
 
-typedef struct _virCommandSendBuffer virCommandSendBuffer;
-struct _virCommandSendBuffer {
-    int fd;
-    unsigned char *buffer;
-    size_t buflen;
-    off_t offset;
-};
-
 struct _virCommand {
     int has_error; /* 0 on success, -1 on error  */
 
@@ -3451,3 +3443,11 @@ virCommandSetRunAmong(virCommand *cmd,
 
     cmd->schedCore = pid;
 }
+
+void virCommandPeekSendBuffers(virCommand *cmd,
+                               virCommandSendBuffer **buffers,
+                               int *nbuffers)
+{
+    *buffers = cmd->sendBuffers;
+    *nbuffers = cmd->numSendBuffers;
+}
diff --git a/src/util/vircommand.h b/src/util/vircommand.h
index 98788bcbf7..fc2ca0f3ff 100644
--- a/src/util/vircommand.h
+++ b/src/util/vircommand.h
@@ -24,6 +24,14 @@
 #include "internal.h"
 #include "virbuffer.h"
 
+typedef struct _virCommandSendBuffer virCommandSendBuffer;
+struct _virCommandSendBuffer {
+    int fd;
+    unsigned char *buffer;
+    size_t buflen;
+    off_t offset;
+};
+
 typedef struct _virCommand virCommand;
 
 /* This will execute in the context of the first child
diff --git a/src/util/vircommandpriv.h b/src/util/vircommandpriv.h
index ff17fa5ded..d579810bb5 100644
--- a/src/util/vircommandpriv.h
+++ b/src/util/vircommandpriv.h
@@ -47,3 +47,7 @@ void virCommandSetDryRun(virCommandDryRunToken *tok,
                          bool bufCommandStripPath,
                          virCommandDryRunCallback cb,
                          void *opaque);
+
+void virCommandPeekSendBuffers(virCommand *cmd,
+                               virCommandSendBuffer **buffers,
+                               int *nbuffers);
-- 
2.37.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