Call it virNodeInfoLinuxPopulateCPU and use the header file to export
it instead of extern definition in the test file.
---
src/libvirt_linux.syms | 2 +-
src/nodeinfo.c | 14 +++++---------
src/nodeinfo.h | 5 +++++
tests/nodeinfotest.c | 6 +-----
4 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/src/libvirt_linux.syms b/src/libvirt_linux.syms
index 3500898..bfef3ec 100644
--- a/src/libvirt_linux.syms
+++ b/src/libvirt_linux.syms
@@ -3,7 +3,7 @@
#
# nodeinfo.h
-linuxNodeInfoCPUPopulate;
+virNodeInfoLinuxPopulateCPU;
# util/virstatslinux.h
linuxDomainInterfaceStats;
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 70814c2..232b465 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -88,11 +88,6 @@ appleFreebsdNodeGetCPUCount(void)
# define LINUX_NB_MEMORY_STATS_ALL 4
# define LINUX_NB_MEMORY_STATS_CELL 2
-/* NB, this is not static as we need to call it from the testsuite */
-int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
- const char *sysfs_dir,
- virNodeInfoPtr nodeinfo);
-
static int linuxNodeGetCPUStats(FILE *procstat,
int cpuNum,
virNodeCPUStatsPtr params,
@@ -376,9 +371,10 @@ cleanup:
return ret;
}
-int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
- const char *sysfs_dir,
- virNodeInfoPtr nodeinfo)
+int
+virNodeInfoLinuxPopulateCPU(FILE *cpuinfo,
+ const char *sysfs_dir,
+ virNodeInfoPtr nodeinfo)
{
char line[1024];
DIR *nodedir = NULL;
@@ -872,7 +868,7 @@ int nodeGetInfo(virNodeInfoPtr nodeinfo)
return -1;
}
- ret = linuxNodeInfoCPUPopulate(cpuinfo, SYSFS_SYSTEM_PATH, nodeinfo);
+ ret = virNodeInfoLinuxPopulateCPU(cpuinfo, SYSFS_SYSTEM_PATH, nodeinfo);
if (ret < 0)
goto cleanup;
diff --git a/src/nodeinfo.h b/src/nodeinfo.h
index 413fddd..a13cf28 100644
--- a/src/nodeinfo.h
+++ b/src/nodeinfo.h
@@ -57,4 +57,9 @@ int nodeGetCPUMap(unsigned char **cpumap,
unsigned int *online,
unsigned int flags);
+
+int virNodeInfoLinuxPopulateCPU(FILE *cpuinfo,
+ const char *sysfs_dir,
+ virNodeInfoPtr nodeinfo);
+
#endif /* __VIR_NODEINFO_H__*/
diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c
index 74f6d4d..9bb7adb 100644
--- a/tests/nodeinfotest.c
+++ b/tests/nodeinfotest.c
@@ -27,10 +27,6 @@ main(void)
#else
-extern int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
- char *sysfs_dir,
- virNodeInfoPtr nodeinfo);
-
static int
linuxTestCompareFiles(const char *cpuinfofile,
char *sysfs_dir,
@@ -50,7 +46,7 @@ linuxTestCompareFiles(const char *cpuinfofile,
goto fail;
memset(&nodeinfo, 0, sizeof(nodeinfo));
- if (linuxNodeInfoCPUPopulate(cpuinfo, sysfs_dir, &nodeinfo) < 0) {
+ if (virNodeInfoLinuxPopulateCPU(cpuinfo, sysfs_dir, &nodeinfo) < 0) {
if (virTestGetDebug()) {
virErrorPtr error = virSaveLastError();
if (error && error->code != VIR_ERR_OK)
--
1.8.3.2