From nobody Mon Feb 9 11:29:42 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=1692646395; cv=none; d=zohomail.com; s=zohoarc; b=d1Mf5i1nH5aLI9dmCuG/L8LB0+Gi997DraZCJFhoqO54biKt1yDAQVsMN46YUB+NtOC/KNKF9akv14vxnvbCA8cNWv6IlSggs+E3XohsxxFAexW5j4S94PlYvLlBFYjDvir0HANLQ3fkAVrXBR2x/8JCdOxC/MpRXRWbE35kGBM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692646395; h=Content-Type:Content-Transfer-Encoding:Cc: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=iOgCsOxhv36l2avqmHAXlMsQ6wSFBCwNKUM8Ora/1Zk=; b=fg2PSvHd8VHE9sc/AJhXPE69ZKNqaTBcHufgGswBrV/3Mj1Q3AmHe/CZQw2Jg++1hbMXbUQBotzDJ9LDi2JoJD01EMQAGUof6yDtvNrJoChK83CBWcfNNIUzx0RXWn4zEarIsdJWywQp2t+M6tmai45kCrrfAMM3d4U2V8cI5SA= 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 1692646395806713.1020192431408; Mon, 21 Aug 2023 12:33:15 -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-324-XnoR7bAYOiqRtEYUKNmimw-1; Mon, 21 Aug 2023 15:33:10 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 051DD8022E4; Mon, 21 Aug 2023 19:33:08 +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 8B48064687; Mon, 21 Aug 2023 19:33:05 +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 1ACA81946587; Mon, 21 Aug 2023 19:33:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 662941946586 for ; Mon, 21 Aug 2023 19:32:59 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 477B64A9004; Mon, 21 Aug 2023 19:32:59 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.9.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A7AA492C13; Mon, 21 Aug 2023 19:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692646394; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=iOgCsOxhv36l2avqmHAXlMsQ6wSFBCwNKUM8Ora/1Zk=; b=MrsnLgPQPe0xT/i9t4avve6vG/0R4D+VUVruZBKIRJqiAQdsN2nPXZWqnPx6qrabbaX7bg sgZ7xSx7aNu4+KDaaXY807p9wXbQ8Tv3MtEtAR9nvwt3TFL93xCNlUTLkuDeotbAj8gNne 1kpyYwh1EkxY8imret3GVhB2uugLhkY= X-MC-Unique: XnoR7bAYOiqRtEYUKNmimw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v3 1/8] util: use "stubDriverType" instead of just "stubDriver" Date: Mon, 21 Aug 2023 15:32:51 -0400 Message-ID: <20230821193258.520859-2-laine@redhat.com> In-Reply-To: <20230821193258.520859-1-laine@redhat.com> References: <20230821193258.520859-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: , Cc: "Cc : Joao Martins" , "Cc : Cedric Le Goater" , "Cc : Jason Gunthorpe" Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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: 1692646397605100003 Content-Type: text/plain; charset="utf-8"; x-default="true" In the past we just kept track of the type of the "stub driver" (the driver that is bound to a device in order to assign it to a guest). The next commit will add a stubDriverName to go along with type, so lets use stubDriverType for the existing enum to make it easier to keep track of whether we're talking about the name or the type. Signed-off-by: Laine Stump --- src/hypervisor/domain_driver.c | 4 ++-- src/hypervisor/virhostdev.c | 8 ++++---- src/libvirt_private.syms | 4 ++-- src/util/virnvme.c | 2 +- src/util/virpci.c | 16 ++++++++-------- src/util/virpci.h | 6 +++--- tests/virhostdevtest.c | 2 +- tests/virpcitest.c | 8 ++++---- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/hypervisor/domain_driver.c b/src/hypervisor/domain_driver.c index 66e09ffb04..a70f75f3ae 100644 --- a/src/hypervisor/domain_driver.c +++ b/src/hypervisor/domain_driver.c @@ -505,9 +505,9 @@ virDomainDriverNodeDeviceDetachFlags(virNodeDevicePtr d= ev, return -1; =20 if (STREQ(driverName, "vfio")) - virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_VFIO); + virPCIDeviceSetStubDriverType(pci, VIR_PCI_STUB_DRIVER_VFIO); else if (STREQ(driverName, "xen")) - virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_XEN); + virPCIDeviceSetStubDriverType(pci, VIR_PCI_STUB_DRIVER_XEN); =20 return virHostdevPCINodeDeviceDetach(hostdevMgr, pci); } diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index eac3474783..c437ca9d22 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -244,9 +244,9 @@ virHostdevGetPCIHostDevice(const virDomainHostdevDef *h= ostdev, virPCIDeviceSetManaged(actual, hostdev->managed); =20 if (pcisrc->backend =3D=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) { - virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_VFIO); + virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_VFIO); } else if (pcisrc->backend =3D=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN) { - virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_XEN); + virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_XEN); } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("pci backend driver '%1$s' is not supported"), @@ -679,7 +679,7 @@ virHostdevPreparePCIDevicesImpl(virHostdevManager *mgr, for (i =3D 0; i < virPCIDeviceListCount(pcidevs); i++) { virPCIDevice *pci =3D virPCIDeviceListGet(pcidevs, i); bool strict_acs_check =3D !!(flags & VIR_HOSTDEV_STRICT_ACS_CHECK); - bool usesVFIO =3D (virPCIDeviceGetStubDriver(pci) =3D=3D VIR_PCI_S= TUB_DRIVER_VFIO); + bool usesVFIO =3D (virPCIDeviceGetStubDriverType(pci) =3D=3D VIR_P= CI_STUB_DRIVER_VFIO); struct virHostdevIsPCINodeDeviceUsedData data =3D {mgr, drv_name, = dom_name, false}; int hdrType =3D -1; =20 @@ -776,7 +776,7 @@ virHostdevPreparePCIDevicesImpl(virHostdevManager *mgr, =20 /* The device is bound to a known stub driver: store this * information and add a copy to the inactive list */ - virPCIDeviceSetStubDriver(pci, stub); + virPCIDeviceSetStubDriverType(pci, stub); =20 VIR_DEBUG("Adding PCI device %s to inactive list", virPCIDeviceGetName(pci)); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index da60c965dd..983109df86 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3072,7 +3072,7 @@ virPCIDeviceGetManaged; virPCIDeviceGetName; virPCIDeviceGetRemoveSlot; virPCIDeviceGetReprobe; -virPCIDeviceGetStubDriver; +virPCIDeviceGetStubDriverType; virPCIDeviceGetUnbindFromStub; virPCIDeviceGetUsedBy; virPCIDeviceGetVPD; @@ -3098,7 +3098,7 @@ virPCIDeviceReset; virPCIDeviceSetManaged; virPCIDeviceSetRemoveSlot; virPCIDeviceSetReprobe; -virPCIDeviceSetStubDriver; +virPCIDeviceSetStubDriverType; virPCIDeviceSetUnbindFromStub; virPCIDeviceSetUsedBy; virPCIDeviceUnbind; diff --git a/src/util/virnvme.c b/src/util/virnvme.c index f7f8dc5ea9..37333d515b 100644 --- a/src/util/virnvme.c +++ b/src/util/virnvme.c @@ -292,7 +292,7 @@ virNVMeDeviceCreatePCIDevice(const virNVMeDevice *nvme) return NULL; =20 /* NVMe devices must be bound to vfio */ - virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_VFIO); + virPCIDeviceSetStubDriverType(pci, VIR_PCI_STUB_DRIVER_VFIO); virPCIDeviceSetManaged(pci, nvme->managed); =20 return g_steal_pointer(&pci); diff --git a/src/util/virpci.c b/src/util/virpci.c index cc2b07bbba..88a020fb86 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -87,7 +87,7 @@ struct _virPCIDevice { =20 bool managed; =20 - virPCIStubDriver stubDriver; + virPCIStubDriver stubDriverType; =20 /* used by reattach function */ bool unbind_from_stub; @@ -1233,12 +1233,12 @@ virPCIDeviceBindToStub(virPCIDevice *dev) g_autofree char *driverLink =3D NULL; =20 /* Check the device is configured to use one of the known stub drivers= */ - if (dev->stubDriver =3D=3D VIR_PCI_STUB_DRIVER_NONE) { + if (dev->stubDriverType =3D=3D VIR_PCI_STUB_DRIVER_NONE) { virReportError(VIR_ERR_INTERNAL_ERROR, _("No stub driver configured for PCI device %1$s"), dev->name); return -1; - } else if (!(stubDriverName =3D virPCIStubDriverTypeToString(dev->stub= Driver))) { + } else if (!(stubDriverName =3D virPCIStubDriverTypeToString(dev->stub= DriverType))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown stub driver configured for PCI device %1= $s"), dev->name); @@ -1287,7 +1287,7 @@ virPCIDeviceDetach(virPCIDevice *dev, virPCIDeviceList *activeDevs, virPCIDeviceList *inactiveDevs) { - if (virPCIProbeStubDriver(dev->stubDriver) < 0) + if (virPCIProbeStubDriver(dev->stubDriverType) < 0) return -1; =20 if (activeDevs && virPCIDeviceListFind(activeDevs, &dev->address)) { @@ -1569,15 +1569,15 @@ virPCIDeviceGetManaged(virPCIDevice *dev) } =20 void -virPCIDeviceSetStubDriver(virPCIDevice *dev, virPCIStubDriver driver) +virPCIDeviceSetStubDriverType(virPCIDevice *dev, virPCIStubDriver driverTy= pe) { - dev->stubDriver =3D driver; + dev->stubDriverType =3D driverType; } =20 virPCIStubDriver -virPCIDeviceGetStubDriver(virPCIDevice *dev) +virPCIDeviceGetStubDriverType(virPCIDevice *dev) { - return dev->stubDriver; + return dev->stubDriverType; } =20 bool diff --git a/src/util/virpci.h b/src/util/virpci.h index 4d9193f24e..485f535bc9 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -134,9 +134,9 @@ int virPCIDeviceReset(virPCIDevice *dev, void virPCIDeviceSetManaged(virPCIDevice *dev, bool managed); bool virPCIDeviceGetManaged(virPCIDevice *dev); -void virPCIDeviceSetStubDriver(virPCIDevice *dev, - virPCIStubDriver driver); -virPCIStubDriver virPCIDeviceGetStubDriver(virPCIDevice *dev); +void virPCIDeviceSetStubDriverType(virPCIDevice *dev, + virPCIStubDriver driverType); +virPCIStubDriver virPCIDeviceGetStubDriverType(virPCIDevice *dev); virPCIDeviceAddress *virPCIDeviceGetAddress(virPCIDevice *dev); int virPCIDeviceSetUsedBy(virPCIDevice *dev, const char *drv_name, diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c index ee0d1c1e6b..04e6c00908 100644 --- a/tests/virhostdevtest.c +++ b/tests/virhostdevtest.c @@ -142,7 +142,7 @@ myInit(void) if (!(dev[i] =3D virPCIDeviceNew(&subsys->u.pci.addr))) goto cleanup; =20 - virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO); + virPCIDeviceSetStubDriverType(dev[i], VIR_PCI_STUB_DRIVER_VFIO); } =20 for (i =3D 0; i < ndisks; i++) { diff --git a/tests/virpcitest.c b/tests/virpcitest.c index 769175d7c4..92cc8c07c6 100644 --- a/tests/virpcitest.c +++ b/tests/virpcitest.c @@ -107,7 +107,7 @@ testVirPCIDeviceDetach(const void *opaque G_GNUC_UNUSED) if (!(dev[i] =3D virPCIDeviceNew(&devAddr))) goto cleanup; =20 - virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO); + virPCIDeviceSetStubDriverType(dev[i], VIR_PCI_STUB_DRIVER_VFIO); =20 if (virPCIDeviceDetach(dev[i], activeDevs, inactiveDevs) < 0) goto cleanup; @@ -149,7 +149,7 @@ testVirPCIDeviceReset(const void *opaque G_GNUC_UNUSED) if (!(dev[i] =3D virPCIDeviceNew(&devAddr))) goto cleanup; =20 - virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO); + virPCIDeviceSetStubDriverType(dev[i], VIR_PCI_STUB_DRIVER_VFIO); =20 if (virPCIDeviceReset(dev[i], activeDevs, inactiveDevs) < 0) goto cleanup; @@ -190,7 +190,7 @@ testVirPCIDeviceReattach(const void *opaque G_GNUC_UNUS= ED) CHECK_LIST_COUNT(activeDevs, 0); CHECK_LIST_COUNT(inactiveDevs, i + 1); =20 - virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO); + virPCIDeviceSetStubDriverType(dev[i], VIR_PCI_STUB_DRIVER_VFIO); } =20 CHECK_LIST_COUNT(activeDevs, 0); @@ -249,7 +249,7 @@ testVirPCIDeviceDetachSingle(const void *opaque) if (!dev) goto cleanup; =20 - virPCIDeviceSetStubDriver(dev, VIR_PCI_STUB_DRIVER_VFIO); + virPCIDeviceSetStubDriverType(dev, VIR_PCI_STUB_DRIVER_VFIO); =20 if (virPCIDeviceDetach(dev, NULL, NULL) < 0) goto cleanup; --=20 2.41.0