On 2/23/19 4:24 PM, Eric Blake wrote:
> Add a new function to output all of the domain's snapshots in one
> buffer.
>
> Signed-off-by: Eric Blake <ebl...@redhat.com>
> ---
> src/conf/snapshot_conf.h | 8 +++++++-
> src/conf/snapshot_conf.c | 39 +++++++++++++++++++++++++++++++++++++++
> src/libvirt_private.syms | 1 +
> 3 files changed, 47 insertions(+), 1 deletion(-)
>
[...]
> diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
> index 5cb977336a..a572da5b58 100644
> --- a/src/conf/snapshot_conf.c
> +++ b/src/conf/snapshot_conf.c
> @@ -803,6 +803,45 @@ virDomainSnapshotDefFormat(const char *uuidstr,
> return virBufferContentAndReset(&buf);
> }
>
> +struct virDomainSnapshotFormatData {
> + virBufferPtr buf;
> + const char *uuidstr;
> + virCapsPtr caps;
> + virDomainXMLOptionPtr xmlopt;
> + unsigned int flags;
> +};
> +
> +static int
> +virDomainSnapshotFormatOne(void *payload, const void *name ATTRIBUTE_UNUSED,
One arg per line.
> + void *opaque)
> +{
> + virDomainSnapshotObjPtr snap = payload;
> + struct virDomainSnapshotFormatData *data = opaque;
> + return virDomainSnapshotDefFormatInternal(data->buf, data->uuidstr,
> + snap->def, data->caps,
> + data->xmlopt, data->flags);
> +}
> +
> +
There's no parameter and method description here leading me to wonder...
> +int
> +virDomainSnapshotObjListFormat(virBufferPtr buf,
> + const char *uuidstr,
> + virDomainSnapshotObjListPtr snapshots,
> + virCapsPtr caps,
> + virDomainXMLOptionPtr xmlopt,
> + unsigned int flags)
> +{
> + struct virDomainSnapshotFormatData data = {
> + .buf = buf,
> + .uuidstr = uuidstr,
> + .caps = caps,
> + .xmlopt = xmlopt,
> + .flags = flags,
> + };
...Hmm... so should this also clear and reset buffer if
virDomainSnapshotForEach returns -1 or trust the caller to do that?
With a bit of extra docs and since I have read the next patch...
Reviewed-by: John Ferlan <jfer...@redhat.com>
John
> + return virDomainSnapshotForEach(snapshots, virDomainSnapshotFormatOne,
> + &data);
> +}
> +
> /* Snapshot Obj functions */
> static virDomainSnapshotObjPtr virDomainSnapshotObjNew(void)
> {
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index 6bfb497648..c623737c30 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -891,6 +891,7 @@ virDomainSnapshotFormatConvertXMLFlags;
> virDomainSnapshotIsExternal;
> virDomainSnapshotLocationTypeFromString;
> virDomainSnapshotLocationTypeToString;
> +virDomainSnapshotObjListFormat;
> virDomainSnapshotObjListFree;
> virDomainSnapshotObjListGetNames;
> virDomainSnapshotObjListNew;
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list