From nobody Mon Feb 9 00:55:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1594749685; cv=none; d=zohomail.com; s=zohoarc; b=SJajSj8VqAMqKJIYCS7wpT2OFRS4k8NE7D8R/zHDJKYE01eikyN6xb50bY+EeuPagH04gDQFoKTWrQ9ZSyaFpeQQkrOuE/3358KVeSFca3Hq/8okE/zqLbDrzb9ecy7MyCxmbu48BI1HhGHa2UaYnYicjAV1GVIyZWmLVvDpE/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594749685; 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=MuisLfXhVVV+9VVyJ4GzqqRFvu/Dtmq7pKo4Ouotc7Q=; b=iS8/oSOjq81v8sC2CRnKl+g024TKLXgTANrbg5olRtWYdVdXuXqpMlaOQ1MfZlhBcuuCfgTnAB/ZA1UWOuX6pZT2F7gsbHuZoR9pX+ba64l2P+5n/J485AEgVH7vBnNGeShiGz3/WI8wIGn2MTYT2fHfytl2VHGLHHVRqB/muwg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1594749685686330.4218334047665; Tue, 14 Jul 2020 11:01:25 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-87-oKshWxorM_CGqiv1EifCyQ-1; Tue, 14 Jul 2020 14:01:08 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3110D527EC; Tue, 14 Jul 2020 18:00:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D7D306146F; Tue, 14 Jul 2020 18:00:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A008C94F0E; Tue, 14 Jul 2020 18:00:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06EI0RTa024002 for ; Tue, 14 Jul 2020 14:00:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id C9D795C679; Tue, 14 Jul 2020 18:00:27 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31DC35C6DD for ; Tue, 14 Jul 2020 18:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594749684; 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=MuisLfXhVVV+9VVyJ4GzqqRFvu/Dtmq7pKo4Ouotc7Q=; b=dEX3KMwKoGcb3NutA1RAcMVMxXECEd1ynzFLTT3JdN4FVNOgJn2oOh6FrDoEwpEspEmMgE Aa3BfAmwdFhu/obp2c7mPH/oWylpBE3gXG6pExbRHej7cR1eBdCisu/c7Mox1+vSCM4L8s LXO4oXb0iWoZzv7s53xW2GZfZfn85c8= X-MC-Unique: oKshWxorM_CGqiv1EifCyQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/11] virDomainHostdevSubsysSCSIDefParseXML: Use typecasted switch Date: Tue, 14 Jul 2020 20:00:13 +0200 Message-Id: <78111c83c56d7fd5bebb9a4dc0a71c730d310c71.1594749375.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use a switch statement which will not be omitted when adding potential new types. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e9fee10e31..c8ac4380c4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8392,11 +8392,21 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr so= urcenode, } } - if (scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISC= SI) + switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: + return virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, scsis= rc); + + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI: return virDomainHostdevSubsysSCSIiSCSIDefParseXML(sourcenode, scsi= src, ctxt, flags, xmlopt); - return virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, scsisrc); + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST: + default: + virReportEnumRangeError(virDomainHostdevSCSIProtocolType, scsisrc-= >protocol); + return -1; + } + + return 0; } static int --=20 2.26.2