mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
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: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
This commit is contained in:
parent
f00c00475f
commit
1be35910f7
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user