From nobody Tue Oct 22 22:26:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1694699812; cv=none; d=zohomail.com; s=zohoarc; b=M79Z6tWIoaVrIj0eJXiQAcPNzb4n2bZeoSLb/k1ctd8902+gUmCAN4fTEhmWmUMEyiGwGrOd0KNorN7v1dI9jXckjR89E6huE+GfHFBlgrTeUyBvrvi4t9SaryWoP7zfqwEpJ3PwFCNeP9hvBjqyI0qFbgGfyYCcluJtxlq/yhE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694699812; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VlmSgMIgkoYpjTErHJwoYi28JQI9BnMgB4nJcnjcE2w=; b=XzGnaBmf+3uHNDYEbIkSCfXzf/EEzBvmWgPJYOtT7gsES+B4sy/lZB1+aXgyCKHZBtCWIati9b957oJQBw6PqyEWNLZsm2Gt6MhUvGDBgli86XCd+KeeAlnlwEsUhI2iPgmWqHb6t1EA5PH5Fvo2dWj+pVJm1rgWdW0Fc0zwUwc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1694699812016460.47130922228257; Thu, 14 Sep 2023 06:56:52 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-142-qpQ48JLWP_mwJleQfml48Q-1; Thu, 14 Sep 2023 09:56:48 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 141B5185A78E; Thu, 14 Sep 2023 13:56:43 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF9D61054FC2; Thu, 14 Sep 2023 13:56:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id DB8DC1946A48; Thu, 14 Sep 2023 13:56:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 20AD819465B8 for ; Thu, 14 Sep 2023 13:56:28 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1BFBB40C6EC0; Thu, 14 Sep 2023 13:56:28 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.2.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7D4040C6EBF for ; Thu, 14 Sep 2023 13:56:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694699810; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=VlmSgMIgkoYpjTErHJwoYi28JQI9BnMgB4nJcnjcE2w=; b=MUIzMRhcB2C2DUmDl1rfQU+siS0A0YqN+HCk6YUfmfJlziOncqSR5b1XxT1uW0AGQ+WPq+ oShg0QxAmXnnvrFs/rjqu6XHeILE5Iyk+LYFsykxcGJDZ9Sfp+zGqdoeKCTyf2FoqULU2C KoyWeWUK2N99xNYFGrd/KgjcHkLsPhY= X-MC-Unique: qpQ48JLWP_mwJleQfml48Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 05/20] src: Drop needless typecast to virDomainDeviceType Date: Thu, 14 Sep 2023 15:56:06 +0200 Message-ID: <4904007f4b8b6d8236d3bf0caccf6246ecf08877.1694699682.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1694699813599100003 Content-Type: text/plain; charset="utf-8"; x-default="true" 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 --- src/ch/ch_domain.c | 2 +- src/conf/domain_conf.c | 8 ++++---- src/conf/domain_postparse.c | 2 +- src/conf/domain_validate.c | 2 +- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_domain.c | 6 +++--- src/qemu/qemu_domain_address.c | 4 ++-- src/qemu/qemu_driver.c | 6 +++--- src/qemu/qemu_hotplug.c | 10 +++++----- src/qemu/qemu_validate.c | 2 +- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/ch/ch_domain.c b/src/ch/ch_domain.c index d6b64b6c59..866f0d899a 100644 --- a/src/ch/ch_domain.c +++ b/src/ch/ch_domain.c @@ -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: diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9d819c3dab..306547e798 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3520,7 +3520,7 @@ void virDomainDeviceDefFree(virDomainDeviceDef *def) if (!def) return; =20 - 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 =3D devicedata; break; @@ -13777,7 +13777,7 @@ virDomainDeviceDefParse(const char *xmlStr, if (virDomainDeviceDefParseType((const char *)node->name, &dev->type) = < 0) return NULL; =20 - switch ((virDomainDeviceType) dev->type) { + switch (dev->type) { case VIR_DOMAIN_DEVICE_DISK: if (!(dev->data.disk =3D virDomainDiskDefParseXML(xmlopt, node, ct= xt, flags))) diff --git a/src/conf/domain_postparse.c b/src/conf/domain_postparse.c index b76e8dcc5c..e79913b73f 100644 --- a/src/conf/domain_postparse.c +++ b/src/conf/domain_postparse.c @@ -684,7 +684,7 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDef *d= ev, { int ret =3D -1; =20 - switch ((virDomainDeviceType)dev->type) { + switch (dev->type) { case VIR_DOMAIN_DEVICE_CHR: ret =3D virDomainChrDefPostParse(dev->data.chr, def); break; diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 53d920b2b3..a8f90af3aa 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -2847,7 +2847,7 @@ virDomainDeviceDefValidateInternal(const virDomainDev= iceDef *dev, if (virDomainDeviceInfoValidate(dev) < 0) return -1; =20 - switch ((virDomainDeviceType) dev->type) { + switch (dev->type) { case VIR_DOMAIN_DEVICE_DISK: return virDomainDiskDefValidate(def, dev->data.disk); =20 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f9e4de9bd7..6de0bdf977 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -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) =3D= =3D VIR_STORAGE_TYPE_VHOST_USER) *baseName =3D "vhost-user-blk"; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 52ea8f649d..e578df624b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6175,7 +6175,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDef *dev, virQEMUCaps *qemuCaps =3D parseOpaque; int ret =3D -1; =20 - switch ((virDomainDeviceType) dev->type) { + switch (dev->type) { case VIR_DOMAIN_DEVICE_NET: ret =3D qemuDomainDeviceNetDefPostParse(dev->data.net, def, qemuCa= ps); break; @@ -10297,7 +10297,7 @@ qemuDomainPrepareChardevSourceOne(virDomainDeviceDe= f *dev, struct qemuDomainPrepareChardevSourceData *data =3D opaque; qemuDomainChrSourcePrivate *charpriv =3D QEMU_DOMAIN_CHR_SOURCE_PRIVAT= E(charsrc); =20 - switch ((virDomainDeviceType) dev->type) { + switch (dev->type) { =20 case VIR_DOMAIN_DEVICE_CHR: case VIR_DOMAIN_DEVICE_RNG: @@ -12148,7 +12148,7 @@ qemuDomainDeviceBackendChardevForeachOne(virDomainD= eviceDef *dev, qemuDomainDeviceBackendChardevFor= eachCallback cb, void *opaque) { - switch ((virDomainDeviceType) dev->type) { + switch (dev->type) { case VIR_DOMAIN_DEVICE_DISK: if (virStorageSourceGetActualType(dev->data.disk->src) !=3D VIR_ST= ORAGE_TYPE_VHOST_USER) return 0; diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 01f44a4991..38411b4872 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -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; =20 @@ -604,7 +604,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevic= eDef *dev, virDomainPCIConnectFlags pciFlags =3D (VIR_PCI_CONNECT_TYPE_PCI_DEVICE= | VIR_PCI_CONNECT_AUTOASSIGN); =20 - switch ((virDomainDeviceType)dev->type) { + switch (dev->type) { case VIR_DOMAIN_DEVICE_CONTROLLER: { virDomainControllerDef *cont =3D dev->data.controller; =20 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0d4da937b0..28ec40e351 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6624,7 +6624,7 @@ qemuDomainAttachDeviceConfig(virDomainDef *vmdef, virDomainRedirdevDef *redirdev; virDomainShmemDef *shmem; =20 - switch ((virDomainDeviceType)dev->type) { + switch (dev->type) { case VIR_DOMAIN_DEVICE_DISK: disk =3D dev->data.disk; if (virDomainDiskIndexByName(vmdef, disk->dst, true) >=3D 0) { @@ -6843,7 +6843,7 @@ qemuDomainDetachDeviceConfig(virDomainDef *vmdef, virDomainMemoryDef *mem; int idx; =20 - switch ((virDomainDeviceType)dev->type) { + switch (dev->type) { case VIR_DOMAIN_DEVICE_DISK: disk =3D dev->data.disk; if (!(det_disk =3D virDomainDiskRemoveByName(vmdef, disk->dst))) { @@ -7041,7 +7041,7 @@ qemuDomainUpdateDeviceConfig(virDomainDef *vmdef, virDomainDeviceDef oldDev =3D { .type =3D dev->type }; int pos; =20 - switch ((virDomainDeviceType)dev->type) { + switch (dev->type) { case VIR_DOMAIN_DEVICE_DISK: newDisk =3D dev->data.disk; if ((pos =3D virDomainDiskIndexByName(vmdef, newDisk->dst, false))= < 0) { diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 177ca87d11..0d5f253bb9 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3307,7 +3307,7 @@ qemuDomainAttachDeviceLive(virDomainObj *vm, &chardevBackendData) < 0) return -1; =20 - switch ((virDomainDeviceType)dev->type) { + switch (dev->type) { case VIR_DOMAIN_DEVICE_DISK: qemuDomainObjCheckDiskTaint(driver, vm, dev->data.disk, NULL); ret =3D 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", suc= cess); break; @@ -5231,7 +5231,7 @@ qemuDomainRemoveDevice(virQEMUDriver *driver, alias =3D g_strdup(info->alias); info =3D NULL; =20 - 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 =3D -1; int rc; =20 - 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 =3D { .type =3D dev->type }; int idx; =20 - 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); diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index c7deac6251..3b57fa3c21 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -5068,7 +5068,7 @@ qemuValidateDomainDeviceDef(const virDomainDeviceDef = *dev, if (qemuValidateDomainDeviceInfo(dev, def, qemuCaps) < 0) return -1; =20 - switch ((virDomainDeviceType)dev->type) { + switch (dev->type) { case VIR_DOMAIN_DEVICE_NET: return qemuValidateDomainDeviceDefNetwork(dev->data.net, qemuCaps); =20 --=20 2.41.0