Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx> --- src/qemu/qemu_agent.c | 4 +- src/qemu/qemu_alias.c | 2 +- src/qemu/qemu_block.c | 2 +- src/qemu/qemu_capabilities.c | 20 +++++----- src/qemu/qemu_command.c | 18 ++++----- src/qemu/qemu_domain.c | 32 ++++++++-------- src/qemu/qemu_domain_address.c | 12 +++--- src/qemu/qemu_driver.c | 68 +++++++++++++++++----------------- src/qemu/qemu_hostdev.c | 2 +- src/qemu/qemu_hotplug.c | 8 ++-- src/qemu/qemu_migration.c | 2 +- src/qemu/qemu_monitor.c | 2 +- src/qemu/qemu_monitor_json.c | 4 +- src/qemu/qemu_parse_command.c | 6 +-- src/qemu/qemu_process.c | 10 ++--- 15 files changed, 96 insertions(+), 96 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index 488a19d4a6d4..4df1bde458e5 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -220,7 +220,7 @@ qemuAgentOpenUnix(const char *monitor, pid_t cpid, bool *inProgress) if (virTimeBackOffStart(&timeout, 1, 3*1000 /* ms */) < 0) goto error; while (virTimeBackOffWait(&timeout)) { - ret = connect(monfd, (struct sockaddr *) &addr, sizeof(addr)); + ret = connect(monfd, (struct sockaddr *)&addr, sizeof(addr)); if (ret == 0) break; @@ -2225,7 +2225,7 @@ qemuAgentSetUserPassword(qemuAgentPtr mon, virJSONValuePtr reply = NULL; char *password64 = NULL; - if (!(password64 = virStringEncodeBase64((unsigned char *) password, + if (!(password64 = virStringEncodeBase64((unsigned char *)password, strlen(password)))) goto cleanup; diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c index 95d1e0370a63..9b49f9c1e163 100644 --- a/src/qemu/qemu_alias.c +++ b/src/qemu/qemu_alias.c @@ -92,7 +92,7 @@ qemuAssignDeviceChrAlias(virDomainDefPtr def, if (chr->info.alias) return 0; - switch ((virDomainChrDeviceType) chr->deviceType) { + switch ((virDomainChrDeviceType)chr->deviceType) { case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL: prefix = "parallel"; break; diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index c0cf6a95ad8b..e648fb9625f1 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -987,7 +987,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src) int actualType = virStorageSourceGetActualType(src); virJSONValuePtr fileprops = NULL; - switch ((virStorageType) actualType) { + switch ((virStorageType)actualType) { case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_FILE: case VIR_STORAGE_TYPE_DIR: diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 833c75514c25..312984bac61e 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2359,7 +2359,7 @@ virQEMUCapsProbeQMPTPM(virQEMUCapsPtr qemuCaps, for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsTPMModelsToCaps); i++) { const char *needle = virDomainTPMModelTypeToString( virQEMUCapsTPMModelsToCaps[i].type); - if (virStringListHasString((const char **) entries, needle)) + if (virStringListHasString((const char **)entries, needle)) virQEMUCapsSet(qemuCaps, virQEMUCapsTPMModelsToCaps[i].caps); } @@ -2373,7 +2373,7 @@ virQEMUCapsProbeQMPTPM(virQEMUCapsPtr qemuCaps, for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsTPMTypesToCaps); i++) { const char *needle = virDomainTPMBackendTypeToString( virQEMUCapsTPMTypesToCaps[i].type); - if (virStringListHasString((const char **) entries, needle)) + if (virStringListHasString((const char **)entries, needle)) virQEMUCapsSet(qemuCaps, virQEMUCapsTPMTypesToCaps[i].caps); } } @@ -3449,11 +3449,11 @@ virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps) virBufferAdjustIndent(&buf, 2); virBufferAsprintf(&buf, "<qemuctime>%llu</qemuctime>\n", - (long long) qemuCaps->ctime); + (long long)qemuCaps->ctime); virBufferAsprintf(&buf, "<selfctime>%llu</selfctime>\n", - (long long) qemuCaps->libvirtCtime); + (long long)qemuCaps->libvirtCtime); virBufferAsprintf(&buf, "<selfvers>%lu</selfvers>\n", - (unsigned long) qemuCaps->libvirtVersion); + (unsigned long)qemuCaps->libvirtVersion); if (qemuCaps->usedQMP) virBufferAddLit(&buf, "<usedQMP/>\n"); @@ -3595,7 +3595,7 @@ virQEMUCapsIsValid(void *data, VIR_DEBUG("Outdated capabilities for '%s': QEMU binary changed " "(%lld vs %lld)", qemuCaps->binary, - (long long) sb.st_ctime, (long long) qemuCaps->ctime); + (long long)sb.st_ctime, (long long)qemuCaps->ctime); return false; } @@ -3970,10 +3970,10 @@ virQEMUCapsInitQMPCommandAbort(virQEMUCapsInitQMPCommandPtr cmd) if (cmd->pid != 0) { char ebuf[1024]; - VIR_DEBUG("Killing QMP caps process %lld", (long long) cmd->pid); + VIR_DEBUG("Killing QMP caps process %lld", (long long)cmd->pid); if (virProcessKill(cmd->pid, SIGKILL) < 0 && errno != ESRCH) VIR_ERROR(_("Failed to kill process %lld: %s"), - (long long) cmd->pid, + (long long)cmd->pid, virStrerror(errno, ebuf, sizeof(ebuf))); VIR_FREE(*cmd->qmperr); @@ -4451,7 +4451,7 @@ virQEMUCapsCompareArch(const void *payload, const void *name ATTRIBUTE_UNUSED, const void *opaque) { - struct virQEMUCapsSearchData *data = (struct virQEMUCapsSearchData *) opaque; + struct virQEMUCapsSearchData *data = (struct virQEMUCapsSearchData *)opaque; const virQEMUCaps *qemuCaps = payload; return qemuCaps->arch == data->arch; @@ -4621,7 +4621,7 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps, cpus = qemuCaps->tcgCPUModels; filtered = virDomainCapsCPUModelsFilter(cpus, - (const char **) models, + (const char **)models, blacklist); virStringListFree(models); } diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 418729b9881e..79beec48dadd 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1035,7 +1035,7 @@ qemuGetDriveSourceString(virStorageSourcePtr src, if (virStorageSourceIsEmpty(src)) return 1; - switch ((virStorageType) actualType) { + switch ((virStorageType)actualType) { case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_FILE: case VIR_STORAGE_TYPE_DIR: @@ -2618,7 +2618,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, *devstr = NULL; - switch ((virDomainControllerType) def->type) { + switch ((virDomainControllerType)def->type) { case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: switch ((virDomainControllerModelSCSI) def->model) { case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: @@ -3923,7 +3923,7 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def, goto error; } - switch ((virDomainInputType) dev->type) { + switch ((virDomainInputType)dev->type) { case VIR_DOMAIN_INPUT_TYPE_MOUSE: if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_MOUSE) || (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW && @@ -4489,7 +4489,7 @@ qemuBuildPCIHostdevDevStr(const virDomainDef *def, int backend = pcisrc->backend; /* caller has to assign proper passthrough backend type */ - switch ((virDomainHostdevSubsysPCIBackendType) backend) { + switch ((virDomainHostdevSubsysPCIBackendType)backend) { case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM: virBufferAddLit(&buf, "pci-assign"); if (configfd && *configfd) @@ -6116,7 +6116,7 @@ qemuBuildClockCommandLine(virCommandPtr cmd, } for (i = 0; i < def->clock.ntimers; i++) { - switch ((virDomainTimerNameType) def->clock.timers[i]->name) { + switch ((virDomainTimerNameType)def->clock.timers[i]->name) { case VIR_DOMAIN_TIMER_NAME_PLATFORM: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unsupported timer type (name) '%s'"), @@ -8051,7 +8051,7 @@ qemuBuildVhostuserCommandLine(virQEMUDriverPtr driver, goto error; } - switch ((virDomainChrType) net->data.vhostuser->type) { + switch ((virDomainChrType)net->data.vhostuser->type) { case VIR_DOMAIN_CHR_TYPE_UNIX: if (!(chardev = qemuBuildChrChardevStr(logManager, cmd, cfg, def, net->data.vhostuser, @@ -10126,7 +10126,7 @@ qemuBuildChannelChrDeviceStr(char **deviceStr, char *addr = NULL; int port; - switch ((virDomainChrChannelTargetType) chr->targetType) { + switch ((virDomainChrChannelTargetType)chr->targetType) { case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD: addr = virSocketAddrFormat(chr->target.addr); @@ -10164,7 +10164,7 @@ qemuBuildConsoleChrDeviceStr(char **deviceStr, { int ret = -1; - switch ((virDomainChrConsoleTargetType) chr->targetType) { + switch ((virDomainChrConsoleTargetType)chr->targetType) { case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP: case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM: if (!(*deviceStr = qemuBuildSclpDevStr(chr))) @@ -10204,7 +10204,7 @@ qemuBuildChrDeviceStr(char **deviceStr, { int ret = -1; - switch ((virDomainChrDeviceType) chr->deviceType) { + switch ((virDomainChrDeviceType)chr->deviceType) { case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: ret = qemuBuildSerialChrDeviceStr(deviceStr, vmdef, chr, qemuCaps); break; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 326c939c85c0..f46b0ad89761 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2465,7 +2465,7 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, xmlNodePtr next; for (next = node->children; next; next = next->next) { - int ns = qemuDomainNamespaceTypeFromString((const char *) next->name); + int ns = qemuDomainNamespaceTypeFromString((const char *)next->name); if (ns < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -3657,7 +3657,7 @@ qemuDomainChrSourceDefValidate(const virDomainChrSourceDef *def) static int qemuDomainChrSerialTargetTypeToAddressType(int targetType) { - switch ((virDomainChrSerialTargetType) targetType) { + switch ((virDomainChrSerialTargetType)targetType) { case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA; case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: @@ -3708,11 +3708,11 @@ qemuDomainChrTargetDefValidate(const virDomainChrDef *chr) { int expected; - switch ((virDomainChrDeviceType) chr->deviceType) { + switch ((virDomainChrDeviceType)chr->deviceType) { case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: /* Validate target type */ - switch ((virDomainChrSerialTargetType) chr->targetType) { + switch ((virDomainChrSerialTargetType)chr->targetType) { case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: @@ -4926,7 +4926,7 @@ qemuDomainDeviceDefValidateController(const virDomainControllerDef *controller, if (qemuDomainDeviceDefValidateControllerAttributes(controller) < 0) return -1; - switch ((virDomainControllerType) controller->type) { + switch ((virDomainControllerType)controller->type) { case VIR_DOMAIN_CONTROLLER_TYPE_IDE: ret = qemuDomainDeviceDefValidateControllerIDE(controller, def); break; @@ -4994,7 +4994,7 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev, def->emulator))) return -1; - switch ((virDomainDeviceType) dev->type) { + switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_NET: ret = qemuDomainDeviceDefValidateNetwork(dev->data.net); break; @@ -5337,7 +5337,7 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont, */ if (cont->opts.pciopts.numaNode >= 0 && cont->opts.pciopts.numaNode >= - (int) virDomainNumaGetNodeCount(def->numa)) { + (int)virDomainNumaGetNodeCount(def->numa)) { virReportError(VIR_ERR_XML_ERROR, _("%s with index %d is " "configured for a NUMA node (%d) " @@ -5393,7 +5393,7 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, /* Set the default target model */ if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && chr->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE) { - switch ((virDomainChrSerialTargetType) chr->targetType) { + switch ((virDomainChrSerialTargetType)chr->targetType) { case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL; break; @@ -6334,7 +6334,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver, * towards older libvirt versions works for such guests, we switch * it back to the default here */ if (flags & VIR_DOMAIN_XML_MIGRATABLE) { - switch ((virDomainChrSerialTargetType) serial->targetType) { + switch ((virDomainChrSerialTargetType)serial->targetType) { case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: serial->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE; @@ -9575,7 +9575,7 @@ qemuDomainGetHostdevPath(virDomainDefPtr def, switch ((virDomainHostdevMode) dev->mode) { case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS: - switch ((virDomainHostdevSubsysType) dev->source.subsys.type) { + switch ((virDomainHostdevSubsysType)dev->source.subsys.type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) { pci = virPCIDeviceNew(pcisrc->addr.domain, @@ -9617,7 +9617,7 @@ qemuDomainGetHostdevPath(virDomainDefPtr def, if (!usb) goto cleanup; - if (!(tmpPath = (char *) virUSBDeviceGetPath(usb))) + if (!(tmpPath = (char *)virUSBDeviceGetPath(usb))) goto cleanup; perm = VIR_CGROUP_DEVICE_RW; break; @@ -9642,7 +9642,7 @@ qemuDomainGetHostdevPath(virDomainDefPtr def, if (!scsi) goto cleanup; - if (!(tmpPath = (char *) virSCSIDeviceGetPath(scsi))) + if (!(tmpPath = (char *)virSCSIDeviceGetPath(scsi))) goto cleanup; perm = virSCSIDeviceGetReadonly(scsi) ? VIR_CGROUP_DEVICE_READ : VIR_CGROUP_DEVICE_RW; @@ -9655,7 +9655,7 @@ qemuDomainGetHostdevPath(virDomainDefPtr def, if (!(host = virSCSIVHostDeviceNew(hostsrc->wwpn))) goto cleanup; - if (!(tmpPath = (char *) virSCSIVHostDeviceGetPath(host))) + if (!(tmpPath = (char *)virSCSIVHostDeviceGetPath(host))) goto cleanup; perm = VIR_CGROUP_DEVICE_RW; } @@ -10077,7 +10077,7 @@ qemuDomainCreateDeviceRecursive(const char *device, } if (tcon && - lsetfilecon_raw(devicePath, (VIR_SELINUX_CTX_CONST char *) tcon) < 0) { + lsetfilecon_raw(devicePath, (VIR_SELINUX_CTX_CONST char *)tcon) < 0) { VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR if (errno != EOPNOTSUPP && errno != ENOTSUP) { VIR_WARNINGS_RESET @@ -10332,7 +10332,7 @@ qemuDomainSetupAllChardevs(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED, if (virDomainChrDefForeach(vm->def, true, qemuDomainSetupChardev, - (void *) data) < 0) + (void *)data) < 0) return -1; VIR_DEBUG("Setup all chardevs"); @@ -10848,7 +10848,7 @@ qemuDomainAttachDeviceMknodHelper(pid_t pid ATTRIBUTE_UNUSED, # ifdef WITH_SELINUX if (data->tcon && - lsetfilecon_raw(data->file, (VIR_SELINUX_CTX_CONST char *) data->tcon) < 0) { + lsetfilecon_raw(data->file, (VIR_SELINUX_CTX_CONST char *)data->tcon) < 0) { VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR if (errno != EOPNOTSUPP && errno != ENOTSUP) { VIR_WARNINGS_RESET diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 7fe9d5926c9f..ce2b0790c040 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -427,7 +427,7 @@ qemuDomainHasVirtioMMIODevicesCallback(virDomainDefPtr def ATTRIBUTE_UNUSED, if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO) { /* We can stop iterating as soon as we find the first * virtio-mmio device */ - *((bool *) opaque) = true; + *((bool *)opaque) = true; return -1; } @@ -508,11 +508,11 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, virDomainPCIConnectFlags pciFlags = (VIR_PCI_CONNECT_TYPE_PCI_DEVICE | VIR_PCI_CONNECT_HOTPLUGGABLE); - switch ((virDomainDeviceType) dev->type) { + switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_CONTROLLER: { virDomainControllerDefPtr cont = dev->data.controller; - switch ((virDomainControllerType) cont->type) { + switch ((virDomainControllerType)cont->type) { case VIR_DOMAIN_CONTROLLER_TYPE_PCI: return virDomainPCIControllerModelToConnectType(cont->model); @@ -786,7 +786,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, break; case VIR_DOMAIN_DEVICE_VIDEO: - switch ((virDomainVideoType) dev->data.video->type) { + switch ((virDomainVideoType)dev->data.video->type) { case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: return virtioFlags; @@ -824,7 +824,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, break; case VIR_DOMAIN_DEVICE_CHR: - switch ((virDomainChrSerialTargetType) dev->data.chr->targetType) { + switch ((virDomainChrSerialTargetType)dev->data.chr->targetType) { case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: return pciFlags; @@ -2346,7 +2346,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, virDomainControllerDefPtr cont = def->controllers[i]; if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) { - if ((int) cont->idx > max_idx) + if ((int)cont->idx > max_idx) max_idx = cont->idx; } } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 7484b00e23c3..016669ba81a9 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -765,36 +765,36 @@ qemuStateInitialize(bool privileged, if (chown(cfg->libDir, cfg->user, cfg->group) < 0) { virReportSystemError(errno, _("unable to set ownership of '%s' to user %d:%d"), - cfg->libDir, (int) cfg->user, - (int) cfg->group); + cfg->libDir, (int)cfg->user, + (int)cfg->group); goto error; } if (chown(cfg->cacheDir, cfg->user, cfg->group) < 0) { virReportSystemError(errno, _("unable to set ownership of '%s' to %d:%d"), - cfg->cacheDir, (int) cfg->user, - (int) cfg->group); + cfg->cacheDir, (int)cfg->user, + (int)cfg->group); goto error; } if (chown(cfg->saveDir, cfg->user, cfg->group) < 0) { virReportSystemError(errno, _("unable to set ownership of '%s' to %d:%d"), - cfg->saveDir, (int) cfg->user, - (int) cfg->group); + cfg->saveDir, (int)cfg->user, + (int)cfg->group); goto error; } if (chown(cfg->snapshotDir, cfg->user, cfg->group) < 0) { virReportSystemError(errno, _("unable to set ownership of '%s' to %d:%d"), - cfg->snapshotDir, (int) cfg->user, - (int) cfg->group); + cfg->snapshotDir, (int)cfg->user, + (int)cfg->group); goto error; } if (chown(cfg->autoDumpPath, cfg->user, cfg->group) < 0) { virReportSystemError(errno, _("unable to set ownership of '%s' to %d:%d"), - cfg->autoDumpPath, (int) cfg->user, - (int) cfg->group); + cfg->autoDumpPath, (int)cfg->user, + (int)cfg->group); goto error; } if (!(channeldir = mdir_name(cfg->channelTargetDir))) { @@ -804,8 +804,8 @@ qemuStateInitialize(bool privileged, if (chown(channeldir, cfg->user, cfg->group) < 0) { virReportSystemError(errno, _("unable to set ownership of '%s' to %d:%d"), - channeldir, (int) cfg->user, - (int) cfg->group); + channeldir, (int)cfg->user, + (int)cfg->group); VIR_FREE(channeldir); goto error; } @@ -813,22 +813,22 @@ qemuStateInitialize(bool privileged, if (chown(cfg->channelTargetDir, cfg->user, cfg->group) < 0) { virReportSystemError(errno, _("unable to set ownership of '%s' to %d:%d"), - cfg->channelTargetDir, (int) cfg->user, - (int) cfg->group); + cfg->channelTargetDir, (int)cfg->user, + (int)cfg->group); goto error; } if (chown(cfg->nvramDir, cfg->user, cfg->group) < 0) { virReportSystemError(errno, _("unable to set ownership of '%s' to %d:%d"), - cfg->nvramDir, (int) cfg->user, - (int) cfg->group); + cfg->nvramDir, (int)cfg->user, + (int)cfg->group); goto error; } if (chown(cfg->memoryBackingDir, cfg->user, cfg->group) < 0) { virReportSystemError(errno, _("unable to set ownership of '%s' to %d:%d"), - cfg->memoryBackingDir, (int) cfg->user, - (int) cfg->group); + cfg->memoryBackingDir, (int)cfg->user, + (int)cfg->group); goto error; } @@ -1405,9 +1405,9 @@ qemuGetProcessInfo(unsigned long long *cpuTime, int *lastCpu, long *vm_rss, /* In general, we cannot assume pid_t fits in int; but /proc parsing * is specific to Linux where int works fine. */ if (tid) - ret = virAsprintf(&proc, "/proc/%d/task/%d/stat", (int) pid, tid); + ret = virAsprintf(&proc, "/proc/%d/task/%d/stat", (int)pid, tid); else - ret = virAsprintf(&proc, "/proc/%d/stat", (int) pid); + ret = virAsprintf(&proc, "/proc/%d/stat", (int)pid); if (ret < 0) return -1; @@ -1444,7 +1444,7 @@ qemuGetProcessInfo(unsigned long long *cpuTime, int *lastCpu, long *vm_rss, VIR_DEBUG("Got status for %d/%d user=%llu sys=%llu cpu=%d rss=%ld", - (int) pid, tid, usertime, systime, cpu, rss); + (int)pid, tid, usertime, systime, cpu, rss); VIR_FORCE_FCLOSE(pidinfo); @@ -6558,7 +6558,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, virQEMUSaveHeaderPtr header = &data->header; qemuDomainSaveCookiePtr cookie = NULL; - if (virSaveCookieParseString(data->cookie, (virObjectPtr *) &cookie, + if (virSaveCookieParseString(data->cookie, (virObjectPtr *)&cookie, virDomainXMLOptionGetSaveCookie(driver->xmlopt)) < 0) goto cleanup; @@ -7599,7 +7599,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, int ret = -1; const char *alias = NULL; - switch ((virDomainDeviceType) dev->type) { + switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_DISK: qemuDomainObjCheckDiskTaint(driver, vm, dev->data.disk, NULL); ret = qemuDomainAttachDeviceDiskLive(driver, vm, dev); @@ -7765,7 +7765,7 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm, { int ret = -1; - switch ((virDomainDeviceType) dev->type) { + switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_DISK: ret = qemuDomainDetachDeviceDiskLive(driver, vm, dev); break; @@ -7904,7 +7904,7 @@ qemuDomainUpdateDeviceLive(virDomainObjPtr vm, int ret = -1; int idx; - switch ((virDomainDeviceType) dev->type) { + switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_DISK: qemuDomainObjCheckDiskTaint(driver, vm, dev->data.disk, NULL); ret = qemuDomainChangeDiskLive(vm, dev, driver, force); @@ -7977,7 +7977,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, virDomainRedirdevDefPtr redirdev; virDomainShmemDefPtr shmem; - switch ((virDomainDeviceType) dev->type) { + switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_DISK: disk = dev->data.disk; if (virDomainDiskIndexByName(vmdef, disk->dst, true) >= 0) { @@ -8168,7 +8168,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, virDomainMemoryDefPtr mem; int idx; - switch ((virDomainDeviceType) dev->type) { + switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_DISK: disk = dev->data.disk; if (!(det_disk = virDomainDiskRemoveByName(vmdef, disk->dst))) { @@ -8346,7 +8346,7 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDef oldDev = { .type = dev->type }; int pos; - switch ((virDomainDeviceType) dev->type) { + switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_DISK: newDisk = dev->data.disk; if ((pos = virDomainDiskIndexByName(vmdef, newDisk->dst, false)) < 0) { @@ -11671,7 +11671,7 @@ qemuDomainMemoryPeek(virDomainPtr dom, goto endjob; /* Read the memory file into buffer. */ - if (saferead(fd, buffer, size) == (ssize_t) -1) { + if (saferead(fd, buffer, size) == (ssize_t)-1) { virReportSystemError(errno, _("failed to read temporary file " "created with template %s"), tmp); @@ -14114,7 +14114,7 @@ qemuDomainSnapshotPrepareDiskExternalInactive(virDomainSnapshotDiskDefPtr snapdi int domDiskType = virStorageSourceGetActualType(domdisk->src); int snapDiskType = virStorageSourceGetActualType(snapdisk->src); - switch ((virStorageType) domDiskType) { + switch ((virStorageType)domDiskType) { case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_FILE: break; @@ -14153,7 +14153,7 @@ qemuDomainSnapshotPrepareDiskExternalInactive(virDomainSnapshotDiskDefPtr snapdi return -1; } - switch ((virStorageType) snapDiskType) { + switch ((virStorageType)snapDiskType) { case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_FILE: break; @@ -14189,7 +14189,7 @@ qemuDomainSnapshotPrepareDiskExternalActive(virDomainSnapshotDiskDefPtr snapdisk return -1; } - switch ((virStorageType) actualType) { + switch ((virStorageType)actualType) { case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_FILE: break; @@ -14307,7 +14307,7 @@ qemuDomainSnapshotPrepareDiskInternal(virDomainDiskDefPtr disk, actualType = virStorageSourceGetActualType(disk->src); - switch ((virStorageType) actualType) { + switch ((virStorageType)actualType) { case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_FILE: return 0; @@ -17497,7 +17497,7 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *disk, const char *destxml, * overflow detection if this is a 32-bit server handling a * 64-bit client. */ if (STREQ(param->field, VIR_DOMAIN_BLOCK_COPY_BANDWIDTH)) { - if (sizeof(unsigned long) < sizeof(bandwidth) && + if (sizeof(unsigned long)< sizeof(bandwidth) && param->value.ul > ULONG_MAX * (1ULL << 20)) { virReportError(VIR_ERR_OVERFLOW, _("bandwidth must be less than %llu bytes"), diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index afe445d4e737..d2b546043d24 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -205,7 +205,7 @@ qemuHostdevPreparePCIDevicesCheckSupport(virDomainHostdevDefPtr *hostdevs, if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) continue; - switch ((virDomainHostdevSubsysPCIBackendType) *backend) { + switch ((virDomainHostdevSubsysPCIBackendType)*backend) { case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT: if (supportsPassthroughVFIO && virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) { diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index df9e8aa71679..282916d3fc02 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1207,7 +1207,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, /* this could have been changed by qemuHostdevPreparePCIDevices */ backend = hostdev->source.subsys.u.pci.backend; - switch ((virDomainHostdevSubsysPCIBackendType) backend) { + switch ((virDomainHostdevSubsysPCIBackendType)backend) { case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO: if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -4060,7 +4060,7 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver, if (qemuDomainNamespaceTeardownHostdev(vm, hostdev) < 0) VIR_WARN("Unable to remove host device from /dev"); - switch ((virDomainHostdevSubsysType) hostdev->source.subsys.type) { + switch ((virDomainHostdevSubsysType)hostdev->source.subsys.type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: qemuDomainRemovePCIHostDevice(driver, vm, hostdev); /* QEMU might no longer need to lock as much memory, eg. we just @@ -4474,7 +4474,7 @@ qemuDomainRemoveDevice(virQEMUDriverPtr driver, virDomainDeviceDefPtr dev) { int ret = -1; - switch ((virDomainDeviceType) dev->type) { + switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_DISK: ret = qemuDomainRemoveDiskDevice(driver, vm, dev->data.disk); break; @@ -5411,7 +5411,7 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver, (auth->expires && auth->validTo <= now)) { expire = "now"; } else if (auth->expires) { - if (virAsprintf(&validTo, "%lu", (unsigned long) auth->validTo) < 0) + if (virAsprintf(&validTo, "%lu", (unsigned long)auth->validTo) < 0) goto end_job; expire = validTo; } else { diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 88b8253fa996..6a93b771aace 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -180,7 +180,7 @@ qemuMigrationDstPrecreateDisk(virConnectPtr conn, VIR_DEBUG("Precreate disk type=%s", virStorageTypeToString(disk->src->type)); - switch ((virStorageType) disk->src->type) { + switch ((virStorageType)disk->src->type) { case VIR_STORAGE_TYPE_FILE: if (!virDomainDiskGetSource(disk)) { VIR_DEBUG("Dropping sourceless disk '%s'", diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f642d9a51ab6..8c3e881b29c2 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -365,7 +365,7 @@ qemuMonitorOpenUnix(const char *monitor, if (virTimeBackOffStart(&timebackoff, 1, timeout * 1000) < 0) goto error; while (virTimeBackOffWait(&timebackoff)) { - ret = connect(monfd, (struct sockaddr *) &addr, sizeof(addr)); + ret = connect(monfd, (struct sockaddr *)&addr, sizeof(addr)); if (ret == 0) break; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 24d37eb41dc1..180f4b2a3a40 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5325,7 +5325,7 @@ qemuMonitorJSONParseCPUModelProperty(const char *key, prop = machine_model->props + machine_model->nprops; - switch ((virJSONType) virJSONValueGetType(value)) { + switch ((virJSONType)virJSONValueGetType(value)) { case VIR_JSON_TYPE_STRING: if (VIR_STRDUP(prop->value.string, virJSONValueGetString(value)) < 0) return -1; @@ -6587,7 +6587,7 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID, goto cleanup; } - switch ((virDomainChrType) chr->type) { + switch ((virDomainChrType)chr->type) { case VIR_DOMAIN_CHR_TYPE_NULL: case VIR_DOMAIN_CHR_TYPE_VC: backend_type = "null"; diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index 0ce963222f9c..351425fedd15 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -2820,7 +2820,7 @@ virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps, /* The parser requires /proc/pid, which only exists on platforms * like Linux where pid_t fits in int. */ - if ((int) pid != pid || + if ((int)pid != pid || qemuParseProcFileStrings(pid, "cmdline", &progargv) < 0 || qemuParseProcFileStrings(pid, "environ", &progenv) < 0) goto cleanup; @@ -2829,13 +2829,13 @@ virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps, pidfile, monConfig, monJSON))) goto cleanup; - if (virAsprintf(&exepath, "/proc/%d/exe", (int) pid) < 0) + if (virAsprintf(&exepath, "/proc/%d/exe", (int)pid) < 0) goto cleanup; if (virFileResolveLink(exepath, &emulator) < 0) { virReportSystemError(errno, _("Unable to resolve %s for pid %u"), - exepath, (int) pid); + exepath, (int)pid); goto cleanup; } VIR_FREE(def->emulator); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 6a5262ae46ab..c668546cc21f 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2131,7 +2131,7 @@ qemuRefreshRTC(virQEMUDriverPtr driver, return; thenbits.tm_isdst = -1; - if ((then = mktime(&thenbits)) == (time_t) -1) { + if ((then = mktime(&thenbits)) == (time_t)-1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unable to convert time")); return; @@ -3301,7 +3301,7 @@ qemuProcessUpdateDevices(virQEMUDriverPtr driver, if (qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) goto cleanup; - qemuDevices = (const char **) priv->qemuDevices; + qemuDevices = (const char **)priv->qemuDevices; if ((tmp = old)) { while (*tmp) { if (!virStringListHasString(qemuDevices, *tmp) && @@ -6026,7 +6026,7 @@ qemuProcessLaunch(virConnectPtr conn, rv = -1; } VIR_DEBUG("QEMU vm=%p name=%s running with pid=%lld", - vm, vm->def->name, (long long) vm->pid); + vm, vm->def->name, (long long)vm->pid); } else { VIR_DEBUG("QEMU vm=%p name=%s failed to spawn", vm, vm->def->name); @@ -6435,7 +6435,7 @@ qemuProcessKill(virDomainObjPtr vm, unsigned int flags) VIR_DEBUG("vm=%p name=%s pid=%lld flags=0x%x", vm, vm->def->name, - (long long) vm->pid, flags); + (long long)vm->pid, flags); if (!(flags & VIR_QEMU_PROCESS_KILL_NOCHECK)) { if (!virDomainObjIsActive(vm)) { @@ -6516,7 +6516,7 @@ void qemuProcessStop(virQEMUDriverPtr driver, VIR_DEBUG("Shutting down vm=%p name=%s id=%d pid=%lld, " "reason=%s, asyncJob=%s, flags=0x%x", vm, vm->def->name, vm->def->id, - (long long) vm->pid, + (long long)vm->pid, virDomainShutoffReasonTypeToString(reason), qemuDomainAsyncJobTypeToString(asyncJob), flags); -- 2.17.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list