]> xenbits.xensource.com Git - libvirt.git/commitdiff
nodeinfo: Rename linuxParseCPUmax() to linuxParseCPUCount()
authorAndrea Bolognani <abologna@redhat.com>
Mon, 20 Jul 2015 16:37:23 +0000 (18:37 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 22 Jul 2015 08:14:01 +0000 (10:14 +0200)
The original name was confusing because the function returns the number
of CPUs, not the maximum CPU id. The comment above the function has
been updated to reflect this.

No behavioral changes.

src/nodeinfo.c

index eb7a188d5a3d770f0d270824f12b3e8bfa1f82a0..1a1d8654857304d6acc585e73a893d94d574a626 100644 (file)
@@ -983,9 +983,10 @@ linuxGetCPUOnlinePath(const char *sysfs_prefix)
     return linuxGetCPUGlobalPath(sysfs_prefix, "online");
 }
 
-/* Determine the maximum cpu id from a Linux sysfs cpu/present file. */
+/* Determine the number of CPUs (maximum CPU id + 1) from a file containing
+ * a list of CPU ids, like the Linux sysfs cpu/present file */
 static int
-linuxParseCPUmax(const char *path)
+linuxParseCPUCount(const char *path)
 {
     char *str = NULL;
     char *tmp;
@@ -1247,7 +1248,7 @@ nodeGetCPUCount(const char *sysfs_prefix ATTRIBUTE_UNUSED)
         return -1;
 
     if (virFileExists(present_path)) {
-        ncpu = linuxParseCPUmax(present_path);
+        ncpu = linuxParseCPUCount(present_path);
         goto cleanup;
     }