From nobody Mon Feb 9 07:54:50 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1536135004193113.32394679151867; Wed, 5 Sep 2018 01:10:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2C3E2307D855; Wed, 5 Sep 2018 08:10:02 +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 103CE5E7C6; Wed, 5 Sep 2018 08:10:01 +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 AF489181A12F; Wed, 5 Sep 2018 08:10:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8589Y21022586 for ; Wed, 5 Sep 2018 04:09:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 612B8215670B; Wed, 5 Sep 2018 08:09:34 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F22582156701 for ; Wed, 5 Sep 2018 08:09:33 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 5 Sep 2018 10:09:26 +0200 Message-Id: <20180905080926.3034-4-abologna@redhat.com> In-Reply-To: <20180905080926.3034-1-abologna@redhat.com> References: <20180905080926.3034-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 3/3] util: Drop virPCIGetAddrString() 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 05 Sep 2018 08:10:03 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" There's a single user for it which takes an existing virPCIDeviceAddress, passes its various bits to the function which in turn constructs a virPCIDevice and then copies the string representation for the caller to use: we can use virPCIDeviceAddressAsString() instead and avoid creating the virPCIDevice in the first place. Since the function ends up having no users after the change, we can just drop it. Signed-off-by: Andrea Bolognani Reviewed-by: Martin Kletzander --- src/util/virnetdev.c | 6 +----- src/util/virpci.c | 16 ---------------- src/util/virpci.h | 7 ------- 3 files changed, 1 insertion(+), 28 deletions(-) diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 8eac419725..9cc9d18155 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1305,11 +1305,7 @@ virNetDevGetVirtualFunctions(const char *pfname, goto cleanup; =20 for (i =3D 0; i < *n_vfname; i++) { - if (virPCIGetAddrString((*virt_fns)[i]->domain, - (*virt_fns)[i]->bus, - (*virt_fns)[i]->slot, - (*virt_fns)[i]->function, - &pciConfigAddr) < 0) { + if (!(pciConfigAddr =3D virPCIDeviceAddressAsString((*virt_fns)[i]= ))) { virReportSystemError(ENOSYS, "%s", _("Failed to get PCI Config Address Strin= g")); goto cleanup; diff --git a/src/util/virpci.c b/src/util/virpci.c index d82da710ee..1730d888f7 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -1668,22 +1668,6 @@ virPCIDeviceReadID(virPCIDevicePtr dev, const char *= id_name) return id_str; } =20 -int -virPCIGetAddrString(unsigned int domain, - unsigned int bus, - unsigned int slot, - unsigned int function, - char **pciConfigAddr) -{ - VIR_AUTOPTR(virPCIDevice) dev =3D NULL; - - dev =3D virPCIDeviceNew(domain, bus, slot, function); - if (!dev || VIR_STRDUP(*pciConfigAddr, dev->name) < 0) - return -1; - - return 0; -} - char * virPCIDeviceAddressAsString(virPCIDeviceAddressPtr addr) { diff --git a/src/util/virpci.h b/src/util/virpci.h index 271a753be2..b4f72f8f06 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -218,13 +218,6 @@ int virPCIGetSysfsFile(char *virPCIDeviceName, char **pci_sysfs_device_link) ATTRIBUTE_RETURN_CHECK; =20 -int virPCIGetAddrString(unsigned int domain, - unsigned int bus, - unsigned int slot, - unsigned int function, - char **pciConfigAddr) - ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK; - char *virPCIDeviceAddressAsString(virPCIDeviceAddressPtr addr) ATTRIBUTE_NONNULL(1); =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list