Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/util/virsysfs.c | 15 +++++++++++++--
src/util/virsysfs.h | 11 +++++++++++
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/src/util/virsysfs.c b/src/util/virsysfs.c
index 7a98b488e0ff..c482e188a301 100644
--- a/src/util/virsysfs.c
+++ b/src/util/virsysfs.c
@@ -40,6 +40,9 @@ VIR_LOG_INIT("util.sysfs");
static const char *sysfs_system_path = SYSFS_SYSTEM_PATH;
+/*
+ * Private function that should only be called from tests
+ */
void virSysfsSetSystemPath(const char *path)
{
if (path)
@@ -49,6 +52,9 @@ void virSysfsSetSystemPath(const char *path)
}
+/*
+ * Generic getters
+ */
const char *
virSysfsGetSystemPath(void)
{
@@ -110,6 +116,9 @@ virSysfsGetValueBitmap(const char *file,
return ret;
}
+/*
+ * Per-CPU getters
+ */
int
virSysfsGetCpuValueInt(unsigned int cpu,
const char *file,
@@ -127,7 +136,6 @@ virSysfsGetCpuValueInt(unsigned int cpu,
return ret;
}
-
int
virSysfsGetCpuValueUint(unsigned int cpu,
const char *file,
@@ -145,7 +153,6 @@ virSysfsGetCpuValueUint(unsigned int cpu,
return ret;
}
-
int
virSysfsGetCpuValueString(unsigned int cpu,
const char *file,
@@ -187,6 +194,10 @@ virSysfsGetCpuValueBitmap(unsigned int cpu,
return ret;
}
+
+/*
+ * Per-NUMA node getters
+ */
int
virSysfsGetNodeValueString(unsigned int node,
const char *file,
diff --git a/src/util/virsysfs.h b/src/util/virsysfs.h
index cd871ff11dd1..1b24fc193a16 100644
--- a/src/util/virsysfs.h
+++ b/src/util/virsysfs.h
@@ -24,6 +24,9 @@
# include "internal.h"
# include "virbitmap.h"
+/*
+ * Generic getters
+ */
const char * virSysfsGetSystemPath(void);
int
@@ -38,6 +41,10 @@ int
virSysfsGetValueBitmap(const char *file,
virBitmapPtr *value);
+
+/*
+ * Per-CPU getters
+ */
int
virSysfsGetCpuValueInt(unsigned int cpu,
const char *file,
@@ -57,6 +64,10 @@ virSysfsGetCpuValueBitmap(unsigned int cpu,
const char *file,
virBitmapPtr *value);
+
+/*
+ * Per-NUMA node getters
+ */
int
virSysfsGetNodeValueString(unsigned int node,
const char *file,
--
2.12.2