[libvirt] [PATCH 1/3] qemu_monitor_json: Populate CPUModelInfo struct from json
Ján Tomko
jtomko at redhat.com
Mon Apr 16 07:53:32 UTC 2018
On Mon, Apr 16, 2018 at 01:06:56AM -0500, Chris Venteicher wrote:
>New function qemuMonitorJSONBuildCPUModelInfo created by extracting code
>from existing function qemuMonitorJSONGetCPUModelExpansion to create a
>reusable function for extracting cpu model info from json.
>---
> src/qemu/qemu_monitor_json.c | 82 ++++++++++++++++++++++++++++++--------------
> 1 file changed, 56 insertions(+), 26 deletions(-)
>
>diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
>index 57c2c4de0..cf31c16a0 100644
>--- a/src/qemu/qemu_monitor_json.c
>+++ b/src/qemu/qemu_monitor_json.c
>@@ -5337,6 +5337,61 @@ qemuMonitorJSONParseCPUModelProperty(const char *key,
> return 0;
> }
>
>+// model_json: {"model": {"name": "IvyBridge", "props": {}}}
/* comment */
and
/*
* comment
*/
are the preferred comment styles in libvirt.
https://libvirt.org/hacking.html#formatting
>+static int
This function either returns -1 when model is NULL or 0 when it's not.
You can return qemuMonitorCPUModelInfoPtr directly.
>+qemuMonitorJSONBuildCPUModelInfo(virJSONValuePtr model_json,
Put 'FromJSON' at the end of the function name, e.g.:
qemuMonitorJSONGetCPUModelInfoFromJSON
>+ qemuMonitorCPUModelInfoPtr *model)
>+{
>+ virJSONValuePtr cpu_model;
>+ virJSONValuePtr cpu_props;
>+ qemuMonitorCPUModelInfoPtr machine_model = NULL;
>+ int ret = -1;
>+ char const *cpu_name;
>+
>+ *model = NULL;
>+
Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180416/a3ea8c9c/attachment-0001.sig>
More information about the libvir-list
mailing list