Re: [PATCH 2/3] qemu_monitor_json: Build Json CPU Model Info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 16, 2018 at 01:06:57AM -0500, Chris Venteicher wrote:
> Function qemuMonitorJSONBuildCPUModelInfoJSON builds Json of form
> {"model": {"name": "IvyBridge", "props": {}}}
> from pointer to qemuMonitorCPUModelInfo.
> ---
>  src/qemu/qemu_monitor_json.c | 49 ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 49 insertions(+)

...

> +
> +        switch (prop->type) {
> +        case QEMU_MONITOR_CPU_PROPERTY_BOOLEAN:
> +            if (virJSONValueObjectAppendBoolean(cpu_props, prop->name, prop->value.boolean) < 0)
> +                goto cleanup;
> +            break;
> +
> +        case QEMU_MONITOR_CPU_PROPERTY_STRING:
> +            if (virJSONValueObjectAppendString(cpu_props, prop->name, prop->value.string) < 0)
> +                goto cleanup;
> +            break;
> +
> +        case QEMU_MONITOR_CPU_PROPERTY_NUMBER:
> +            if (virJSONValueObjectAppendNumberLong(cpu_props, prop->name, prop->value.number) < 0)
> +                goto cleanup;
> +            break;
> +
> +        case QEMU_MONITOR_CPU_PROPERTY_LAST:
> +            break;

The most recent "correct" way to write switches in libvirt is to do the
following:
    case QEMU_MONITOR_CPU_PROPERTY_LAST:
    default:
        virReportEnumRangeError(qemuMonitorCPUPropertyPtr, prop->type);
        goto cleanup;

Erik

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux