On Fri, Jul 17, 2015 at 18:13:20 +0200, Andrea Bolognani wrote:
This is just a more generic version of linuxGetCPUPresentPath(),
which is now implemented by calling the new function appropriately.
---
src/nodeinfo.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 105d7ab..64b12e6 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -958,16 +958,21 @@ linuxNodeGetMemoryStats(FILE *meminfo,
}
static char *
-linuxGetCPUPresentPath(const char *sysfs_prefix)
+linuxGetCPUGlobalPath(const char *sysfs_prefix,
+ const char *file)
{
const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SYSTEM_PATH;
char *path = NULL;
- if (virAsprintf(&path, "%s/cpu/present", prefix) < 0)
+ if (virAsprintf(&path, "%s/cpu/%s", prefix, file) < 0)
return NULL;
+
return path;
}
+# define linuxGetCPUPresentPath(sysfs_prefix) \
+ linuxGetCPUGlobalPath(sysfs_prefix, "present")
I'd rather see a wrapper function that adds the argument rather than a
macro.
ACK with that change.
Peter