提交 5cca4cd1 编写于 作者: M Martin Kletzander

Remove unnecessary curly brackets in src/qemu/

Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
上级 df6c14e6
......@@ -381,9 +381,8 @@ static int qemuAgentIOProcessData(qemuAgentPtr mon,
int got = nl - (data + used);
for (i = 0; i < strlen(LINE_ENDING); i++)
data[used + got + i] = '\0';
if (qemuAgentIOProcessLine(mon, data + used, msg) < 0) {
if (qemuAgentIOProcessLine(mon, data + used, msg) < 0)
return -1;
}
used += got + strlen(LINE_ENDING);
} else {
break;
......
......@@ -1179,9 +1179,8 @@ virQEMUCapsComputeCmdFlags(const char *help,
if (is_kvm && (version >= 10000 || kvm_version >= 74))
virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNET_HDR);
if (strstr(help, ",vhost=")) {
if (strstr(help, ",vhost="))
virQEMUCapsSet(qemuCaps, QEMU_CAPS_VHOST_NET);
}
/* Do not use -no-shutdown if qemu doesn't support it or SIGTERM handling
* is most likely buggy when used with -no-shutdown (which applies for qemu
......@@ -1947,9 +1946,8 @@ void virQEMUCapsDispose(void *obj)
VIR_FREE(qemuCaps->machineAliases);
VIR_FREE(qemuCaps->machineMaxCpus);
for (i = 0; i < qemuCaps->ncpuDefinitions; i++) {
for (i = 0; i < qemuCaps->ncpuDefinitions; i++)
VIR_FREE(qemuCaps->cpuDefinitions[i]);
}
VIR_FREE(qemuCaps->cpuDefinitions);
virBitmapFree(qemuCaps->flags);
......@@ -2837,9 +2835,8 @@ virQEMUCapsReset(virQEMUCapsPtr qemuCaps)
qemuCaps->arch = VIR_ARCH_NONE;
qemuCaps->usedQMP = false;
for (i = 0; i < qemuCaps->ncpuDefinitions; i++) {
for (i = 0; i < qemuCaps->ncpuDefinitions; i++)
VIR_FREE(qemuCaps->cpuDefinitions[i]);
}
VIR_FREE(qemuCaps->cpuDefinitions);
qemuCaps->ncpuDefinitions = 0;
......
......@@ -920,9 +920,8 @@ qemuSetupCgroupVcpuPin(virCgroupPtr cgroup,
size_t i;
for (i = 0; i < nvcpupin; i++) {
if (vcpuid == vcpupin[i]->vcpuid) {
if (vcpuid == vcpupin[i]->vcpuid)
return qemuSetupCgroupEmulatorPin(cgroup, vcpupin[i]->cpumask);
}
}
return -1;
......@@ -937,9 +936,8 @@ qemuSetupCgroupIOThreadsPin(virCgroupPtr cgroup,
size_t i;
for (i = 0; i < niothreadspin; i++) {
if (iothreadid == iothreadspin[i]->vcpuid) {
if (iothreadid == iothreadspin[i]->vcpuid)
return qemuSetupCgroupEmulatorPin(cgroup, iothreadspin[i]->cpumask);
}
}
return -1;
......
......@@ -8862,9 +8862,8 @@ qemuBuildCommandLine(virConnectPtr conn,
_("network disks are only supported with -drive"));
goto error;
} else {
if (VIR_STRDUP(file, disk->src->path) < 0) {
if (VIR_STRDUP(file, disk->src->path) < 0)
goto error;
}
}
/* Don't start with source if the tray is open for
......@@ -10144,9 +10143,8 @@ static int qemuStringToArgvEnv(const char *args,
start = curr;
/* accept a space in CEPH_ARGS */
if (STRPREFIX(curr, "CEPH_ARGS=-m ")) {
if (STRPREFIX(curr, "CEPH_ARGS=-m "))
start += strlen("CEPH_ARGS=-m ");
}
if (*start == '\'') {
if (start == curr)
curr++;
......
......@@ -1018,9 +1018,8 @@ qemuSharedDeviceEntryFree(void *payload, const void *name ATTRIBUTE_UNUSED)
if (!entry)
return;
for (i = 0; i < entry->ref; i++) {
for (i = 0; i < entry->ref; i++)
VIR_FREE(entry->domains[i]);
}
VIR_FREE(entry->domains);
VIR_FREE(entry);
}
......
......@@ -495,9 +495,8 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
size_t i;
virBufferAddLit(buf, "<vcpus>\n");
virBufferAdjustIndent(buf, 2);
for (i = 0; i < priv->nvcpupids; i++) {
for (i = 0; i < priv->nvcpupids; i++)
virBufferAsprintf(buf, "<vcpu pid='%d'/>\n", priv->vcpupids[i]);
}
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</vcpus>\n");
}
......
......@@ -995,9 +995,8 @@ qemuStateStop(void)
for (i = 0; i < numDomains; i++) {
flags[i] = VIR_DOMAIN_SAVE_RUNNING;
if (virDomainGetState(domains[i], &state, NULL, 0) == 0) {
if (state == VIR_DOMAIN_PAUSED) {
if (state == VIR_DOMAIN_PAUSED)
flags[i] = VIR_DOMAIN_SAVE_PAUSED;
}
}
virDomainSuspend(domains[i]);
}
......@@ -1840,9 +1839,8 @@ static int qemuDomainSuspend(virDomainPtr dom)
"%s", _("domain is pmsuspended"));
goto endjob;
} else if (state != VIR_DOMAIN_PAUSED) {
if (qemuProcessStopCPUs(driver, vm, reason, QEMU_ASYNC_JOB_NONE) < 0) {
if (qemuProcessStopCPUs(driver, vm, reason, QEMU_ASYNC_JOB_NONE) < 0)
goto endjob;
}
if (eventDetail >= 0) {
event = virDomainEventLifecycleNewFromObj(vm,
......@@ -4043,9 +4041,8 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
switch (action) {
case VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY:
if (doCoreDumpToAutoDumpPath(driver, vm, VIR_DUMP_MEMORY_ONLY) < 0) {
if (doCoreDumpToAutoDumpPath(driver, vm, VIR_DUMP_MEMORY_ONLY) < 0)
goto cleanup;
}
/* fall through */
case VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY:
......@@ -4074,15 +4071,13 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
virDomainAuditStop(vm, "destroyed");
if (!vm->persistent) {
if (!vm->persistent)
qemuDomainRemoveInactive(driver, vm);
}
break;
case VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_RESTART:
if (doCoreDumpToAutoDumpPath(driver, vm, VIR_DUMP_MEMORY_ONLY) < 0) {
if (doCoreDumpToAutoDumpPath(driver, vm, VIR_DUMP_MEMORY_ONLY) < 0)
goto cleanup;
}
/* fall through */
case VIR_DOMAIN_LIFECYCLE_CRASH_RESTART:
......@@ -4955,9 +4950,8 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom,
&targetDef) < 0)
goto cleanup;
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
if (flags & VIR_DOMAIN_AFFECT_LIVE)
targetDef = vm->def;
}
/* Coverity didn't realize that targetDef must be set if we got here. */
sa_assert(targetDef);
......@@ -4973,9 +4967,8 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom,
if (ncpumaps > targetDef->vcpus)
ncpumaps = targetDef->vcpus;
if (ncpumaps < 1) {
if (ncpumaps < 1)
goto cleanup;
}
/* initialize cpumaps */
memset(cpumaps, 0xff, maplen * ncpumaps);
......@@ -5233,9 +5226,8 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom,
/* initialize cpumaps */
memset(cpumaps, 0xff, maplen);
if (maxcpu % 8) {
if (maxcpu % 8)
cpumaps[maplen - 1] &= (1 << maxcpu % 8) - 1;
}
if (targetDef->cputune.emulatorpin) {
cpumask = targetDef->cputune.emulatorpin->cpumask;
......@@ -9532,9 +9524,8 @@ qemuSetEmulatorBandwidthLive(virDomainObjPtr vm, virCgroupPtr cgroup,
if (period == 0 && quota == 0)
return 0;
if (priv->nvcpupids == 0 || priv->vcpupids[0] == vm->pid) {
if (priv->nvcpupids == 0 || priv->vcpupids[0] == vm->pid)
return 0;
}
if (virCgroupNewEmulator(cgroup, false, &cgroup_emulator) < 0)
goto cleanup;
......@@ -10510,12 +10501,10 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
/* average is mandatory, peak and burst are optional. So if no
* average is given, we free inbound/outbound here which causes
* inbound/outbound to not be set. */
if (!bandwidth->in->average) {
if (!bandwidth->in->average)
VIR_FREE(bandwidth->in);
}
if (!bandwidth->out->average) {
if (!bandwidth->out->average)
VIR_FREE(bandwidth->out);
}
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
if (VIR_ALLOC(newBandwidth) < 0)
......@@ -14860,9 +14849,8 @@ qemuDomainSnapshotReparentChildren(void *payload,
virDomainSnapshotObjPtr snap = payload;
virQEMUSnapReparentPtr rep = data;
if (rep->err < 0) {
if (rep->err < 0)
return;
}
VIR_FREE(snap->def->parent);
snap->parent = rep->parent;
......@@ -15036,9 +15024,8 @@ static int qemuDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd,
qemuDomainObjExitMonitor(driver, vm);
endjob:
if (!qemuDomainObjEndJob(driver, vm)) {
if (!qemuDomainObjEndJob(driver, vm))
vm = NULL;
}
cleanup:
if (vm)
......@@ -15905,9 +15892,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
}
device = qemuDiskPathToAlias(vm, path, &idx);
if (!device) {
if (!device)
goto endjob;
}
disk = vm->def->disks[idx];
if (disk->mirror) {
virReportError(VIR_ERR_BLOCK_COPY_ACTIVE,
......@@ -17032,9 +17018,8 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
}
device = qemuDiskPathToAlias(vm, disk, NULL);
if (!device) {
if (!device)
goto endjob;
}
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
qemuDomainObjEnterMonitor(driver, vm);
......
......@@ -468,9 +468,8 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver,
goto cleanup;
}
if (!(devstr = qemuBuildControllerDevStr(vm->def, controller, priv->qemuCaps, NULL))) {
if (!(devstr = qemuBuildControllerDevStr(vm->def, controller, priv->qemuCaps, NULL)))
goto cleanup;
}
}
if (VIR_REALLOC_N(vm->def->controllers, vm->def->ncontrollers+1) < 0)
......@@ -3095,9 +3094,8 @@ qemuFindDisk(virDomainDefPtr def, const char *dst)
size_t i;
for (i = 0; i < def->ndisks; i++) {
if (STREQ(def->disks[i]->dst, dst)) {
if (STREQ(def->disks[i]->dst, dst))
return i;
}
}
return -1;
......
......@@ -2853,9 +2853,8 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, 0);
endjob:
if (!qemuMigrationJobFinish(driver, vm)) {
if (!qemuMigrationJobFinish(driver, vm))
vm = NULL;
}
goto cleanup;
}
......
......@@ -565,9 +565,8 @@ static void qemuMonitorJSONHandleWatchdog(qemuMonitorPtr mon, virJSONValuePtr da
{
const char *action;
int actionID;
if (!(action = virJSONValueObjectGetString(data, "action"))) {
if (!(action = virJSONValueObjectGetString(data, "action")))
VIR_WARN("missing action in watchdog event");
}
if (action) {
if ((actionID = qemuMonitorWatchdogActionTypeFromString(action)) < 0) {
VIR_WARN("unknown action %s in watchdog event", action);
......@@ -602,9 +601,8 @@ qemuMonitorJSONHandleIOError(qemuMonitorPtr mon, virJSONValuePtr data)
action = "ignore";
}
if ((device = virJSONValueObjectGetString(data, "device")) == NULL) {
if ((device = virJSONValueObjectGetString(data, "device")) == NULL)
VIR_WARN("missing device in disk io error event");
}
if (virJSONValueObjectGetBoolean(data, "nospace", &nospc) == 0 && nospc)
reason = "enospc";
......@@ -4451,9 +4449,8 @@ int qemuMonitorJSONGetBlockIoThrottle(qemuMonitorPtr mon,
virJSONValuePtr result = NULL;
cmd = qemuMonitorJSONMakeCommand("query-block", NULL);
if (!cmd) {
if (!cmd)
return -1;
}
ret = qemuMonitorJSONCommand(mon, cmd, &result);
......@@ -4485,9 +4482,8 @@ int qemuMonitorJSONSystemWakeup(qemuMonitorPtr mon)
virJSONValuePtr reply = NULL;
cmd = qemuMonitorJSONMakeCommand("system_wakeup", NULL);
if (!cmd) {
if (!cmd)
return -1;
}
ret = qemuMonitorJSONCommand(mon, cmd, &reply);
......
......@@ -123,9 +123,8 @@ int qemuMonitorTextIOProcess(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
*/
if (msg->txLength > 0) {
char *tmp;
if ((tmp = strchr(msg->txBuffer, '\r'))) {
if ((tmp = strchr(msg->txBuffer, '\r')))
*tmp = '\0';
}
}
/* QEMU echos the command back to us, full of control
......@@ -144,9 +143,8 @@ int qemuMonitorTextIOProcess(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
skip = strstr(data + used, msg->txBuffer);
/* After the junk we should have a line ending... */
if (skip) {
if (skip)
start = strstr(skip + strlen(msg->txBuffer), LINE_ENDING);
}
/* ... then our command reply data, following by a (qemu) prompt */
if (start) {
......
......@@ -627,9 +627,8 @@ qemuProcessFakeReboot(void *opaque)
cleanup:
if (vm) {
if (ret == -1) {
if (ret == -1)
ignore_value(qemuProcessKill(vm, VIR_QEMU_PROCESS_KILL_FORCE));
}
if (virObjectUnref(vm))
virObjectUnlock(vm);
}
......@@ -1830,9 +1829,8 @@ qemuProcessExtractTTYPath(const char *haystack,
VIR_FREE(*path);
/* First look for our magic string */
if (!(tmp = strstr(haystack + *offset, needle))) {
if (!(tmp = strstr(haystack + *offset, needle)))
return 1;
}
tmp += sizeof(needle);
dev = tmp;
......@@ -3470,9 +3468,8 @@ qemuProcessReconnect(void *opaque)
priv->agentError = true;
}
if (qemuUpdateActivePCIHostdevs(driver, obj->def) < 0) {
if (qemuUpdateActivePCIHostdevs(driver, obj->def) < 0)
goto error;
}
if (qemuUpdateActiveUSBHostdevs(driver, obj->def) < 0)
goto error;
......@@ -4511,9 +4508,8 @@ int qemuProcessStart(virConnectPtr conn,
}
VIR_DEBUG("Writing early domain status to disk");
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
goto cleanup;
}
VIR_DEBUG("Waiting for handshake from child");
if (virCommandHandshakeWait(cmd) < 0) {
......@@ -4562,9 +4558,8 @@ int qemuProcessStart(virConnectPtr conn,
}
VIR_DEBUG("Labelling done, completing handshake to child");
if (virCommandHandshakeNotify(cmd) < 0) {
if (virCommandHandshakeNotify(cmd) < 0)
goto cleanup;
}
VIR_DEBUG("Handshake complete, child running");
if (migrateFrom)
......@@ -4929,9 +4924,8 @@ void qemuProcessStop(virQEMUDriverPtr driver,
/* Clear out dynamically assigned labels */
for (i = 0; i < vm->def->nseclabels; i++) {
if (vm->def->seclabels[i]->type == VIR_DOMAIN_SECLABEL_DYNAMIC) {
if (vm->def->seclabels[i]->type == VIR_DOMAIN_SECLABEL_DYNAMIC)
VIR_FREE(vm->def->seclabels[i]->label);
}
VIR_FREE(vm->def->seclabels[i]->imagelabel);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册