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 98a925933e..6b6bcc368a 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -111,6 +111,7 @@ virCPUDefFree; virCPUDefFreeFeatures; virCPUDefFreeModel; virCPUDefIsEqual; +virCPUDefListExplicitFeatures; virCPUDefListFree; virCPUDefListParse; virCPUDefNew;