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