mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
nodeinfo: fix build on non-Linux
Commit b0f8546
broke the build on mingw, by exposing code that
had Linux-specific dependencies but which was previously protected
by libnuma ifdef guards:
make[3]: Entering directory `/home/eblake/libvirt-tmp/build/src'
CC libvirt_driver_la-nodeinfo.lo
../../src/nodeinfo.c: In function 'virNodeGetSiblingsList':
../../src/nodeinfo.c:1543:30: error: 'SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX' undeclared (first use in this function)
if (virFileReadAll(path, SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX, &buf) < 0)
^
../../src/nodeinfo.c:1543:30: note: each undeclared identifier is reported only once for each function it appears in
../../src/nodeinfo.c: In function 'virNodeCapsFillCPUInfo':
../../src/nodeinfo.c:1562:5: error: implicit declaration of function 'virNodeGetCpuValue' [-Werror=implicit-function-declaration]
if ((tmp = virNodeGetCpuValue(SYSFS_CPU_PATH, cpu_id,
^
../../src/nodeinfo.c:1562:5: error: nested extern declaration of 'virNodeGetCpuValue' [-Werror=nested-externs]
../../src/nodeinfo.c:1562:35: error: 'SYSFS_CPU_PATH' undeclared (first use in this function)
if ((tmp = virNodeGetCpuValue(SYSFS_CPU_PATH, cpu_id,
^
cc1: all warnings being treated as errors
* src/nodeinfo.c (virNodeCapsFillCPUInfo): Make conditional.
(virNodeGetSiblingsList): Move into #ifdef linux block.
Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
348b4e254b
commit
adb44955c4
@ -867,6 +867,30 @@ error:
|
|||||||
virBitmapFree(map);
|
virBitmapFree(map);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static virBitmapPtr
|
||||||
|
virNodeGetSiblingsList(const char *dir, int cpu_id)
|
||||||
|
{
|
||||||
|
char *path = NULL;
|
||||||
|
char *buf = NULL;
|
||||||
|
virBitmapPtr ret = NULL;
|
||||||
|
|
||||||
|
if (virAsprintf(&path, "%s/cpu%u/topology/thread_siblings_list",
|
||||||
|
dir, cpu_id) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virFileReadAll(path, SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX, &buf) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virBitmapParse(buf, 0, &ret, virNumaGetMaxCPUs()) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
VIR_FREE(buf);
|
||||||
|
VIR_FREE(path);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int nodeGetInfo(virNodeInfoPtr nodeinfo)
|
int nodeGetInfo(virNodeInfoPtr nodeinfo)
|
||||||
@ -1529,33 +1553,12 @@ nodeGetFreeMemoryFake(void)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static virBitmapPtr
|
|
||||||
virNodeGetSiblingsList(const char *dir, int cpu_id)
|
|
||||||
{
|
|
||||||
char *path = NULL;
|
|
||||||
char *buf = NULL;
|
|
||||||
virBitmapPtr ret = NULL;
|
|
||||||
|
|
||||||
if (virAsprintf(&path, "%s/cpu%u/topology/thread_siblings_list",
|
|
||||||
dir, cpu_id) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (virFileReadAll(path, SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX, &buf) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (virBitmapParse(buf, 0, &ret, virNumaGetMaxCPUs()) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
VIR_FREE(buf);
|
|
||||||
VIR_FREE(path);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* returns 1 on success, 0 if the detection failed and -1 on hard error */
|
/* returns 1 on success, 0 if the detection failed and -1 on hard error */
|
||||||
static int
|
static int
|
||||||
virNodeCapsFillCPUInfo(int cpu_id, virCapsHostNUMACellCPUPtr cpu)
|
virNodeCapsFillCPUInfo(int cpu_id ATTRIBUTE_UNUSED,
|
||||||
|
virCapsHostNUMACellCPUPtr cpu ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
|
#ifdef __linux__
|
||||||
int tmp;
|
int tmp;
|
||||||
cpu->id = cpu_id;
|
cpu->id = cpu_id;
|
||||||
|
|
||||||
@ -1575,6 +1578,11 @@ virNodeCapsFillCPUInfo(int cpu_id, virCapsHostNUMACellCPUPtr cpu)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
virReportError(VIR_ERR_NO_SUPPORT, "%s",
|
||||||
|
_("node cpu info not implemented on this platform"));
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user