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;
virJSONValuePtr reply = NULL;
char *password64 = NULL;
- if (!(password64 = virStringEncodeBase64((unsigned char *) password,
+ if (!(password64 = virStringEncodeBase64((unsigned char *)password,
strlen(password))))
goto cleanup;
if (chr->info.alias)
return 0;
- switch ((virDomainChrDeviceType) chr->deviceType) {
+ switch ((virDomainChrDeviceType)chr->deviceType) {
case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL:
prefix = "parallel";
break;
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:
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);
}
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);
}
}
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");
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;
}
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);
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;
cpus = qemuCaps->tcgCPUModels;
filtered = virDomainCapsCPUModelsFilter(cpus,
- (const char **) models,
+ (const char **)models,
blacklist);
virStringListFree(models);
}
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:
*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:
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 &&
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)
}
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'"),
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,
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);
{
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)))
{
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;
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,
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:
{
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:
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;
def->emulator)))
return -1;
- switch ((virDomainDeviceType) dev->type) {
+ switch ((virDomainDeviceType)dev->type) {
case VIR_DOMAIN_DEVICE_NET:
ret = qemuDomainDeviceDefValidateNetwork(dev->data.net);
break;
*/
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) "
/* 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;
* 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;
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,
if (!usb)
goto cleanup;
- if (!(tmpPath = (char *) virUSBDeviceGetPath(usb)))
+ if (!(tmpPath = (char *)virUSBDeviceGetPath(usb)))
goto cleanup;
perm = VIR_CGROUP_DEVICE_RW;
break;
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;
if (!(host = virSCSIVHostDeviceNew(hostsrc->wwpn)))
goto cleanup;
- if (!(tmpPath = (char *) virSCSIVHostDeviceGetPath(host)))
+ if (!(tmpPath = (char *)virSCSIVHostDeviceGetPath(host)))
goto cleanup;
perm = VIR_CGROUP_DEVICE_RW;
}
}
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
if (virDomainChrDefForeach(vm->def,
true,
qemuDomainSetupChardev,
- (void *) data) < 0)
+ (void *)data) < 0)
return -1;
VIR_DEBUG("Setup all chardevs");
# 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
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;
}
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);
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;
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;
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;
}
}
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))) {
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;
}
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;
}
/* 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;
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);
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;
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);
{
int ret = -1;
- switch ((virDomainDeviceType) dev->type) {
+ switch ((virDomainDeviceType)dev->type) {
case VIR_DOMAIN_DEVICE_DISK:
ret = qemuDomainDetachDeviceDiskLive(driver, vm, dev);
break;
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);
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) {
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))) {
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) {
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);
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;
return -1;
}
- switch ((virStorageType) snapDiskType) {
+ switch ((virStorageType)snapDiskType) {
case VIR_STORAGE_TYPE_BLOCK:
case VIR_STORAGE_TYPE_FILE:
break;
return -1;
}
- switch ((virStorageType) actualType) {
+ switch ((virStorageType)actualType) {
case VIR_STORAGE_TYPE_BLOCK:
case VIR_STORAGE_TYPE_FILE:
break;
actualType = virStorageSourceGetActualType(disk->src);
- switch ((virStorageType) actualType) {
+ switch ((virStorageType)actualType) {
case VIR_STORAGE_TYPE_BLOCK:
case VIR_STORAGE_TYPE_FILE:
return 0;
* 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"),
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)) {
/* 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",
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
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;
(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 {
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'",
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;
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;
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";
/* 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;
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);
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;
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) &&
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);
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)) {
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);