mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
util: make virCommandSetSendBuffer testable
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@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
3361cfd79e
commit
f3942eece5
@ -2119,6 +2119,7 @@ virCommandNewArgs;
|
||||
virCommandNewVAList;
|
||||
virCommandNonblockingFDs;
|
||||
virCommandPassFD;
|
||||
virCommandPeekSendBuffers;
|
||||
virCommandRawStatus;
|
||||
virCommandRequireHandshake;
|
||||
virCommandRun;
|
||||
|
@ -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 */
|
||||
|
||||
@ -3514,3 +3506,12 @@ virCommandSetRunAmong(virCommand *cmd,
|
||||
|
||||
cmd->schedCore = pid;
|
||||
}
|
||||
|
||||
void
|
||||
virCommandPeekSendBuffers(virCommand *cmd,
|
||||
virCommandSendBuffer **buffers,
|
||||
int *nbuffers)
|
||||
{
|
||||
*buffers = cmd->sendBuffers;
|
||||
*nbuffers = cmd->numSendBuffers;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -47,3 +47,7 @@ void virCommandSetDryRun(virCommandDryRunToken *tok,
|
||||
bool bufCommandStripPath,
|
||||
virCommandDryRunCallback cb,
|
||||
void *opaque);
|
||||
|
||||
void virCommandPeekSendBuffers(virCommand *cmd,
|
||||
virCommandSendBuffer **buffers,
|
||||
int *nbuffers);
|
||||
|
Loading…
Reference in New Issue
Block a user