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()
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
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;
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);
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 = ¶ms->params[params->nbParams];
* 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;
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 = ¶ms->params[params->nbParams];
p->type = HYPERV_EMBEDDED_PARAM;
p->embedded.name = name;
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;
return -1;
}
- if (hypervGetWmiClassInfo(wqlQuery->info, &wmiInfo) < 0)
- goto cleanup;
-
serializerContext = wsmc_get_serialization_context(priv->client);
options = wsmc_options_init();
typedef hypervWqlQuery *hypervWqlQueryPtr;
struct _hypervWqlQuery {
virBufferPtr query;
- hypervWmiClassInfoListPtr info;
+ hypervWmiClassInfoPtr info;
};
int hypervEnumAndPull(hypervPrivate *priv, hypervWqlQueryPtr wqlQuery,
hypervInvokeParamsListPtr hypervCreateInvokeParamsList(const char *method,
const char *selector,
- hypervWmiClassInfoListPtr obj);
+ hypervWmiClassInfoPtr obj);
void hypervFreeInvokeParams(hypervInvokeParamsListPtr params);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(hypervInvokeParamsList, hypervFreeInvokeParams);
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,
int hypervAddEmbeddedParam(hypervInvokeParamsListPtr params,
const char *name,
GHashTable **table,
- hypervWmiClassInfoListPtr info);
+ hypervWmiClassInfoPtr info);
void hypervFreeEmbeddedParam(GHashTable *p);
int hypervGetWmiClassList(hypervPrivate *priv,
- hypervWmiClassInfoListPtr wmiInfo, virBufferPtr query,
+ hypervWmiClassInfoPtr wmiInfo,
+ virBufferPtr query,
hypervObject **wmiClass);
/**
hypervCimTypePtr propertyInfo;
};
-
-typedef struct _hypervWmiClassInfoList hypervWmiClassInfoList;
-typedef hypervWmiClassInfoList *hypervWmiClassInfoListPtr;
-struct _hypervWmiClassInfoList {
- size_t count;
- hypervWmiClassInfoPtr *objs;
-};
-
#include "hyperv_wmi_classes.generated.h"