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