From 5b88383e216f5f4a27b94f2db7e6aadce526d18b Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Thu, 4 Sep 2025 14:34:36 +0200 Subject: [PATCH] qemu: Merge qemuMonitorJSONGetCPUDataDisabled in qemuMonitorJSONGetGuestCPU MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The qemuMonitorJSONGetCPUDataDisabled function is just a wrapper around two function calls and it is only used by qemuMonitorJSONGetGuestCPU. Signed-off-by: Jiri Denemark Reviewed-by: Peter Krempa Reviewed-by: Ján Tomko --- src/qemu/qemu_monitor_json.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index d6c5c26280..f42bfb3d58 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6723,25 +6723,6 @@ qemuMonitorJSONCPUDataAddFeatures(virCPUData *data, } -static int -qemuMonitorJSONGetCPUDataDisabled(qemuMonitor *mon, - const char *cpuQOMPath, - qemuMonitorCPUFeatureTranslationCallback translate, - virCPUData *data) -{ - g_auto(GStrv) props = NULL; - - if (qemuMonitorJSONGetStringListProperty(mon, cpuQOMPath, - "unavailable-features", &props) < 0) - return -1; - - if (qemuMonitorJSONCPUDataAddFeatures(data, props, translate) < 0) - return -1; - - return 0; -} - - /** * qemuMonitorJSONGetGuestCPU: * @mon: Pointer to the monitor @@ -6771,6 +6752,7 @@ qemuMonitorJSONGetGuestCPU(qemuMonitor *mon, g_autoptr(virCPUData) cpuEnabled = NULL; g_autoptr(virCPUData) cpuDisabled = NULL; g_auto(GStrv) propsEnabled = NULL; + g_auto(GStrv) propsDisabled = NULL; if (!(cpuEnabled = virCPUDataNew(arch)) || !(cpuDisabled = virCPUDataNew(arch))) @@ -6783,7 +6765,11 @@ qemuMonitorJSONGetGuestCPU(qemuMonitor *mon, if (qemuMonitorJSONCPUDataAddFeatures(cpuEnabled, propsEnabled, translate) < 0) return -1; - if (qemuMonitorJSONGetCPUDataDisabled(mon, cpuQOMPath, translate, cpuDisabled) < 0) + if (qemuMonitorJSONGetStringListProperty(mon, cpuQOMPath, + "unavailable-features", &propsDisabled) < 0) + return -1; + + if (qemuMonitorJSONCPUDataAddFeatures(cpuDisabled, propsDisabled, translate) < 0) return -1; *enabled = g_steal_pointer(&cpuEnabled); -- 2.47.3