Added implementation of virNodeGetCPUMapFlags to libvirt.c
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
src/libvirt.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 3c6d67d..25c37d3 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -20098,3 +20098,59 @@ error:
virDispatchError(domain->conn);
return NULL;
}
+
+/**
+ * virNodeGetCPUMapFlags:
+ * @conn: pointer to the hypervisor connection
+ * @cpumap: optional pointer to a bit map of real CPUs on the host node
+ * (in 8-bit bytes) (OUT)
+ * In case of success each bit set to 1 means that corresponding
+ * CPU is online.
+ * Bytes are stored in little-endian order: CPU0-7, 8-15...
+ * In each byte, lowest CPU number is least significant bit.
+ * The bit map is allocated by virNodeGetCPUMapFlags and needs
+ * to be released using free() by the caller.
+ * @online: optional number of online CPUs in cpumap (OUT)
+ * Contains the number of online CPUs if the call was successful.
+ * @flags: extra flags; not used yet, so callers should always pass 0
+ *
+ * Get CPU map of host node CPUs.
+ *
+ * Returns number of CPUs present on the host node,
+ * or -1 if there was an error.
+ */
+int
+virNodeGetCPUMapFlags (virConnectPtr conn,
+ unsigned char **cpumap,
+ unsigned int *online,
+ unsigned int flags)
+{
+ VIR_DEBUG("conn=%p, cpumap=%p, online=%p, flags=%x",
+ conn, cpumap, online, flags);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECT (conn)) {
+ virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virDispatchError(NULL);
+ return -1;
+ }
+
+ if (conn->driver->nodeGetCPUMapFlags) {
+ int ret = conn->driver->nodeGetCPUMapFlags (conn,
+ cpumap,
+ online,
+ flags);
+ if (ret < 0)
+ goto error;
+ VIR_DEBUG("conn=%p, cpumap=%p, online=%u, flags=%x, ret=%d",
+ conn, cpumap, online ? *online : 0 , flags, ret);
+ return ret;
+ }
+
+ virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+ virDispatchError(conn);
+ return -1;
+}
--
1.7.0.4