7a3408
From 3897d418e69e7604302040a8015bf6f50d40ae45 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <3897d418e69e7604302040a8015bf6f50d40ae45@dist-git>
7a3408
From: Andrea Bolognani <abologna@redhat.com>
7a3408
Date: Wed, 5 Aug 2015 18:18:24 +0200
7a3408
Subject: [PATCH] nodeinfo: Rename linuxParseCPUmax() to linuxParseCPUCount()
7a3408
7a3408
The original name was confusing because the function returns the number
7a3408
of CPUs, not the maximum CPU id. The comment above the function has
7a3408
been updated to reflect this.
7a3408
7a3408
No behavioral changes.
7a3408
7a3408
(cherry picked from commit a2e2add1f1e253b5ba150446980aa32a161dc107)
7a3408
7a3408
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1213713
7a3408
7a3408
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/nodeinfo.c | 7 ++++---
7a3408
 1 file changed, 4 insertions(+), 3 deletions(-)
7a3408
7a3408
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
7a3408
index 5459cc6..a7a5d98 100644
7a3408
--- a/src/nodeinfo.c
7a3408
+++ b/src/nodeinfo.c
7a3408
@@ -982,9 +982,10 @@ linuxGetCPUOnlinePath(const char *sysfs_prefix)
7a3408
     return linuxGetCPUGlobalPath(sysfs_prefix, "online");
7a3408
 }
7a3408
 
7a3408
-/* Determine the maximum cpu id from a Linux sysfs cpu/present file. */
7a3408
+/* Determine the number of CPUs (maximum CPU id + 1) from a file containing
7a3408
+ * a list of CPU ids, like the Linux sysfs cpu/present file */
7a3408
 static int
7a3408
-linuxParseCPUmax(const char *path)
7a3408
+linuxParseCPUCount(const char *path)
7a3408
 {
7a3408
     char *str = NULL;
7a3408
     char *tmp;
7a3408
@@ -1246,7 +1247,7 @@ nodeGetCPUCount(const char *sysfs_prefix ATTRIBUTE_UNUSED)
7a3408
         return -1;
7a3408
 
7a3408
     if (virFileExists(present_path)) {
7a3408
-        ncpu = linuxParseCPUmax(present_path);
7a3408
+        ncpu = linuxParseCPUCount(present_path);
7a3408
         goto cleanup;
7a3408
     }
7a3408
 
7a3408
-- 
7a3408
2.5.0
7a3408