From nobody Mon Feb 9 10:29:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585120413; cv=none; d=zohomail.com; s=zohoarc; b=Ko7jeXJ9kT4JvwBZ8h2lC2gqwzci8cIU5M6aTCnZbgiKG+xk+9ZPyrtpYkvPhc/ZnF6cLUJQN2CM2Boni5RuwfCXPRhXCJuI6Ka/ClRrxK6mjEFmCO7VXkepT15hE1PAD1S2LRBMLneGSW14WNI2t9nI/NzK5rC+dRhl7bcURp0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585120413; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=fHRmNRS4U8/PwgfL7kY4njcKVIJ/P3lklxmJZelAbJ4=; b=CThaH2zW5saQ0fuqZcS/z+dL2C+73ORKf/UDKTSMojxmXKRmMjbfaUGX0GwCXbYosRk/LNzZ2Zq7V68pVU0PSWlsxnPhhuNVy+HshrgSklcKfZazq+u07D34S8zmo0CKOeRTcYkIZ/0kORQvn17l6XWnI+cTzw9VyMvxL3V6YkQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585120413994669.4316503097828; Wed, 25 Mar 2020 00:13:33 -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-157-IQIyTLpWNxS-pQz7LzYFpw-1; Wed, 25 Mar 2020 03:13:31 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 89810801E78; Wed, 25 Mar 2020 07:13:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C71C9B934; Wed, 25 Mar 2020 07:13:25 +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 07C6618034EE; Wed, 25 Mar 2020 07:13:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02P7CUJ6023893 for ; Wed, 25 Mar 2020 03:12:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id A01532037E59; Wed, 25 Mar 2020 07:12:29 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9AA4D2037E4F for ; Wed, 25 Mar 2020 07:12:28 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C13F280029B for ; Wed, 25 Mar 2020 07:12:28 +0000 (UTC) Received: from mail-m24147.qiye.163.com (mail-m24147.qiye.163.com [220.194.24.147]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-435-VZM04qrnM76ixPcZiaAsLA-1; Wed, 25 Mar 2020 03:12:25 -0400 Received: from localhost.localdomain (unknown [123.232.151.103]) by smtp4 (Coremail) with SMTP id JedpCgD3ftNNBHtey+koAw--.408S7; Wed, 25 Mar 2020 15:12:20 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585120412; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=fHRmNRS4U8/PwgfL7kY4njcKVIJ/P3lklxmJZelAbJ4=; b=eF4T8WHDivlVFFay0vHtGZWOFpuGPkpNAVe4sapaFFXYDlZBnvx/+p2uSg3By3U0Ydt5pC ddzsHU6VHvaBGbVShol7w3Yi8TkUbAHoGQUIPBJvfeqY8vK3CCcDKvP49AdHGJ0+Skpwza jMaBzyyDZetlXv4KDNSKiobZxEYwIq0= X-MC-Unique: IQIyTLpWNxS-pQz7LzYFpw-1 X-MC-Unique: VZM04qrnM76ixPcZiaAsLA-1 From: Shi Lei To: libvir-list@redhat.com Subject: [RFC 05/29] util: Replace virTristateBool|virTristateSwitch(hardcoded) with namesakes(generated) Date: Wed, 25 Mar 2020 15:11:45 +0800 Message-Id: <20200325071209.20841-6-shi_lei@massclouds.com> In-Reply-To: <20200325071209.20841-1-shi_lei@massclouds.com> References: <20200325071209.20841-1-shi_lei@massclouds.com> X-CM-TRANSID: JedpCgD3ftNNBHtey+koAw--.408S7 X-Coremail-Antispam: 1Uf129KBjvJXoWxJF45WFWUAr4kGF15ArWxtFb_yoW5WrWrpw s5Ars7Cry3Xr1a9w4ftw4Fya1akw15tr15CF93WF1kWF4FqwnrXrZ7tFWkWrWjyFW5J39x Zw1UK348Jay0yw7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pR8-BtUUUUU= X-Originating-IP: [123.232.151.103] X-CM-SenderInfo: pvklsz1hl6ztxvvfz0xxgvhudrp/1tbiRxTxT1dqAIIyYQAAsB X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 02P7CUJ6023893 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.11 X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Shi Lei --- docs/schemas/basictypes.rng | 14 ++++++++++++++ src/util/Makefile.inc.am | 2 ++ src/util/virenum.c | 15 --------------- src/util/virenum.h | 21 +++------------------ 4 files changed, 19 insertions(+), 33 deletions(-) diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng index 8146527..e602715 100644 --- a/docs/schemas/basictypes.rng +++ b/docs/schemas/basictypes.rng @@ -571,6 +571,13 @@ =20 + yes no @@ -578,6 +585,13 @@ =20 + on off diff --git a/src/util/Makefile.inc.am b/src/util/Makefile.inc.am index ada1bb2..fcf0a0d 100644 --- a/src/util/Makefile.inc.am +++ b/src/util/Makefile.inc.am @@ -238,6 +238,8 @@ UTIL_SOURCES =3D \ =20 =20 UTIL_GENERATED_SOURCES =3D \ + util/virenum.generated.h \ + util/virenum.generated.c \ $(NULL) =20 =20 diff --git a/src/util/virenum.c b/src/util/virenum.c index 26093bd..8236924 100644 --- a/src/util/virenum.c +++ b/src/util/virenum.c @@ -22,21 +22,6 @@ =20 #define VIR_FROM_THIS VIR_FROM_NONE =20 -VIR_ENUM_IMPL(virTristateBool, - VIR_TRISTATE_BOOL_LAST, - "default", - "yes", - "no", -); - -VIR_ENUM_IMPL(virTristateSwitch, - VIR_TRISTATE_SWITCH_LAST, - "default", - "on", - "off", -); - - virTristateBool virTristateBoolFromBool(bool val) { diff --git a/src/util/virenum.h b/src/util/virenum.h index 24a69bd..add02ee 100644 --- a/src/util/virenum.h +++ b/src/util/virenum.h @@ -19,6 +19,7 @@ #pragma once =20 #include "internal.h" +#include "virenum.generated.h" =20 int virEnumFromString(const char * const *types, @@ -30,24 +31,8 @@ virEnumToString(const char * const *types, unsigned int ntypes, int type); =20 -typedef enum { - VIR_TRISTATE_BOOL_ABSENT =3D 0, - VIR_TRISTATE_BOOL_YES, - VIR_TRISTATE_BOOL_NO, - - VIR_TRISTATE_BOOL_LAST -} virTristateBool; - -typedef enum { - VIR_TRISTATE_SWITCH_ABSENT =3D 0, - VIR_TRISTATE_SWITCH_ON, - VIR_TRISTATE_SWITCH_OFF, - - VIR_TRISTATE_SWITCH_LAST -} virTristateSwitch; - -VIR_ENUM_DECL(virTristateBool); -VIR_ENUM_DECL(virTristateSwitch); +typedef virTristateBoolType virTristateBool; +typedef virTristateSwitchType virTristateSwitch; =20 virTristateBool virTristateBoolFromBool(bool val); virTristateSwitch virTristateSwitchFromBool(bool val); --=20 2.17.1