[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 1/2] nodeinfo: Export nodeGetCPUValue() after renaming it.



The previous name was virNodeGetCpuValue(), which was not
consistent with the other functions exported by the same file.
---
 src/libvirt_private.syms |  1 +
 src/nodeinfo.c           | 28 +++++++++++++++-------------
 src/nodeinfo.h           |  6 +++++-
 3 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index c8e6fb4..1ccdf34 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -991,6 +991,7 @@ nodeGetCPUBitmap;
 nodeGetCPUCount;
 nodeGetCPUMap;
 nodeGetCPUStats;
+nodeGetCPUValue;
 nodeGetFreePages;
 nodeGetInfo;
 nodeGetMemory;
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 22df95c..bd915a6 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -1,7 +1,7 @@
 /*
  * nodeinfo.c: Helper routines for OS specific node information
  *
- * Copyright (C) 2006-2008, 2010-2014 Red Hat, Inc.
+ * Copyright (C) 2006-2008, 2010-2015 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -299,9 +299,11 @@ freebsdNodeGetMemoryStats(virNodeMemoryStatsPtr params,
  * this is useful for machines that cannot hot-unplug cpu0, or where
  * hot-unplugging is disabled, or where the kernel is too old
  * to support NUMA cells, etc.  */
-static int
-virNodeGetCpuValue(const char *dir, unsigned int cpu, const char *file,
-                   int default_value)
+int
+nodeGetCPUValue(const char *dir,
+                unsigned int cpu,
+                const char *file,
+                int default_value)
 {
     char *path;
     FILE *pathfp;
@@ -397,7 +399,7 @@ virNodeParseSocket(const char *dir,
                    virArch arch,
                    unsigned int cpu)
 {
-    int ret = virNodeGetCpuValue(dir, cpu, "topology/physical_package_id", 0);
+    int ret = nodeGetCPUValue(dir, cpu, "topology/physical_package_id", 0);
 
     if (ARCH_IS_ARM(arch) || ARCH_IS_PPC(arch) || ARCH_IS_S390(arch)) {
         /* arm, ppc and s390(x) has -1 */
@@ -464,7 +466,7 @@ virNodeParseNode(const char *node,
         if (sscanf(cpudirent->d_name, "cpu%u", &cpu) != 1)
             continue;
 
-        if ((online = virNodeGetCpuValue(node, cpu, "online", 1)) < 0)
+        if ((online = nodeGetCPUValue(node, cpu, "online", 1)) < 0)
             goto cleanup;
 
         if (!online)
@@ -497,7 +499,7 @@ virNodeParseNode(const char *node,
         if (sscanf(cpudirent->d_name, "cpu%u", &cpu) != 1)
             continue;
 
-        if ((online = virNodeGetCpuValue(node, cpu, "online", 1)) < 0)
+        if ((online = nodeGetCPUValue(node, cpu, "online", 1)) < 0)
             goto cleanup;
 
         if (!online) {
@@ -521,7 +523,7 @@ virNodeParseNode(const char *node,
             /* logical cpu is equivalent to a core on s390 */
             core = cpu;
         } else {
-            core = virNodeGetCpuValue(node, cpu, "topology/core_id", 0);
+            core = nodeGetCPUValue(node, cpu, "topology/core_id", 0);
         }
 
         CPU_SET(core, &core_maps[sock]);
@@ -1282,7 +1284,7 @@ nodeGetCPUBitmap(int *max_id ATTRIBUTE_UNUSED)
         if (!cpumap)
             return NULL;
         for (i = 0; i < present; i++) {
-            int online = virNodeGetCpuValue(SYSFS_SYSTEM_PATH, i, "online", 1);
+            int online = nodeGetCPUValue(SYSFS_CPU_PATH, i, "online", 1);
             if (online < 0) {
                 virBitmapFree(cpumap);
                 return NULL;
@@ -1778,14 +1780,14 @@ virNodeCapsFillCPUInfo(int cpu_id ATTRIBUTE_UNUSED,
     int tmp;
     cpu->id = cpu_id;
 
-    if ((tmp = virNodeGetCpuValue(SYSFS_CPU_PATH, cpu_id,
-                                  "topology/physical_package_id", -1)) < 0)
+    if ((tmp = nodeGetCPUValue(SYSFS_CPU_PATH, cpu_id,
+                               "topology/physical_package_id", -1)) < 0)
         return 0;
 
     cpu->socket_id = tmp;
 
-    if ((tmp = virNodeGetCpuValue(SYSFS_CPU_PATH, cpu_id,
-                                  "topology/core_id", -1)) < 0)
+    if ((tmp = nodeGetCPUValue(SYSFS_CPU_PATH, cpu_id,
+                               "topology/core_id", -1)) < 0)
         return 0;
 
     cpu->core_id = tmp;
diff --git a/src/nodeinfo.h b/src/nodeinfo.h
index 047bd5c..65c52c5 100644
--- a/src/nodeinfo.h
+++ b/src/nodeinfo.h
@@ -1,7 +1,7 @@
 /*
  * nodeinfo.h: Helper routines for OS specific node information
  *
- * Copyright (C) 2006-2008, 2011-2012 Red Hat, Inc.
+ * Copyright (C) 2006-2008, 2011-2015 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -29,6 +29,10 @@
 int nodeGetInfo(virNodeInfoPtr nodeinfo);
 int nodeCapsInitNUMA(virCapsPtr caps);
 
+int nodeGetCPUValue(const char *dir,
+                    unsigned int cpu,
+                    const char *file,
+                    int default_value);
 int nodeGetCPUStats(int cpuNum,
                     virNodeCPUStatsPtr params,
                     int *nparams,
-- 
2.1.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]