[libvirt] [PATCH v4 05/12] hyperv: make hypervEnumAndPull use hypervWqlQuery
Matthias Bolte
matthias.bolte at googlemail.com
Sat Apr 8 14:14:40 UTC 2017
2017-04-05 0:26 GMT+02:00 Dawid Zamirski <dzamirski at datto.com>:
> This enables this function to handle "v1" and "v2" WMI requests.
>
> Since this commit and the ones that follow should be squashed on
> previous one:
> * rename hypervObjectUnified -> hypervObject as we've already broken
> compilation here so there's no point in keeping those in parallel
> anymore.
> * do not mark hypervGetWmiClassInfo as unused
> ---
> src/hyperv/hyperv_wmi.c | 41 ++++++++++++++++++++++-------------------
> src/hyperv/hyperv_wmi.h | 17 ++++-------------
> 2 files changed, 26 insertions(+), 32 deletions(-)
>
> diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c
> index 069bcc9..eab6192 100644
> --- a/src/hyperv/hyperv_wmi.c
> +++ b/src/hyperv/hyperv_wmi.c
> @@ -45,7 +45,7 @@
> #define VIR_FROM_THIS VIR_FROM_HYPERV
>
>
> -static int ATTRIBUTE_UNUSED
> +static int
> hypervGetWmiClassInfo(hypervPrivate *priv, hypervWmiClassInfoListPtr list,
> hypervWmiClassInfoPtr *info)
> {
> @@ -143,14 +143,14 @@ hypervVerifyResponse(WsManClient *client, WsXmlDocH response,
>
> /* This function guarantees that query is freed, even on failure */
> int
> -hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root,
> - XmlSerializerInfo *serializerInfo, const char *resourceUri,
> - const char *className, hypervObject **list)
> +hypervEnumAndPull(hypervPrivate *priv, hypervWqlQueryPtr wqlQuery,
> + hypervObject **list)
> {
> int result = -1;
> WsSerializerContextH serializerContext;
> client_opt_t *options = NULL;
> char *query_string = NULL;
> + hypervWmiClassInfoPtr wmiInfo = NULL;
> filter_t *filter = NULL;
> WsXmlDocH response = NULL;
> char *enumContext = NULL;
> @@ -160,18 +160,20 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root,
> XML_TYPE_PTR data = NULL;
> hypervObject *object;
>
> - if (virBufferCheckError(query) < 0) {
> - virBufferFreeAndReset(query);
> + if (virBufferCheckError(&wqlQuery->query) < 0) {
> + virBufferFreeAndReset(&wqlQuery->query);
> return -1;
> }
> - query_string = virBufferContentAndReset(query);
> + query_string = virBufferContentAndReset(&wqlQuery->query);
>
> if (list == NULL || *list != NULL) {
> virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
> - VIR_FREE(query_string);
> return -1;
> }
This VIR_FREE needs to stay. I kept it before pushing this patch.
--
Matthias Bolte
http://photron.blogspot.com
More information about the libvir-list
mailing list