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(a)redhat.com>
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/libvirt_private.syms | 1 +
src/util/vircommand.c | 17 +++++++++--------
src/util/vircommand.h | 8 ++++++++
src/util/vircommandpriv.h | 4 ++++
4 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 1e3e407097..e4da5388e7 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2117,6 +2117,7 @@ virCommandNewArgs;
virCommandNewVAList;
virCommandNonblockingFDs;
virCommandPassFD;
+virCommandPeekSendBuffers;
virCommandRawStatus;
virCommandRequireHandshake;
virCommandRun;
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 899d413dd2..7d7ce4297e 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -78,14 +78,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 */
@@ -3515,3 +3507,12 @@ 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 d51449ac90..9bcdce35b9 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.41.0