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: Jiri Denemark <jdenemar@redhat.com>
}
+/**
+ * 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:
*
void
virCPUDataFree(virCPUDataPtr data);
+bool
+virCPUGetHostIsSupported(virArch arch);
+
virCPUDefPtr
virCPUGetHost(virArch arch,
virCPUType type,
virCPUDataParse;
virCPUExpandFeatures;
virCPUGetHost;
+virCPUGetHostIsSupported;
virCPUGetModels;
virCPUProbeHost;
virCPUTranslate;