mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 19:45:21 +00:00
src: Drop needless typecast to virDomainDeviceType
The 'type' member of _virDomainDeviceDef is already declared of virDomainDeviceType type. Hence, there is no need to typecast the variable when passing to switch() statements. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
3926f1e688
commit
75cdb664d0
@ -146,7 +146,7 @@ chValidateDomainDeviceDef(const virDomainDeviceDef *dev,
|
||||
void *opaque G_GNUC_UNUSED,
|
||||
void *parseOpaque G_GNUC_UNUSED)
|
||||
{
|
||||
switch ((virDomainDeviceType)dev->type) {
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
case VIR_DOMAIN_DEVICE_NET:
|
||||
case VIR_DOMAIN_DEVICE_MEMORY:
|
||||
|
@ -3520,7 +3520,7 @@ void virDomainDeviceDefFree(virDomainDeviceDef *def)
|
||||
if (!def)
|
||||
return;
|
||||
|
||||
switch ((virDomainDeviceType) def->type) {
|
||||
switch (def->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
virDomainDiskDefFree(def->data.disk);
|
||||
break;
|
||||
@ -4468,7 +4468,7 @@ virDomainObjGetOneDef(virDomainObj *vm,
|
||||
virDomainDeviceInfo *
|
||||
virDomainDeviceGetInfo(const virDomainDeviceDef *device)
|
||||
{
|
||||
switch ((virDomainDeviceType) device->type) {
|
||||
switch (device->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
return &device->data.disk->info;
|
||||
case VIR_DOMAIN_DEVICE_FS:
|
||||
@ -4541,7 +4541,7 @@ void
|
||||
virDomainDeviceSetData(virDomainDeviceDef *device,
|
||||
void *devicedata)
|
||||
{
|
||||
switch ((virDomainDeviceType) device->type) {
|
||||
switch (device->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
device->data.disk = devicedata;
|
||||
break;
|
||||
@ -13777,7 +13777,7 @@ virDomainDeviceDefParse(const char *xmlStr,
|
||||
if (virDomainDeviceDefParseType((const char *)node->name, &dev->type) < 0)
|
||||
return NULL;
|
||||
|
||||
switch ((virDomainDeviceType) dev->type) {
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
if (!(dev->data.disk = virDomainDiskDefParseXML(xmlopt, node, ctxt,
|
||||
flags)))
|
||||
|
@ -684,7 +684,7 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDef *dev,
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
switch ((virDomainDeviceType)dev->type) {
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_DEVICE_CHR:
|
||||
ret = virDomainChrDefPostParse(dev->data.chr, def);
|
||||
break;
|
||||
|
@ -2847,7 +2847,7 @@ virDomainDeviceDefValidateInternal(const virDomainDeviceDef *dev,
|
||||
if (virDomainDeviceInfoValidate(dev) < 0)
|
||||
return -1;
|
||||
|
||||
switch ((virDomainDeviceType) dev->type) {
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
return virDomainDiskDefValidate(def, dev->data.disk);
|
||||
|
||||
|
@ -796,7 +796,7 @@ qemuBuildVirtioDevGetConfigDev(const virDomainDeviceDef *device,
|
||||
bool *has_ntmodel,
|
||||
bool *useBusSuffix)
|
||||
{
|
||||
switch ((virDomainDeviceType) device->type) {
|
||||
switch (device->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
if (virStorageSourceGetActualType(device->data.disk->src) == VIR_STORAGE_TYPE_VHOST_USER)
|
||||
*baseName = "vhost-user-blk";
|
||||
|
@ -6175,7 +6175,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDef *dev,
|
||||
virQEMUCaps *qemuCaps = parseOpaque;
|
||||
int ret = -1;
|
||||
|
||||
switch ((virDomainDeviceType) dev->type) {
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_DEVICE_NET:
|
||||
ret = qemuDomainDeviceNetDefPostParse(dev->data.net, def, qemuCaps);
|
||||
break;
|
||||
@ -10297,7 +10297,7 @@ qemuDomainPrepareChardevSourceOne(virDomainDeviceDef *dev,
|
||||
struct qemuDomainPrepareChardevSourceData *data = opaque;
|
||||
qemuDomainChrSourcePrivate *charpriv = QEMU_DOMAIN_CHR_SOURCE_PRIVATE(charsrc);
|
||||
|
||||
switch ((virDomainDeviceType) dev->type) {
|
||||
switch (dev->type) {
|
||||
|
||||
case VIR_DOMAIN_DEVICE_CHR:
|
||||
case VIR_DOMAIN_DEVICE_RNG:
|
||||
@ -12148,7 +12148,7 @@ qemuDomainDeviceBackendChardevForeachOne(virDomainDeviceDef *dev,
|
||||
qemuDomainDeviceBackendChardevForeachCallback cb,
|
||||
void *opaque)
|
||||
{
|
||||
switch ((virDomainDeviceType) dev->type) {
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
if (virStorageSourceGetActualType(dev->data.disk->src) != VIR_STORAGE_TYPE_VHOST_USER)
|
||||
return 0;
|
||||
|
@ -522,7 +522,7 @@ qemuDomainAssignVirtioMMIOAddresses(virDomainDef *def,
|
||||
static bool
|
||||
qemuDomainDeviceSupportZPCI(virDomainDeviceDef *device)
|
||||
{
|
||||
switch ((virDomainDeviceType)device->type) {
|
||||
switch (device->type) {
|
||||
case VIR_DOMAIN_DEVICE_CHR:
|
||||
return false;
|
||||
|
||||
@ -604,7 +604,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef *dev,
|
||||
virDomainPCIConnectFlags pciFlags = (VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
|
||||
VIR_PCI_CONNECT_AUTOASSIGN);
|
||||
|
||||
switch ((virDomainDeviceType)dev->type) {
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_DEVICE_CONTROLLER: {
|
||||
virDomainControllerDef *cont = dev->data.controller;
|
||||
|
||||
|
@ -6624,7 +6624,7 @@ qemuDomainAttachDeviceConfig(virDomainDef *vmdef,
|
||||
virDomainRedirdevDef *redirdev;
|
||||
virDomainShmemDef *shmem;
|
||||
|
||||
switch ((virDomainDeviceType)dev->type) {
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
disk = dev->data.disk;
|
||||
if (virDomainDiskIndexByName(vmdef, disk->dst, true) >= 0) {
|
||||
@ -6843,7 +6843,7 @@ qemuDomainDetachDeviceConfig(virDomainDef *vmdef,
|
||||
virDomainMemoryDef *mem;
|
||||
int idx;
|
||||
|
||||
switch ((virDomainDeviceType)dev->type) {
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
disk = dev->data.disk;
|
||||
if (!(det_disk = virDomainDiskRemoveByName(vmdef, disk->dst))) {
|
||||
@ -7041,7 +7041,7 @@ qemuDomainUpdateDeviceConfig(virDomainDef *vmdef,
|
||||
virDomainDeviceDef oldDev = { .type = dev->type };
|
||||
int pos;
|
||||
|
||||
switch ((virDomainDeviceType)dev->type) {
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
newDisk = dev->data.disk;
|
||||
if ((pos = virDomainDiskIndexByName(vmdef, newDisk->dst, false)) < 0) {
|
||||
|
@ -3307,7 +3307,7 @@ qemuDomainAttachDeviceLive(virDomainObj *vm,
|
||||
&chardevBackendData) < 0)
|
||||
return -1;
|
||||
|
||||
switch ((virDomainDeviceType)dev->type) {
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
qemuDomainObjCheckDiskTaint(driver, vm, dev->data.disk, NULL);
|
||||
ret = qemuDomainAttachDeviceDiskLive(driver, vm, dev);
|
||||
@ -5150,7 +5150,7 @@ qemuDomainRemoveAuditDevice(virDomainObj *vm,
|
||||
virDomainDeviceDef *detach,
|
||||
bool success)
|
||||
{
|
||||
switch ((virDomainDeviceType)detach->type) {
|
||||
switch (detach->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
virDomainAuditDisk(vm, detach->data.disk->src, NULL, "detach", success);
|
||||
break;
|
||||
@ -5231,7 +5231,7 @@ qemuDomainRemoveDevice(virQEMUDriver *driver,
|
||||
alias = g_strdup(info->alias);
|
||||
info = NULL;
|
||||
|
||||
switch ((virDomainDeviceType)dev->type) {
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_DEVICE_CHR:
|
||||
/* We must return directly after calling
|
||||
* qemuDomainRemoveChrDevice because it is called directly
|
||||
@ -6058,7 +6058,7 @@ qemuDomainDetachDeviceLive(virDomainObj *vm,
|
||||
int ret = -1;
|
||||
int rc;
|
||||
|
||||
switch ((virDomainDeviceType)match->type) {
|
||||
switch (match->type) {
|
||||
/*
|
||||
* lease and chr devices don't follow the standard pattern of
|
||||
* the others, so they must have their own self-contained
|
||||
@ -7100,7 +7100,7 @@ qemuDomainUpdateDeviceLive(virDomainObj *vm,
|
||||
virDomainDeviceDef oldDev = { .type = dev->type };
|
||||
int idx;
|
||||
|
||||
switch ((virDomainDeviceType)dev->type) {
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
qemuDomainObjCheckDiskTaint(driver, vm, dev->data.disk, NULL);
|
||||
return qemuDomainChangeDiskLive(vm, dev, driver, force);
|
||||
|
@ -5068,7 +5068,7 @@ qemuValidateDomainDeviceDef(const virDomainDeviceDef *dev,
|
||||
if (qemuValidateDomainDeviceInfo(dev, def, qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
switch ((virDomainDeviceType)dev->type) {
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_DEVICE_NET:
|
||||
return qemuValidateDomainDeviceDefNetwork(dev->data.net, qemuCaps);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user