mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
conf: Introduce virDomainCapsCPUModelsGet
This internal API can be used to find a specific CPU model in virDomainCapsCPUModels list. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
a62dca833e
commit
20664ec779
@ -259,6 +259,24 @@ virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virDomainCapsCPUModelPtr
|
||||||
|
virDomainCapsCPUModelsGet(virDomainCapsCPUModelsPtr cpuModels,
|
||||||
|
const char *name)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if (!cpuModels)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
for (i = 0; i < cpuModels->nmodels; i++) {
|
||||||
|
if (STREQ(cpuModels->models[i].name, name))
|
||||||
|
return cpuModels->models + i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virDomainCapsEnumSet(virDomainCapsEnumPtr capsEnum,
|
virDomainCapsEnumSet(virDomainCapsEnumPtr capsEnum,
|
||||||
const char *capsEnumName,
|
const char *capsEnumName,
|
||||||
|
@ -179,6 +179,10 @@ int virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels,
|
|||||||
ssize_t nameLen,
|
ssize_t nameLen,
|
||||||
virDomainCapsCPUUsable usable,
|
virDomainCapsCPUUsable usable,
|
||||||
char **blockers);
|
char **blockers);
|
||||||
|
virDomainCapsCPUModelPtr
|
||||||
|
virDomainCapsCPUModelsGet(virDomainCapsCPUModelsPtr cpuModels,
|
||||||
|
const char *name);
|
||||||
|
|
||||||
|
|
||||||
# define VIR_DOMAIN_CAPS_ENUM_SET(capsEnum, ...) \
|
# define VIR_DOMAIN_CAPS_ENUM_SET(capsEnum, ...) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -829,16 +829,10 @@ bool
|
|||||||
virCPUModelIsAllowed(const char *model,
|
virCPUModelIsAllowed(const char *model,
|
||||||
virDomainCapsCPUModelsPtr models)
|
virDomainCapsCPUModelsPtr models)
|
||||||
{
|
{
|
||||||
size_t i;
|
|
||||||
|
|
||||||
if (!models)
|
if (!models)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
for (i = 0; i < models->nmodels; i++) {
|
return !!virDomainCapsCPUModelsGet(models, model);
|
||||||
if (STREQ(models->models[i].name, model))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -174,6 +174,7 @@ virDomainCapsCPUModelsAdd;
|
|||||||
virDomainCapsCPUModelsAddSteal;
|
virDomainCapsCPUModelsAddSteal;
|
||||||
virDomainCapsCPUModelsCopy;
|
virDomainCapsCPUModelsCopy;
|
||||||
virDomainCapsCPUModelsFilter;
|
virDomainCapsCPUModelsFilter;
|
||||||
|
virDomainCapsCPUModelsGet;
|
||||||
virDomainCapsCPUModelsNew;
|
virDomainCapsCPUModelsNew;
|
||||||
virDomainCapsCPUUsableTypeFromString;
|
virDomainCapsCPUUsableTypeFromString;
|
||||||
virDomainCapsCPUUsableTypeToString;
|
virDomainCapsCPUUsableTypeToString;
|
||||||
|
Loading…
Reference in New Issue
Block a user