[libvirt] [PATCH 06/10] nodeinfo: Rename nodeGetCPUBitmap() to nodeGetOnlineCPUBitmap()

Andrea Bolognani abologna at redhat.com
Fri Jul 17 16:13:25 UTC 2015


The new name makes it clear that the returned bitmap contains the
information about which CPUs are online, not eg. which CPUs are
present.

Change the name of the out parameter from max_id, which didn't
reflect the actual value returned, to size. Update the error
message as well.

No functional changes.
---
 src/libvirt_private.syms |  2 +-
 src/nodeinfo.c           | 12 ++++++------
 src/nodeinfo.h           |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index b6347de..7f42e40 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -999,7 +999,6 @@ virLockManagerRelease;
 nodeAllocPages;
 nodeCapsInitNUMA;
 nodeGetCellsFreeMemory;
-nodeGetCPUBitmap;
 nodeGetCPUCount;
 nodeGetCPUMap;
 nodeGetCPUStats;
@@ -1008,6 +1007,7 @@ nodeGetInfo;
 nodeGetMemory;
 nodeGetMemoryParameters;
 nodeGetMemoryStats;
+nodeGetOnlineCPUBitmap;
 nodeGetPresentCPUBitmap;
 nodeSetMemoryParameters;
 
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 7aecc8f..44983b8 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -1325,8 +1325,8 @@ nodeGetPresentCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED,
 }
 
 virBitmapPtr
-nodeGetCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED,
-                 int *max_id ATTRIBUTE_UNUSED)
+nodeGetOnlineCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED,
+                       int *size ATTRIBUTE_UNUSED)
 {
 #ifdef __linux__
     const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SYSTEM_PATH;
@@ -1364,15 +1364,15 @@ nodeGetCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED,
                 ignore_value(virBitmapSetBit(cpumap, i));
         }
     }
-    if (max_id && cpumap)
-        *max_id = present;
+    if (size && cpumap)
+        *size = present;
  cleanup:
     VIR_FREE(online_path);
     VIR_FREE(cpudir);
     return cpumap;
 #else
     virReportError(VIR_ERR_NO_SUPPORT, "%s",
-                   _("node cpumap not implemented on this platform"));
+                   _("node online CPU map not implemented on this platform"));
     return NULL;
 #endif
 }
@@ -1695,7 +1695,7 @@ nodeGetCPUMap(const char *sysfs_prefix,
     if (!cpumap && !online)
         return nodeGetCPUCount(sysfs_prefix);
 
-    if (!(cpus = nodeGetCPUBitmap(sysfs_prefix, &maxpresent)))
+    if (!(cpus = nodeGetOnlineCPUBitmap(sysfs_prefix, &maxpresent)))
         goto cleanup;
 
     if (cpumap && virBitmapToData(cpus, cpumap, &dummy) < 0)
diff --git a/src/nodeinfo.h b/src/nodeinfo.h
index e83db7b..f47e330 100644
--- a/src/nodeinfo.h
+++ b/src/nodeinfo.h
@@ -46,8 +46,8 @@ int nodeGetMemory(unsigned long long *mem,
 
 virBitmapPtr nodeGetPresentCPUBitmap(const char *sysfs_prefix,
                                      int *size);
-virBitmapPtr nodeGetCPUBitmap(const char *sysfs_prefix,
-                              int *size);
+virBitmapPtr nodeGetOnlineCPUBitmap(const char *sysfs_prefix,
+                                    int *size);
 int nodeGetCPUCount(const char *sysfs_prefix);
 
 int nodeGetMemoryParameters(virTypedParameterPtr params,
-- 
2.4.3




More information about the libvir-list mailing list