hyperv: move hypervGetWmiClass to hyperv_wmi.h

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Matt Coleman 2020-11-02 19:22:04 -05:00 committed by Michal Privoznik
parent 58ae6be649
commit add5cd8a3c
3 changed files with 19 additions and 24 deletions

View File

@ -48,20 +48,6 @@ VIR_LOG_INIT("hyperv.hyperv_driver");
* wrapper functions for commonly-accessed WMI objects and interfaces. * 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 static int
hypervGetProcessorsByName(hypervPrivate *priv, const char *name, hypervGetProcessorsByName(hypervPrivate *priv, const char *name,
Win32_Processor **processorList) Win32_Processor **processorList)

View File

@ -918,8 +918,7 @@ hypervInvokeMethod(hypervPrivate *priv,
MSVM_CONCRETEJOB_WQL_SELECT MSVM_CONCRETEJOB_WQL_SELECT
"WHERE InstanceID = '%s'", instanceID); "WHERE InstanceID = '%s'", instanceID);
if (hypervGetWmiClassList(priv, Msvm_ConcreteJob_WmiInfo, &query, if (hypervGetWmiClass(Msvm_ConcreteJob, &job) < 0 || !job)
(hypervObject **)&job) < 0 || job == NULL)
goto cleanup; goto cleanup;
jobState = job->data.common->JobState; jobState = job->data.common->JobState;
@ -1333,8 +1332,7 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain,
MSVM_CONCRETEJOB_WQL_SELECT MSVM_CONCRETEJOB_WQL_SELECT
"WHERE InstanceID = '%s'", instanceID); "WHERE InstanceID = '%s'", instanceID);
if (hypervGetWmiClassList(priv, Msvm_ConcreteJob_WmiInfo, &query, if (hypervGetWmiClass(Msvm_ConcreteJob, &concreteJob) < 0)
(hypervObject **)&concreteJob) < 0)
goto cleanup; goto cleanup;
if (concreteJob == NULL) { if (concreteJob == NULL) {
@ -1523,8 +1521,7 @@ hypervMsvmComputerSystemFromUUID(hypervPrivate *priv, const char *uuid,
"WHERE " MSVM_COMPUTERSYSTEM_WQL_VIRTUAL "WHERE " MSVM_COMPUTERSYSTEM_WQL_VIRTUAL
"AND Name = '%s'", uuid); "AND Name = '%s'", uuid);
if (hypervGetWmiClassList(priv, Msvm_ComputerSystem_WmiInfo, &query, if (hypervGetWmiClass(Msvm_ComputerSystem, computerSystem) < 0)
(hypervObject **)computerSystem) < 0)
return -1; return -1;
if (!*computerSystem) { if (!*computerSystem) {
@ -1566,8 +1563,7 @@ hypervGetMsvmVirtualSystemSettingDataFromUUID(hypervPrivate *priv,
"ResultClass = Msvm_VirtualSystemSettingData", "ResultClass = Msvm_VirtualSystemSettingData",
uuid_string); uuid_string);
if (hypervGetWmiClassList(priv, Msvm_VirtualSystemSettingData_WmiInfo, &query, if (hypervGetWmiClass(Msvm_VirtualSystemSettingData, list) < 0 || !*list)
(hypervObject **)list) < 0 || *list == NULL)
return -1; return -1;
return 0; return 0;
@ -1587,8 +1583,7 @@ hypervGetMsvmMemorySettingDataFromVSSD(hypervPrivate *priv,
"ResultClass = Msvm_MemorySettingData", "ResultClass = Msvm_MemorySettingData",
vssd_instanceid); vssd_instanceid);
if (hypervGetWmiClassList(priv, Msvm_MemorySettingData_WmiInfo, &query, if (hypervGetWmiClass(Msvm_MemorySettingData, list) < 0 || !*list)
(hypervObject **)list) < 0 || *list == NULL)
return -1; return -1;
return 0; return 0;

View File

@ -205,6 +205,20 @@ int hypervGetWmiClassList(hypervPrivate *priv,
hypervWmiClassInfoListPtr wmiInfo, virBufferPtr query, hypervWmiClassInfoListPtr wmiInfo, virBufferPtr query,
hypervObject **wmiClass); 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 * Msvm_ComputerSystem
*/ */