From nobody Tue May 7 17:59:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1628172977; cv=none; d=zohomail.com; s=zohoarc; b=bkqFaAZtzN9r5qLw1auu4uucxpe20orz2RuhGFHEGqyafRfgGksDNsqFPKQ8ZQXrEi2nBVl443gKCZCfAUInyyb+2khQM7FRGEY/L61GXx2/QkyfdiUEQ6nJO8FlGwa93Or5/DzqTkoVJnOl03LuwX7YUha8uVg32QRA/ZmFlvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628172977; 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; bh=t3iI4sd73i3xAivrpFkNljVwS4LpAh/kQeLB+LX1ij8=; b=clpgSN7plYDRvEpXc3zdD+5b5TRgGqm6FzM5ml5R598lzrT0dSRxUsni9t6UeyOfalj6B3roQNuf+IybPWs7Tx6NTqkknpfom2YH6AlKZ1dyHkcME4PXX7aa8VeqH34eZXXPJogaMirbCl/FrpxbSwNMeckGcXgA6BpAm2GOj3s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1628172977598913.1757520454488; Thu, 5 Aug 2021 07:16:17 -0700 (PDT) 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-353-cisOr_sfMvy0tkdzfSuKrg-1; Thu, 05 Aug 2021 10:16:15 -0400 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 37EBE1B18BC6; Thu, 5 Aug 2021 14:16:09 +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 1617B295E5; Thu, 5 Aug 2021 14:16:09 +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 6F1EF4A7C8; Thu, 5 Aug 2021 14:16:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 175EDHe6016798 for ; Thu, 5 Aug 2021 10:13:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 661295C25D; Thu, 5 Aug 2021 14:13:17 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id C7F285C1A1 for ; Thu, 5 Aug 2021 14:13:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628172976; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=t3iI4sd73i3xAivrpFkNljVwS4LpAh/kQeLB+LX1ij8=; b=MLqOK+at39aSBkFT3LMrtkoLQ24yUPvGy8mUm3IXDhqkKile2hMbXT3QYOxcM3tzuVJYIu vxdZt4d0BqdHwi+QCRWY3fwUuUgtmHNGPYLczbNn741PscujsEcOQ9Y0sicbTntmUzfe7A N7MDliAA5w7M5qPAfiM1krQhIx43F6M= X-MC-Unique: cisOr_sfMvy0tkdzfSuKrg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/6] virNetDevGetVirtualFunctions: Remove 'max_vfs' argument Date: Thu, 5 Aug 2021 16:13:05 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628172979244100003 Content-Type: text/plain; charset="utf-8" The only caller doesn't use it. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/network/bridge_driver.c | 3 +-- src/util/virnetdev.c | 11 ++++------- src/util/virnetdev.h | 5 ++--- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index c9ee4b1a4e..4ffcecdf9f 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2599,7 +2599,6 @@ static int networkCreateInterfacePool(virNetworkDef *netdef) { size_t numVirtFns =3D 0; - unsigned int maxVirtFns =3D 0; char **vfNames =3D NULL; virPCIDeviceAddress **virtFns; @@ -2610,7 +2609,7 @@ networkCreateInterfacePool(virNetworkDef *netdef) return 0; if ((virNetDevGetVirtualFunctions(netdef->forward.pfs->dev, &vfNames, - &virtFns, &numVirtFns, &maxVirtFns))= < 0) { + &virtFns, &numVirtFns)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not get Virtual functions on %s"), netdef->forward.pfs->dev); diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index fe531a3260..d578becb20 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1225,17 +1225,16 @@ int virNetDevGetVirtualFunctions(const char *pfname, char ***vfname, virPCIDeviceAddress ***virt_fns, - size_t *n_vfname, - unsigned int *max_vfs) + size_t *n_vfname) { int ret =3D -1; size_t i; g_autofree char *pf_sysfs_device_link =3D NULL; g_autofree char *pfPhysPortID =3D NULL; + unsigned int max_vfs; *virt_fns =3D NULL; *n_vfname =3D 0; - *max_vfs =3D 0; if (virNetDevGetPhysPortID(pfname, &pfPhysPortID) < 0) goto cleanup; @@ -1243,8 +1242,7 @@ virNetDevGetVirtualFunctions(const char *pfname, if (virNetDevSysfsFile(&pf_sysfs_device_link, pfname, "device") < 0) goto cleanup; - if (virPCIGetVirtualFunctions(pf_sysfs_device_link, virt_fns, - n_vfname, max_vfs) < 0) + if (virPCIGetVirtualFunctions(pf_sysfs_device_link, virt_fns, n_vfname= , &max_vfs) < 0) goto cleanup; *vfname =3D g_new0(char *, *n_vfname); @@ -1480,8 +1478,7 @@ int virNetDevGetVirtualFunctions(const char *pfname G_GNUC_UNUSED, char ***vfname G_GNUC_UNUSED, virPCIDeviceAddress ***virt_fns G_GNUC_UNUSED, - size_t *n_vfname G_GNUC_UNUSED, - unsigned int *max_vfs G_GNUC_UNUSED) + size_t *n_vfname G_GNUC_UNUSED) { virReportSystemError(ENOSYS, "%s", _("Unable to get virtual functions on this platfo= rm")); diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h index b694f4ac35..de786c9789 100644 --- a/src/util/virnetdev.h +++ b/src/util/virnetdev.h @@ -254,10 +254,9 @@ int virNetDevGetPhysPortName(const char *ifname, int virNetDevGetVirtualFunctions(const char *pfname, char ***vfname, virPCIDeviceAddress ***virt_fns, - size_t *n_vfname, - unsigned int *max_vfs) + size_t *n_vfname) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) - ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) G_GNUC_WARN_UNUSED_RESULT; + ATTRIBUTE_NONNULL(4) G_GNUC_WARN_UNUSED_RESULT; int virNetDevSaveNetConfig(const char *linkdev, int vf, const char *stateDir, --=20 2.31.1 From nobody Tue May 7 17:59:56 2024 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=1628172976; cv=none; d=zohomail.com; s=zohoarc; b=jAdqEk+VB55pDPutEhdns6Bubx3kHB/dLvuIGgmHEZPY2ic3qyKbXCKawPQQZGuuHWKd4mM+xVK/1JaNnmaTOky1E8054LuZYauTSgDQaSjvJk/ZpvXW2d1ADTy4FOzffCuIIf5NgjZ5uUwvUKe3XpVvO7Sd98nCLkmsqnB/Rng= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628172976; 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; bh=wYZfbeg8UEgwfCzRp4ftTOHDnmI2z3OTZyz0yH84jR8=; b=NQqmyI0o2N598/o490Pu+R/w88kOsVaNea0ZROLQW0R+ALroAA7kaCejlYvljnG4npRMZQyxe7YRslmDMB5YNmA5Q3sOSZC1I2ZJItvnTsMP2caf/a/RxGuJtk3U2Jnk5YkFx9ANjNnz4gQhCujvfhc7tKXN1OQV3Fn34ZV0SBk= 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 1628172976845953.8056287979414; Thu, 5 Aug 2021 07:16:16 -0700 (PDT) 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-584-qJJ-RqgzMq69eh5wtBj4Og-1; Thu, 05 Aug 2021 10:16:13 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1B555881279; Thu, 5 Aug 2021 14:16:09 +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 AAA095C25D; Thu, 5 Aug 2021 14:16:08 +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 9DE34180BAB1; Thu, 5 Aug 2021 14:16:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 175EDIQ9016803 for ; Thu, 5 Aug 2021 10:13:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 845885C25D; Thu, 5 Aug 2021 14:13:18 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB9F65C1A1 for ; Thu, 5 Aug 2021 14:13:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628172975; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=wYZfbeg8UEgwfCzRp4ftTOHDnmI2z3OTZyz0yH84jR8=; b=AjdGmLToGvSHWR5wqAzbocf1NYLtHjEGOzh/yVpMUG3DNlf+xn1+6ReZMtWlXVNYF8cLh9 t1BK/xrxhQofssTytnX8KBIgJ3lQ7drbHYWMi0euDZn1pnSjmh93IUqgVnkl5oOGouQA6q KWXQTrrepZIyk+67g2R/jTo52bMUudw= X-MC-Unique: qJJ-RqgzMq69eh5wtBj4Og-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/6] virPCIGetVirtualFunctions: Simplify cleanup of returned data Date: Thu, 5 Aug 2021 16:13:06 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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.16 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 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628172978998100001 Content-Type: text/plain; charset="utf-8" Introduce a struct for holding the list of VFs returned by virPCIGetVirtualFunctions so that we can employ automatic memory clearing and also allow querying more information at once. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/node_device_conf.c | 16 +++++--- src/libvirt_private.syms | 1 + src/util/virnetdev.c | 10 +++-- src/util/virpci.c | 79 ++++++++++++++++++------------------- src/util/virpci.h | 18 +++++++-- 5 files changed, 72 insertions(+), 52 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index d12d97f077..d363ddc22e 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -2623,6 +2623,7 @@ static int virNodeDeviceGetPCISRIOVCaps(const char *sysfsPath, virNodeDevCapPCIDev *pci_dev) { + g_autoptr(virPCIVirtualFunctionList) vfs =3D g_new0(virPCIVirtualFunct= ionList, 1); size_t i; int ret; @@ -2644,11 +2645,16 @@ virNodeDeviceGetPCISRIOVCaps(const char *sysfsPath, if (pci_dev->physical_function) pci_dev->flags |=3D VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION; - ret =3D virPCIGetVirtualFunctions(sysfsPath, &pci_dev->virtual_functio= ns, - &pci_dev->num_virtual_functions, - &pci_dev->max_virtual_functions); - if (ret < 0) - return ret; + if (virPCIGetVirtualFunctions(sysfsPath, &vfs) < 0) + return -1; + + pci_dev->virtual_functions =3D g_new0(virPCIDeviceAddress *, vfs->nfun= ctions); + + for (i =3D 0; i < vfs->nfunctions; i++) + pci_dev->virtual_functions[i] =3D g_steal_pointer(&vfs->functions[= i].addr); + + pci_dev->num_virtual_functions =3D vfs->nfunctions; + pci_dev->max_virtual_functions =3D vfs->maxfunctions; if (pci_dev->num_virtual_functions > 0 || pci_dev->max_virtual_functions > 0) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index e4168a06b9..20e74dd5d5 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3016,6 +3016,7 @@ virPCIHeaderTypeToString; virPCIIsVirtualFunction; virPCIStubDriverTypeFromString; virPCIStubDriverTypeToString; +virPCIVirtualFunctionListFree; virZPCIDeviceAddressIsIncomplete; virZPCIDeviceAddressIsPresent; diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index d578becb20..ea5aba7116 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1231,7 +1231,7 @@ virNetDevGetVirtualFunctions(const char *pfname, size_t i; g_autofree char *pf_sysfs_device_link =3D NULL; g_autofree char *pfPhysPortID =3D NULL; - unsigned int max_vfs; + g_autoptr(virPCIVirtualFunctionList) vfs =3D NULL; *virt_fns =3D NULL; *n_vfname =3D 0; @@ -1242,14 +1242,18 @@ virNetDevGetVirtualFunctions(const char *pfname, if (virNetDevSysfsFile(&pf_sysfs_device_link, pfname, "device") < 0) goto cleanup; - if (virPCIGetVirtualFunctions(pf_sysfs_device_link, virt_fns, n_vfname= , &max_vfs) < 0) + if (virPCIGetVirtualFunctions(pf_sysfs_device_link, &vfs) < 0) goto cleanup; - *vfname =3D g_new0(char *, *n_vfname); + *vfname =3D g_new0(char *, vfs->nfunctions); + *virt_fns =3D g_new0(virPCIDeviceAddress *, vfs->nfunctions); + *n_vfname =3D vfs->nfunctions; for (i =3D 0; i < *n_vfname; i++) { g_autofree char *pci_sysfs_device_link =3D NULL; + virt_fns[i] =3D g_steal_pointer(&vfs->functions[i].addr); + if (virPCIDeviceAddressGetSysfsFile((*virt_fns)[i], &pci_sysfs_device_link) < 0) { virReportSystemError(ENOSYS, "%s", diff --git a/src/util/virpci.c b/src/util/virpci.c index 67c3896dd5..2afbf40af3 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -2247,6 +2247,22 @@ virZPCIDeviceAddressIsPresent(const virZPCIDeviceAdd= ress *addr) } +void +virPCIVirtualFunctionListFree(virPCIVirtualFunctionList *list) +{ + size_t i; + + if (!list) + return; + + for (i =3D 0; i < list->nfunctions; i++) { + g_free(list->functions[i].addr); + } + + g_free(list); +} + + #ifdef __linux__ virPCIDeviceAddress * @@ -2321,62 +2337,54 @@ virPCIGetPhysicalFunction(const char *vf_sysfs_path, */ int virPCIGetVirtualFunctions(const char *sysfs_path, - virPCIDeviceAddress ***virtual_functions, - size_t *num_virtual_functions, - unsigned int *max_virtual_functions) + virPCIVirtualFunctionList **vfs) { - size_t i; g_autofree char *totalvfs_file =3D NULL; g_autofree char *totalvfs_str =3D NULL; - g_autofree virPCIDeviceAddress *config_addr =3D NULL; + g_autoptr(virPCIVirtualFunctionList) list =3D g_new0(virPCIVirtualFunc= tionList, 1); - *virtual_functions =3D NULL; - *num_virtual_functions =3D 0; - *max_virtual_functions =3D 0; + *vfs =3D NULL; totalvfs_file =3D g_strdup_printf("%s/sriov_totalvfs", sysfs_path); if (virFileExists(totalvfs_file)) { char *end =3D NULL; /* so that terminating \n doesn't create error= */ + unsigned long long maxfunctions =3D 0; if (virFileReadAll(totalvfs_file, 16, &totalvfs_str) < 0) - goto error; - if (virStrToLong_ui(totalvfs_str, &end, 10, max_virtual_functions)= < 0) { + return -1; + if (virStrToLong_ull(totalvfs_str, &end, 10, &maxfunctions) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unrecognized value in %s: %s"), totalvfs_file, totalvfs_str); - goto error; + return -1; } + list->maxfunctions =3D maxfunctions; } do { g_autofree char *device_link =3D NULL; + struct virPCIVirtualFunction fnc =3D { NULL }; + /* look for virtfn%d links until one isn't found */ - device_link =3D g_strdup_printf("%s/virtfn%zu", sysfs_path, - *num_virtual_functions); + device_link =3D g_strdup_printf("%s/virtfn%zu", sysfs_path, list->= nfunctions); if (!virFileExists(device_link)) break; - if (!(config_addr =3D virPCIGetDeviceAddressFromSysfsLink(device_l= ink))) { + if (!(fnc.addr =3D virPCIGetDeviceAddressFromSysfsLink(device_link= ))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to get SRIOV function from device lin= k '%s'"), device_link); - goto error; + return -1; } - VIR_APPEND_ELEMENT(*virtual_functions, *num_virtual_functions, con= fig_addr); + VIR_APPEND_ELEMENT(list->functions, list->nfunctions, fnc); } while (1); - VIR_DEBUG("Found %zu virtual functions for %s", - *num_virtual_functions, sysfs_path); - return 0; + VIR_DEBUG("Found %zu virtual functions for %s", list->nfunctions, sysf= s_path); - error: - for (i =3D 0; i < *num_virtual_functions; i++) - VIR_FREE((*virtual_functions)[i]); - VIR_FREE(*virtual_functions); - *num_virtual_functions =3D 0; - return -1; + *vfs =3D g_steal_pointer(&list); + return 0; } @@ -2403,24 +2411,21 @@ virPCIGetVirtualFunctionIndex(const char *pf_sysfs_= device_link, { int ret =3D -1; size_t i; - size_t num_virt_fns =3D 0; - unsigned int max_virt_fns =3D 0; g_autofree virPCIDeviceAddress *vf_bdf =3D NULL; - virPCIDeviceAddress **virt_fns =3D NULL; + g_autoptr(virPCIVirtualFunctionList) virt_fns =3D NULL; if (!(vf_bdf =3D virPCIGetDeviceAddressFromSysfsLink(vf_sysfs_device_l= ink))) return ret; - if (virPCIGetVirtualFunctions(pf_sysfs_device_link, &virt_fns, - &num_virt_fns, &max_virt_fns) < 0) { + if (virPCIGetVirtualFunctions(pf_sysfs_device_link, &virt_fns) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Error getting physical function's '%s' " "virtual_functions"), pf_sysfs_device_link); goto out; } - for (i =3D 0; i < num_virt_fns; i++) { - if (virPCIDeviceAddressEqual(vf_bdf, virt_fns[i])) { + for (i =3D 0; i < virt_fns->nfunctions; i++) { + if (virPCIDeviceAddressEqual(vf_bdf, virt_fns->functions[i].addr))= { *vf_index =3D i; ret =3D 0; break; @@ -2428,12 +2433,6 @@ virPCIGetVirtualFunctionIndex(const char *pf_sysfs_d= evice_link, } out: - - /* free virtual functions */ - for (i =3D 0; i < num_virt_fns; i++) - VIR_FREE(virt_fns[i]); - - VIR_FREE(virt_fns); return ret; } @@ -2641,9 +2640,7 @@ virPCIGetPhysicalFunction(const char *vf_sysfs_path G= _GNUC_UNUSED, int virPCIGetVirtualFunctions(const char *sysfs_path G_GNUC_UNUSED, - virPCIDeviceAddress ***virtual_functions G_GNUC_= UNUSED, - size_t *num_virtual_functions G_GNUC_UNUSED, - unsigned int *max_virtual_functions G_GNUC_UNUSE= D) + virPCIVirtualFunctionList **vfs G_GNUC_UNUSED) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported)); return -1; diff --git a/src/util/virpci.h b/src/util/virpci.h index 1fa6c58d50..ce6a056c9c 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -212,10 +212,22 @@ virPCIGetDeviceAddressFromSysfsLink(const char *devic= e_link); int virPCIGetPhysicalFunction(const char *vf_sysfs_path, virPCIDeviceAddress **pf); +struct virPCIVirtualFunction { + virPCIDeviceAddress *addr; +}; + +struct _virPCIVirtualFunctionList { + struct virPCIVirtualFunction *functions; + size_t nfunctions; + size_t maxfunctions; +}; +typedef struct _virPCIVirtualFunctionList virPCIVirtualFunctionList; + +void virPCIVirtualFunctionListFree(virPCIVirtualFunctionList *list); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virPCIVirtualFunctionList, virPCIVirtualFunc= tionListFree); + int virPCIGetVirtualFunctions(const char *sysfs_path, - virPCIDeviceAddress ***virtual_functions, - size_t *num_virtual_functions, - unsigned int *max_virtual_functions); + virPCIVirtualFunctionList **vfs); int virPCIIsVirtualFunction(const char *vf_sysfs_device_link); --=20 2.31.1 From nobody Tue May 7 17:59:56 2024 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=1628173026; cv=none; d=zohomail.com; s=zohoarc; b=AIuQTAYS3VapLIFM8FyF79Qg5kcia2fD87hlWQXZc/DrqgWG9MGc/Kdo4nLeICHGdiZvZsK07lSvUhLu9ITgW+oEt82k2Snzzl1Nj66Pz5dPknqH8LIaoTaKD11KqATeGoy2/XbIH3ZEdcTlX6p7ZITv+Rz3H6DjeqmEOSvnkt4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628173026; 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; bh=1U9VHvTdbauOe0gVG9Ea39b3wDM7cnWT6/WM8Q4V+3E=; b=ScmLf0Nz+3zI1DZ4A2G0VZFJoxRolJVIHNRcYQ57h/3ndX02+EB9bqBElOYYbx5dfSvyqCjOsc74MiXfxjusahLUuGMXzV6wCJAHHDeHFYCAqGuG/I/B0u7vWtFi03qh+dQ0VxJWfSJ5DyLQSs96g+soYR/XNZPJ4HmocWq+aPU= 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 162817302631987.61649926201937; Thu, 5 Aug 2021 07:17:06 -0700 (PDT) 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-590-4vAyrOt-MpKi_a2vUnzxkw-1; Thu, 05 Aug 2021 10:16:59 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C1225871255; Thu, 5 Aug 2021 14:16:16 +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 A187B60BF4; Thu, 5 Aug 2021 14:16:16 +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 69598180BAC5; Thu, 5 Aug 2021 14:16:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 175EDJPe016822 for ; Thu, 5 Aug 2021 10:13:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9422C5C1A1; Thu, 5 Aug 2021 14:13:19 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id E7A0D6788C for ; Thu, 5 Aug 2021 14:13:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628173025; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=1U9VHvTdbauOe0gVG9Ea39b3wDM7cnWT6/WM8Q4V+3E=; b=BQwbkVY+T1TIytB7XcQG5F0mDOQ+9hzNPH973DR0iF50GLO8Ek9WtP/Hw3KuK5o9Fyogp9 wLGjfvusmEJ1G//M6kye6BXwCBzJ66n3hfU5hgYdAMDB4e9coizm5ZY85AI+p7KwpssMDB G6IjS+yiXZwkQPxEBMrWvx8o4+VwNys= X-MC-Unique: 4vAyrOt-MpKi_a2vUnzxkw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/6] virPCIGetVirtualFunctionIndex: Refactor cleanup Date: Thu, 5 Aug 2021 16:13:07 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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.12 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 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628173026690100003 Content-Type: text/plain; charset="utf-8" The 'ret' variable and 'out' label can be removed. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virpci.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index 2afbf40af3..7059b29ec3 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -2409,31 +2409,28 @@ virPCIGetVirtualFunctionIndex(const char *pf_sysfs_= device_link, const char *vf_sysfs_device_link, int *vf_index) { - int ret =3D -1; size_t i; g_autofree virPCIDeviceAddress *vf_bdf =3D NULL; g_autoptr(virPCIVirtualFunctionList) virt_fns =3D NULL; if (!(vf_bdf =3D virPCIGetDeviceAddressFromSysfsLink(vf_sysfs_device_l= ink))) - return ret; + return -1; if (virPCIGetVirtualFunctions(pf_sysfs_device_link, &virt_fns) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Error getting physical function's '%s' " "virtual_functions"), pf_sysfs_device_link); - goto out; + return -1; } for (i =3D 0; i < virt_fns->nfunctions; i++) { if (virPCIDeviceAddressEqual(vf_bdf, virt_fns->functions[i].addr))= { *vf_index =3D i; - ret =3D 0; - break; + return 0; } } - out: - return ret; + return -1; } /* --=20 2.31.1 From nobody Tue May 7 17:59:56 2024 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=1628173026; cv=none; d=zohomail.com; s=zohoarc; b=Q2P3jPDQZzTbL8nGErBJeeqeoednusfG1iHGSnHFigqqvm6ukcedUxt8sbU3CLlC17V/SQGmEBTWb8t0JcZvvlQdrDzKQFQvKZbuyAFF9gRLoLWsn4PrQsheaz/TnhK4AZ3CWHyR4i9C+LjVVjk/ZvpYnJjOzmIU7O8E4t2nOlk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628173026; 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; bh=zVzScWdNPLwe0NH3X1nX/TMWSnOBaa8Mmns2KD830qs=; b=OdQJ53FOctPts3Z2NVPiknM7LkMJJpZqDyCHBEqjlduXOAU+gR1F2rFYTAbNiWylGvliUVU3NcLu14RT0Ka9XLstpdLH1gcLo8rASC4S4aDds4tp0PPiVujrE/Woi440y6RdlFX4Iq0eJYuOsnPIYt3l4xFjXJQBLU7mgwrMDfI= 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 162817302630371.53968670921279; Thu, 5 Aug 2021 07:17:06 -0700 (PDT) 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-441-vg9lGObpMY6MZenhR8tUJA-1; Thu, 05 Aug 2021 10:16:29 -0400 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 3E7031B18BCC; Thu, 5 Aug 2021 14:16:22 +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 1C8BD295E5; Thu, 5 Aug 2021 14:16:22 +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 D2EEB180140F; Thu, 5 Aug 2021 14:16:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 175EDKdc016827 for ; Thu, 5 Aug 2021 10:13:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id A266A5C1A1; Thu, 5 Aug 2021 14:13:20 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0EBE65C1B4 for ; Thu, 5 Aug 2021 14:13:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628173025; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=zVzScWdNPLwe0NH3X1nX/TMWSnOBaa8Mmns2KD830qs=; b=Qg+mj/VCk9lttOwe/BpqnsCQcG79kmDOpwoCA3kgCIJ3YYIokkNVwRrC3wPWu58hAgODZF WkZCLx7BJS2S5V/VEzYOMVoSsxIYia/U6tKPwIzuLTUqhR7NXTR8hu3c10491GobiVfIC+ Pssj0Xt59jvXg/dLI4r+hJYNOekM59E= X-MC-Unique: vg9lGObpMY6MZenhR8tUJA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/6] virPCIGetNetName: Make 'physPortID' argument const Date: Thu, 5 Aug 2021 16:13:08 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628173928641100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virpci.c | 4 ++-- src/util/virpci.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index 7059b29ec3..7dbca5f3ff 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -2461,7 +2461,7 @@ virPCIDeviceAddressGetSysfsFile(virPCIDeviceAddress *= addr, int virPCIGetNetName(const char *device_link_sysfs_path, size_t idx, - char *physPortID, + const char *physPortID, char **netname) { g_autofree char *pcidev_sysfs_net_path =3D NULL; @@ -2672,7 +2672,7 @@ virPCIDeviceAddressGetSysfsFile(virPCIDeviceAddress *= dev G_GNUC_UNUSED, int virPCIGetNetName(const char *device_link_sysfs_path G_GNUC_UNUSED, size_t idx G_GNUC_UNUSED, - char *physPortID G_GNUC_UNUSED, + const char *physPortID G_GNUC_UNUSED, char **netname G_GNUC_UNUSED) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported)); diff --git a/src/util/virpci.h b/src/util/virpci.h index ce6a056c9c..60f93fa87d 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -240,7 +240,7 @@ int virPCIDeviceAddressGetSysfsFile(virPCIDeviceAddress= *addr, int virPCIGetNetName(const char *device_link_sysfs_path, size_t idx, - char *physPortID, + const char *physPortID, char **netname); bool virPCIDeviceAddressIsValid(virPCIDeviceAddress *addr, --=20 2.31.1 From nobody Tue May 7 17:59:56 2024 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=1628173026; cv=none; d=zohomail.com; s=zohoarc; b=ObKWpceJreuzTcDoDh1M9/w6FG/m+kesAbL0tulEL8td6W8oAOGDRl3hwyVPDWadi2NhBkKoN5r8cZxG0XeIEGsB1juPRhC4dAVkoffYKE0ZtFXrI6rXhM6duaJU81RWO1o/OREaVpdHYxLix+nJa2/s9NM4jv8q7xH1hpZ7wS0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628173026; 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; bh=RNdVkf8efgm+o0viPmtx9UhdXn2DhRHQYZIOAHQ7R6w=; b=g8McsmzySNL5zt2zEY/hpu6XG4WOgJkyPpranYUzTnaI8TY8Ou0Y2kAPCzuAoqIulTfcIRE0FpPPUjJOHgRuxo1Du0gOMf5wYaW18rgaAXH2eCDSgsq017+irA/WsTkw0m3WYk2mf2aUFdmdqBbIVJ/AyYVWb+TKVkE84KQpNDM= 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 1628173026385789.05085261649; Thu, 5 Aug 2021 07:17:06 -0700 (PDT) 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-193-NFdUX8FIMdmYCcuXEftEzA-1; Thu, 05 Aug 2021 10:16:32 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A2F1E1B18BD6; Thu, 5 Aug 2021 14:16:25 +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 7F6D260FB8; Thu, 5 Aug 2021 14:16:25 +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 4169C4A706; Thu, 5 Aug 2021 14:16:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 175EDL4X016832 for ; Thu, 5 Aug 2021 10:13:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id BBF2F5C1B4; Thu, 5 Aug 2021 14:13:21 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C3615C1A1 for ; Thu, 5 Aug 2021 14:13:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628173025; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=RNdVkf8efgm+o0viPmtx9UhdXn2DhRHQYZIOAHQ7R6w=; b=AreZLw7oSwgnlIirGkd4s0T9odphCQRAc5xB/tkOkL2vNp/k/4dN4IfY4GE33pOtVN1Jzi cVP4chJC0QLehW95n3x/JOCCZrdcL+XytbuAAgopv4koo8IbMDJMQQxHVU2mb6DyXGIOO0 LWza5c1vHHSk7nM59rKsPUFp+wgFYOw= X-MC-Unique: NFdUX8FIMdmYCcuXEftEzA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/6] virPCIGetVirtualFunctions: Fetch also network interface name if needed Date: Thu, 5 Aug 2021 16:13:09 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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.12 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 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628173026832100005 Content-Type: text/plain; charset="utf-8" 'virNetDevGetVirtualFunctions' calls 'virPCIGetVirtualFunctions' and then re-iterates the returned list to fetch the interface names for the returned virtual functions. If we move the fetching of the interface name into virPCIGetVirtualFunctions we can simplify the code and remove a bunch of impossible error states. To accomplish this the function is renamed to 'virPCIGetVirtualFunctionsFull' while keeping a wrapper with original name and if the physical port ID is passed the interface name is fetched too without the need to re-convert the address into a sysfs link. For now 'virNetDevGetVirtualFunctions' still converts the returned data into two lists. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 1 + src/util/virnetdev.c | 44 ++++++---------------------------------- src/util/virpci.c | 39 ++++++++++++++++++++++++++++------- src/util/virpci.h | 4 ++++ 4 files changed, 43 insertions(+), 45 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 20e74dd5d5..fd02b27c51 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3011,6 +3011,7 @@ virPCIGetPhysicalFunction; virPCIGetVirtualFunctionIndex; virPCIGetVirtualFunctionInfo; virPCIGetVirtualFunctions; +virPCIGetVirtualFunctionsFull; virPCIHeaderTypeFromString; virPCIHeaderTypeToString; virPCIIsVirtualFunction; diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index ea5aba7116..4db3b255f6 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1227,62 +1227,30 @@ virNetDevGetVirtualFunctions(const char *pfname, virPCIDeviceAddress ***virt_fns, size_t *n_vfname) { - int ret =3D -1; size_t i; g_autofree char *pf_sysfs_device_link =3D NULL; g_autofree char *pfPhysPortID =3D NULL; g_autoptr(virPCIVirtualFunctionList) vfs =3D NULL; - *virt_fns =3D NULL; - *n_vfname =3D 0; - if (virNetDevGetPhysPortID(pfname, &pfPhysPortID) < 0) - goto cleanup; + return -1; if (virNetDevSysfsFile(&pf_sysfs_device_link, pfname, "device") < 0) - goto cleanup; + return -1; - if (virPCIGetVirtualFunctions(pf_sysfs_device_link, &vfs) < 0) - goto cleanup; + if (virPCIGetVirtualFunctionsFull(pf_sysfs_device_link, &vfs, pfPhysPo= rtID) < 0) + return -1; *vfname =3D g_new0(char *, vfs->nfunctions); *virt_fns =3D g_new0(virPCIDeviceAddress *, vfs->nfunctions); *n_vfname =3D vfs->nfunctions; for (i =3D 0; i < *n_vfname; i++) { - g_autofree char *pci_sysfs_device_link =3D NULL; - virt_fns[i] =3D g_steal_pointer(&vfs->functions[i].addr); - - if (virPCIDeviceAddressGetSysfsFile((*virt_fns)[i], - &pci_sysfs_device_link) < 0) { - virReportSystemError(ENOSYS, "%s", - _("Failed to get PCI SYSFS file")); - goto cleanup; - } - - if (virPCIGetNetName(pci_sysfs_device_link, 0, - pfPhysPortID, &((*vfname)[i])) < 0) { - goto cleanup; - } - - if (!(*vfname)[i]) - VIR_INFO("VF does not have an interface name"); + vfname[i] =3D g_steal_pointer(&vfs->functions[i].ifname); } - ret =3D 0; - - cleanup: - if (ret < 0) { - virStringListFreeCount(*vfname, *n_vfname); - - for (i =3D 0; i < *n_vfname; i++) - VIR_FREE((*virt_fns)[i]); - VIR_FREE(*virt_fns); - *vfname =3D NULL; - *n_vfname =3D 0; - } - return ret; + return 0; } /** diff --git a/src/util/virpci.c b/src/util/virpci.c index 7dbca5f3ff..915a4903ca 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -2257,12 +2257,21 @@ virPCIVirtualFunctionListFree(virPCIVirtualFunction= List *list) for (i =3D 0; i < list->nfunctions; i++) { g_free(list->functions[i].addr); + g_free(list->functions[i].ifname); } g_free(list); } +int +virPCIGetVirtualFunctions(const char *sysfs_path, + virPCIVirtualFunctionList **vfs) +{ + return virPCIGetVirtualFunctionsFull(sysfs_path, vfs, NULL); +} + + #ifdef __linux__ virPCIDeviceAddress * @@ -2332,12 +2341,20 @@ virPCIGetPhysicalFunction(const char *vf_sysfs_path, } -/* - * Returns virtual functions of a physical function +/** + * virPCIGetVirtualFunctionsFull: + * @sysfs_path: path to physical function sysfs entry + * @vfs: filled with the virtual function data + * @pfPhysPortID: Optional physical port id. If provided the network inter= face + * name of the VFs is queried too. + * + * + * Returns virtual functions of a physical function. */ int -virPCIGetVirtualFunctions(const char *sysfs_path, - virPCIVirtualFunctionList **vfs) +virPCIGetVirtualFunctionsFull(const char *sysfs_path, + virPCIVirtualFunctionList **vfs, + const char *pfPhysPortID) { g_autofree char *totalvfs_file =3D NULL; g_autofree char *totalvfs_str =3D NULL; @@ -2363,7 +2380,7 @@ virPCIGetVirtualFunctions(const char *sysfs_path, do { g_autofree char *device_link =3D NULL; - struct virPCIVirtualFunction fnc =3D { NULL }; + struct virPCIVirtualFunction fnc =3D { NULL, NULL }; /* look for virtfn%d links until one isn't found */ device_link =3D g_strdup_printf("%s/virtfn%zu", sysfs_path, list->= nfunctions); @@ -2378,6 +2395,13 @@ virPCIGetVirtualFunctions(const char *sysfs_path, return -1; } + if (pfPhysPortID) { + if (virPCIGetNetName(device_link, 0, pfPhysPortID, &fnc.ifname= ) < 0) { + g_free(fnc.addr); + return -1; + } + } + VIR_APPEND_ELEMENT(list->functions, list->nfunctions, fnc); } while (1); @@ -2636,8 +2660,9 @@ virPCIGetPhysicalFunction(const char *vf_sysfs_path G= _GNUC_UNUSED, } int -virPCIGetVirtualFunctions(const char *sysfs_path G_GNUC_UNUSED, - virPCIVirtualFunctionList **vfs G_GNUC_UNUSED) +virPCIGetVirtualFunctionsFull(const char *sysfs_path G_GNUC_UNUSED, + virPCIVirtualFunctionList **vfs G_GNUC_UNUSE= D, + const char *pfPhysPortID G_GNUC_UNUSED) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported)); return -1; diff --git a/src/util/virpci.h b/src/util/virpci.h index 60f93fa87d..9a3db6c6d8 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -214,6 +214,7 @@ int virPCIGetPhysicalFunction(const char *vf_sysfs_path, struct virPCIVirtualFunction { virPCIDeviceAddress *addr; + char *ifname; }; struct _virPCIVirtualFunctionList { @@ -226,6 +227,9 @@ typedef struct _virPCIVirtualFunctionList virPCIVirtual= FunctionList; void virPCIVirtualFunctionListFree(virPCIVirtualFunctionList *list); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virPCIVirtualFunctionList, virPCIVirtualFunc= tionListFree); +int virPCIGetVirtualFunctionsFull(const char *sysfs_path, + virPCIVirtualFunctionList **vfs, + const char *pfPhysPortID); int virPCIGetVirtualFunctions(const char *sysfs_path, virPCIVirtualFunctionList **vfs); --=20 2.31.1 From nobody Tue May 7 17:59:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1628172988; cv=none; d=zohomail.com; s=zohoarc; b=gr87RuYXMU7xJQwLajmi6A+lulS7DlCNQB8XyDOx4QuvXdbgrQzaD7zTg1MWFvrcl0lOhKko7sHMjZrcbBDTZD5bXH+XHTR4eiekyq9HNNqaw88H1QluWBHO3Q3ROuqHCpPaGUcGfJH2W4wxugjRefM2NJzujeDJjHHlW5N76S4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628172988; 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; bh=zQrS/25Lpv6afwzEbku89Cb1Qs/s2qkPAIttB0UI0eU=; b=d3OEVZrN6046q17WLkdf4VDUGDBA2HEZDGc/LfErGaSci+W7j0KpIzeLwRL+ov2mN1zfEOF9t9LyFIBriI1d61G/6E/9ypq4NciGcV0e6c6OxGdzyTaW+M4OuyLsRGQVc1zlVoxWdwlXd4lAkCKCtDPNVnb5DW+COzQNfvN+GWQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1628172988428179.53714745183993; Thu, 5 Aug 2021 07:16:28 -0700 (PDT) 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-523-oGjFshiWP12voKCUOk3o7w-1; Thu, 05 Aug 2021 10:16:25 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C20B5802C80; Thu, 5 Aug 2021 14:16:16 +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 A5B4A6E6E9; Thu, 5 Aug 2021 14:16:16 +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 6DD82180BAD2; Thu, 5 Aug 2021 14:16:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 175EDMkR016842 for ; Thu, 5 Aug 2021 10:13:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id CA9B45C1A1; Thu, 5 Aug 2021 14:13:22 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 343D35C25D for ; Thu, 5 Aug 2021 14:13:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628172987; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=zQrS/25Lpv6afwzEbku89Cb1Qs/s2qkPAIttB0UI0eU=; b=HWfkXSc33EATA4QfXJ5jI0aMGBI9WYlpDM3HeIQhx5Gmh/G/KHBJxGHiQ/R5grOuCUX/NW rXBvP1Yiy/0v8oGl4HofW0nTxsr+Hu+ZC2Hoap8zBa5GWftj92xTE3wVZClBGUO121SWYO Fjz2RzorwCNCHK0b6QsY/SQFTsoq5+w= X-MC-Unique: oGjFshiWP12voKCUOk3o7w-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 6/6] virNetDevGetVirtualFunctions: Directly return virPCIVirtualFunctionList Date: Thu, 5 Aug 2021 16:13:10 +0200 Message-Id: <7b0ebe1a2e3f3030d08ea13a135e9c0ef7c882b6.1628169131.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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.11 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 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628172990622100001 Content-Type: text/plain; charset="utf-8" Remove the conversion from virPCIVirtualFunctionList which encapsulates the list of virtual functions to two disjunct arrays. This greatly simplifies the fetching of the parameters as well as cleanup in the caller. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/network/bridge_driver.c | 22 ++++++---------------- src/util/virnetdev.c | 26 ++++---------------------- src/util/virnetdev.h | 7 ++----- 3 files changed, 12 insertions(+), 43 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 4ffcecdf9f..2555119892 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2598,29 +2598,25 @@ networkShutdownNetworkBridge(virNetworkObj *obj G_G= NUC_UNUSED) static int networkCreateInterfacePool(virNetworkDef *netdef) { - size_t numVirtFns =3D 0; - char **vfNames =3D NULL; - virPCIDeviceAddress **virtFns; - + g_autoptr(virPCIVirtualFunctionList) vfs =3D NULL; int ret =3D -1; size_t i; if (netdef->forward.npfs =3D=3D 0 || netdef->forward.nifs > 0) return 0; - if ((virNetDevGetVirtualFunctions(netdef->forward.pfs->dev, &vfNames, - &virtFns, &numVirtFns)) < 0) { + if (virNetDevGetVirtualFunctions(netdef->forward.pfs->dev, &vfs) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not get Virtual functions on %s"), netdef->forward.pfs->dev); goto cleanup; } - netdef->forward.ifs =3D g_new0(virNetworkForwardIfDef, numVirtFns); + netdef->forward.ifs =3D g_new0(virNetworkForwardIfDef, vfs->nfunctions= ); - for (i =3D 0; i < numVirtFns; i++) { - virPCIDeviceAddress *thisVirtFn =3D virtFns[i]; - const char *thisName =3D vfNames[i]; + for (i =3D 0; i < vfs->nfunctions; i++) { + virPCIDeviceAddress *thisVirtFn =3D vfs->functions[i].addr; + const char *thisName =3D vfs->functions[i].ifname; virNetworkForwardIfDef *thisIf =3D &netdef->forward.ifs[netdef->forward.nifs]; @@ -2689,12 +2685,6 @@ networkCreateInterfacePool(virNetworkDef *netdef) if (netdef->forward.nifs =3D=3D 0) g_clear_pointer(&netdef->forward.ifs, g_free); - for (i =3D 0; i < numVirtFns; i++) { - g_free(vfNames[i]); - g_free(virtFns[i]); - } - g_free(vfNames); - g_free(virtFns); return ret; } diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 4db3b255f6..5b4c585716 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1213,24 +1213,17 @@ virNetDevGetPhysPortName(const char *ifname, /** * virNetDevGetVirtualFunctions: - * * @pfname : name of the physical function interface name - * @vfname: array that will hold the interface names of the virtual_functi= ons - * @n_vfname: pointer to the number of virtual functions + * @vfs: Filled with struct describing the virtual functions of @pfname * * Returns 0 on success and -1 on failure */ - int virNetDevGetVirtualFunctions(const char *pfname, - char ***vfname, - virPCIDeviceAddress ***virt_fns, - size_t *n_vfname) + virPCIVirtualFunctionList **vfs) { - size_t i; g_autofree char *pf_sysfs_device_link =3D NULL; g_autofree char *pfPhysPortID =3D NULL; - g_autoptr(virPCIVirtualFunctionList) vfs =3D NULL; if (virNetDevGetPhysPortID(pfname, &pfPhysPortID) < 0) return -1; @@ -1238,18 +1231,9 @@ virNetDevGetVirtualFunctions(const char *pfname, if (virNetDevSysfsFile(&pf_sysfs_device_link, pfname, "device") < 0) return -1; - if (virPCIGetVirtualFunctionsFull(pf_sysfs_device_link, &vfs, pfPhysPo= rtID) < 0) + if (virPCIGetVirtualFunctionsFull(pf_sysfs_device_link, vfs, pfPhysPor= tID) < 0) return -1; - *vfname =3D g_new0(char *, vfs->nfunctions); - *virt_fns =3D g_new0(virPCIDeviceAddress *, vfs->nfunctions); - *n_vfname =3D vfs->nfunctions; - - for (i =3D 0; i < *n_vfname; i++) { - virt_fns[i] =3D g_steal_pointer(&vfs->functions[i].addr); - vfname[i] =3D g_steal_pointer(&vfs->functions[i].ifname); - } - return 0; } @@ -1448,9 +1432,7 @@ virNetDevGetPhysPortName(const char *ifname G_GNUC_UN= USED, int virNetDevGetVirtualFunctions(const char *pfname G_GNUC_UNUSED, - char ***vfname G_GNUC_UNUSED, - virPCIDeviceAddress ***virt_fns G_GNUC_UNUSED, - size_t *n_vfname G_GNUC_UNUSED) + virPCIVirtualFunctionList **vfs G_GNUC_UNUSED) { virReportSystemError(ENOSYS, "%s", _("Unable to get virtual functions on this platfo= rm")); diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h index de786c9789..790fae5f7a 100644 --- a/src/util/virnetdev.h +++ b/src/util/virnetdev.h @@ -252,11 +252,8 @@ int virNetDevGetPhysPortName(const char *ifname, G_GNUC_WARN_UNUSED_RESULT; int virNetDevGetVirtualFunctions(const char *pfname, - char ***vfname, - virPCIDeviceAddress ***virt_fns, - size_t *n_vfname) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) - ATTRIBUTE_NONNULL(4) G_GNUC_WARN_UNUSED_RESULT; + virPCIVirtualFunctionList **vfs) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; int virNetDevSaveNetConfig(const char *linkdev, int vf, const char *stateDir, --=20 2.31.1