Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx> --- src/libvirt_private.syms | 1 + src/util/virsysfs.c | 14 ++++++++++++++ src/util/virsysfs.h | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 3965ef3f89c9..bcd2506ef7c9 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2621,6 +2621,7 @@ virVasprintfInternal; # util/virsysfs.h +virSysfsCpuDirOpen; virSysfsDirOpen; virSysfsGetCpuValueBitmap; virSysfsGetCpuValueInt; diff --git a/src/util/virsysfs.c b/src/util/virsysfs.c index 6686d8ddbfcb..7403ae20ba17 100644 --- a/src/util/virsysfs.c +++ b/src/util/virsysfs.c @@ -214,6 +214,20 @@ virSysfsGetCpuValueBitmap(unsigned int cpu, * Per-NUMA node getters */ int +virSysfsCpuDirOpen(unsigned int cpu, + const char *file, + DIR **dirp) +{ + char *path = NULL; + + if (virAsprintf(&path, "cpu/cpu%u/%s", cpu, file) < 0) + return -1; + + return virSysfsDirOpen(path, dirp); +} + + +int virSysfsGetNodeValueString(unsigned int node, const char *file, char **value) diff --git a/src/util/virsysfs.h b/src/util/virsysfs.h index ff5012d62747..25bd100ea9cb 100644 --- a/src/util/virsysfs.h +++ b/src/util/virsysfs.h @@ -70,6 +70,11 @@ virSysfsGetCpuValueBitmap(unsigned int cpu, const char *file, virBitmapPtr *value); +int +virSysfsCpuDirOpen(unsigned int cpu, + const char *file, + DIR **dirp); + /* * Per-NUMA node getters -- 2.12.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list