conf: Replace usage of virNodeDevCapMdevType with virMediatedDeviceType

Now that we have all the building blocks in place, switch the nodedev
driver to use the "new" virMediatedDeviceType type instead of the "old"
virNodeDevCapMdevType one.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Erik Skultety 2018-01-23 09:51:11 +01:00
parent 3cbac4dec0
commit 882fd7a13c
3 changed files with 5 additions and 31 deletions

View File

@ -91,19 +91,6 @@ virNodeDevCapsDefParseString(const char *xpath,
} }
void
virNodeDevCapMdevTypeFree(virNodeDevCapMdevTypePtr type)
{
if (!type)
return;
VIR_FREE(type->id);
VIR_FREE(type->name);
VIR_FREE(type->device_api);
VIR_FREE(type);
}
void void
virNodeDeviceDefFree(virNodeDeviceDefPtr def) virNodeDeviceDefFree(virNodeDeviceDefPtr def)
{ {
@ -285,7 +272,7 @@ virNodeDeviceCapPCIDefFormat(virBufferPtr buf,
virBufferAddLit(buf, "<capability type='mdev_types'>\n"); virBufferAddLit(buf, "<capability type='mdev_types'>\n");
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
for (i = 0; i < data->pci_dev.nmdev_types; i++) { for (i = 0; i < data->pci_dev.nmdev_types; i++) {
virNodeDevCapMdevTypePtr type = data->pci_dev.mdev_types[i]; virMediatedDeviceTypePtr type = data->pci_dev.mdev_types[i];
virBufferEscapeString(buf, "<type id='%s'>\n", type->id); virBufferEscapeString(buf, "<type id='%s'>\n", type->id);
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
if (type->name) if (type->name)
@ -1546,7 +1533,7 @@ virNodeDevPCICapMdevTypesParseXML(xmlXPathContextPtr ctxt,
xmlNodePtr orignode = NULL; xmlNodePtr orignode = NULL;
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
int nmdev_types = -1; int nmdev_types = -1;
virNodeDevCapMdevTypePtr type = NULL; virMediatedDeviceTypePtr type = NULL;
size_t i; size_t i;
if ((nmdev_types = virXPathNodeSet("./type", ctxt, &nodes)) < 0) if ((nmdev_types = virXPathNodeSet("./type", ctxt, &nodes)) < 0)
@ -1593,7 +1580,7 @@ virNodeDevPCICapMdevTypesParseXML(xmlXPathContextPtr ctxt,
ret = 0; ret = 0;
cleanup: cleanup:
VIR_FREE(nodes); VIR_FREE(nodes);
virNodeDevCapMdevTypeFree(type); virMediatedDeviceTypeFree(type);
ctxt->node = orignode; ctxt->node = orignode;
return ret; return ret;
} }
@ -2176,7 +2163,7 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
VIR_FREE(data->pci_dev.iommuGroupDevices); VIR_FREE(data->pci_dev.iommuGroupDevices);
virPCIEDeviceInfoFree(data->pci_dev.pci_express); virPCIEDeviceInfoFree(data->pci_dev.pci_express);
for (i = 0; i < data->pci_dev.nmdev_types; i++) for (i = 0; i < data->pci_dev.nmdev_types; i++)
virNodeDevCapMdevTypeFree(data->pci_dev.mdev_types[i]); virMediatedDeviceTypeFree(data->pci_dev.mdev_types[i]);
VIR_FREE(data->pci_dev.mdev_types); VIR_FREE(data->pci_dev.mdev_types);
break; break;
case VIR_NODE_DEV_CAP_USB_DEV: case VIR_NODE_DEV_CAP_USB_DEV:

View File

@ -139,15 +139,6 @@ struct _virNodeDevCapSystem {
virNodeDevCapSystemFirmware firmware; virNodeDevCapSystemFirmware firmware;
}; };
typedef struct _virNodeDevCapMdevType virNodeDevCapMdevType;
typedef virNodeDevCapMdevType *virNodeDevCapMdevTypePtr;
struct _virNodeDevCapMdevType {
char *id;
char *name;
char *device_api;
unsigned int available_instances;
};
typedef struct _virNodeDevCapMdev virNodeDevCapMdev; typedef struct _virNodeDevCapMdev virNodeDevCapMdev;
typedef virNodeDevCapMdev *virNodeDevCapMdevPtr; typedef virNodeDevCapMdev *virNodeDevCapMdevPtr;
struct _virNodeDevCapMdev { struct _virNodeDevCapMdev {
@ -178,7 +169,7 @@ struct _virNodeDevCapPCIDev {
int numa_node; int numa_node;
virPCIEDeviceInfoPtr pci_express; virPCIEDeviceInfoPtr pci_express;
int hdrType; /* enum virPCIHeaderType or -1 */ int hdrType; /* enum virPCIHeaderType or -1 */
virNodeDevCapMdevTypePtr *mdev_types; virMediatedDeviceTypePtr *mdev_types;
size_t nmdev_types; size_t nmdev_types;
}; };
@ -358,9 +349,6 @@ virNodeDeviceDefFree(virNodeDeviceDefPtr def);
void void
virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps); virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps);
void
virNodeDevCapMdevTypeFree(virNodeDevCapMdevTypePtr type);
# define VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP \ # define VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP \
(VIR_CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM | \ (VIR_CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM | \
VIR_CONNECT_LIST_NODE_DEVICES_CAP_PCI_DEV | \ VIR_CONNECT_LIST_NODE_DEVICES_CAP_PCI_DEV | \

View File

@ -695,7 +695,6 @@ virNetDevIPRouteParseXML;
# conf/node_device_conf.h # conf/node_device_conf.h
virNodeDevCapMdevTypeFree;
virNodeDevCapsDefFree; virNodeDevCapsDefFree;
virNodeDevCapTypeFromString; virNodeDevCapTypeFromString;
virNodeDevCapTypeToString; virNodeDevCapTypeToString;