From nobody Thu May 15 04:04:59 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 1516872340290680.0614504644795; Thu, 25 Jan 2018 01:25:40 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2F0DE5C9CE; Thu, 25 Jan 2018 09:25:39 +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 EBDD96A96D; Thu, 25 Jan 2018 09:25: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 AA1A818033DF; Thu, 25 Jan 2018 09:25: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 w0P9Pb4j000488 for ; Thu, 25 Jan 2018 04:25:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id C8ABB6268B; Thu, 25 Jan 2018 09:25:37 +0000 (UTC) Received: from beluga.usersys.redhat.com (unknown [10.43.2.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD32A2C31F; Thu, 25 Jan 2018 09:25:25 +0000 (UTC) From: Erik Skultety To: libvir-list@redhat.com Date: Thu, 25 Jan 2018 10:23:57 +0100 Message-Id: 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 10/15] util: mdev: Introduce virMediatedDeviceType structure 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 25 Jan 2018 09:25:39 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This is later going to replace the existing virNodeDevCapMdevType, since: 1) it's going to couple related stuff in a single module 2) util is supposed to contain helpers that are widely accessible across the whole repository. Signed-off-by: Erik Skultety --- src/libvirt_private.syms | 1 + src/util/virmdev.c | 13 +++++++++++++ src/util/virmdev.h | 12 ++++++++++++ 3 files changed, 26 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 1698e6227..75eaf1d4c 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2181,6 +2181,7 @@ virMediatedDeviceModelTypeFromString; virMediatedDeviceModelTypeToString; virMediatedDeviceNew; virMediatedDeviceSetUsedBy; +virMediatedDeviceTypeFree; =20 =20 =20 diff --git a/src/util/virmdev.c b/src/util/virmdev.c index a5f52d10f..db679b8a6 100644 --- a/src/util/virmdev.c +++ b/src/util/virmdev.c @@ -483,3 +483,16 @@ virMediatedDeviceListMarkDevices(virMediatedDeviceList= Ptr dst, } goto cleanup; } + + +void +virMediatedDeviceTypeFree(virMediatedDeviceTypePtr type) +{ + if (!type) + return; + + VIR_FREE(type->id); + VIR_FREE(type->name); + VIR_FREE(type->device_api); + VIR_FREE(type); +} diff --git a/src/util/virmdev.h b/src/util/virmdev.h index 84cbb1f2a..320610ab9 100644 --- a/src/util/virmdev.h +++ b/src/util/virmdev.h @@ -37,6 +37,15 @@ typedef virMediatedDevice *virMediatedDevicePtr; typedef struct _virMediatedDeviceList virMediatedDeviceList; typedef virMediatedDeviceList *virMediatedDeviceListPtr; =20 +typedef struct _virMediatedDeviceType virMediatedDeviceType; +typedef virMediatedDeviceType *virMediatedDeviceTypePtr; +struct _virMediatedDeviceType { + char *id; + char *name; + char *device_api; + unsigned int available_instances; +}; + typedef int (*virMediatedDeviceCallback)(virMediatedDevicePtr dev, const char *path, void *opaque); =20 @@ -117,4 +126,7 @@ virMediatedDeviceListMarkDevices(virMediatedDeviceListP= tr dst, virMediatedDeviceListPtr src, const char *drvname, const char *domname); + +void +virMediatedDeviceTypeFree(virMediatedDeviceTypePtr type); #endif /* __VIR_MDEV_H__ */ --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list