Signed-off-by: Matt Coleman <m...@datto.com>
---
 src/hyperv/hyperv_driver.c | 14 --------------
 src/hyperv/hyperv_wmi.c    | 15 +++++----------
 src/hyperv/hyperv_wmi.h    | 14 ++++++++++++++
 3 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index c1748eed70..de38dce9db 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -48,20 +48,6 @@ VIR_LOG_INIT("hyperv.hyperv_driver");
  * wrapper functions for commonly-accessed WMI objects and interfaces.
  */
 
-/**
- * hypervGetWmiClass:
- * @type: the type of the class being retrieved from WMI
- * @class: double pointer where the class data will be stored
- *
- * Retrieve one or more classes from WMI.
- *
- * The following variables must exist in the caller:
- *   1. hypervPrivate *priv
- *   2. virBuffer query
- */
-#define hypervGetWmiClass(type, class) \
-    hypervGetWmiClassList(priv, type ## _WmiInfo, &query, (hypervObject 
**)class)
-
 static int
 hypervGetProcessorsByName(hypervPrivate *priv, const char *name,
                           Win32_Processor **processorList)
diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c
index 42ab00e629..8e5d99ad70 100644
--- a/src/hyperv/hyperv_wmi.c
+++ b/src/hyperv/hyperv_wmi.c
@@ -918,8 +918,7 @@ hypervInvokeMethod(hypervPrivate *priv,
                                MSVM_CONCRETEJOB_WQL_SELECT
                                "WHERE InstanceID = '%s'", instanceID);
 
-            if (hypervGetWmiClassList(priv, Msvm_ConcreteJob_WmiInfo, &query,
-                                      (hypervObject **)&job) < 0 || job == 
NULL)
+            if (hypervGetWmiClass(Msvm_ConcreteJob, &job) < 0 || !job)
                 goto cleanup;
 
             jobState = job->data.common->JobState;
@@ -1333,8 +1332,7 @@ 
hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain,
                               MSVM_CONCRETEJOB_WQL_SELECT
                               "WHERE InstanceID = '%s'", instanceID);
 
-            if (hypervGetWmiClassList(priv, Msvm_ConcreteJob_WmiInfo, &query,
-                                      (hypervObject **)&concreteJob) < 0)
+            if (hypervGetWmiClass(Msvm_ConcreteJob, &concreteJob) < 0)
                 goto cleanup;
 
             if (concreteJob == NULL) {
@@ -1523,8 +1521,7 @@ hypervMsvmComputerSystemFromUUID(hypervPrivate *priv, 
const char *uuid,
                        "WHERE " MSVM_COMPUTERSYSTEM_WQL_VIRTUAL
                        "AND Name = '%s'", uuid);
 
-    if (hypervGetWmiClassList(priv, Msvm_ComputerSystem_WmiInfo, &query,
-                              (hypervObject **)computerSystem) < 0)
+    if (hypervGetWmiClass(Msvm_ComputerSystem, computerSystem) < 0)
         return -1;
 
     if (!*computerSystem) {
@@ -1566,8 +1563,7 @@ 
hypervGetMsvmVirtualSystemSettingDataFromUUID(hypervPrivate *priv,
                       "ResultClass = Msvm_VirtualSystemSettingData",
                       uuid_string);
 
-    if (hypervGetWmiClassList(priv, Msvm_VirtualSystemSettingData_WmiInfo, 
&query,
-                              (hypervObject **)list) < 0 || *list == NULL)
+    if (hypervGetWmiClass(Msvm_VirtualSystemSettingData, list) < 0 || !*list)
         return -1;
 
     return 0;
@@ -1587,8 +1583,7 @@ hypervGetMsvmMemorySettingDataFromVSSD(hypervPrivate 
*priv,
                       "ResultClass = Msvm_MemorySettingData",
                       vssd_instanceid);
 
-    if (hypervGetWmiClassList(priv, Msvm_MemorySettingData_WmiInfo, &query,
-                              (hypervObject **)list) < 0 || *list == NULL)
+    if (hypervGetWmiClass(Msvm_MemorySettingData, list) < 0 || !*list)
         return -1;
 
     return 0;
diff --git a/src/hyperv/hyperv_wmi.h b/src/hyperv/hyperv_wmi.h
index c8bb82ca6b..72c8e54678 100644
--- a/src/hyperv/hyperv_wmi.h
+++ b/src/hyperv/hyperv_wmi.h
@@ -205,6 +205,20 @@ int hypervGetWmiClassList(hypervPrivate *priv,
                           hypervWmiClassInfoListPtr wmiInfo, virBufferPtr 
query,
                           hypervObject **wmiClass);
 
+/**
+ * hypervGetWmiClass:
+ * @type: the type of the class being retrieved from WMI
+ * @class: double pointer where the class data will be stored
+ *
+ * Retrieve one or more classes from WMI.
+ *
+ * The following variables must exist in the caller:
+ *   1. hypervPrivate *priv
+ *   2. virBuffer query
+ */
+#define hypervGetWmiClass(type, class) \
+    hypervGetWmiClassList(priv, type ## _WmiInfo, &query, (hypervObject 
**)class)
+
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  * Msvm_ComputerSystem
  */
-- 
2.27.0


Reply via email to