On Tue, Aug 20, 2019 at 04:30:23PM +0200, Michal Privoznik wrote:
There are two places where we need to create virPCIDevice from
given virDomainHostdevDef. In both places the code is duplicated.
Move them into a single function and call it from those two
places.

Signed-off-by: Michal Privoznik <mpriv...@redhat.com>
---
src/util/virhostdev.c | 93 +++++++++++++++++++++++++------------------
1 file changed, 54 insertions(+), 39 deletions(-)

diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 6861b8a84e..e3f48a9a2e 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -212,6 +212,51 @@ virHostdevManagerGetDefault(void)
    return virObjectRef(manager);
}

+/**
+ * virHostdevGetPCIHostDevice:
+ * @hostdev: domain hostdev definition
+ * @pci: returned PCI device
+ *
+ * For given @hostdev which represents a PCI device construct its
+ * virPCIDevice representation and returned it in @pci. If

s/returned/return/

+ * @hostdev does not represent a PCI device then @pci is set to
+ * NULL and 0 is returned.
+ *
+ * Returns: 0 on success (@pci might be NULL though),
+ *         -1 otherwise (with error reported).
+ */

Reviewed-by: Ján Tomko <jto...@redhat.com>

Jano

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to