From nobody Sat Apr 20 09:29:27 2024 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.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; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1498747716017773.32307494375; Thu, 29 Jun 2017 07:48:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 366A6118E05; Thu, 29 Jun 2017 14:48:31 +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 044647FDA1; Thu, 29 Jun 2017 14:48:31 +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 009471841C41; Thu, 29 Jun 2017 14:48:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5TEl3sf013182 for ; Thu, 29 Jun 2017 10:47:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id E76CA179E8; Thu, 29 Jun 2017 14:47:03 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.82]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4A39787C35; Thu, 29 Jun 2017 14:47:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 366A6118E05 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 366A6118E05 From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 29 Jun 2017 16:46:57 +0200 Message-Id: <1498747617-5624-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: laine@laine.org Subject: [libvirt] [PATCH] conf: Move virDomainPCIAddressBusIsFullyReserved() 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 29 Jun 2017 14:48:32 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This function was private to the QEMU driver and was, accordingly, called qemuDomainPCIBusFullyReserved(). However, since it's really not QEMU-specific at all, it makes a lot of sense to have it closer to the virDomainPCIAddressBus struct it operates on; even more so considering we're going to introduce a complementary virDomainPCIAddressBusIsEmpty() function later on. Signed-off-by: Andrea Bolognani Reviewed-by: Laine Stump --- src/conf/domain_addr.c | 14 ++++++++++++++ src/conf/domain_addr.h | 3 +++ src/libvirt_private.syms | 1 + src/qemu/qemu_domain_address.c | 15 +-------------- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index 639168e..0ae1ed9 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -355,6 +355,20 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusP= tr bus, } =20 =20 +bool +virDomainPCIAddressBusIsFullyReserved(virDomainPCIAddressBusPtr bus) +{ + size_t i; + + for (i =3D bus->minSlot; i <=3D bus->maxSlot; i++) { + if (!bus->slot[i].functions) + return false; + } + + return true; +} + + /* Ensure addr fits in the address set, by expanding it if needed * * Return value: diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h index f884b8a..c90a335 100644 --- a/src/conf/domain_addr.h +++ b/src/conf/domain_addr.h @@ -141,6 +141,9 @@ int virDomainPCIAddressBusSetModel(virDomainPCIAddressB= usPtr bus, virDomainControllerModelPCI model) ATTRIBUTE_NONNULL(1); =20 +bool virDomainPCIAddressBusIsFullyReserved(virDomainPCIAddressBusPtr bus) + ATTRIBUTE_NONNULL(1); + bool virDomainPCIAddressSlotInUse(virDomainPCIAddressSetPtr addrs, virPCIDeviceAddressPtr addr) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 888412a..d76c1a7 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -106,6 +106,7 @@ virDomainCCWAddressSetFree; virDomainCCWAddressValidate; virDomainGetBlkioParametersAssignFromDef; virDomainPCIAddressAsString; +virDomainPCIAddressBusIsFullyReserved; virDomainPCIAddressBusSetModel; virDomainPCIAddressEnsureAddr; virDomainPCIAddressFlagsCompatible; diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index b5b863f..efc698d 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -1499,19 +1499,6 @@ qemuDomainValidateDevicePCISlotsChipsets(virDomainDe= fPtr def, } =20 =20 -static bool -qemuDomainPCIBusFullyReserved(virDomainPCIAddressBusPtr bus) -{ - size_t i; - - for (i =3D bus->minSlot; i <=3D bus->maxSlot; i++) - if (!bus->slot[i].functions) - return false; - - return true; -} - - /* * This assigns static PCI slots to all configured devices. * The ordering here is chosen to match the ordering used @@ -2043,7 +2030,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, bool buses_reserved =3D true; =20 for (i =3D 0; i < addrs->nbuses; i++) { - if (!qemuDomainPCIBusFullyReserved(&addrs->buses[i])) { + if (!virDomainPCIAddressBusIsFullyReserved(&addrs->buses[i= ])) { buses_reserved =3D false; break; } --=20 2.7.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list