1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

esx: Simplify some esxVI_Boolean to bool

This commit is contained in:
Matthias Bolte 2011-05-01 21:57:45 +02:00
parent 93f31b073d
commit 483ed20ae6
3 changed files with 22 additions and 30 deletions

View File

@ -1511,8 +1511,7 @@ esxNumberOfDomains(virConnectPtr conn)
}
return esxVI_LookupNumberOfDomainsByPowerState
(priv->primary, esxVI_VirtualMachinePowerState_PoweredOn,
esxVI_Boolean_False);
(priv->primary, esxVI_VirtualMachinePowerState_PoweredOn, false);
}
@ -2935,8 +2934,7 @@ esxNumberOfDefinedDomains(virConnectPtr conn)
}
return esxVI_LookupNumberOfDomainsByPowerState
(priv->primary, esxVI_VirtualMachinePowerState_PoweredOn,
esxVI_Boolean_True);
(priv->primary, esxVI_VirtualMachinePowerState_PoweredOn, true);
}

View File

@ -2006,7 +2006,7 @@ esxVI_GetManagedObjectReference(esxVI_ObjectContent *objectContent,
int
esxVI_LookupNumberOfDomainsByPowerState(esxVI_Context *ctx,
esxVI_VirtualMachinePowerState powerState,
esxVI_Boolean inverse)
bool inverse)
{
bool success = false;
esxVI_String *propertyNameList = NULL;
@ -2034,10 +2034,8 @@ esxVI_LookupNumberOfDomainsByPowerState(esxVI_Context *ctx,
goto cleanup;
}
if ((inverse != esxVI_Boolean_True &&
powerState_ == powerState) ||
(inverse == esxVI_Boolean_True &&
powerState_ != powerState)) {
if ((!inverse && powerState_ == powerState) ||
( inverse && powerState_ != powerState)) {
count++;
}
} else {
@ -2478,7 +2476,7 @@ esxVI_LookupVirtualMachineByUuidAndPrepareForTask
esxVI_String *completePropertyNameList = NULL;
esxVI_VirtualMachineQuestionInfo *questionInfo = NULL;
esxVI_TaskInfo *pendingTaskInfoList = NULL;
esxVI_Boolean blocked = esxVI_Boolean_Undefined;
bool blocked;
if (esxVI_String_DeepCopyList(&completePropertyNameList,
propertyNameList) < 0 ||
@ -2874,8 +2872,7 @@ int
esxVI_LookupAndHandleVirtualMachineQuestion(esxVI_Context *ctx,
const unsigned char *uuid,
esxVI_Occurrence occurrence,
bool autoAnswer,
esxVI_Boolean *blocked)
bool autoAnswer, bool *blocked)
{
int result = -1;
esxVI_ObjectContent *virtualMachine = NULL;
@ -3543,8 +3540,8 @@ esxVI_LookupAutoStartPowerInfoList(esxVI_Context *ctx,
int
esxVI_HandleVirtualMachineQuestion
(esxVI_Context *ctx, esxVI_ManagedObjectReference *virtualMachine,
esxVI_VirtualMachineQuestionInfo *questionInfo,
bool autoAnswer, esxVI_Boolean *blocked)
esxVI_VirtualMachineQuestionInfo *questionInfo, bool autoAnswer,
bool *blocked)
{
int result = -1;
esxVI_ElementDescription *elementDescription = NULL;
@ -3553,12 +3550,12 @@ esxVI_HandleVirtualMachineQuestion
int answerIndex = 0;
char *possibleAnswers = NULL;
if (blocked == NULL || *blocked != esxVI_Boolean_Undefined) {
if (blocked == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
*blocked = esxVI_Boolean_False;
*blocked = false;
if (questionInfo->choice->choiceInfo != NULL) {
for (elementDescription = questionInfo->choice->choiceInfo;
@ -3594,7 +3591,7 @@ esxVI_HandleVirtualMachineQuestion
"question is '%s', no possible answers"),
questionInfo->text);
*blocked = esxVI_Boolean_True;
*blocked = true;
goto cleanup;
} else if (answerChoice == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
@ -3603,7 +3600,7 @@ esxVI_HandleVirtualMachineQuestion
"default answer is specified"), questionInfo->text,
possibleAnswers);
*blocked = esxVI_Boolean_True;
*blocked = true;
goto cleanup;
}
@ -3629,7 +3626,7 @@ esxVI_HandleVirtualMachineQuestion
questionInfo->text);
}
*blocked = esxVI_Boolean_True;
*blocked = true;
goto cleanup;
}
@ -3667,7 +3664,7 @@ esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
esxVI_PropertyChange *propertyChange = NULL;
esxVI_AnyType *propertyValue = NULL;
esxVI_TaskInfoState state = esxVI_TaskInfoState_Undefined;
esxVI_Boolean blocked = esxVI_Boolean_Undefined;
bool blocked;
esxVI_TaskInfo *taskInfo = NULL;
if (errorMessage == NULL || *errorMessage != NULL) {
@ -3725,13 +3722,12 @@ esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
}
if (taskInfo->cancelable == esxVI_Boolean_True) {
if (esxVI_CancelTask(ctx, task) < 0 &&
blocked == esxVI_Boolean_True) {
if (esxVI_CancelTask(ctx, task) < 0 && blocked) {
VIR_ERROR(_("Cancelable task is blocked by an "
"unanswered question but cancelation "
"failed"));
}
} else if (blocked == esxVI_Boolean_True) {
} else if (blocked) {
VIR_ERROR(_("Non-cancelable task is blocked by an "
"unanswered question"));
}

View File

@ -351,7 +351,7 @@ int esxVI_GetManagedObjectReference(esxVI_ObjectContent *objectContent,
int esxVI_LookupNumberOfDomainsByPowerState
(esxVI_Context *ctx, esxVI_VirtualMachinePowerState powerState,
esxVI_Boolean inverse);
bool inverse);
int esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
int *id, char **name, unsigned char *uuid);
@ -427,8 +427,7 @@ int esxVI_LookupPendingTaskInfoListByVirtualMachine
int esxVI_LookupAndHandleVirtualMachineQuestion(esxVI_Context *ctx,
const unsigned char *uuid,
esxVI_Occurrence occurrence,
bool autoAnswer,
esxVI_Boolean *blocked);
bool autoAnswer, bool *blocked);
int esxVI_LookupRootSnapshotTreeList
(esxVI_Context *ctx, const unsigned char *virtualMachineUuid,
@ -460,10 +459,9 @@ int esxVI_LookupAutoStartPowerInfoList(esxVI_Context *ctx,
esxVI_AutoStartPowerInfo **powerInfoList);
int esxVI_HandleVirtualMachineQuestion
(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine,
esxVI_VirtualMachineQuestionInfo *questionInfo,
bool autoAnswer, esxVI_Boolean *blocked);
(esxVI_Context *ctx, esxVI_ManagedObjectReference *virtualMachine,
esxVI_VirtualMachineQuestionInfo *questionInfo, bool autoAnswer,
bool *blocked);
int esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
esxVI_ManagedObjectReference *task,