From nobody Sun Feb 8 23:03:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1610999705; cv=none; d=zohomail.com; s=zohoarc; b=Rt9kcmlYMKH7Q2s8gH2uRdTunIwNp6W5Q5Wxz5iwQ6Zi1NqQe9RKgJsW/8ZpSQRfnW74a2AeSkxu7ei0968jWctX9Xv8s58YZWATZHarq1LYqLJe/Kox0fVGRosT4HGNo5gQpKYV+4cVqCDfsnb2RcFsNOjixwEsa1f9Kfa2jPE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610999705; 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=mLxLQsjIyz8HdC9M4WZsqIEgZwpWhe94zoLYYMExaAk=; b=mSJSoqXAguRbs1CMuKhTmpK/qaUhK5VlmuFppmuEKRATxuU68ly5bKXTQdFhgGNZffLsGKT4lgMRYab+i/+d2e0L1OgLJuVHQ7bsaQn8AJXWJYDw76nUc53ScUU+TVhgQ8xXGTFMBBdPQdkV9DWAFbqkI8I76jwLMtTrUg4lFcw= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1610999705238120.218832509089; Mon, 18 Jan 2021 11:55:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-385-on8CXbsENZKBeJ3JfVxspQ-1; Mon, 18 Jan 2021 14:54:42 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5A30D1005D44; Mon, 18 Jan 2021 19:54:35 +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 391075D9D7; Mon, 18 Jan 2021 19:54:35 +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 01E1A50041; Mon, 18 Jan 2021 19:54:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10IJsH6i032615 for ; Mon, 18 Jan 2021 14:54:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 539042026D16; Mon, 18 Jan 2021 19:54:17 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4ED6A2026D11 for ; Mon, 18 Jan 2021 19:54:17 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3B7581875040 for ; Mon, 18 Jan 2021 19:54:17 +0000 (UTC) Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-403-k7Lmv9G0OVCsA-SNVHamZA-1; Mon, 18 Jan 2021 14:54:15 -0500 Received: by mail-qv1-f52.google.com with SMTP id h1so8050261qvy.12 for ; Mon, 18 Jan 2021 11:54:15 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c7:a75a:cb34:ba60:6de6:be1d]) by smtp.gmail.com with ESMTPSA id 16sm11309085qkf.112.2021.01.18.11.54.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jan 2021 11:54:14 -0800 (PST) X-MC-Unique: on8CXbsENZKBeJ3JfVxspQ-1 X-MC-Unique: k7Lmv9G0OVCsA-SNVHamZA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mLxLQsjIyz8HdC9M4WZsqIEgZwpWhe94zoLYYMExaAk=; b=FQMnk4JV3OFOHAwHYgnu6IpApwk81CYyG52GYOlsPhE2u4H9AmNP56c3bCOcBCtXEe +aATw0pNGKUYmA59Qz9eUGhJKpqgUkPxlRNcBsQcrJNBbBJeIiyQ+rNjagydKImUmTon ujLpZw4RF1V058Ykd3Z/byjDvbCaZ08g8DKCmnti+dEgX2AINXnMDquCsTZqvrMGyG7/ GoWIYedJKm/DJcBFg14NA6zXWAsiGohqf1eaHy+xajCzuOmyeKYQ5XI4C20oL/Ru1xy/ m7/K1h4wYfKkldWp0isBOIPW6dvbXjmf15lWcpIJsn37emF3mLyh+7QzUNUlsKoVkdKS tIZw== X-Gm-Message-State: AOAM532kjhrX/e62Vqi1lg2Qykn/sH/KciZDuKp7yOZ0QABAxugicMNM LlBpMvy8ssH15wPaPYuD8C3NQ14TK16eAA== X-Google-Smtp-Source: ABdhPJxlGgDepQ4bx9XQidEa7yKIb/26lKOXrunsU/ncUD8dQRUIS8yzAaU1WEp0uxYNoRcokDPsLA== X-Received: by 2002:a0c:f601:: with SMTP id r1mr994608qvm.39.1610999654647; Mon, 18 Jan 2021 11:54:14 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH RESEND 18/20] virpci.c: use virPCIDeviceAddressPtr in virPCIDeviceListSteal() Date: Mon, 18 Jan 2021 16:53:34 -0300 Message-Id: <20210118195336.2090823-19-danielhb413@gmail.com> In-Reply-To: <20210118195336.2090823-1-danielhb413@gmail.com> References: <20210118195336.2090823-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel Henrique Barboza Reviewed-by: Laine Stump --- src/hypervisor/virhostdev.c | 8 +++++--- src/util/virpci.c | 6 +++--- src/util/virpci.h | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index 3bfb04c674..4042f874d6 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -846,7 +846,7 @@ virHostdevPreparePCIDevicesImpl(virHostdevManagerPtr mg= r, =20 VIR_DEBUG("Removing PCI device %s from inactive list", virPCIDeviceGetName(pci)); - actual =3D virPCIDeviceListSteal(mgr->inactivePCIHostdevs, pci); + actual =3D virPCIDeviceListSteal(mgr->inactivePCIHostdevs, virPCID= eviceGetAddress(pci)); =20 VIR_DEBUG("Adding PCI device %s to active list", virPCIDeviceGetName(pci)); @@ -918,7 +918,8 @@ virHostdevPreparePCIDevicesImpl(virHostdevManagerPtr mg= r, =20 VIR_DEBUG("Removing PCI device %s from active list", virPCIDeviceGetName(pci)); - if (!(actual =3D virPCIDeviceListSteal(mgr->activePCIHostdevs, pci= ))) + if (!(actual =3D virPCIDeviceListSteal(mgr->activePCIHostdevs, + virPCIDeviceGetAddress(pci)))) continue; =20 VIR_DEBUG("Adding PCI device %s to inactive list", @@ -1022,7 +1023,8 @@ virHostdevReAttachPCIDevicesImpl(virHostdevManagerPtr= mgr, =20 VIR_DEBUG("Removing PCI device %s from active list", virPCIDeviceGetName(pci)); - actual =3D virPCIDeviceListSteal(mgr->activePCIHostdevs, pci); + actual =3D virPCIDeviceListSteal(mgr->activePCIHostdevs, + virPCIDeviceGetAddress(pci)); =20 VIR_DEBUG("Adding PCI device %s to inactive list", virPCIDeviceGetName(pci)); diff --git a/src/util/virpci.c b/src/util/virpci.c index 9544275c31..332e681c43 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -1743,16 +1743,16 @@ virPCIDeviceListStealIndex(virPCIDeviceListPtr list, =20 virPCIDevicePtr virPCIDeviceListSteal(virPCIDeviceListPtr list, - virPCIDevicePtr dev) + virPCIDeviceAddressPtr devAddr) { - return virPCIDeviceListStealIndex(list, virPCIDeviceListFindIndex(list= , &dev->address)); + return virPCIDeviceListStealIndex(list, virPCIDeviceListFindIndex(list= , devAddr)); } =20 void virPCIDeviceListDel(virPCIDeviceListPtr list, virPCIDevicePtr dev) { - virPCIDeviceFree(virPCIDeviceListSteal(list, dev)); + virPCIDeviceFree(virPCIDeviceListSteal(list, &dev->address)); } =20 int diff --git a/src/util/virpci.h b/src/util/virpci.h index 628a293972..e3458a75fa 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -161,7 +161,7 @@ virPCIDevicePtr virPCIDeviceListGet(virPCIDeviceListPtr= list, int idx); size_t virPCIDeviceListCount(virPCIDeviceListPtr list); virPCIDevicePtr virPCIDeviceListSteal(virPCIDeviceListPtr list, - virPCIDevicePtr dev); + virPCIDeviceAddressPtr devAddr); virPCIDevicePtr virPCIDeviceListStealIndex(virPCIDeviceListPtr list, int idx); void virPCIDeviceListDel(virPCIDeviceListPtr list, --=20 2.26.2