[PATCH 5/6] virCommandSetSendBuffer: Provide saner semantics

Ján Tomko jtomko at redhat.com
Tue Mar 2 17:11:16 UTC 2021


On a Tuesday in 2021, Peter Krempa wrote:
>The function is used to automatically feed a buffer into a pipe which
>can be used by the command to read contents of the buffer.
>
>Rather than passing in a pipe, let's create the pipe inside
>virCommandSetSendBuffer and directly associate the reader end with the
>command. This way the ownership of both ends of the pipe will end up
>with the virCommand right away reducing the need of cleanup in callers.
>
>The returned value then can be used just to format the appropriate
>arguments without worrying about cleanup or failure.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/qemu/qemu_tpm.c   | 50 +++++++++----------------------------------
> src/util/vircommand.c | 39 ++++++++++++++++++++++-----------
> src/util/vircommand.h |  6 +++---
> tests/commandtest.c   | 32 ++++++---------------------
> 4 files changed, 46 insertions(+), 81 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210302/dbf8fc51/attachment-0001.sig>


More information about the libvir-list mailing list