|
|
7a3408 |
From fa55eec14a4739ff3ab0a9e2c97319abb47168e6 Mon Sep 17 00:00:00 2001
|
|
|
7a3408 |
Message-Id: <fa55eec14a4739ff3ab0a9e2c97319abb47168e6@dist-git>
|
|
|
7a3408 |
From: Andrea Bolognani <abologna@redhat.com>
|
|
|
7a3408 |
Date: Wed, 5 Aug 2015 18:18:26 +0200
|
|
|
7a3408 |
Subject: [PATCH] nodeinfo: Remove out parameter from nodeGetCPUBitmap()
|
|
|
7a3408 |
|
|
|
7a3408 |
Not all users of this API will need the size of the returned
|
|
|
7a3408 |
bitmap; those who do can simply call virBitmapSize() themselves.
|
|
|
7a3408 |
|
|
|
7a3408 |
(cherry picked from commit ccd0ea7ef58130c46599453925e8f6716d310d5c)
|
|
|
7a3408 |
|
|
|
7a3408 |
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1213713
|
|
|
7a3408 |
|
|
|
7a3408 |
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
|
|
7a3408 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
7a3408 |
---
|
|
|
7a3408 |
src/nodeinfo.c | 12 +++++-------
|
|
|
7a3408 |
src/nodeinfo.h | 2 +-
|
|
|
7a3408 |
2 files changed, 6 insertions(+), 8 deletions(-)
|
|
|
7a3408 |
|
|
|
7a3408 |
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
|
|
|
7a3408 |
index ceb517a..69c15fc 100644
|
|
|
7a3408 |
--- a/src/nodeinfo.c
|
|
|
7a3408 |
+++ b/src/nodeinfo.c
|
|
|
7a3408 |
@@ -1324,8 +1324,7 @@ nodeGetPresentCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED)
|
|
|
7a3408 |
}
|
|
|
7a3408 |
|
|
|
7a3408 |
virBitmapPtr
|
|
|
7a3408 |
-nodeGetCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED,
|
|
|
7a3408 |
- int *max_id ATTRIBUTE_UNUSED)
|
|
|
7a3408 |
+nodeGetCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED)
|
|
|
7a3408 |
{
|
|
|
7a3408 |
#ifdef __linux__
|
|
|
7a3408 |
const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SYSTEM_PATH;
|
|
|
7a3408 |
@@ -1363,8 +1362,7 @@ nodeGetCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED,
|
|
|
7a3408 |
ignore_value(virBitmapSetBit(cpumap, i));
|
|
|
7a3408 |
}
|
|
|
7a3408 |
}
|
|
|
7a3408 |
- if (max_id && cpumap)
|
|
|
7a3408 |
- *max_id = present;
|
|
|
7a3408 |
+
|
|
|
7a3408 |
cleanup:
|
|
|
7a3408 |
VIR_FREE(online_path);
|
|
|
7a3408 |
VIR_FREE(cpudir);
|
|
|
7a3408 |
@@ -1685,7 +1683,6 @@ nodeGetCPUMap(const char *sysfs_prefix,
|
|
|
7a3408 |
unsigned int flags)
|
|
|
7a3408 |
{
|
|
|
7a3408 |
virBitmapPtr cpus = NULL;
|
|
|
7a3408 |
- int maxpresent;
|
|
|
7a3408 |
int ret = -1;
|
|
|
7a3408 |
int dummy;
|
|
|
7a3408 |
|
|
|
7a3408 |
@@ -1694,7 +1691,7 @@ nodeGetCPUMap(const char *sysfs_prefix,
|
|
|
7a3408 |
if (!cpumap && !online)
|
|
|
7a3408 |
return nodeGetCPUCount(sysfs_prefix);
|
|
|
7a3408 |
|
|
|
7a3408 |
- if (!(cpus = nodeGetCPUBitmap(sysfs_prefix, &maxpresent)))
|
|
|
7a3408 |
+ if (!(cpus = nodeGetCPUBitmap(sysfs_prefix)))
|
|
|
7a3408 |
goto cleanup;
|
|
|
7a3408 |
|
|
|
7a3408 |
if (cpumap && virBitmapToData(cpus, cpumap, &dummy) < 0)
|
|
|
7a3408 |
@@ -1702,7 +1699,8 @@ nodeGetCPUMap(const char *sysfs_prefix,
|
|
|
7a3408 |
if (online)
|
|
|
7a3408 |
*online = virBitmapCountBits(cpus);
|
|
|
7a3408 |
|
|
|
7a3408 |
- ret = maxpresent;
|
|
|
7a3408 |
+ ret = virBitmapSize(cpus);
|
|
|
7a3408 |
+
|
|
|
7a3408 |
cleanup:
|
|
|
7a3408 |
if (ret < 0 && cpumap)
|
|
|
7a3408 |
VIR_FREE(*cpumap);
|
|
|
7a3408 |
diff --git a/src/nodeinfo.h b/src/nodeinfo.h
|
|
|
7a3408 |
index 4f983c2..02af9c5 100644
|
|
|
7a3408 |
--- a/src/nodeinfo.h
|
|
|
7a3408 |
+++ b/src/nodeinfo.h
|
|
|
7a3408 |
@@ -45,7 +45,7 @@ int nodeGetMemory(unsigned long long *mem,
|
|
|
7a3408 |
unsigned long long *freeMem);
|
|
|
7a3408 |
|
|
|
7a3408 |
virBitmapPtr nodeGetPresentCPUBitmap(const char *sysfs_prefix);
|
|
|
7a3408 |
-virBitmapPtr nodeGetCPUBitmap(const char *sysfs_prefix, int *max_id);
|
|
|
7a3408 |
+virBitmapPtr nodeGetCPUBitmap(const char *sysfs_prefix);
|
|
|
7a3408 |
int nodeGetCPUCount(const char *sysfs_prefix);
|
|
|
7a3408 |
|
|
|
7a3408 |
int nodeGetMemoryParameters(virTypedParameterPtr params,
|
|
|
7a3408 |
--
|
|
|
7a3408 |
2.5.0
|
|
|
7a3408 |
|