hyperv: remove hypervWmiClassInfoList, hypervWmiClassInfoListPtr, and _hypervWmiClassInfoList

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Matt Coleman <matt@datto.com>
This commit is contained in:
Matt Coleman 2020-11-09 03:43:10 -05:00 committed by Daniel P. Berrangé
parent 0e43ccb838
commit 8a9eb5de0c
4 changed files with 21 additions and 62 deletions

View File

@ -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

View File

@ -47,16 +47,8 @@
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();

View 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);
/**

View 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"