The 'bus' member of _virDomainDiskDef is already declared of virDomainDiskModel type. Hence, there is no need to typecast the variable when passing to switch() statements. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/qemu/qemu_alias.c | 2 +- src/qemu/qemu_command.c | 4 ++-- src/qemu/qemu_domain_address.c | 2 +- src/qemu/qemu_hotplug.c | 4 ++-- src/qemu/qemu_validate.c | 4 ++-- src/vbox/vbox_common.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c index 161d30cf72..e58c488f8a 100644 --- a/src/qemu/qemu_alias.c +++ b/src/qemu/qemu_alias.c @@ -244,7 +244,7 @@ qemuAssignDeviceDiskAlias(virDomainDef *def, * need the full path into /machine/peripheral as a historical artifact. */ if (!diskPriv->qomName) { - switch ((virDomainDiskBus) disk->bus) { + switch (disk->bus) { case VIR_DOMAIN_DISK_BUS_FDC: case VIR_DOMAIN_DISK_BUS_IDE: case VIR_DOMAIN_DISK_BUS_SATA: diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6de0bdf977..be5814663c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -409,7 +409,7 @@ qemuBuildDeviceAddresDriveProps(virJSONValue *props, virDomainControllerDef *controller = NULL; const char *controllerAlias = NULL; - switch ((virDomainDiskBus) info->addr.drive.diskbus) { + switch (info->addr.drive.diskbus) { case VIR_DOMAIN_DISK_BUS_IDE: /* When domain has builtin IDE controller we don't put it onto cmd * line. Therefore we can't set its alias. In that case, use the @@ -1770,7 +1770,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, const char *wpolicy = NULL; const char *rpolicy = NULL; - switch ((virDomainDiskBus) disk->bus) { + switch (disk->bus) { case VIR_DOMAIN_DISK_BUS_IDE: case VIR_DOMAIN_DISK_BUS_SATA: if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 0875ed0401..00742d3c0e 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -790,7 +790,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef *dev, break; case VIR_DOMAIN_DEVICE_DISK: - switch ((virDomainDiskBus) dev->data.disk->bus) { + switch (dev->data.disk->bus) { case VIR_DOMAIN_DISK_BUS_VIRTIO: /* only virtio disks use PCI */ switch (dev->data.disk->model) { diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 0d5f253bb9..d4f01cfd93 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -926,7 +926,7 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *driver, goto cleanup; } - switch ((virDomainDiskBus) disk->bus) { + switch (disk->bus) { case VIR_DOMAIN_DISK_BUS_USB: if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -5468,7 +5468,7 @@ qemuDomainDetachPrepDisk(virDomainObj *vm, case VIR_DOMAIN_DISK_DEVICE_DISK: case VIR_DOMAIN_DISK_DEVICE_LUN: - switch ((virDomainDiskBus) disk->bus) { + switch (disk->bus) { case VIR_DOMAIN_DISK_BUS_VIRTIO: case VIR_DOMAIN_DISK_BUS_USB: case VIR_DOMAIN_DISK_BUS_SCSI: diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 3b57fa3c21..18d34e7f59 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1371,7 +1371,7 @@ qemuValidateDomainDeviceDefAddressDrive(virDomainDeviceInfo *info, { virDomainControllerDef *controller = NULL; - switch ((virDomainDiskBus) info->addr.drive.diskbus) { + switch (info->addr.drive.diskbus) { case VIR_DOMAIN_DISK_BUS_SCSI: /* Setting bus= attr for SCSI drives, causes a controller * to be created. Yes this is slightly odd. It is not possible @@ -2673,7 +2673,7 @@ static bool qemuValidateDomainDeviceDefDiskIOThreads(const virDomainDef *def, const virDomainDiskDef *disk) { - switch ((virDomainDiskBus)disk->bus) { + switch (disk->bus) { case VIR_DOMAIN_DISK_BUS_VIRTIO: break; diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index dba4af1a44..490f337a56 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -1206,7 +1206,7 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDriver *data, IMachine *machine) goto cleanup; } - switch ((virDomainDiskBus) disk->bus) { + switch (disk->bus) { case VIR_DOMAIN_DISK_BUS_IDE: VBOX_UTF8_TO_UTF16(VBOX_CONTROLLER_IDE_NAME, &storageCtlName); devicePort = def->disks[i]->info.addr.drive.bus; -- 2.41.0