mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virhostcpu: Expose virHostCPUGetOnline on non-Linux
Previously, this function must've been called only on Linux in order
to fail gracefully. That lead to #ifdef mess in callers, so the
function was redesigned so it failed gracefully on non-existing
files. However that commit forgot to define the function outside the
__linux__ ifdef, it broke non-Linux builds.
Caused by c67e04e25f
.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
75f30a60e6
commit
9c5ac84d76
@ -262,24 +262,6 @@ virHostCPUGetCore(unsigned int cpu, unsigned int *core)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
virHostCPUGetOnline(unsigned int cpu, bool *online)
|
|
||||||
{
|
|
||||||
unsigned int tmp = 0;
|
|
||||||
int ret = virSysfsGetCpuValueUint(cpu, "online", &tmp);
|
|
||||||
|
|
||||||
|
|
||||||
/* If the file is not there, it's online (doesn't support offlining) */
|
|
||||||
if (ret == -2)
|
|
||||||
tmp = 1;
|
|
||||||
else if (ret < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
*online = tmp;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
virBitmapPtr
|
virBitmapPtr
|
||||||
virHostCPUGetSiblingsList(unsigned int cpu)
|
virHostCPUGetSiblingsList(unsigned int cpu)
|
||||||
{
|
{
|
||||||
@ -880,6 +862,23 @@ virHostCPUParseCountLinux(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int
|
||||||
|
virHostCPUGetOnline(unsigned int cpu, bool *online)
|
||||||
|
{
|
||||||
|
unsigned int tmp = 0;
|
||||||
|
int ret = virSysfsGetCpuValueUint(cpu, "online", &tmp);
|
||||||
|
|
||||||
|
|
||||||
|
/* If the file is not there, it's online (doesn't support offlining) */
|
||||||
|
if (ret == -2)
|
||||||
|
tmp = 1;
|
||||||
|
else if (ret < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
*online = tmp;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
virHostCPUStatsAssign(virNodeCPUStatsPtr param,
|
virHostCPUStatsAssign(virNodeCPUStatsPtr param,
|
||||||
|
Loading…
Reference in New Issue
Block a user