mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
cpu_conf: Introduce virCPUDefFilterFeatures
This new internal API can be used for in place filtering of CPU features in virCPUDef. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
955fd6e7a2
commit
c145b660b8
@ -908,6 +908,28 @@ virCPUDefFindFeature(virCPUDefPtr def,
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
virCPUDefFilterFeatures(virCPUDefPtr cpu,
|
||||
virCPUDefFeatureFilter filter,
|
||||
void *opaque)
|
||||
{
|
||||
size_t i = 0;
|
||||
|
||||
while (i < cpu->nfeatures) {
|
||||
if (filter(cpu->features[i].name, opaque)) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
VIR_FREE(cpu->features[i].name);
|
||||
if (VIR_DELETE_ELEMENT_INPLACE(cpu->features, i, cpu->nfeatures) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
virCPUDefIsEqual(virCPUDefPtr src,
|
||||
virCPUDefPtr dst,
|
||||
|
@ -219,6 +219,11 @@ virCPUFeatureDefPtr
|
||||
virCPUDefFindFeature(virCPUDefPtr def,
|
||||
const char *name);
|
||||
|
||||
int
|
||||
virCPUDefFilterFeatures(virCPUDefPtr cpu,
|
||||
virCPUDefFeatureFilter filter,
|
||||
void *opaque);
|
||||
|
||||
virCPUDefPtr *
|
||||
virCPUDefListParse(const char **xmlCPUs,
|
||||
unsigned int ncpus,
|
||||
|
@ -77,6 +77,7 @@ virCPUDefCopy;
|
||||
virCPUDefCopyModel;
|
||||
virCPUDefCopyModelFilter;
|
||||
virCPUDefCopyWithoutModel;
|
||||
virCPUDefFilterFeatures;
|
||||
virCPUDefFindFeature;
|
||||
virCPUDefFormat;
|
||||
virCPUDefFormatBuf;
|
||||
|
Loading…
Reference in New Issue
Block a user