]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Merge qemuMonitorJSONGetCPUDataDisabled in qemuMonitorJSONGetGuestCPU
authorJiri Denemark <jdenemar@redhat.com>
Thu, 4 Sep 2025 12:34:36 +0000 (14:34 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 8 Sep 2025 13:32:48 +0000 (15:32 +0200)
The qemuMonitorJSONGetCPUDataDisabled function is just a wrapper around
two function calls and it is only used by qemuMonitorJSONGetGuestCPU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_monitor_json.c

index d6c5c26280ef1bc1089904bd9f108d1dbfc19191..f42bfb3d582339ef8f7a70f9f3785d92f61316e2 100644 (file)
@@ -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);