]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
hyperv: move hypervGetWmiClass to hyperv_wmi.h
authorMatt Coleman <mcoleman@datto.com>
Tue, 3 Nov 2020 00:22:04 +0000 (19:22 -0500)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 3 Nov 2020 10:28:25 +0000 (11:28 +0100)
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/hyperv/hyperv_driver.c
src/hyperv/hyperv_wmi.c
src/hyperv/hyperv_wmi.h

index c1748eed7026e72103825e225817492755a74846..de38dce9dbee60e72dedb517a93ba09aaae601b4 100644 (file)
@@ -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)
index 42ab00e6293fba2621f4adea4eae74edc194bdeb..8e5d99ad7028f97bf83dda39b9d468e87fb0c428 100644 (file)
@@ -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;
index c8bb82ca6b2e8d2a7ab6df7d8a464d23127bd968..72c8e546780d5c40c7cf00449f21a9052e1bbed9 100644 (file)
@@ -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
  */