]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
hyperv: remove hypervWmiClassInfoList, hypervWmiClassInfoListPtr, and _hypervWmiClass...
authorMatt Coleman <mcoleman@datto.com>
Mon, 9 Nov 2020 08:43:10 +0000 (03:43 -0500)
committerDaniel P. Berrangé <berrange@redhat.com>
Mon, 9 Nov 2020 15:26:02 +0000 (15:26 +0000)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Matt Coleman <matt@datto.com>
scripts/hyperv_wmi_generator.py
src/hyperv/hyperv_wmi.c
src/hyperv/hyperv_wmi.h
src/hyperv/hyperv_wmi_classes.h

index 03cac2992ee60a4fed42f5f3d7fc693e3d13ab46..a6f5c6aeab6d9125742fff430569ff9690eb0189 100755 (executable)
@@ -57,7 +57,7 @@ class WmiClass:
         header += "#define %s_WQL_SELECT \\\n" % name_upper
         header += "    \"SELECT * FROM %s \"\n" % self.name
         header += "\n"
-        header += "extern hypervWmiClassInfoListPtr %s_WmiInfo;\n\n" % self.name
+        header += "extern hypervWmiClassInfoPtr %s_WmiInfo;\n\n" % self.name
 
         header += self._declare_data_structs()
         header += self._declare_hypervObject_struct()
@@ -143,19 +143,12 @@ class WmiClass:
         This struct holds info with meta-data needed to make wsman requests for the WMI class.
         """
 
-        source = "hypervWmiClassInfoListPtr %s_WmiInfo = &(hypervWmiClassInfoList) {\n" % self.name
-        source += "    .count = 1,\n"
-        source += "    .objs = (hypervWmiClassInfoPtr []) {\n"
-
-        source += "        &(hypervWmiClassInfo) {\n"
-        source += "            .name = %s_CLASSNAME,\n" % self.name.upper()
-        source += "            .rootUri = %s,\n" % self.uri_info.rootUri
-        source += "            .resourceUri = %s_RESOURCE_URI,\n" % self.name.upper()
-        source += "            .serializerInfo = %s_Data_TypeInfo,\n" % self.name
-        source += "            .propertyInfo = %s_Typemap\n" % self.name
-        source += "        },\n"
-
-        source += "    }\n"
+        source = "hypervWmiClassInfoPtr %s_WmiInfo = &(hypervWmiClassInfo) {\n" % self.name
+        source += "    .name = %s_CLASSNAME,\n" % self.name.upper()
+        source += "    .rootUri = %s,\n" % self.uri_info.rootUri
+        source += "    .resourceUri = %s_RESOURCE_URI,\n" % self.name.upper()
+        source += "    .serializerInfo = %s_Data_TypeInfo,\n" % self.name
+        source += "    .propertyInfo = %s_Typemap\n" % self.name
         source += "};\n"
 
         return source
index 2a3d6abc0b70197a7a44ee86f7f8b1db55b00e34..72a68c0591fbe944c7d32352a0ad667a194292d4 100644 (file)
 
 VIR_LOG_INIT("hyperv.hyperv_wmi");
 
-static int
-hypervGetWmiClassInfo(hypervWmiClassInfoListPtr list, hypervWmiClassInfoPtr *info)
-{
-    *info = list->objs[0];
-    return 0;
-}
-
-
 int
-hypervGetWmiClassList(hypervPrivate *priv, hypervWmiClassInfoListPtr wmiInfo,
+hypervGetWmiClassList(hypervPrivate *priv, hypervWmiClassInfoPtr wmiInfo,
                       virBufferPtr query, hypervObject **wmiClass)
 {
     hypervWqlQuery wqlQuery = HYPERV_WQL_QUERY_INITIALIZER;
@@ -141,13 +133,9 @@ hypervVerifyResponse(WsManClient *client, WsXmlDocH response,
 hypervInvokeParamsListPtr
 hypervCreateInvokeParamsList(const char *method,
                              const char *selector,
-                             hypervWmiClassInfoListPtr obj)
+                             hypervWmiClassInfoPtr info)
 {
     hypervInvokeParamsListPtr params = NULL;
-    hypervWmiClassInfoPtr info = NULL;
-
-    if (hypervGetWmiClassInfo(obj, &info) < 0)
-        return NULL;
 
     params = g_new0(hypervInvokeParamsList, 1);
 
@@ -259,13 +247,11 @@ int
 hypervAddEprParam(hypervInvokeParamsListPtr params,
                   const char *name,
                   virBufferPtr query,
-                  hypervWmiClassInfoListPtr eprInfo)
+                  hypervWmiClassInfoPtr classInfo)
 {
     hypervParamPtr p = NULL;
-    hypervWmiClassInfoPtr classInfo = NULL;
 
-    if (hypervGetWmiClassInfo(eprInfo, &classInfo) < 0 ||
-        hypervCheckParams(params) < 0)
+    if (hypervCheckParams(params) < 0)
         return -1;
 
     p = &params->params[params->nbParams];
@@ -290,17 +276,12 @@ hypervAddEprParam(hypervInvokeParamsListPtr params,
  * Returns a pointer to the GHashTable on success, otherwise NULL.
  */
 GHashTable *
-hypervCreateEmbeddedParam(hypervWmiClassInfoListPtr info)
+hypervCreateEmbeddedParam(hypervWmiClassInfoPtr classInfo)
 {
     size_t i;
     size_t count;
     g_autoptr(GHashTable) table = NULL;
     XmlSerializerInfo *typeinfo = NULL;
-    hypervWmiClassInfoPtr classInfo = NULL;
-
-    /* Get the typeinfo out of the class info list */
-    if (hypervGetWmiClassInfo(info, &classInfo) < 0)
-        return NULL;
 
     typeinfo = classInfo->serializerInfo;
 
@@ -363,18 +344,13 @@ int
 hypervAddEmbeddedParam(hypervInvokeParamsListPtr params,
                        const char *name,
                        GHashTable **table,
-                       hypervWmiClassInfoListPtr info)
+                       hypervWmiClassInfoPtr classInfo)
 {
     hypervParamPtr p = NULL;
-    hypervWmiClassInfoPtr classInfo = NULL;
 
     if (hypervCheckParams(params) < 0)
         return -1;
 
-    /* Get the typeinfo out of the class info list */
-    if (hypervGetWmiClassInfo(info, &classInfo) < 0)
-        return -1;
-
     p = &params->params[params->nbParams];
     p->type = HYPERV_EMBEDDED_PARAM;
     p->embedded.name = name;
@@ -959,7 +935,7 @@ hypervEnumAndPull(hypervPrivate *priv, hypervWqlQueryPtr wqlQuery,
     WsSerializerContextH serializerContext;
     client_opt_t *options = NULL;
     char *query_string = NULL;
-    hypervWmiClassInfoPtr wmiInfo = NULL;
+    hypervWmiClassInfoPtr wmiInfo = wqlQuery->info;
     filter_t *filter = NULL;
     WsXmlDocH response = NULL;
     char *enumContext = NULL;
@@ -977,9 +953,6 @@ hypervEnumAndPull(hypervPrivate *priv, hypervWqlQueryPtr wqlQuery,
         return -1;
     }
 
-    if (hypervGetWmiClassInfo(wqlQuery->info, &wmiInfo) < 0)
-        goto cleanup;
-
     serializerContext = wsmc_get_serialization_context(priv->client);
 
     options = wsmc_options_init();
index a9fe5318e630d6704dd7ecd8b7d21dc60e2cc86b..eb273ba7cfd6b17c8b4b4b673063aa6b8a1ef1c4 100644 (file)
@@ -56,7 +56,7 @@ typedef struct _hypervWqlQuery hypervWqlQuery;
 typedef hypervWqlQuery *hypervWqlQueryPtr;
 struct _hypervWqlQuery {
     virBufferPtr query;
-    hypervWmiClassInfoListPtr info;
+    hypervWmiClassInfoPtr info;
 };
 
 int hypervEnumAndPull(hypervPrivate *priv, hypervWqlQueryPtr wqlQuery,
@@ -121,7 +121,7 @@ typedef hypervInvokeParamsList *hypervInvokeParamsListPtr;
 
 hypervInvokeParamsListPtr hypervCreateInvokeParamsList(const char *method,
                                                        const char *selector,
-                                                       hypervWmiClassInfoListPtr obj);
+                                                       hypervWmiClassInfoPtr obj);
 
 void hypervFreeInvokeParams(hypervInvokeParamsListPtr params);
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(hypervInvokeParamsList, hypervFreeInvokeParams);
@@ -132,9 +132,9 @@ int hypervAddSimpleParam(hypervInvokeParamsListPtr params, const char *name,
 int hypervAddEprParam(hypervInvokeParamsListPtr params,
                       const char *name,
                       virBufferPtr query,
-                      hypervWmiClassInfoListPtr eprInfo);
+                      hypervWmiClassInfoPtr eprInfo);
 
-GHashTable *hypervCreateEmbeddedParam(hypervWmiClassInfoListPtr info);
+GHashTable *hypervCreateEmbeddedParam(hypervWmiClassInfoPtr info);
 
 int hypervSetEmbeddedProperty(GHashTable *table,
                               const char *name,
@@ -143,7 +143,7 @@ int hypervSetEmbeddedProperty(GHashTable *table,
 int hypervAddEmbeddedParam(hypervInvokeParamsListPtr params,
                            const char *name,
                            GHashTable **table,
-                           hypervWmiClassInfoListPtr info);
+                           hypervWmiClassInfoPtr info);
 
 void hypervFreeEmbeddedParam(GHashTable *p);
 
@@ -188,7 +188,8 @@ const char *hypervReturnCodeToString(int returnCode);
 
 
 int hypervGetWmiClassList(hypervPrivate *priv,
-                          hypervWmiClassInfoListPtr wmiInfo, virBufferPtr query,
+                          hypervWmiClassInfoPtr wmiInfo,
+                          virBufferPtr query,
                           hypervObject **wmiClass);
 
 /**
index a00751013d4fbb966ec3874c5e616487292c57ef..161e9be1315ebb20fc9374e812f1de6cac48c406 100644 (file)
@@ -128,12 +128,4 @@ struct _hypervWmiClassInfo {
     hypervCimTypePtr propertyInfo;
 };
 
-
-typedef struct _hypervWmiClassInfoList hypervWmiClassInfoList;
-typedef hypervWmiClassInfoList *hypervWmiClassInfoListPtr;
-struct _hypervWmiClassInfoList {
-    size_t count;
-    hypervWmiClassInfoPtr *objs;
-};
-
 #include "hyperv_wmi_classes.generated.h"