86 lines
2.5 KiB
Diff
86 lines
2.5 KiB
Diff
From a48b3aaee795cdd57b709326821b3648521bc687 Mon Sep 17 00:00:00 2001
|
|
Message-ID: <a48b3aaee795cdd57b709326821b3648521bc687.1710860841.git.jdenemar@redhat.com>
|
|
From: Jiri Denemark <jdenemar@redhat.com>
|
|
Date: Mon, 11 Mar 2024 15:37:32 +0100
|
|
Subject: [PATCH] conf: cpu: Introduce virCPUDefListFeatures
|
|
|
|
The function returns a list of explicitly mentioned features in the CPU
|
|
definition.
|
|
|
|
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
|
|
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
|
(cherry picked from commit 577c4ca414b26c8586f2586978e55c948bec0a32)
|
|
https://issues.redhat.com/browse/RHEL-25995
|
|
|
|
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
---
|
|
src/conf/cpu_conf.c | 24 ++++++++++++++++++++++++
|
|
src/conf/cpu_conf.h | 3 +++
|
|
src/libvirt_private.syms | 1 +
|
|
3 files changed, 28 insertions(+)
|
|
|
|
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
|
|
index 6e6e1b9a89..4dca7e57ec 100644
|
|
--- a/src/conf/cpu_conf.c
|
|
+++ b/src/conf/cpu_conf.c
|
|
@@ -982,6 +982,30 @@ virCPUDefFindFeature(const virCPUDef *def,
|
|
}
|
|
|
|
|
|
+/**
|
|
+ * virCPUDefListExplicitFeatures:
|
|
+ * @def: CPU definition
|
|
+ *
|
|
+ * Provides a list of feature names explicitly mentioned in the CPU definition
|
|
+ * regardless of the policy. The caller is responsible for freeing the list.
|
|
+ *
|
|
+ * Returns a NULL-terminated list of feature names.
|
|
+ */
|
|
+char **
|
|
+virCPUDefListExplicitFeatures(const virCPUDef *def)
|
|
+{
|
|
+ char **list;
|
|
+ size_t i;
|
|
+
|
|
+ list = g_new0(char *, def->nfeatures + 1);
|
|
+
|
|
+ for (i = 0; i < def->nfeatures; i++)
|
|
+ list[i] = g_strdup(def->features[i].name);
|
|
+
|
|
+ return list;
|
|
+}
|
|
+
|
|
+
|
|
int
|
|
virCPUDefFilterFeatures(virCPUDef *cpu,
|
|
virCPUDefFeatureFilter filter,
|
|
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
|
|
index 2694022fed..b10c23ee82 100644
|
|
--- a/src/conf/cpu_conf.h
|
|
+++ b/src/conf/cpu_conf.h
|
|
@@ -270,6 +270,9 @@ virCPUDefCheckFeatures(virCPUDef *cpu,
|
|
void *opaque,
|
|
char ***features);
|
|
|
|
+char **
|
|
+virCPUDefListExplicitFeatures(const virCPUDef *def);
|
|
+
|
|
virCPUDef **
|
|
virCPUDefListParse(const char **xmlCPUs,
|
|
unsigned int ncpus,
|
|
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
|
index d168f45f2d..575fd32ff8 100644
|
|
--- a/src/libvirt_private.syms
|
|
+++ b/src/libvirt_private.syms
|
|
@@ -111,6 +111,7 @@ virCPUDefFree;
|
|
virCPUDefFreeFeatures;
|
|
virCPUDefFreeModel;
|
|
virCPUDefIsEqual;
|
|
+virCPUDefListExplicitFeatures;
|
|
virCPUDefListFree;
|
|
virCPUDefListParse;
|
|
virCPUDefNew;
|
|
--
|
|
2.44.0
|