From nobody Sun Feb 8 17:28:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1558448793; cv=none; d=zoho.com; s=zohoarc; b=JhA6c/kr3NxkYBDbP6j1zkdiAlRyx4MMeKHIvbgwTH++jGvs0XXWnJL5hsmff6lPUDBP04reEVu9tJpJaLY2aW/AC56DT/RHHu0hBSUheZWMOPQy5MSAJ/CUakXCSc7X4qu1CsVVBHVUumizIIt0+gbVjIQIdZ3dBjLwIt7yEus= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558448793; 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:ARC-Authentication-Results; bh=4gODH3uPIjB2tgeFb6UhTZStCjEwLGNNDR0IqoSvqQY=; b=XTwrGOcivyleq1ANctFxcFvz+xOTreM8SV/84iFHxXlivN9ckNV9gZs3Aj1WHdx0FQA+eC6e56r6L4V/RY5OJjo7YPPcyzbiNUYR5bhm0/AMdVx2Mtwp8d6vOU+LwRuC8JRg74Tw7VpnlUTfP9voAmrjSB0HSdYxQ5oPwXpkEHw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558448793286881.1575249968113; Tue, 21 May 2019 07:26:33 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0665330832EF; Tue, 21 May 2019 14:26:15 +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 AFE0A1001F5B; Tue, 21 May 2019 14:26:10 +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 4B6775B425; Tue, 21 May 2019 14:26:08 +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 x4LEQ6KN011942 for ; Tue, 21 May 2019 10:26:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id C2A6266844; Tue, 21 May 2019 14:26:06 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D35B66842 for ; Tue, 21 May 2019 14:26:06 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 21 May 2019 16:25:59 +0200 Message-Id: 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 Subject: [libvirt] [PATCH 1/2] Introduce virDomainDeviceIterate 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 21 May 2019 14:26:27 +0000 (UTC) A counterpart to virDomainDeviceInfoIterate that will iterate over all devices, not just those with an info. Use it in places where we intend to process all devices with callbacks that do not depend on DeviceInfo being present: * virDomainDefPostParse * virDomainDefValidate Signed-off-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 28 +++++++++++++++++++--------- src/conf/domain_conf.h | 3 +++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a3a514136b..fb1256f640 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4297,6 +4297,19 @@ virDomainDeviceInfoIterateInternal(virDomainDefPtr d= ef, } =20 =20 +int +virDomainDeviceIterate(virDomainDefPtr def, + virDomainDeviceInfoCallback cb, + void *opaque) +{ + return virDomainDeviceInfoIterateInternal(def, + cb, + DOMAIN_DEVICE_ITERATE_ALL_CO= NSOLES | + DOMAIN_DEVICE_ITERATE_GRAPHI= CS, + opaque); +} + + int virDomainDeviceInfoIterate(virDomainDefPtr def, virDomainDeviceInfoCallback cb, @@ -5793,10 +5806,9 @@ virDomainDefPostParse(virDomainDefPtr def, } =20 /* iterate the devices */ - ret =3D virDomainDeviceInfoIterateInternal(def, - virDomainDefPostParseDeviceIt= erator, - DOMAIN_DEVICE_ITERATE_ALL_CON= SOLES, - &data); + ret =3D virDomainDeviceIterate(def, + virDomainDefPostParseDeviceIterator, + &data); =20 if (virDomainDefPostParseCheckFailure(def, parseFlags, ret) < 0) goto cleanup; @@ -6923,11 +6935,9 @@ virDomainDefValidate(virDomainDefPtr def, return -1; =20 /* iterate the devices */ - if (virDomainDeviceInfoIterateInternal(def, - virDomainDefValidateDeviceItera= tor, - (DOMAIN_DEVICE_ITERATE_ALL_CONS= OLES | - DOMAIN_DEVICE_ITERATE_GRAPHICS= ), - &data) < 0) + if (virDomainDeviceIterate(def, + virDomainDefValidateDeviceIterator, + &data) < 0) return -1; =20 if (virDomainDefValidateInternal(def, xmlopt) < 0) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index fa0756b634..15ecdac6f7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2869,6 +2869,9 @@ typedef int (*virDomainDeviceInfoCallback)(virDomainD= efPtr def, virDomainDeviceInfoPtr info, void *opaque); =20 +int virDomainDeviceIterate(virDomainDefPtr def, + virDomainDeviceInfoCallback cb, + void *opaque); int virDomainDeviceInfoIterate(virDomainDefPtr def, virDomainDeviceInfoCallback cb, void *opaque); --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list