2017-07-18 18:54 GMT+02:00 Andrea Bolognani <abologna@xxxxxxxxxx>: > On Tue, 2017-06-27 at 15:13 -0400, Sri Ramanujam wrote: >> This commit adds support for invoking methods on remote objects >> via hypervInvokeMethod. >> --- >> src/hyperv/hyperv_wmi.c | 590 ++++++++++++++++++++++++++++++++++++++++++++++++ >> src/hyperv/hyperv_wmi.h | 8 +- >> src/hyperv/openwsman.h | 4 + >> 3 files changed, 600 insertions(+), 2 deletions(-) >> >> diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c >> index 2732db3..f944b14 100644 >> --- a/src/hyperv/hyperv_wmi.c >> +++ b/src/hyperv/hyperv_wmi.c > [...] >> +static int >> +hypervSerializeEprParam(hypervParamPtr p, hypervPrivate *priv, >> + const char *resourceUri, WsXmlDocH doc, WsXmlNodeH *methodNode) >> +{ >> + int result = -1; >> + WsXmlNodeH xmlNodeParam = NULL, >> + xmlNodeTemp = NULL, >> + xmlNodeAddr = NULL, >> + xmlNodeRef = NULL; >> + xmlNodePtr xmlNodeAddrPtr = NULL, >> + xmlNodeRefPtr = NULL; > [...] >> + if (!(xmlNodeAddrPtr = xmlDocCopyNode((xmlNodePtr) xmlNodeAddr, docPtr, 1))) { > > Here you're casting a WsXmlNodeH to a xmlNodePtr, and clang > doesn't like it one bit: > > hyperv/hyperv_wmi.c:576:43: error: > cast from 'WsXmlNodeH' (aka 'struct __WsXmlNode *') > to 'xmlNodePtr' (aka 'struct _xmlNode *') > increases required alignment from 4 to 8 > [-Werror,-Wcast-align] > > Any idea how to unbreak it? The problem here is that the driver is mixing direct libxml2 calls with calls to the libxml2 wrapper of openwsman. The openwsman wrapper type WsXmlNodeH is actually a xmlNodePtr, but that is hidden to the compiler. I checked if the openwsman libxml2 wrapper is complete enough to get rid of this API mixing. I could replace all direct libxml2 calls with openwsman wrapper call except xmlNewCDataBlock. A hack for this last offender is to cast to a void pointer first, instead of a direct cast. See attached patch for a quick fix, compile-tested only. Another possibility is to do all the XML building using direct libxml2 calls, format the XML document and reparse it with the openwsman wrapper. But I don't have time to work on that at the moment. -- Matthias Bolte http://photron.blogspot.com
Attachment:
hyperv_clang.patch
Description: Binary data
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list