By exporting virResctrlAllocMasksAssign() we can remove most of the
conditionals. And that function should be used from the tests later anyway.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/libvirt_private.syms | 1 +
src/util/virresctrl.c | 30 +-----------------------------
src/util/virresctrlpriv.h | 4 ++++
3 files changed, 6 insertions(+), 29 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 3a9680b3cd2b..6a8b40bbbdb1 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2628,6 +2628,7 @@ virResctrlAllocForeachSize;
virResctrlAllocFormat;
virResctrlAllocGetID;
virResctrlAllocGetUnused;
+virResctrlAllocMasksAssign;
virResctrlAllocNew;
virResctrlAllocRemove;
virResctrlAllocSetID;
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index 9a118fc3595d..787db31b6126 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -380,8 +380,6 @@ virResctrlInfoIsEmpty(virResctrlInfoPtr resctrl)
}
-#ifdef __linux__
-
int
virResctrlGetInfo(virResctrlInfoPtr resctrl)
{
@@ -512,18 +510,6 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl)
return ret;
}
-#else /* ! __linux__ */
-
-int
-virResctrlGetInfo(virResctrlInfoPtr resctrl ATTRIBUTE_UNUSED)
-{
- virReportSystemError(ENOSYS, "%s",
- _("Cache tune not supported on this platform"));
- return -1;
-}
-
-#endif /* ! __linux__ */
-
int
virResctrlInfoGetCache(virResctrlInfoPtr resctrl,
@@ -1089,8 +1075,6 @@ virResctrlAllocGetDefault(virResctrlInfoPtr resctrl)
}
-#ifdef __linux__
-
static void
virResctrlAllocSubtractPerType(virResctrlAllocPerTypePtr dst,
virResctrlAllocPerTypePtr src)
@@ -1246,18 +1230,6 @@ virResctrlAllocGetUnused(virResctrlInfoPtr resctrl)
goto cleanup;
}
-#else /* ! __linux__ */
-
-virResctrlAllocPtr
-virResctrlAllocGetUnused(virResctrlInfoPtr resctrl ATTRIBUTE_UNUSED)
-{
- virReportSystemError(ENOSYS, "%s",
- _("Cache tune not supported on this platform"));
- return NULL;
-}
-
-#endif /* ! __linux__ */
-
/*
* Given the information about requested allocation type `a_type`, the host
@@ -1434,7 +1406,7 @@ virResctrlAllocCopyMasks(virResctrlAllocPtr dst,
* then tries to find a proper space for every requested allocation effectively
* transforming `sizes` into `masks`.
*/
-static int
+int
virResctrlAllocMasksAssign(virResctrlInfoPtr resctrl,
virResctrlAllocPtr alloc)
{
diff --git a/src/util/virresctrlpriv.h b/src/util/virresctrlpriv.h
index 72b115afd13e..80ddd4b875a3 100644
--- a/src/util/virresctrlpriv.h
+++ b/src/util/virresctrlpriv.h
@@ -24,4 +24,8 @@
virResctrlAllocPtr
virResctrlAllocGetUnused(virResctrlInfoPtr resctrl);
+int
+virResctrlAllocMasksAssign(virResctrlInfoPtr resctrl,
+ virResctrlAllocPtr alloc);
+
#endif /* __VIR_RESCTRL_PRIV_H__ */
--
2.17.1