|
|
c1c534 |
From bd6a2a903f008eef19caa703303492920878174e Mon Sep 17 00:00:00 2001
|
|
|
c1c534 |
Message-Id: <bd6a2a903f008eef19caa703303492920878174e@dist-git>
|
|
|
c1c534 |
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
|
|
c1c534 |
Date: Wed, 31 Jan 2018 16:32:34 +0100
|
|
|
c1c534 |
Subject: [PATCH] resctl: stub out functions with Linux-only APIs used
|
|
|
c1c534 |
MIME-Version: 1.0
|
|
|
c1c534 |
Content-Type: text/plain; charset=UTF-8
|
|
|
c1c534 |
Content-Transfer-Encoding: 8bit
|
|
|
c1c534 |
|
|
|
c1c534 |
The flock() function and d_type field in struct dirent are not portable
|
|
|
c1c534 |
to the mingw platform.
|
|
|
c1c534 |
|
|
|
c1c534 |
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
c1c534 |
(cherry picked from commit a020ab03fdfc3f95ef8d52908bcfc1aac22a8316)
|
|
|
c1c534 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
c1c534 |
|
|
|
c1c534 |
https://bugzilla.redhat.com/show_bug.cgi?id=1289368
|
|
|
c1c534 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
c1c534 |
---
|
|
|
c1c534 |
src/util/virresctrl.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
c1c534 |
1 file changed, 47 insertions(+)
|
|
|
c1c534 |
|
|
|
c1c534 |
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
|
|
|
c1c534 |
index e252aefe31..754820ee46 100644
|
|
|
c1c534 |
--- a/src/util/virresctrl.c
|
|
|
c1c534 |
+++ b/src/util/virresctrl.c
|
|
|
c1c534 |
@@ -295,6 +295,7 @@ virResctrlAllocNew(void)
|
|
|
c1c534 |
|
|
|
c1c534 |
|
|
|
c1c534 |
/* Common functions */
|
|
|
c1c534 |
+#ifdef __linux__
|
|
|
c1c534 |
static int
|
|
|
c1c534 |
virResctrlLockInternal(int op)
|
|
|
c1c534 |
{
|
|
|
c1c534 |
@@ -321,6 +322,20 @@ virResctrlLockWrite(void)
|
|
|
c1c534 |
return virResctrlLockInternal(LOCK_EX);
|
|
|
c1c534 |
}
|
|
|
c1c534 |
|
|
|
c1c534 |
+#else
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+static inline int
|
|
|
c1c534 |
+virResctrlLockWrite(void)
|
|
|
c1c534 |
+{
|
|
|
c1c534 |
+ virReportSystemError(ENOSYS, "%s",
|
|
|
c1c534 |
+ _("resctrlfs not supported on this platform"));
|
|
|
c1c534 |
+ return -1;
|
|
|
c1c534 |
+}
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+#endif
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+
|
|
|
c1c534 |
|
|
|
c1c534 |
static int
|
|
|
c1c534 |
virResctrlUnlock(int fd)
|
|
|
c1c534 |
@@ -328,6 +343,7 @@ virResctrlUnlock(int fd)
|
|
|
c1c534 |
if (fd == -1)
|
|
|
c1c534 |
return 0;
|
|
|
c1c534 |
|
|
|
c1c534 |
+#ifdef __linux__
|
|
|
c1c534 |
/* The lock gets unlocked by closing the fd, which we need to do anyway in
|
|
|
c1c534 |
* order to clean up properly */
|
|
|
c1c534 |
if (VIR_CLOSE(fd) < 0) {
|
|
|
c1c534 |
@@ -338,6 +354,7 @@ virResctrlUnlock(int fd)
|
|
|
c1c534 |
virReportSystemError(errno, "%s", _("Cannot unlock resctrlfs"));
|
|
|
c1c534 |
return -1;
|
|
|
c1c534 |
}
|
|
|
c1c534 |
+#endif /* ! __linux__ */
|
|
|
c1c534 |
|
|
|
c1c534 |
return 0;
|
|
|
c1c534 |
}
|
|
|
c1c534 |
@@ -369,6 +386,8 @@ virResctrlInfoIsEmpty(virResctrlInfoPtr resctrl)
|
|
|
c1c534 |
}
|
|
|
c1c534 |
|
|
|
c1c534 |
|
|
|
c1c534 |
+#ifdef __linux__
|
|
|
c1c534 |
+
|
|
|
c1c534 |
int
|
|
|
c1c534 |
virResctrlGetInfo(virResctrlInfoPtr resctrl)
|
|
|
c1c534 |
{
|
|
|
c1c534 |
@@ -495,6 +514,18 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl)
|
|
|
c1c534 |
return ret;
|
|
|
c1c534 |
}
|
|
|
c1c534 |
|
|
|
c1c534 |
+#else /* ! __linux__ */
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+int
|
|
|
c1c534 |
+virResctrlGetInfo(virResctrlInfoPtr resctrl ATTRIBUTE_UNUSED)
|
|
|
c1c534 |
+{
|
|
|
c1c534 |
+ virReportSystemError(ENOSYS, "%s",
|
|
|
c1c534 |
+ _("Cache tune not supported on this platform"));
|
|
|
c1c534 |
+ return -1;
|
|
|
c1c534 |
+}
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+#endif /* ! __linux__ */
|
|
|
c1c534 |
+
|
|
|
c1c534 |
|
|
|
c1c534 |
int
|
|
|
c1c534 |
virResctrlInfoGetCache(virResctrlInfoPtr resctrl,
|
|
|
c1c534 |
@@ -632,6 +663,8 @@ virResctrlAllocGetType(virResctrlAllocPtr resctrl,
|
|
|
c1c534 |
}
|
|
|
c1c534 |
|
|
|
c1c534 |
|
|
|
c1c534 |
+#ifdef __linux__
|
|
|
c1c534 |
+
|
|
|
c1c534 |
static int
|
|
|
c1c534 |
virResctrlAllocUpdateMask(virResctrlAllocPtr resctrl,
|
|
|
c1c534 |
unsigned int level,
|
|
|
c1c534 |
@@ -659,6 +692,8 @@ virResctrlAllocUpdateMask(virResctrlAllocPtr resctrl,
|
|
|
c1c534 |
return virBitmapCopy(a_type->masks[cache], mask);
|
|
|
c1c534 |
}
|
|
|
c1c534 |
|
|
|
c1c534 |
+#endif
|
|
|
c1c534 |
+
|
|
|
c1c534 |
|
|
|
c1c534 |
static int
|
|
|
c1c534 |
virResctrlAllocUpdateSize(virResctrlAllocPtr resctrl,
|
|
|
c1c534 |
@@ -878,6 +913,8 @@ virResctrlAllocFormat(virResctrlAllocPtr resctrl)
|
|
|
c1c534 |
}
|
|
|
c1c534 |
|
|
|
c1c534 |
|
|
|
c1c534 |
+#ifdef __linux__
|
|
|
c1c534 |
+
|
|
|
c1c534 |
static int
|
|
|
c1c534 |
virResctrlAllocParseProcessCache(virResctrlInfoPtr resctrl,
|
|
|
c1c534 |
virResctrlAllocPtr alloc,
|
|
|
c1c534 |
@@ -1180,7 +1217,17 @@ virResctrlAllocGetUnused(virResctrlInfoPtr resctrl)
|
|
|
c1c534 |
goto cleanup;
|
|
|
c1c534 |
}
|
|
|
c1c534 |
|
|
|
c1c534 |
+#else /* ! __linux__ */
|
|
|
c1c534 |
|
|
|
c1c534 |
+virResctrlAllocPtr
|
|
|
c1c534 |
+virResctrlAllocGetUnused(virResctrlInfoPtr resctrl ATTRIBUTE_UNUSED)
|
|
|
c1c534 |
+{
|
|
|
c1c534 |
+ virReportSystemError(ENOSYS, "%s",
|
|
|
c1c534 |
+ _("Cache tune not supported on this platform"));
|
|
|
c1c534 |
+ return NULL;
|
|
|
c1c534 |
+}
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+#endif /* ! __linux__ */
|
|
|
c1c534 |
|
|
|
c1c534 |
static int
|
|
|
c1c534 |
virResctrlAllocSetMask(virResctrlAllocPerTypePtr a_type,
|
|
|
c1c534 |
--
|
|
|
c1c534 |
2.16.1
|
|
|
c1c534 |
|