提交 bd87f07c 编写于 作者: A Andrea Bolognani 提交者: Peter Krempa

nodeinfo: Introduce linuxGetCPUGlobalPath()

This is just a more generic version of linuxGetCPUPresentPath(),
which is now implemented by calling the new function appropriately.
上级 2a680189
......@@ -959,16 +959,24 @@ 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;
}
static char *
linuxGetCPUPresentPath(const char *sysfs_prefix)
{
return linuxGetCPUGlobalPath(sysfs_prefix, "present");
}
/* Determine the maximum cpu id from a Linux sysfs cpu/present file. */
static int
linuxParseCPUmax(const char *path)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册