mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03:00
cpu: Add virCPUDataIsIdentical
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
399d6df60e
commit
20fcf0e9e5
@ -1141,6 +1141,34 @@ virCPUDataAddFeature(virCPUData *cpuData,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virCPUDataIsIdentical:
|
||||
*
|
||||
* Returns VIR_CPU_COMPARE_IDENTICAL if @a and @b are identical,
|
||||
* VIR_CPU_COMPARE_INCOMPATIBLE if @a and @b are not identical, or
|
||||
* VIR_CPU_COMPARE_ERROR on error.
|
||||
*/
|
||||
virCPUCompareResult
|
||||
virCPUDataIsIdentical(const virCPUData *a,
|
||||
const virCPUData *b)
|
||||
{
|
||||
struct cpuArchDriver *driver;
|
||||
|
||||
VIR_DEBUG("a=%p, b=%p", a, b);
|
||||
|
||||
if (!a || !b)
|
||||
return VIR_CPU_COMPARE_ERROR;
|
||||
|
||||
if (!(driver = cpuGetSubDriver(a->arch)))
|
||||
return VIR_CPU_COMPARE_ERROR;
|
||||
|
||||
if (!driver->dataIsIdentical)
|
||||
return VIR_CPU_COMPARE_ERROR;
|
||||
|
||||
return driver->dataIsIdentical(a, b);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virCPUArchIsSupported:
|
||||
*
|
||||
|
@ -123,6 +123,10 @@ typedef int
|
||||
(*virCPUArchDataAddFeature)(virCPUData *cpuData,
|
||||
const char *name);
|
||||
|
||||
typedef virCPUCompareResult
|
||||
(*virCPUArchDataIsIdentical)(const virCPUData *a,
|
||||
const virCPUData *b);
|
||||
|
||||
struct cpuArchDriver {
|
||||
const char *name;
|
||||
const virArch *arch;
|
||||
@ -146,6 +150,7 @@ struct cpuArchDriver {
|
||||
virCPUArchCopyMigratable copyMigratable;
|
||||
virCPUArchValidateFeatures validateFeatures;
|
||||
virCPUArchDataAddFeature dataAddFeature;
|
||||
virCPUArchDataIsIdentical dataIsIdentical;
|
||||
};
|
||||
|
||||
|
||||
@ -275,6 +280,10 @@ int
|
||||
virCPUDataAddFeature(virCPUData *cpuData,
|
||||
const char *name);
|
||||
|
||||
virCPUCompareResult
|
||||
virCPUDataIsIdentical(const virCPUData *a,
|
||||
const virCPUData *b);
|
||||
|
||||
bool
|
||||
virCPUArchIsSupported(virArch arch);
|
||||
|
||||
|
@ -1462,6 +1462,7 @@ virCPUDataAddFeature;
|
||||
virCPUDataCheckFeature;
|
||||
virCPUDataFormat;
|
||||
virCPUDataFree;
|
||||
virCPUDataIsIdentical;
|
||||
virCPUDataNew;
|
||||
virCPUDataParse;
|
||||
virCPUDataParseNode;
|
||||
|
Loading…
Reference in New Issue
Block a user