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 <eskultet@xxxxxxxxxx> --- 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; 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(virMediatedDeviceListPtr 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; +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); @@ -117,4 +126,7 @@ virMediatedDeviceListMarkDevices(virMediatedDeviceListPtr dst, virMediatedDeviceListPtr src, const char *drvname, const char *domname); + +void +virMediatedDeviceTypeFree(virMediatedDeviceTypePtr type); #endif /* __VIR_MDEV_H__ */ -- 2.13.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list