mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-05 22:05:47 +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;
|
virCommandNewVAList;
|
||||||
virCommandNonblockingFDs;
|
virCommandNonblockingFDs;
|
||||||
virCommandPassFD;
|
virCommandPassFD;
|
||||||
|
virCommandPeekSendBuffers;
|
||||||
virCommandRawStatus;
|
virCommandRawStatus;
|
||||||
virCommandRequireHandshake;
|
virCommandRequireHandshake;
|
||||||
virCommandRun;
|
virCommandRun;
|
||||||
|
@ -78,14 +78,6 @@ struct _virCommandFD {
|
|||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _virCommandSendBuffer virCommandSendBuffer;
|
|
||||||
struct _virCommandSendBuffer {
|
|
||||||
int fd;
|
|
||||||
unsigned char *buffer;
|
|
||||||
size_t buflen;
|
|
||||||
off_t offset;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _virCommand {
|
struct _virCommand {
|
||||||
int has_error; /* 0 on success, -1 on error */
|
int has_error; /* 0 on success, -1 on error */
|
||||||
|
|
||||||
@ -3514,3 +3506,12 @@ virCommandSetRunAmong(virCommand *cmd,
|
|||||||
|
|
||||||
cmd->schedCore = pid;
|
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 "internal.h"
|
||||||
#include "virbuffer.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;
|
typedef struct _virCommand virCommand;
|
||||||
|
|
||||||
/* This will execute in the context of the first child
|
/* This will execute in the context of the first child
|
||||||
|
@ -47,3 +47,7 @@ void virCommandSetDryRun(virCommandDryRunToken *tok,
|
|||||||
bool bufCommandStripPath,
|
bool bufCommandStripPath,
|
||||||
virCommandDryRunCallback cb,
|
virCommandDryRunCallback cb,
|
||||||
void *opaque);
|
void *opaque);
|
||||||
|
|
||||||
|
void virCommandPeekSendBuffers(virCommand *cmd,
|
||||||
|
virCommandSendBuffer **buffers,
|
||||||
|
int *nbuffers);
|
||||||
|
Loading…
Reference in New Issue
Block a user