<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 27, 2023 at 12:35 PM Michal Privoznik <<a href="mailto:mprivozn@redhat.com">mprivozn@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">When processing memory devices (as a reply from QEMU), a bunch of<br>
STREQ()-s is used. Fortunately, the set of strings we process is<br>
the same as virDomainMemoryModel enum. Therefore, we can use<br>
virDomainMemoryModelTypeFromString() and when use integer<br>
comparison (well, switch()). This has an up side, that<br>
introducing a new memory model let's us see immediately at<br>
compile time, what places need adjusting.<br>
<br>
NB, this is in contrast with cmd line generator<br>
(qemuBuildMemoryDeviceProps()), where more specific models are<br>
generated (e.g. "pc-dimm", "virtio-mem-pci", etc.). But QEMU<br>
reports back the parent model, instead of specific child<br>
instance.<br>
<br>
Signed-off-by: Michal Privoznik <<a href="mailto:mprivozn@redhat.com" target="_blank">mprivozn@redhat.com</a>><br>
---<br>
 src/qemu/qemu_monitor_json.c | 52 +++++++++++++++++++++++++-----------<br>
 1 file changed, 37 insertions(+), 15 deletions(-)<br></blockquote><div><br></div><div><br></div><div>Seems that  I can't compile this patch - compiler is sad that devalias may be used uninitialized:</div><div><br></div><div>../src/qemu/qemu_monitor_json.c: In function ‘qemuMonitorJSONGetMemoryDeviceInfo’:<br>../src/qemu/qemu_monitor_json.c:7333:13: error: ‘devalias’ may be used uninitialized [-Werror=maybe-uninitialized]<br> 7333 |         if (virHashAddEntry(info, devalias, meminfo) < 0)<br>      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>../src/qemu/qemu_monitor_json.c:7213:21: note: ‘devalias’ was declared here<br> 7213 |         const char *devalias;<br></div><div><br></div><div>Using gcc 12.2.1</div><div><br></div><div><br></div><div>Kristina<br></div></div></div>