On Fri, Aug 31, 2018 at 04:00:45PM +0200, Andrea Bolognani wrote:
It's a better fit than domain_conf.
Unfortunately, even after this change functions
handling virPCIDeviceAddress are split pretty much
evenly between conf/device_conf and utils/virpci:
ideally everything would be moved to the former,
including the struct declaration itself, and all the
names would be changed to be consistent with the rest
of the virDomainDevice*Address, but that's a cleanup
for another day.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/conf/device_conf.c | 13 +++++++++++++
src/conf/device_conf.h | 3 +++
src/conf/domain_addr.c | 14 --------------
src/conf/domain_addr.h | 3 ---
src/libvirt_private.syms | 2 +-
5 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index 1565d43fe6..afa06c3cda 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -309,6 +309,19 @@ virPCIDeviceAddressFormat(virBufferPtr buf,
return 0;
}
+char *
+virDomainPCIAddressAsString(virPCIDeviceAddressPtr addr)
+{
+ char *str;
+
+ ignore_value(virAsprintf(&str, "%.4x:%.2x:%.2x.%.1x",
+ addr->domain,
+ addr->bus,
+ addr->slot,
+ addr->function));
+ return str;
+}
This should really be in src/util/virpci.{c,h}, since that's where the
virPCIDeviceAddressPtr struct is declared. There's nothing XML related
about this string conversion, so doesn't belong in src/conf at all.
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|