mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
pci: virPCIDeviceListAddCopy API
Make a copy of the device and add the copy to the list. (virPCIDeviceListAdd() adds the original object to the list instead).
This commit is contained in:
parent
6e8003ad30
commit
0e89a543be
@ -1709,6 +1709,7 @@ virPCIDeviceGetUnbindFromStub;
|
||||
virPCIDeviceGetUsedBy;
|
||||
virPCIDeviceIsAssignable;
|
||||
virPCIDeviceListAdd;
|
||||
virPCIDeviceListAddCopy;
|
||||
virPCIDeviceListCount;
|
||||
virPCIDeviceListDel;
|
||||
virPCIDeviceListFind;
|
||||
|
@ -1705,6 +1705,23 @@ virPCIDeviceListAdd(virPCIDeviceListPtr list,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* virPCIDeviceListAddCopy - add a *copy* of the device to this list */
|
||||
int
|
||||
virPCIDeviceListAddCopy(virPCIDeviceListPtr list, virPCIDevicePtr dev)
|
||||
{
|
||||
virPCIDevicePtr copy = virPCIDeviceCopy(dev);
|
||||
|
||||
if (!copy)
|
||||
return -1;
|
||||
if (virPCIDeviceListAdd(list, copy) < 0) {
|
||||
virPCIDeviceFree(copy);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
virPCIDevicePtr
|
||||
virPCIDeviceListGet(virPCIDeviceListPtr list,
|
||||
int idx)
|
||||
|
@ -83,6 +83,7 @@ void virPCIDeviceReattachInit(virPCIDevice *dev);
|
||||
virPCIDeviceListPtr virPCIDeviceListNew(void);
|
||||
int virPCIDeviceListAdd(virPCIDeviceListPtr list,
|
||||
virPCIDevicePtr dev);
|
||||
int virPCIDeviceListAddCopy(virPCIDeviceListPtr list, virPCIDevicePtr dev);
|
||||
virPCIDevicePtr virPCIDeviceListGet(virPCIDeviceListPtr list,
|
||||
int idx);
|
||||
int virPCIDeviceListCount(virPCIDeviceListPtr list);
|
||||
|
Loading…
Reference in New Issue
Block a user