From nobody Mon Feb 9 04:45:49 2026 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=1666621000; cv=none; d=zohomail.com; s=zohoarc; b=akHFpRHw6Nyr+zFP8z7fvJ0vgj6QaSBSdhWb5rQffnBkSRdyi8vBxbIDAOtmOYvMyC5+UBqbbtD7yp0bpLBr6bSySkaRCSE7ahwEBeiGyMDw0l0YyITX5HugWZXN/dXKDNLtrWIpmEoyBglQRfoC8svh0RXnVB8WLuokj+fvJOg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666621000; 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=sfvGitCSLtQQ7029/Cavd5aaidXkgpVi1jK5+8vEOQA=; b=PV91Z9GaDB5NFJ+d1NsJB4VC5ZzHLEDsT9xAgHDNiLKiC/3+9zoth3vswAQ5DlGaDC/aHZWi1GKV49egSWmdIftDUJABm7rAz98BqTIYPhDXHyB3feiy7MFS37LABJdiLgPfYGBVMiTs/lgReleUccyih8+eZgnbDAW/IHEI5zE= 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 1666621000547250.75213407692547; Mon, 24 Oct 2022 07:16:40 -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-356-RtcAjzdNOjyj7_W1Sa4r2w-1; Mon, 24 Oct 2022 10:16:36 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7A65981F46A; Mon, 24 Oct 2022 14:15:46 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 68A5240C2064; Mon, 24 Oct 2022 14:15:46 +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 5D3781946595; Mon, 24 Oct 2022 14:15:46 +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 A9D3619465A2 for ; Mon, 24 Oct 2022 14:15:44 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9D04E40C2088; Mon, 24 Oct 2022 14:15:44 +0000 (UTC) Received: from speedmetal.lan (ovpn-208-27.brq.redhat.com [10.40.208.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1838F40C2089 for ; Mon, 24 Oct 2022 14:15:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666620999; 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=sfvGitCSLtQQ7029/Cavd5aaidXkgpVi1jK5+8vEOQA=; b=AW5nvb6BUMLV6RZS1GBBm7nxHfMMINPtzCuDPQs90l2AxnYOM0+wEM4D6r90WYcwAn92um ogQtBo226IeJYy/AOdw6esc67nJvlBO2Qk/Yl2D8stwCTK8EhW/hBRNUyXFxHwlymkdY6r 4M5BgpNkYxTQujgYwv30Ak7qMVPJ7p0= X-MC-Unique: RtcAjzdNOjyj7_W1Sa4r2w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 33/43] virDomainTimerDef: Convert 'tickpolicy' field to proper enum type Date: Mon, 24 Oct 2022 16:14:38 +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: 1666621002582100010 Content-Type: text/plain; charset="utf-8" Convert the field, adjust the XML parser to use virXMLPropEnum and add the VIR_DOMAIN_TIMER_TICKPOLICY_LAST enum case to all appropriate 'switch' statements. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 12 +++--------- src/conf/domain_conf.h | 2 +- src/qemu/qemu_command.c | 5 +++++ src/qemu/qemu_validate.c | 6 ++++++ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index aa949766e1..4810aa7b82 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10546,7 +10546,6 @@ virDomainTimerDefParseXML(xmlNodePtr node, VIR_XPATH_NODE_AUTORESTORE(ctxt) xmlNodePtr catchup; int ret; - g_autofree char *tickpolicy =3D NULL; g_autofree char *track =3D NULL; g_autofree char *mode =3D NULL; @@ -10561,14 +10560,9 @@ virDomainTimerDefParseXML(xmlNodePtr node, &def->present) < 0) return NULL; - tickpolicy =3D virXMLPropString(node, "tickpolicy"); - if (tickpolicy !=3D NULL) { - if ((def->tickpolicy =3D virDomainTimerTickpolicyTypeFromString(ti= ckpolicy)) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown timer tickpolicy '%s'"), tickpolicy); - return NULL; - } - } + if (virXMLPropEnum(node, "tickpolicy", virDomainTimerTickpolicyTypeFro= mString, + VIR_XML_PROP_NONZERO, &def->tickpolicy) < 0) + return NULL; track =3D virXMLPropString(node, "track"); if (track !=3D NULL) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index de6aefed2d..2733d12fcd 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2474,7 +2474,7 @@ struct _virDomainTimerCatchupDef { struct _virDomainTimerDef { virDomainTimerNameType name; virTristateBool present; - int tickpolicy; /* enum virDomainTimerTickpolicyType */ + virDomainTimerTickpolicyType tickpolicy; virDomainTimerCatchupDef catchup; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 150824f2e1..7507ab46ab 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5747,6 +5747,8 @@ qemuBuildClockArgStr(virDomainClockDef *def) case VIR_DOMAIN_TIMER_TICKPOLICY_MERGE: case VIR_DOMAIN_TIMER_TICKPOLICY_DISCARD: return NULL; + case VIR_DOMAIN_TIMER_TICKPOLICY_LAST: + break; } break; /* no need to check other timers - there is only one rt= c */ } @@ -5818,6 +5820,8 @@ qemuBuildClockCommandLine(virCommand *cmd, case VIR_DOMAIN_TIMER_TICKPOLICY_MERGE: /* no way to support this mode for pit in qemu */ return -1; + case VIR_DOMAIN_TIMER_TICKPOLICY_LAST: + break; } break; @@ -6201,6 +6205,7 @@ qemuBuildCpuCommandLine(virCommand *cmd, case VIR_DOMAIN_TIMER_TICKPOLICY_NONE: case VIR_DOMAIN_TIMER_TICKPOLICY_CATCHUP: case VIR_DOMAIN_TIMER_TICKPOLICY_MERGE: + case VIR_DOMAIN_TIMER_TICKPOLICY_LAST: break; } break; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 079009ea4b..f8f2a0fd32 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -572,6 +572,8 @@ qemuValidateDomainDefClockTimers(const virDomainDef *de= f, virDomainTimerTickpolicyTypeToString( timer->tickpolicy)); return -1; + case VIR_DOMAIN_TIMER_TICKPOLICY_LAST: + break; } break; @@ -598,6 +600,8 @@ qemuValidateDomainDefClockTimers(const virDomainDef *de= f, virDomainTimerTickpolicyTypeToString( timer->tickpolicy)); return -1; + case VIR_DOMAIN_TIMER_TICKPOLICY_LAST: + break; } break; @@ -650,6 +654,8 @@ qemuValidateDomainDefClockTimers(const virDomainDef *de= f, virDomainTimerNameTypeToString(timer->name), virDomainTimerTickpolicyTypeToString(timer-= >tickpolicy)); return -1; + case VIR_DOMAIN_TIMER_TICKPOLICY_LAST: + break; } break; } --=20 2.37.3