[libvirt] [PATCH 03/19] qemu: monitor: Extract data about dirty-bimaps in qemuMonitorBlockGetNamedNodeData

Eric Blake eblake at redhat.com
Thu Dec 12 18:30:54 UTC 2019


On 12/12/19 11:18 AM, Peter Krempa wrote:
> We will need to inspect the presence and attributes for dirty bitmaps.
> Extract them when processing reply of query-named-block-nodes.
> 
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
>   src/qemu/qemu_monitor.h      | 15 ++++++++
>   src/qemu/qemu_monitor_json.c | 74 ++++++++++++++++++++++++++++++++++++
>   2 files changed, 89 insertions(+)
> 

> +static void
> +qemuMonitorJSONBlockGetNamedNodeDataBitmaps(virJSONValuePtr bitmaps,
> +                                            qemuBlockNamedNodeDataPtr data)
> +{
> +    size_t nbitmaps = virJSONValueArraySize(bitmaps);
> +    size_t i;
> +
> +    data->bitmaps = g_new0(qemuBlockNamedNodeDataBitmapPtr, nbitmaps);
> +
> +    for (i = 0; i < nbitmaps; i++) {
> +        virJSONValuePtr bitmap = virJSONValueArrayGet(bitmaps, i);
> +        qemuBlockNamedNodeDataBitmapPtr tmp;
> +
> +        if (!bitmap)
> +            continue;

Can bitmap ever be NULL?  (We could assert that it is not, given our 
correct usage of the API - except that we aren't using asserts).  But 
doesn't hurt to leave the check in.

Reviewed-by: Eric Blake <eblake at redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




More information about the libvir-list mailing list