From nobody Thu May 15 03:45:34 2025 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1516872399550499.22018543259276; Thu, 25 Jan 2018 01:26:39 -0800 (PST) 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 9BA4DC0567A2; Thu, 25 Jan 2018 09:26:38 +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 712D05D728; Thu, 25 Jan 2018 09:26:38 +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 30A4718033DD; Thu, 25 Jan 2018 09:26:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0P9QaAC000997 for ; Thu, 25 Jan 2018 04:26:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id 866092C318; Thu, 25 Jan 2018 09:26:36 +0000 (UTC) Received: from beluga.usersys.redhat.com (unknown [10.43.2.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 575BA6268B; Thu, 25 Jan 2018 09:26:29 +0000 (UTC) From: Erik Skultety To: libvir-list@redhat.com Date: Thu, 25 Jan 2018 10:24:00 +0100 Message-Id: <25cdef9772fa52a769dfecacf8c113f23c1c6e56.1516872173.git.eskultet@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [PATCH 13/15] nodedev: udev: Drop the unused mdev type helpers 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.32]); Thu, 25 Jan 2018 09:26:39 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" These are not necessary anymore, since these are going to be shadowed by the helpers provided by util/virmdev.c module. Signed-off-by: Erik Skultety --- src/node_device/node_device_udev.c | 119 ---------------------------------= ---- 1 file changed, 119 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 519b0bf6f..1ccf1f8b4 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -393,119 +393,6 @@ udevTranslatePCIIds(unsigned int vendor, =20 =20 static int -udevFillMdevType(struct udev_device *device, - const char *dir, - virNodeDevCapMdevTypePtr type) -{ - int ret =3D -1; - char *attrpath =3D NULL; - -#define MDEV_GET_SYSFS_ATTR(attr_name, cb, ...) \ - do { \ - if (virAsprintf(&attrpath, "%s/%s", dir, #attr_name) < 0) \ - goto cleanup; \ - \ - if (cb(device, attrpath, __VA_ARGS__) < 0) \ - goto cleanup; \ - \ - VIR_FREE(attrpath); \ - } while (0) \ - - if (VIR_STRDUP(type->id, last_component(dir)) < 0) - goto cleanup; - - /* query udev for the attributes under subdirectories using the relati= ve - * path stored in @dir, i.e. 'mdev_supported_types/' - */ - MDEV_GET_SYSFS_ATTR(name, udevGetStringSysfsAttr, &type->name); - MDEV_GET_SYSFS_ATTR(device_api, udevGetStringSysfsAttr, &type->device_= api); - MDEV_GET_SYSFS_ATTR(available_instances, udevGetUintSysfsAttr, - &type->available_instances, 10); - -#undef MDEV_GET_SYSFS_ATTR - - ret =3D 0; - cleanup: - VIR_FREE(attrpath); - return ret; -} - - -static int -udevPCIGetMdevTypesCap(struct udev_device *device, - virNodeDevCapPCIDevPtr pcidata) -{ - int ret =3D -1; - int dirret =3D -1; - DIR *dir =3D NULL; - struct dirent *entry; - char *path =3D NULL; - char *tmppath =3D NULL; - virNodeDevCapMdevTypePtr type =3D NULL; - virNodeDevCapMdevTypePtr *types =3D NULL; - size_t ntypes =3D 0; - size_t i; - - if (virAsprintf(&path, "%s/mdev_supported_types", - udev_device_get_syspath(device)) < 0) - return -1; - - if ((dirret =3D virDirOpenIfExists(&dir, path)) < 0) - goto cleanup; - - if (dirret =3D=3D 0) { - ret =3D 0; - goto cleanup; - } - - if (VIR_ALLOC(types) < 0) - goto cleanup; - - /* UDEV doesn't report attributes under subdirectories by default but = is - * able to query them if the path to the attribute is relative to the - * device's base path, e.g. /sys/devices/../0000:00:01.0/ is the devic= e's - * base path as udev reports it, but we're interested in attributes un= der - * /sys/devices/../0000:00:01.0/mdev_supported_types//. So, we n= eed to - * scan the subdirectories ourselves. - */ - while ((dirret =3D virDirRead(dir, &entry, path)) > 0) { - if (VIR_ALLOC(type) < 0) - goto cleanup; - - /* construct the relative mdev type path bit for udev */ - if (virAsprintf(&tmppath, "mdev_supported_types/%s", entry->d_name= ) < 0) - goto cleanup; - - if (udevFillMdevType(device, tmppath, type) < 0) - goto cleanup; - - if (VIR_APPEND_ELEMENT(types, ntypes, type) < 0) - goto cleanup; - - VIR_FREE(tmppath); - } - - if (dirret < 0) - goto cleanup; - - VIR_STEAL_PTR(pcidata->mdev_types, types); - pcidata->nmdev_types =3D ntypes; - pcidata->flags |=3D VIR_NODE_DEV_CAP_FLAG_PCI_MDEV; - ntypes =3D 0; - ret =3D 0; - cleanup: - virNodeDevCapMdevTypeFree(type); - for (i =3D 0; i < ntypes; i++) - virNodeDevCapMdevTypeFree(types[i]); - VIR_FREE(types); - VIR_FREE(path); - VIR_FREE(tmppath); - VIR_DIR_CLOSE(dir); - return ret; -} - - -static int udevProcessPCI(struct udev_device *device, virNodeDeviceDefPtr def) { @@ -596,12 +483,6 @@ udevProcessPCI(struct udev_device *device, } } =20 - /* check whether the device is mediated devices framework capable, if = so, - * process it - */ - if (udevPCIGetMdevTypesCap(device, pci_dev) < 0) - goto cleanup; - ret =3D 0; =20 cleanup: --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list