From nobody Mon Feb 9 03:00:05 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=1566311462; cv=none; d=zoho.com; s=zohoarc; b=QnSTXV0Q/oX5OR90HyswaR8oLUJmHO83c9bTJhkqF5J9Uv9nTv1B/pp7hKB80Sfd3LMQ2wlUL2Gv12XO64h4BzNK74u/0ztb042wxHo6aHDi5hHHKPzN3NpoUAAPrbvXUOHlTQY0i1thNtq+Lnu4JsZlEpyDstPxQPR3RjUHk5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566311462; 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=jH9xtwxm9RjDaCTL61accTiJ33vG23HFt+qkXj7CGvE=; b=cXab7MmFV38G6pdvcUZKRMK5MR9RS/FcjipgrAy/il3cQIxxom4SnyggeuX6+rENq+ArwuWgkKix4LgndKq0D6oWsSe4e55UqQcwBoLRyP7JyT3c6uNAyPbYqlwm/WjxJCDi6YXHQF4dGby4AN1yBhhya2/+8hdgYDVXX5HyHRI= 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 1566311462880982.3259719020668; Tue, 20 Aug 2019 07:31:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A8D9810F23E4; Tue, 20 Aug 2019 14:31:01 +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 7DBE53DE5; Tue, 20 Aug 2019 14:31: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 37F7A180BA9B; Tue, 20 Aug 2019 14:31:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7KEUvEA028871 for ; Tue, 20 Aug 2019 10:30:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7A9456092F; Tue, 20 Aug 2019 14:30:57 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03CFF17AB5 for ; Tue, 20 Aug 2019 14:30:56 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 20 Aug 2019 16:30:31 +0200 Message-Id: <17e7499d30003cea014c38a5025c1aa2e5247b7a.1566311075.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 11/12] virpcimock: Drop @driverActions enum 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-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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.66]); Tue, 20 Aug 2019 14:31:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This enum was introduced to model how RHEL-7 kernel behaves - for some reason going with the old way (via new_id + bind) fails but using driver_override succeeds. Well, we don't need to care about that anymore since we don't create new_id file. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko Tested-by: Daniel Henrique Barboza --- tests/virpcimock.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/tests/virpcimock.c b/tests/virpcimock.c index 3157037913..a5045ed97c 100644 --- a/tests/virpcimock.c +++ b/tests/virpcimock.c @@ -98,19 +98,11 @@ char *fakerootdir; * */ =20 -enum driverActions { - PCI_ACTION_BIND =3D 1 << 0, - PCI_ACTION_UNBIND =3D 1 << 1, - PCI_ACTION_NEW_ID =3D 1 << 2, - PCI_ACTION_REMOVE_ID =3D 1 << 3, -}; - struct pciDriver { char *name; int *vendor; /* List of vendor:device IDs the driver can handle= */ int *device; size_t len; /* @len is used for both @vendor and @device */ - unsigned int fail; /* Bitwise-OR of driverActions that should fail */ }; =20 struct pciDeviceAddress { @@ -151,7 +143,7 @@ static void pci_device_new_from_stub(const struct pciDe= vice *data); static struct pciDevice *pci_device_find_by_id(struct pciDeviceAddress con= st *addr); static struct pciDevice *pci_device_find_by_content(const char *path); =20 -static void pci_driver_new(const char *name, int fail, ...); +static void pci_driver_new(const char *name, ...); static struct pciDriver *pci_driver_find_by_dev(struct pciDevice *dev); static struct pciDriver *pci_driver_find_by_path(const char *path); static struct pciDriver *pci_driver_find_by_driver_override(struct pciDevi= ce *dev); @@ -594,7 +586,7 @@ pci_driver_get_path(const struct pciDriver *driver, =20 =20 static void -pci_driver_new(const char *name, int fail, ...) +pci_driver_new(const char *name, ...) { struct pciDriver *driver; va_list args; @@ -606,12 +598,10 @@ pci_driver_new(const char *name, int fail, ...) !(driverpath =3D pci_driver_get_path(driver, NULL, true))) ABORT_OOM(); =20 - driver->fail =3D fail; - if (virFileMakePath(driverpath) < 0) ABORT("Unable to create: %s", driverpath); =20 - va_start(args, fail); + va_start(args, name); =20 while ((vendor =3D va_arg(args, int)) !=3D -1) { if ((device =3D va_arg(args, int)) =3D=3D -1) @@ -805,7 +795,7 @@ pci_driver_handle_bind(const char *path) struct pciDevice *dev =3D pci_device_find_by_content(path); struct pciDriver *driver =3D pci_driver_find_by_path(path); =20 - if (!driver || !dev || PCI_ACTION_BIND & driver->fail) { + if (!driver || !dev) { /* No driver, no device or failing driver requested */ errno =3D ENODEV; goto cleanup; @@ -822,7 +812,7 @@ pci_driver_handle_unbind(const char *path) int ret =3D -1; struct pciDevice *dev =3D pci_device_find_by_content(path); =20 - if (!dev || !dev->driver || PCI_ACTION_UNBIND & dev->driver->fail) { + if (!dev || !dev->driver) { /* No device, device not binded or failing driver requested */ errno =3D ENODEV; goto cleanup; @@ -876,11 +866,11 @@ init_env(void) make_file(tmp, "drivers_probe", NULL, -1); =20 # define MAKE_PCI_DRIVER(name, ...) \ - pci_driver_new(name, 0, __VA_ARGS__, -1, -1) + pci_driver_new(name, __VA_ARGS__, -1, -1) =20 MAKE_PCI_DRIVER("iwlwifi", 0x8086, 0x0044); MAKE_PCI_DRIVER("i915", 0x8086, 0x0046, 0x8086, 0x0047); - pci_driver_new("vfio-pci", PCI_ACTION_BIND, -1, -1); + MAKE_PCI_DRIVER("vfio-pci", -1, -1); =20 # define MAKE_PCI_DEVICE(Id, Vendor, Device, ...) \ do { \ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list