提交 1be35910 编写于 作者: V Viktor Mihajlovski 提交者: John Ferlan

util: Allow to query the presence of host CPU bitmaps

The functions to retrieve online and present host CPU information
are only supported on Linux for the time being.

This leads to runtime errors if these function are used on other
platforms. To avoid that, code in higher levels using the functions
must replicate the conditional compilation in higher level which
is error prone (and is plainly spoken ugly).

Adding a function virHostCPUHasBitmap that can be used to check
for host CPU bitmap support.

NB: There are other functions including the host CPU count that
are lacking support on all platforms, but they are too essential
in order to be bypassed.
Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
上级 f00c0047
......@@ -1118,6 +1118,7 @@ virHostCPUGetOnlineBitmap;
virHostCPUGetPresentBitmap;
virHostCPUGetStats;
virHostCPUGetThreadsPerSubcore;
virHostCPUHasBitmap;
virHostCPUStatsAssign;
virHostMemAllocPages;
virHostMemGetCellsFree;
......
......@@ -1112,6 +1112,16 @@ virHostCPUGetCount(void)
#endif
}
bool
virHostCPUHasBitmap(void)
{
#ifdef __linux__
return true;
#else
return false;
#endif
}
virBitmapPtr
virHostCPUGetPresentBitmap(void)
{
......
......@@ -35,6 +35,7 @@ int virHostCPUGetStats(int cpuNum,
int *nparams,
unsigned int flags);
bool virHostCPUHasBitmap(void);
virBitmapPtr virHostCPUGetPresentBitmap(void);
virBitmapPtr virHostCPUGetOnlineBitmap(void);
int virHostCPUGetCount(void);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册