提交 bf1a8817 编写于 作者: J Jiri Denemark

cpu: Introduce virCPUGetHostIsSupported

Sometimes we want to call virCPUGetHost only when it is implemented for
a given architecture to avoid logging expected and possibly misleading
errors. The new virCPUGetHostIsSupported API may be used to guard such
calls to virCPUGetHost.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 232d87c7
......@@ -357,6 +357,26 @@ virCPUDataFree(virCPUDataPtr data)
}
/**
* virCPUGetHostIsSupported:
*
* @arch: CPU architecture
*
* Check whether virCPUGetHost is supported for @arch.
*
* Returns true if virCPUGetHost is supported, false otherwise.
*/
bool
virCPUGetHostIsSupported(virArch arch)
{
struct cpuArchDriver *driver;
VIR_DEBUG("arch=%s", virArchToString(arch));
return (driver = cpuGetSubDriver(arch)) && driver->getHost;
}
/**
* virCPUGetHost:
*
......
......@@ -183,6 +183,9 @@ virCPUDataNew(virArch arch);
void
virCPUDataFree(virCPUDataPtr data);
bool
virCPUGetHostIsSupported(virArch arch);
virCPUDefPtr
virCPUGetHost(virArch arch,
virCPUType type,
......
......@@ -1039,6 +1039,7 @@ virCPUDataNew;
virCPUDataParse;
virCPUExpandFeatures;
virCPUGetHost;
virCPUGetHostIsSupported;
virCPUGetModels;
virCPUProbeHost;
virCPUTranslate;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册