[libvirt PATCH v3 15/18] util: make virCommandSetSendBuffer testable
Peter Krempa
pkrempa at redhat.com
Fri Dec 9 14:01:14 UTC 2022
On Thu, Oct 20, 2022 at 16:59:06 -0500, Jonathon Jongsma wrote:
> 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 at redhat.com>
> ---
> 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)
Header formatting does not conform to the rest of the file.
> +{
> + *buffers = cmd->sendBuffers;
> + *nbuffers = cmd->numSendBuffers;
> +}
With the above addressed:
Reviewed-by: Peter Krempa <pkrempa at redhat.com>
More information about the libvir-list
mailing list