tools/libxl: Fix building against libxl for LIBXL_API_VERSION < 0x040500
PATCH 1/1 tools/libxl: Fix building against libxl for LIBXL_API_VERSION < 0x040500
c/s 6276f66ebe "libxl: libxl_uuid_copy now takes a ctx argument" introduces API compatibiltiy for libxl_uuid_copy() which sadly is not valid C. Fix it.
--- tools/libxl/libxl_uuid.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/libxl/libxl_uuid.h +6 -1
@@ -61,7 +61,12 @@ int libxl_uuid_from_string(libxl_uuid *uuid, const char *in);void libxl_uuid_copy (libxl_ctx *ctx_opt,libxl_uuid *dst,const libxl_uuid *src);#if defined(LIBXL_API_VERSION ) &&LIBXL_API_VERSION <0x040500 -void libxl_uuid_copy(dst, src) libxl_uuid_copy(NULL, dst, src) +void static inline libxl_uuid_copy_0x040400 (libxl_uuid *dst, +const libxl_uuid *src) +{ +libxl_uuid_copy (NULL , dst, src); +} +#define libxl_uuid_copy libxl_uuid_copy_0x040400#endif void libxl_uuid_clear (libxl_uuid *uuid);
Signature · 1 line
1.7.10.4
Quoted 7 lines · Andrew Cooper
c/s
6276f66ebe"libxl:libxl_uuid_copynow takes a ctx argument" introduces API compatibiltiy forlibxl_uuid_copy()which sadly is not valid C. Fix it.Signed-off-by Andrew Cooper <[email protected]>CC Ian Campbell <[email protected]>CC Ian Jackson <[email protected]>CC Wei Liu <[email protected]>
Quoted 24 lines
--- tools/libxl/libxl_uuid.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)tools/libxl/libxl_uuid.h +6
-1@@ -61,7 +61,12 @@ int libxl_uuid_from_string(libxl_uuid *uuid, const char *in);void libxl_uuid_copy (libxl_ctx *ctx_opt,libxl_uuid *dst,const libxl_uuid *src);#if defined(LIBXL_API_VERSION ) &&LIBXL_API_VERSION <0x040500 -void libxl_uuid_copy(dst, src) libxl_uuid_copy(NULL, dst, src) +void static inline libxl_uuid_copy_0x040400 (libxl_uuid *dst, +const libxl_uuid *src) +{ +libxl_uuid_copy (NULL , dst, src); +} +#define libxl_uuid_copy libxl_uuid_copy_0x040400#endif void libxl_uuid_clear (libxl_uuid *uuid);Signature · 1 line
1.7.10.4
Andrew Cooper writes ("[PATCH for-4.5] tools/libxl: Fix building against libxl for LIBXL_API_VERSION < 0x040500"):
Quoted 2 lines
c/s
6276f66ebe"libxl:libxl_uuid_copynow takes a ctx argument" introduces API compatibiltiy forlibxl_uuid_copy()which sadly is not valid C. Fix it.
...
Quoted 2 lines
#if
defined(LIBXL_API_VERSION)&&LIBXL_API_VERSION<0x040500
-voidlibxl_uuid_copy(dst, src)libxl_uuid_copy(NULL, dst, src)
I think this was intended to read
#define libxl_uuid_copy(dst, src) libxl_uuid_copy(NULL, dst, src)
but should in fact read
#define libxl_uuid_copy(dst, src) libxl_uuid_copy(NULL, (dst), (src))
I don't understand why you want to introduce a function as well as a macro.
Ian.
Quoted 10 lines · Ian Jackson
Andrew Cooper writes ("[PATCH for-4.5]
tools/libxl: Fix building against libxl forLIBXL_API_VERSION<0x040500"):Quoted 2 lines
c/s
6276f66ebe"libxl:libxl_uuid_copynow takes a ctx argument" introduces API compatibiltiy forlibxl_uuid_copy()which sadly is not valid C. Fix it....
Quoted 2 lines
#if
defined(LIBXL_API_VERSION)&&LIBXL_API_VERSION<0x040500
-voidlibxl_uuid_copy(dst, src)libxl_uuid_copy(NULL, dst, src)I think this was intended to read
#definelibxl_uuid_copy(dst, src)libxl_uuid_copy(NULL, dst, src)
but should in fact read
#definelibxl_uuid_copy(dst, src)libxl_uuid_copy(NULL, (dst), (src))
Does this even work?
Won't the parser complain about passing 3 parameters to a two-parameter macro?
~Andrew
Andrew Cooper writes ("Re: [PATCH for-4.5] tools/libxl: Fix building against libxl for LIBXL_API_VERSION < 0x040500"):
Quoted 10 lines · Ian Jackson
Quoted 4 lines
I think this was intended to read
#definelibxl_uuid_copy(dst, src)libxl_uuid_copy(NULL, dst, src)
but should in fact read
#definelibxl_uuid_copy(dst, src)libxl_uuid_copy(NULL, (dst), (src))Does this even work?
Won't the parser complain about passing 3 parameters to a two-parameter macro?
mariner:~> ed t.ct.c: No such file or directory
a
#define libxl_uuid_copy(dst, src) libxl_uuid_copy(NULL, (dst), (src)) libxl_uuid_copy(1,2)
.
w
91
q
mariner:~> gcc -E t.c
# 1 "t.c"
# 1 "<command-line>"
# 1 "t.c"
libxl_uuid_copy(NULL, (1), (2))
mariner:~>
Ian Jackson writes ("Re: [PATCH for-4.5] tools/libxl: Fix building against libxl for LIBXL_API_VERSION < 0x040500"):
Quoted 6 lines
Andrew Cooper writes ("Re: [PATCH for-4.5]
tools/libxl: Fix building against libxl forLIBXL_API_VERSION<0x040500"):Quoted 5 lines · Ian Jackson
Quoted 4 lines
I think this was intended to read
#definelibxl_uuid_copy(dst, src)libxl_uuid_copy(NULL, dst, src)
but should in fact read
#definelibxl_uuid_copy(dst, src)libxl_uuid_copy(NULL, (dst), (src))
Having checked the rules, for C++ this might conceivably have to be
#define libxl_uuid_copy(dst, src) (libxl_uuid_copy(NULL, (dst), (src)))
Ian.
Quoted 11 lines · Ian Jackson
Ian Jackson writes ("Re: [PATCH for-4.5]
tools/libxl: Fix building against libxl forLIBXL_API_VERSION<0x040500"):Quoted 6 lines
Andrew Cooper writes ("Re: [PATCH for-4.5]
tools/libxl: Fix building against libxl forLIBXL_API_VERSION<0x040500"):Quoted 5 lines · Ian Jackson
Quoted 4 lines
I think this was intended to read
#definelibxl_uuid_copy(dst, src)libxl_uuid_copy(NULL, dst, src)
but should in fact read
#definelibxl_uuid_copy(dst, src)libxl_uuid_copy(NULL, (dst), (src))Having checked the rules, for C++ this might conceivably have to be
#define libxl_uuid_copy(dst, src) (libxl_uuid_copy(NULL, (dst), (src)))Ian.
Fundamentally, I am not really fussed how this is fixed, although I have confirmed my patch fixes the libvirt build in the XenServer branch I am attempting to test Xen-4.5 under.
~Andrew
Quoted 8 lines · Andrew Cooper
Quoted 7 lines · Ian Jackson
Ian Jackson writes ("Re: [PATCH for-4.5]
tools/libxl: Fix building against libxl forLIBXL_API_VERSION<0x040500"):Quoted 6 lines
Andrew Cooper writes ("Re: [PATCH for-4.5]
tools/libxl: Fix building against libxl forLIBXL_API_VERSION<0x040500"):Quoted 5 lines · Ian Jackson
Quoted 4 lines
I think this was intended to read
#definelibxl_uuid_copy(dst, src)libxl_uuid_copy(NULL, dst, src)
but should in fact read
#definelibxl_uuid_copy(dst, src)libxl_uuid_copy(NULL, (dst), (src))
Quoted 8 lines
Quoted 4 lines
Having checked the rules, for C++ this might conceivably have to be
#define libxl_uuid_copy(dst, src) (libxl_uuid_copy(NULL, (dst), (src)))Ian.
Fundamentally, I am not really fussed how this is fixed, although I have confirmed my patch fixes the libvirt build in the XenServer branch I am attempting to test Xen-4.5 under.
Ian, are you happy with that or do you want to (ask Andy to) resubmit with the #define?
Ian.
Quoted 12 lines · Ian Campbell
Quoted 11 lines · Andrew Cooper
Quoted 10 lines · Ian Jackson
Ian Jackson writes ("Re: [PATCH for-4.5]
tools/libxl: Fix building against libxl forLIBXL_API_VERSION<0x040500"):Quoted 6 lines
Andrew Cooper writes ("Re: [PATCH for-4.5]
tools/libxl: Fix building against libxl forLIBXL_API_VERSION<0x040500"):Quoted 5 lines · Ian Jackson
Quoted 4 lines
I think this was intended to read
#definelibxl_uuid_copy(dst, src)libxl_uuid_copy(NULL, dst, src)
but should in fact read
#definelibxl_uuid_copy(dst, src)libxl_uuid_copy(NULL, (dst), (src))Having checked the rules, for C++ this might conceivably have to be
#define libxl_uuid_copy(dst, src) (libxl_uuid_copy(NULL, (dst), (src)))
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
Ian.
Fundamentally, I am not really fussed how this is fixed, although I have confirmed my patch fixes the libvirt build in the XenServer branch I am attempting to test Xen-4.5 under.
Ian, are you happy with that or do you want to (ask Andy to) resubmit with the #define?
Ian.
Ping (regarding question)? Whichever fix gets used eventually. this really needs to get in before the release candidate is cut.
~Andrew
Quoted 2 lines · Andrew Cooper
Ping (regarding question)? Whichever fix gets used eventually. this really needs to get in before the release candidate is cut.
I've applied it locally and kicked off my usual set of tests, I'll push once those complete (and/or I've finished lunch, whichever comes second) unless Ian objects before then.
Ian.