From 6fecc4017d953d2c4c73b29b0ac6209644585137 Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Mon, 20 Jul 2015 18:37:22 +0200 Subject: [PATCH] nodeinfo: Introduce linuxGetCPUOnlinePath() --- src/nodeinfo.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 64442563f2..eb7a188d5a 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -977,6 +977,12 @@ linuxGetCPUPresentPath(const char *sysfs_prefix) return linuxGetCPUGlobalPath(sysfs_prefix, "present"); } +static char * +linuxGetCPUOnlinePath(const char *sysfs_prefix) +{ + return linuxGetCPUGlobalPath(sysfs_prefix, "online"); +} + /* Determine the maximum cpu id from a Linux sysfs cpu/present file. */ static int linuxParseCPUmax(const char *path) @@ -1317,7 +1323,7 @@ nodeGetCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED, if (present < 0) return NULL; - if (virAsprintf(&online_path, "%s/cpu/online", prefix) < 0) + if (!(online_path = linuxGetCPUOnlinePath(sysfs_prefix))) return NULL; if (virFileExists(online_path)) { cpumap = linuxParseCPUmap(present, online_path); -- GitLab