mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
cpu_x86: Introduce virCPUx86DataAddFeature
The API is useful for creating virCPUData in a hypervisor driver from data we got by querying the hypervisor. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
8da3ca8419
commit
14aeba2dfd
@ -2756,6 +2756,28 @@ virCPUx86DataSetVendor(virCPUDataPtr cpuData,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virCPUx86DataAddFeature(virCPUDataPtr cpuData,
|
||||||
|
const char *name)
|
||||||
|
{
|
||||||
|
virCPUx86FeaturePtr feature;
|
||||||
|
virCPUx86MapPtr map;
|
||||||
|
|
||||||
|
if (!(map = virCPUx86GetMap()))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* ignore unknown features */
|
||||||
|
if (!(feature = x86FeatureFind(map, name)) &&
|
||||||
|
!(feature = x86FeatureFindInternal(name)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (x86DataAdd(&cpuData->data.x86, &feature->data) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
struct cpuArchDriver cpuDriverX86 = {
|
struct cpuArchDriver cpuDriverX86 = {
|
||||||
.name = "x86",
|
.name = "x86",
|
||||||
.arch = archs,
|
.arch = archs,
|
||||||
|
@ -39,4 +39,7 @@ int virCPUx86DataSetSignature(virCPUDataPtr cpuData,
|
|||||||
int virCPUx86DataSetVendor(virCPUDataPtr cpuData,
|
int virCPUx86DataSetVendor(virCPUDataPtr cpuData,
|
||||||
const char *vendor);
|
const char *vendor);
|
||||||
|
|
||||||
|
int virCPUx86DataAddFeature(virCPUDataPtr cpuData,
|
||||||
|
const char *name);
|
||||||
|
|
||||||
#endif /* __VIR_CPU_X86_H__ */
|
#endif /* __VIR_CPU_X86_H__ */
|
||||||
|
@ -1003,6 +1003,7 @@ virCPUUpdate;
|
|||||||
|
|
||||||
# cpu/cpu_x86.h
|
# cpu/cpu_x86.h
|
||||||
virCPUx86DataAddCPUID;
|
virCPUx86DataAddCPUID;
|
||||||
|
virCPUx86DataAddFeature;
|
||||||
virCPUx86DataSetSignature;
|
virCPUx86DataSetSignature;
|
||||||
virCPUx86DataSetVendor;
|
virCPUx86DataSetVendor;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user