mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
conf: Introduce virCPUDefFindFeature
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
4b87b3675f
commit
3276416904
@ -773,15 +773,14 @@ virCPUDefUpdateFeatureInternal(virCPUDefPtr def,
|
||||
int policy,
|
||||
bool update)
|
||||
{
|
||||
size_t i;
|
||||
virCPUFeatureDefPtr feat;
|
||||
|
||||
if (def->type == VIR_CPU_TYPE_HOST)
|
||||
policy = -1;
|
||||
|
||||
for (i = 0; i < def->nfeatures; i++) {
|
||||
if (STREQ(name, def->features[i].name)) {
|
||||
if ((feat = virCPUDefFindFeature(def, name))) {
|
||||
if (update) {
|
||||
def->features[i].policy = policy;
|
||||
feat->policy = policy;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -791,7 +790,6 @@ virCPUDefUpdateFeatureInternal(virCPUDefPtr def,
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (VIR_RESIZE_N(def->features, def->nfeatures_max,
|
||||
def->nfeatures, 1) < 0)
|
||||
@ -822,6 +820,22 @@ virCPUDefAddFeature(virCPUDefPtr def,
|
||||
return virCPUDefUpdateFeatureInternal(def, name, policy, false);
|
||||
}
|
||||
|
||||
|
||||
virCPUFeatureDefPtr
|
||||
virCPUDefFindFeature(virCPUDefPtr def,
|
||||
const char *name)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < def->nfeatures; i++) {
|
||||
if (STREQ(name, def->features[i].name))
|
||||
return def->features + i;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
virCPUDefIsEqual(virCPUDefPtr src,
|
||||
virCPUDefPtr dst,
|
||||
|
@ -215,6 +215,10 @@ virCPUDefUpdateFeature(virCPUDefPtr cpu,
|
||||
const char *name,
|
||||
int policy);
|
||||
|
||||
virCPUFeatureDefPtr
|
||||
virCPUDefFindFeature(virCPUDefPtr def,
|
||||
const char *name);
|
||||
|
||||
virCPUDefPtr *
|
||||
virCPUDefListParse(const char **xmlCPUs,
|
||||
unsigned int ncpus,
|
||||
|
@ -75,6 +75,7 @@ virCPUDefCopy;
|
||||
virCPUDefCopyModel;
|
||||
virCPUDefCopyModelFilter;
|
||||
virCPUDefCopyWithoutModel;
|
||||
virCPUDefFindFeature;
|
||||
virCPUDefFormat;
|
||||
virCPUDefFormatBuf;
|
||||
virCPUDefFormatBufFull;
|
||||
|
Loading…
Reference in New Issue
Block a user