From nobody Sat May 11 18:50:06 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=1695106816; cv=none; d=zohomail.com; s=zohoarc; b=JH7pDlP9ZVUEgBuHIMhT0v/wYVg9hx6CHMllq8xCtkXb6X1AESp4TnlzbYH9oLFvIch0gaR2YkjHwdCbzy5+fOJrrlWAzmq5BBMY6gJBsuZla691RHEF+Fm9wri7NuxZXgE0KOGgyg8uMjTT7OOiivKqJcnVjGx0Kk8ZCEwMI7s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695106816; 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=zbnxDCw5J5Pqmjyamv5kihNMyt5wviXpU5NdttVnzVA=; b=MTzsgliiXOLlnWcSpFQAq5CgRK2neVQcPWEjC81UBO/dsMpSwAcDMzlj+NjkqK/vN1DCj++HOsExbJgdLRVr4mougAD/Sc5FFeTArqoNVjPUIN3V5aI4swaLGIDmWeyYS6rMb/VfIM8ZOS9USeFa3vUCVvWYsMDahwW4otKDmDM= 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 1695106816166109.62133447340659; Tue, 19 Sep 2023 00:00:16 -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-694-b0jn1xPIMre4G0gG6uND7g-1; Tue, 19 Sep 2023 03:00:11 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 EAD0A18162D2; Tue, 19 Sep 2023 07:00:07 +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 3EBDF14171D4; Tue, 19 Sep 2023 07:00:07 +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 9C55519466E6; Tue, 19 Sep 2023 07:00:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9C7E0194658F for ; Tue, 19 Sep 2023 07:00:04 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id EA0B240C2009; Tue, 19 Sep 2023 07:00:03 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.2.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91CA540C2070 for ; Tue, 19 Sep 2023 07:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695106815; 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=zbnxDCw5J5Pqmjyamv5kihNMyt5wviXpU5NdttVnzVA=; b=HWoGlf3zQr3wsDUofLvx9RA8YZt5EEoauWjqBElWyyhvxkb+BOArXraTFQ5f9Piwnlzd8k Tg/neBM0eRywMyY63rEscQM/W41cZjGpUE/tyNRLFcB0BoEBdQRop0LDqnpJ6XPsK4u+9m pSQAH281/7V0Ww3sYv4l5dbKLKjGejw= X-MC-Unique: b0jn1xPIMre4G0gG6uND7g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/4] virnetdevvportprofile: Turn virNetDevVPortProfileLinkOp enum into a proper typedef Date: Tue, 19 Sep 2023 08:59:57 +0200 Message-ID: <278d9f5041943fc1d1a411fc4df6943bca628e25.1695105934.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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.7 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: 1695106816537100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This allows us to declare variables without using 'enum virNetDev....' and will become more useful in the near future (when virReportEnumRangeError() is fixed). Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/util/virnetdevvportprofile.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprof= ile.c index 33bcd350c4..6d5bfbe870 100644 --- a/src/util/virnetdevvportprofile.c +++ b/src/util/virnetdevvportprofile.c @@ -69,12 +69,12 @@ VIR_LOG_INIT("util.netdevvportprofile"); # define LLDPAD_PID_FILE "/var/run/lldpad.pid" =20 =20 -enum virNetDevVPortProfileLinkOp { +typedef enum { VIR_NETDEV_VPORT_PROFILE_LINK_OP_ASSOCIATE =3D 0x1, VIR_NETDEV_VPORT_PROFILE_LINK_OP_DISASSOCIATE =3D 0x2, VIR_NETDEV_VPORT_PROFILE_LINK_OP_PREASSOCIATE =3D 0x3, VIR_NETDEV_VPORT_PROFILE_LINK_OP_PREASSOCIATE_RR =3D 0x4, -}; +} virNetDevVPortProfileLinkOp; =20 #endif =20 @@ -1024,7 +1024,7 @@ virNetDevVPortProfileOp8021Qbg(const char *ifname, const virMacAddr *macaddr, int vf, const virNetDevVPortProfile *virtPort, - enum virNetDevVPortProfileLinkOp virtPortOp, + virNetDevVPortProfileLinkOp virtPortOp, bool setlink_only) { int op =3D PORT_REQUEST_ASSOCIATE; @@ -1093,7 +1093,7 @@ virNetDevVPortProfileOp8021Qbh(const char *ifname, int32_t vf, const virNetDevVPortProfile *virtPort, const unsigned char *vm_uuid, - enum virNetDevVPortProfileLinkOp virtPortOp) + virNetDevVPortProfileLinkOp virtPortOp) { int rc =3D 0; char *physfndev =3D NULL; --=20 2.41.0 From nobody Sat May 11 18:50:06 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=1695106816; cv=none; d=zohomail.com; s=zohoarc; b=kLND88rjKQpqavtjQjaEEGlVlj2pJJyutMzfkCzVGuLRPNc/tS7lyP5iNi0qTv+4KBEBn5f3FIKSUlNJliHHRB6P2kCBnY9uNINNbi5FKELhy6XzP0g9Fci7RAQLoS7P7Qmr8aO2KFXxQLR0KOOHwxC8uKQz7euXTE4kUKvNpGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695106816; 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=lu3uqaP22SLY9+y7WpeikZ8qPNrgfjUTRwPzn1CWlnk=; b=h9LGEQvjxIKPbfe4ZWgvXN1xdHbf+rDtBZH1czlTUrYObohGOTxPI24DYtZHT5l1QWB5R8Kmlk33dSOb2XJ/viAuwG1vYunM+N3WCDTrbuL8pLuXRbYGV262BcpnjwbNmg8+4N6d9d1a8e5w2gx7cStHCnG9BdWyokNyq7mV36Y= 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 1695106816002104.98485731802089; Tue, 19 Sep 2023 00:00:16 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-694-eWCHSTwvO1uwzaIjo3beNQ-1; Tue, 19 Sep 2023 03:00:12 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 E892F3844E03; Tue, 19 Sep 2023 07:00:07 +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 2EDC740C2064; Tue, 19 Sep 2023 07:00:07 +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 9C53719466E5; Tue, 19 Sep 2023 07:00:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 99ED7194658C for ; Tue, 19 Sep 2023 07:00:04 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 848A340C2070; Tue, 19 Sep 2023 07:00:04 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.2.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C28C40C200A for ; Tue, 19 Sep 2023 07:00:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695106814; 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=lu3uqaP22SLY9+y7WpeikZ8qPNrgfjUTRwPzn1CWlnk=; b=buy9mvyXH9oBGpcTvrzszdlEBVEOW+YRLI0U3FiC2I6GQ3Lji+YE82yPw2Rney1Ux7sGyz 2uLXNwutrqsnNxXf5ZZ7eFRYPRv961oI+OxQ9qG5MkGcH/tyjGpD+rdGlw/ghTTLpMC0Lp KRp3ih7R+4iZM47D7Wq2l5+YwTS3G2I= X-MC-Unique: eWCHSTwvO1uwzaIjo3beNQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/4] virNetDevVPortProfileOp8021Qbh: Use proper type in virReportEnumRangeError() Date: Tue, 19 Sep 2023 08:59:58 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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.1 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: 1695106816804100003 Content-Type: text/plain; charset="utf-8"; x-default="true" The @virtPortOp variable inside of virNetDevVPortProfileOp8021Qbh is of type virNetDevVPortProfileLinkOp. Pass the proper type to virReportEnumRangeError(). Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/util/virnetdevvportprofile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprof= ile.c index 6d5bfbe870..c755fa79ec 100644 --- a/src/util/virnetdevvportprofile.c +++ b/src/util/virnetdevvportprofile.c @@ -1182,7 +1182,7 @@ virNetDevVPortProfileOp8021Qbh(const char *ifname, rc =3D -1; break; default: - virReportEnumRangeError(virNetDevVPortProfileType, virtPortOp); + virReportEnumRangeError(virNetDevVPortProfileLinkOp, virtPortOp); rc =3D -1; break; } --=20 2.41.0 From nobody Sat May 11 18:50:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1695106864; cv=none; d=zohomail.com; s=zohoarc; b=FTgdAA1ZAQjV0dg9GtKvyouHhRzZaybIJfVTfyMplQAY+unBII6C5s/5vH2MPgXT3z1MxbiUc+bufVPUbV8tAPpRf5ahxfJqnRF2/hbNAXucAW4Gk4UFtLNtQRxDcwwOE0BrIst0rgjRO/Qm/zju1GbpN5VriIEmQ7JGb/h+5LU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695106864; 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=i2f9Nagsi4cEeHm2OBpsZv4YhwC8zpD6rE6IRZKREtA=; b=XfHjIx+mg61DZj1RNZYpl/hhPcyMmeOb5oS2XreIDrGkv66/g9g+E9lXPmpedr2+k5izb2SLVYOf7ncJd+Zt9LKQDC7BysXDOUlWVSXbmKgmag1NeK6NAfSqvD40ctkaNQah88Q77S1wQadOlv9cfv5UBWVdKVHN0w+DaD42nBw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1695106864916383.8485891943137; Tue, 19 Sep 2023 00:01:04 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-343-Tl07mWT5MPK4RqJissB-Xw-1; Tue, 19 Sep 2023 03:00:11 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 73E271C05EB7; Tue, 19 Sep 2023 07:00:08 +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 5DF0D1C554; Tue, 19 Sep 2023 07:00:08 +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 DDF751946A40; Tue, 19 Sep 2023 07:00:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2F702194658C for ; Tue, 19 Sep 2023 07:00:05 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1FB1D40C2070; Tue, 19 Sep 2023 07:00:05 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.2.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB62340C2064 for ; Tue, 19 Sep 2023 07:00:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695106863; 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=i2f9Nagsi4cEeHm2OBpsZv4YhwC8zpD6rE6IRZKREtA=; b=Q9PRRR9/+kb0Mdvkve2Uw6jSWhmJff5exdcCEfkjP0ihKA4X4RMr+6Iftvic9AqLq+JKFh LKyaTimHMmVs2cm4VcuGyzn2ixXzgBJfhidKqE4B3Xd48JllgkHWWyXIAZX6EmgPoitXu1 bc8zNzoOuE84IRJW3MwlIpcVDrbLtA0= X-MC-Unique: Tl07mWT5MPK4RqJissB-Xw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/4] virDomainVideoDefValidate: Use proper type in virReportEnumRangeError() Date: Tue, 19 Sep 2023 08:59:59 +0200 Message-ID: <5b6f1ed84364165e7ec6de61d91959bf0a1a4e31.1695105934.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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.5 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: 1695106866610100001 Content-Type: text/plain; charset="utf-8"; x-default="true" The @backend member of _virDomainVideoDef struct is of type virDomainVideoBackendType. Pass the proper type to virReportEnumRangeError(). Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_validate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index e70841c1d6..ac32fa1477 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -181,7 +181,7 @@ virDomainVideoDefValidate(const virDomainVideoDef *vide= o, break; case VIR_DOMAIN_VIDEO_BACKEND_TYPE_LAST: default: - virReportEnumRangeError(virDomainInputType, video->backend); + virReportEnumRangeError(virDomainVideoBackendType, video->backend); return -1; } =20 --=20 2.41.0 From nobody Sat May 11 18:50:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1695106869; cv=none; d=zohomail.com; s=zohoarc; b=ETVJ5PHeNbBIG/S5+TS+HWnQpQelwYWVtu0cv5LY5HT2lERyZv9NkXzdSpwDFbw3qCHgSdOAoQt3hk9eMozATieGYyHgow277lJScML3tOpYDbLlyKiCWgQIq2eCTNfoBIZDQgR4AZgbrIgTwiINmNAVnVRL5EeE3HufPc/TL90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695106869; 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=uG2NBxbeDKNuphiKY5YckeDtIlgqHBWiO5LLr8pCgUg=; b=V9caK+4riqY7viaARAbFeB5nXJ3FePPKyJa85mIkH194DDVnqq6NwC9kgYl3ozIWfvyXAIfp3wQLXKQoVmQld12qfXzzj/c3OeHWkNHsiFO49g790BJv++eNOP0XfCXXjnV9x5Lo227V34yWtGEvr0eQWpzlt0JfGtbASG0RQ9U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1695106869614173.21303191702032; Tue, 19 Sep 2023 00:01:09 -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-335-ECY_VVCdP-C_jrnia_66SA-1; Tue, 19 Sep 2023 03:00:12 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 4F694811E8F; Tue, 19 Sep 2023 07:00:09 +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 3BABE1C554; Tue, 19 Sep 2023 07:00:09 +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 30F25194658D; Tue, 19 Sep 2023 07:00:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CDB9619466FC for ; Tue, 19 Sep 2023 07:00:05 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id AD82A40C2070; Tue, 19 Sep 2023 07:00:05 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.2.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55F1C40C2064 for ; Tue, 19 Sep 2023 07:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695106868; 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=uG2NBxbeDKNuphiKY5YckeDtIlgqHBWiO5LLr8pCgUg=; b=WoOUS0bISzfCj0sjNnn4pme4RuhcmDbFnT1BqB76B+qWLovI+lvQsPJ3NXQuZiaiqq7HoB IcBTK3oEdfW614GXDO+4oRnHrDaOAT/9mI7JRysWal5EhFEwXdyZ2ojITEDwbkZ+EUOUGb rxyrFXmFwdyAMLEbWyinmuAr8olmgJE= X-MC-Unique: ECY_VVCdP-C_jrnia_66SA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 4/4] virerror: Make virReportEnumRangeError() check for type mismatch Date: Tue, 19 Sep 2023 09:00:00 +0200 Message-ID: <1b90f5c98fb386e76eda9608e2cc151ed684d7c4.1695105934.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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.5 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: 1695106871625100001 Content-Type: text/plain; charset="utf-8"; x-default="true" As can be seen from previous commits, it's fairly easy to pass a different type to virReportEnumRangeError() than the actual variable is of. So far, we have a sizeof() hack to check if some nonsensical types are not passed, e.g. it catches cases where a function name is passed instead of an enum. Extend the hack to check whether proper enum was passed. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/util/virerror.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/util/virerror.h b/src/util/virerror.h index ee85247433..d4b2679a09 100644 --- a/src/util/virerror.h +++ b/src/util/virerror.h @@ -161,16 +161,18 @@ void virReportSystemErrorFull(int domcode, #define virReportRestrictedError(...) \ virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_OPERATION_DENIED, \ __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__) -/* The sizeof(...) comparison here is a hack to catch typos - * in the name of the enum by triggering a compile error, as well - * as detecting if you passed a typename that refers to a function - * or struct type, instead of an enum. It should get optimized away - * since sizeof() is known at compile time */ +/* The ternary operator here is a hack to catch typos in the name of + * the enum and mismatching enum by triggering a compile error, as + * well as detecting if you passed a typename that refers to a + * function or struct type, instead of an enum. It should get + * optimized away since the value is constant and thus is known at + * compile time. */ #define virReportEnumRangeError(typname, value) \ virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INTERNAL_ERROR, \ __FILE__, __FUNCTION__, __LINE__, \ "Unexpected enum value %d for %s", \ - value, sizeof((typname)1) !=3D 0 ? #typname : #ty= pname); + value, \ + (__typeof__(value))1 =3D=3D (typname)1 && sizeof(= (typname)1) !=3D 0 ? #typname : #typname) =20 #define virReportError(code, ...) \ virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \ --=20 2.41.0