From nobody Mon Feb 9 04:03:19 2026 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=1693231131; cv=none; d=zohomail.com; s=zohoarc; b=O6ESi1VKgJDrpzeuxmOstKn15psOrKhkWKusNbcvqavcdhrf4FgwtfItCeLTocwvZ/DChQbJT5wYFmKUVd7jjNrZahOKM+NEqahvL8MiQZD9Tm2QJAZHq1WLgRR4ijb1q8Qfga+3l9OWvVfdr53Qmyf/vaYTbtwIxSjQxvWSvFs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693231131; 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=7if2qM1tNPUWZzDbXJdBlOR9F3zM0FVZq/DQF28pDks=; b=F0ZCdtEs+OcNL5DO0Qi/gvvXG4oPU/9FjDfUZdl13amtY00J5+I1HB3xv3cWCTlkMnLEydZgketOTGXOqBeuFdBmJhHOWPl8yc0d4i0NaIsZKEoQZjEXU6dFx1feBO1F3oOKsAX45bLbG68Sg/vl3s7fFhkSGqOt/PB755ccJuY= 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 1693231131596479.8663158836372; Mon, 28 Aug 2023 06:58:51 -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-447-7P8i-MTaPM2S3_Rc3A83qQ-1; Mon, 28 Aug 2023 09:58:39 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 892AA18A65F1; Mon, 28 Aug 2023 13:58:27 +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 7132040C6F4C; Mon, 28 Aug 2023 13:58:27 +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 3E8211946588; Mon, 28 Aug 2023 13:58:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BFBCF1946587 for ; Mon, 28 Aug 2023 13:57:38 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A2BAB2026D2B; Mon, 28 Aug 2023 13:57:38 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F30F2026D4B for ; Mon, 28 Aug 2023 13:57:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693231130; 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=7if2qM1tNPUWZzDbXJdBlOR9F3zM0FVZq/DQF28pDks=; b=fwi4MqiuwI2UI+rftReNFGCF1lJ5dj+dNX3xbMBsXlUrLvrEhEPOGlJpyMaN2UuM5Yflu7 S6CNxIPZXLAKUrhd6YTIpu8sTskKga5q/JxlCg1aRgz8nz7cwMcgZVQmBNYe/WoWB6cOD+ N5z54fZQH5q8VTZYOwcMK07aC7MpMLY= X-MC-Unique: 7P8i-MTaPM2S3_Rc3A83qQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/5] virDomainFeaturesXENDefParse: Use virXMLNodeGetSubelementList Date: Mon, 28 Aug 2023 15:57:27 +0200 Message-ID: <943265f31f2d40b18184fb43b13cd323b81ef118.1693231019.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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.2 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: 1693231132209100001 Content-Type: text/plain; charset="utf-8" Rewrite the old-style parser to use virXMLNodeGetSubelementList Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3a08034b9d..02bba77768 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16409,22 +16409,25 @@ static int virDomainFeaturesXENDefParse(virDomainDef *def, xmlNodePtr node) { + g_autofree xmlNodePtr *feats =3D NULL; + size_t nfeats =3D virXMLNodeGetSubelementList(node, NULL, &feats); + size_t i; + def->features[VIR_DOMAIN_FEATURE_XEN] =3D VIR_TRISTATE_SWITCH_ON; - node =3D xmlFirstElementChild(node); - while (node) { + for (i =3D 0; i < nfeats; i++) { int feature; virTristateSwitch value; - feature =3D virDomainXenTypeFromString((const char *)node->name); + feature =3D virDomainXenTypeFromString((const char *)feats[i]->nam= e); if (feature < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unsupported Xen feature: %1$s"), - node->name); + feats[i]->name); return -1; } - if (virXMLPropTristateSwitch(node, "state", + if (virXMLPropTristateSwitch(feats[i], "state", VIR_XML_PROP_REQUIRED, &value) < 0) return -1; @@ -16438,7 +16441,7 @@ virDomainFeaturesXENDefParse(virDomainDef *def, if (value !=3D VIR_TRISTATE_SWITCH_ON) break; - if (virXMLPropEnum(node, "mode", + if (virXMLPropEnum(feats[i], "mode", virDomainXenPassthroughModeTypeFromString, VIR_XML_PROP_NONZERO, &def->xen_passthrough_mode) < 0) @@ -16448,8 +16451,6 @@ virDomainFeaturesXENDefParse(virDomainDef *def, case VIR_DOMAIN_XEN_LAST: break; } - - node =3D xmlNextElementSibling(node); } return 0; --=20 2.41.0