[libvirt] [PATCH 0/3] more build fixes

Pushing all three under the build-breaker rules. Eric Blake (3): bitmap: fix problems in previous commit build: fix nodeinfo build on non-Linux platforms build: avoid unused symbol src/libvirt_private.syms | 1 - src/nodeinfo.c | 4 ++++ src/util/bitmap.c | 3 +-- tests/virbitmaptest.c | 12 +++++++----- 4 files changed, 12 insertions(+), 8 deletions(-) -- 1.7.11.4

Commit ee3d3893 missed the fact that (unsigned char)<<(int) is truncated to int, and therefore failed for any bitmap data longer than four bytes, but only on 64-bit platforms. Also, I failed to run 'make syntax-check' on my commit 4bba6579; for whatever odd reason, ffs lives in a different header than ffsl. * src/util/bitmap.c (virBitmapNewData): Use correct shift type. (includes): Glibc (and therefore gnulib) decided ffs is in <strings.h>, but ffsl is in <string.h>. * tests/virbitmaptest.c (test5): Test it. --- src/util/bitmap.c | 3 +-- tests/virbitmaptest.c | 12 +++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/util/bitmap.c b/src/util/bitmap.c index 4bade6c..9ca1af8 100644 --- a/src/util/bitmap.c +++ b/src/util/bitmap.c @@ -27,7 +27,6 @@ #include <stdint.h> #include <stdio.h> #include <string.h> -#include <strings.h> #include <stdlib.h> #include <sys/types.h> @@ -434,7 +433,7 @@ virBitmapPtr virBitmapNewData(void *data, int len) j = 0; p++; } - *p |= bytes[i] << (j * CHAR_BIT); + *p |= (unsigned long) bytes[i] << (j * CHAR_BIT); } return bitmap; diff --git a/tests/virbitmaptest.c b/tests/virbitmaptest.c index 028556f..71836de 100644 --- a/tests/virbitmaptest.c +++ b/tests/virbitmaptest.c @@ -214,15 +214,15 @@ error: /* test for virBitmapNewData/ToData */ static int test5(const void *v ATTRIBUTE_UNUSED) { - char data[] = {0x01, 0x02, 0x00, 0x00}; + char data[] = {0x01, 0x02, 0x00, 0x00, 0x04}; unsigned char *data2 = NULL; int len2; - int bits[] = {0, 9}; + int bits[] = {0, 9, 34}; virBitmapPtr bitmap; int i, j; int ret = -1; - bitmap = virBitmapNewData(data, 4); + bitmap = virBitmapNewData(data, sizeof(data)); if (!bitmap) goto error; @@ -242,10 +242,12 @@ static int test5(const void *v ATTRIBUTE_UNUSED) if (virBitmapToData(bitmap, &data2, &len2) < 0) goto error; - if (data2[0] != 0x05 || + if (len2 != sizeof(data) || + data2[0] != 0x05 || data2[1] != 0x82 || data2[2] != 0x00 || - data2[3] != 0x00) + data2[3] != 0x00 || + data2[4] != 0x04) goto error; ret = 0; -- 1.7.11.4

Commit aaa8ab3 added new static functions that are only used on Linux; but commit 22acfdc didn't go far enough to fix compiler issues. * src/nodeinfo.c (nodeSetMemoryParameterValue) (nodeGetMemoryParameterValue): Conditionally compile based on use. --- src/nodeinfo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 302e017..b2de60f 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -931,6 +931,7 @@ nodeGetCPUmap(virConnectPtr conn ATTRIBUTE_UNUSED, #endif } +#ifdef __linux__ static int nodeSetMemoryParameterValue(const char *field, virTypedParameterPtr param) @@ -964,6 +965,7 @@ cleanup: VIR_FREE(strval); return ret; } +#endif int nodeSetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED, @@ -1014,6 +1016,7 @@ nodeSetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED, #endif } +#ifdef __linux__ static int nodeGetMemoryParameterValue(const char *field, void *value) @@ -1058,6 +1061,7 @@ cleanup: VIR_FREE(buf); return ret; } +#endif #define NODE_MEMORY_PARAMETERS_NUM 7 int -- 1.7.11.4

On 2012年09月19日 09:57, Eric Blake wrote:
Commit aaa8ab3 added new static functions that are only used on Linux; but commit 22acfdc didn't go far enough to fix compiler issues.
* src/nodeinfo.c (nodeSetMemoryParameterValue) (nodeGetMemoryParameterValue): Conditionally compile based on use. --- src/nodeinfo.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 302e017..b2de60f 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -931,6 +931,7 @@ nodeGetCPUmap(virConnectPtr conn ATTRIBUTE_UNUSED, #endif }
+#ifdef __linux__ static int nodeSetMemoryParameterValue(const char *field, virTypedParameterPtr param) @@ -964,6 +965,7 @@ cleanup: VIR_FREE(strval); return ret; } +#endif
int nodeSetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED, @@ -1014,6 +1016,7 @@ nodeSetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED, #endif }
+#ifdef __linux__ static int nodeGetMemoryParameterValue(const char *field, void *value) @@ -1058,6 +1061,7 @@ cleanup: VIR_FREE(buf); return ret; } +#endif
#define NODE_MEMORY_PARAMETERS_NUM 7 int
ACK, Thanks for fixing bug by me. :-)

Commit f36309d added an export with no matching implementation; probably a misspelling of an earlier version of the final addition of virNetworkObjSetDefTransient. * src/libvirt_private.syms (network_conf.h): Drop bogus virNetworkSetDefTransient. --- src/libvirt_private.syms | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index ec2e544..e75e489 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -869,7 +869,6 @@ virNetworkSaveConfig; virNetworkSaveStatus; virNetworkSetBridgeMacAddr; virNetworkSetBridgeName; -virNetworkSetDefTransient; virPortGroupFindByName; -- 1.7.11.4

On 2012年09月19日 09:57, Eric Blake wrote:
Commit f36309d added an export with no matching implementation; probably a misspelling of an earlier version of the final addition of virNetworkObjSetDefTransient.
* src/libvirt_private.syms (network_conf.h): Drop bogus virNetworkSetDefTransient. --- src/libvirt_private.syms | 1 - 1 file changed, 1 deletion(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index ec2e544..e75e489 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -869,7 +869,6 @@ virNetworkSaveConfig; virNetworkSaveStatus; virNetworkSetBridgeMacAddr; virNetworkSetBridgeName; -virNetworkSetDefTransient; virPortGroupFindByName;
ACK.

On 2012年09月19日 09:57, Eric Blake wrote:
Pushing all three under the build-breaker rules.
Well, I should look at this earlier.
Eric Blake (3): bitmap: fix problems in previous commit build: fix nodeinfo build on non-Linux platforms build: avoid unused symbol
src/libvirt_private.syms | 1 - src/nodeinfo.c | 4 ++++ src/util/bitmap.c | 3 +-- tests/virbitmaptest.c | 12 +++++++----- 4 files changed, 12 insertions(+), 8 deletions(-)
participants (2)
-
Eric Blake
-
Osier Yang