mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-05 04:41:20 +00:00
resctl: stub out functions with Linux-only APIs used
The flock() function and d_type field in struct dirent are not portable to the mingw platform. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
4e13fb02fe
commit
a020ab03fd
@ -295,6 +295,7 @@ virResctrlAllocNew(void)
|
|||||||
|
|
||||||
|
|
||||||
/* Common functions */
|
/* Common functions */
|
||||||
|
#ifdef __linux__
|
||||||
static int
|
static int
|
||||||
virResctrlLockInternal(int op)
|
virResctrlLockInternal(int op)
|
||||||
{
|
{
|
||||||
@ -321,6 +322,20 @@ virResctrlLockWrite(void)
|
|||||||
return virResctrlLockInternal(LOCK_EX);
|
return virResctrlLockInternal(LOCK_EX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
virResctrlLockWrite(void)
|
||||||
|
{
|
||||||
|
virReportSystemError(ENOSYS, "%s",
|
||||||
|
_("resctrlfs not supported on this platform"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virResctrlUnlock(int fd)
|
virResctrlUnlock(int fd)
|
||||||
@ -328,6 +343,7 @@ virResctrlUnlock(int fd)
|
|||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
/* The lock gets unlocked by closing the fd, which we need to do anyway in
|
/* The lock gets unlocked by closing the fd, which we need to do anyway in
|
||||||
* order to clean up properly */
|
* order to clean up properly */
|
||||||
if (VIR_CLOSE(fd) < 0) {
|
if (VIR_CLOSE(fd) < 0) {
|
||||||
@ -338,6 +354,7 @@ virResctrlUnlock(int fd)
|
|||||||
virReportSystemError(errno, "%s", _("Cannot unlock resctrlfs"));
|
virReportSystemError(errno, "%s", _("Cannot unlock resctrlfs"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#endif /* ! __linux__ */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -369,6 +386,8 @@ virResctrlInfoIsEmpty(virResctrlInfoPtr resctrl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
|
||||||
int
|
int
|
||||||
virResctrlGetInfo(virResctrlInfoPtr resctrl)
|
virResctrlGetInfo(virResctrlInfoPtr resctrl)
|
||||||
{
|
{
|
||||||
@ -495,6 +514,18 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl)
|
|||||||
return ret;
|
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
|
int
|
||||||
virResctrlInfoGetCache(virResctrlInfoPtr resctrl,
|
virResctrlInfoGetCache(virResctrlInfoPtr resctrl,
|
||||||
@ -632,6 +663,8 @@ virResctrlAllocGetType(virResctrlAllocPtr resctrl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virResctrlAllocUpdateMask(virResctrlAllocPtr resctrl,
|
virResctrlAllocUpdateMask(virResctrlAllocPtr resctrl,
|
||||||
unsigned int level,
|
unsigned int level,
|
||||||
@ -659,6 +692,8 @@ virResctrlAllocUpdateMask(virResctrlAllocPtr resctrl,
|
|||||||
return virBitmapCopy(a_type->masks[cache], mask);
|
return virBitmapCopy(a_type->masks[cache], mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virResctrlAllocUpdateSize(virResctrlAllocPtr resctrl,
|
virResctrlAllocUpdateSize(virResctrlAllocPtr resctrl,
|
||||||
@ -878,6 +913,8 @@ virResctrlAllocFormat(virResctrlAllocPtr resctrl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virResctrlAllocParseProcessCache(virResctrlInfoPtr resctrl,
|
virResctrlAllocParseProcessCache(virResctrlInfoPtr resctrl,
|
||||||
virResctrlAllocPtr alloc,
|
virResctrlAllocPtr alloc,
|
||||||
@ -1180,7 +1217,17 @@ virResctrlAllocGetUnused(virResctrlInfoPtr resctrl)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else /* ! __linux__ */
|
||||||
|
|
||||||
|
virResctrlAllocPtr
|
||||||
|
virResctrlAllocGetUnused(virResctrlInfoPtr resctrl ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
virReportSystemError(ENOSYS, "%s",
|
||||||
|
_("Cache tune not supported on this platform"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ! __linux__ */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virResctrlAllocSetMask(virResctrlAllocPerTypePtr a_type,
|
virResctrlAllocSetMask(virResctrlAllocPerTypePtr a_type,
|
||||||
|
Loading…
Reference in New Issue
Block a user