mirror of https://gitee.com/openkylin/libvirt.git
nodeinfo: Remove out parameter from nodeGetCPUBitmap()
Not all users of this API will need the size of the returned bitmap; those who do can simply call virBitmapSize() themselves.
This commit is contained in:
parent
37f73e4ad5
commit
ccd0ea7ef5
|
@ -1325,8 +1325,7 @@ nodeGetPresentCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
virBitmapPtr
|
virBitmapPtr
|
||||||
nodeGetCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED,
|
nodeGetCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED)
|
||||||
int *max_id ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SYSTEM_PATH;
|
const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SYSTEM_PATH;
|
||||||
|
@ -1364,8 +1363,7 @@ nodeGetCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED,
|
||||||
ignore_value(virBitmapSetBit(cpumap, i));
|
ignore_value(virBitmapSetBit(cpumap, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (max_id && cpumap)
|
|
||||||
*max_id = present;
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(online_path);
|
VIR_FREE(online_path);
|
||||||
VIR_FREE(cpudir);
|
VIR_FREE(cpudir);
|
||||||
|
@ -1686,7 +1684,6 @@ nodeGetCPUMap(const char *sysfs_prefix,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virBitmapPtr cpus = NULL;
|
virBitmapPtr cpus = NULL;
|
||||||
int maxpresent;
|
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int dummy;
|
int dummy;
|
||||||
|
|
||||||
|
@ -1695,7 +1692,7 @@ nodeGetCPUMap(const char *sysfs_prefix,
|
||||||
if (!cpumap && !online)
|
if (!cpumap && !online)
|
||||||
return nodeGetCPUCount(sysfs_prefix);
|
return nodeGetCPUCount(sysfs_prefix);
|
||||||
|
|
||||||
if (!(cpus = nodeGetCPUBitmap(sysfs_prefix, &maxpresent)))
|
if (!(cpus = nodeGetCPUBitmap(sysfs_prefix)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (cpumap && virBitmapToData(cpus, cpumap, &dummy) < 0)
|
if (cpumap && virBitmapToData(cpus, cpumap, &dummy) < 0)
|
||||||
|
@ -1703,7 +1700,8 @@ nodeGetCPUMap(const char *sysfs_prefix,
|
||||||
if (online)
|
if (online)
|
||||||
*online = virBitmapCountBits(cpus);
|
*online = virBitmapCountBits(cpus);
|
||||||
|
|
||||||
ret = maxpresent;
|
ret = virBitmapSize(cpus);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (ret < 0 && cpumap)
|
if (ret < 0 && cpumap)
|
||||||
VIR_FREE(*cpumap);
|
VIR_FREE(*cpumap);
|
||||||
|
|
|
@ -45,7 +45,7 @@ int nodeGetMemory(unsigned long long *mem,
|
||||||
unsigned long long *freeMem);
|
unsigned long long *freeMem);
|
||||||
|
|
||||||
virBitmapPtr nodeGetPresentCPUBitmap(const char *sysfs_prefix);
|
virBitmapPtr nodeGetPresentCPUBitmap(const char *sysfs_prefix);
|
||||||
virBitmapPtr nodeGetCPUBitmap(const char *sysfs_prefix, int *max_id);
|
virBitmapPtr nodeGetCPUBitmap(const char *sysfs_prefix);
|
||||||
int nodeGetCPUCount(const char *sysfs_prefix);
|
int nodeGetCPUCount(const char *sysfs_prefix);
|
||||||
|
|
||||||
int nodeGetMemoryParameters(virTypedParameterPtr params,
|
int nodeGetMemoryParameters(virTypedParameterPtr params,
|
||||||
|
|
Loading…
Reference in New Issue