From ccd0ea7ef58130c46599453925e8f6716d310d5c Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Mon, 20 Jul 2015 18:37:25 +0200 Subject: [PATCH] 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. --- src/nodeinfo.c | 12 +++++------- src/nodeinfo.h | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 1934083563..e98cda983b 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -1325,8 +1325,7 @@ nodeGetPresentCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED) } virBitmapPtr -nodeGetCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED, - int *max_id ATTRIBUTE_UNUSED) +nodeGetCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED) { #ifdef __linux__ 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)); } } - if (max_id && cpumap) - *max_id = present; + cleanup: VIR_FREE(online_path); VIR_FREE(cpudir); @@ -1686,7 +1684,6 @@ nodeGetCPUMap(const char *sysfs_prefix, unsigned int flags) { virBitmapPtr cpus = NULL; - int maxpresent; int ret = -1; int dummy; @@ -1695,7 +1692,7 @@ nodeGetCPUMap(const char *sysfs_prefix, if (!cpumap && !online) return nodeGetCPUCount(sysfs_prefix); - if (!(cpus = nodeGetCPUBitmap(sysfs_prefix, &maxpresent))) + if (!(cpus = nodeGetCPUBitmap(sysfs_prefix))) goto cleanup; if (cpumap && virBitmapToData(cpus, cpumap, &dummy) < 0) @@ -1703,7 +1700,8 @@ nodeGetCPUMap(const char *sysfs_prefix, if (online) *online = virBitmapCountBits(cpus); - ret = maxpresent; + ret = virBitmapSize(cpus); + cleanup: if (ret < 0 && cpumap) VIR_FREE(*cpumap); diff --git a/src/nodeinfo.h b/src/nodeinfo.h index 4f983c231c..02af9c5c55 100644 --- a/src/nodeinfo.h +++ b/src/nodeinfo.h @@ -45,7 +45,7 @@ int nodeGetMemory(unsigned long long *mem, unsigned long long *freeMem); 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 nodeGetMemoryParameters(virTypedParameterPtr params, -- GitLab