提交 0e89a543 编写于 作者: L Laine Stump

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).
上级 6e8003ad
...@@ -1709,6 +1709,7 @@ virPCIDeviceGetUnbindFromStub; ...@@ -1709,6 +1709,7 @@ virPCIDeviceGetUnbindFromStub;
virPCIDeviceGetUsedBy; virPCIDeviceGetUsedBy;
virPCIDeviceIsAssignable; virPCIDeviceIsAssignable;
virPCIDeviceListAdd; virPCIDeviceListAdd;
virPCIDeviceListAddCopy;
virPCIDeviceListCount; virPCIDeviceListCount;
virPCIDeviceListDel; virPCIDeviceListDel;
virPCIDeviceListFind; virPCIDeviceListFind;
......
...@@ -1705,6 +1705,23 @@ virPCIDeviceListAdd(virPCIDeviceListPtr list, ...@@ -1705,6 +1705,23 @@ virPCIDeviceListAdd(virPCIDeviceListPtr list,
return 0; 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 virPCIDevicePtr
virPCIDeviceListGet(virPCIDeviceListPtr list, virPCIDeviceListGet(virPCIDeviceListPtr list,
int idx) int idx)
......
...@@ -83,6 +83,7 @@ void virPCIDeviceReattachInit(virPCIDevice *dev); ...@@ -83,6 +83,7 @@ void virPCIDeviceReattachInit(virPCIDevice *dev);
virPCIDeviceListPtr virPCIDeviceListNew(void); virPCIDeviceListPtr virPCIDeviceListNew(void);
int virPCIDeviceListAdd(virPCIDeviceListPtr list, int virPCIDeviceListAdd(virPCIDeviceListPtr list,
virPCIDevicePtr dev); virPCIDevicePtr dev);
int virPCIDeviceListAddCopy(virPCIDeviceListPtr list, virPCIDevicePtr dev);
virPCIDevicePtr virPCIDeviceListGet(virPCIDeviceListPtr list, virPCIDevicePtr virPCIDeviceListGet(virPCIDeviceListPtr list,
int idx); int idx);
int virPCIDeviceListCount(virPCIDeviceListPtr list); int virPCIDeviceListCount(virPCIDeviceListPtr list);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册