提交 6af9bb35 编写于 作者: S Shivaprasad G Bhat 提交者: Michal Privoznik

virpci: Implement virPCIDeviceGetAddress function

Basically a getter function which is implemented for accessing the
address fields in virPCIDevice.
Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 cec71a6b
......@@ -1655,6 +1655,32 @@ virPCIDeviceFree(virPCIDevicePtr dev)
VIR_FREE(dev);
}
/**
* virPCIDeviceGetAddress:
* @dev: device to get address from
*
* Take a PCI device on input and return its PCI address. The
* caller must free the returned value when no longer needed.
*
* Returns NULL on failure, the device address on success.
*/
virPCIDeviceAddressPtr
virPCIDeviceGetAddress(virPCIDevicePtr dev)
{
virPCIDeviceAddressPtr pciAddrPtr;
if (!dev || (VIR_ALLOC(pciAddrPtr) < 0))
return NULL;
pciAddrPtr->domain = dev->domain;
pciAddrPtr->bus = dev->bus;
pciAddrPtr->slot = dev->slot;
pciAddrPtr->function = dev->function;
return pciAddrPtr;
}
const char *
virPCIDeviceGetName(virPCIDevicePtr dev)
{
......
......@@ -94,6 +94,7 @@ int virPCIDeviceSetStubDriver(virPCIDevicePtr dev,
const char *driver)
ATTRIBUTE_NONNULL(2);
const char *virPCIDeviceGetStubDriver(virPCIDevicePtr dev);
virPCIDeviceAddressPtr virPCIDeviceGetAddress(virPCIDevicePtr dev);
int virPCIDeviceSetUsedBy(virPCIDevice *dev,
const char *drv_name,
const char *dom_name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册