[libvirt] [PATCH 4/6] conf: Move virDomainPCIAddressAsString() to device_conf

Andrea Bolognani abologna at redhat.com
Fri Aug 31 14:00:45 UTC 2018


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 at 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;
+}
+
 bool
 virPCIDeviceAddressEqual(virPCIDeviceAddress *addr1,
                          virPCIDeviceAddress *addr2)
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index b09d6bcecb..846d12543d 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -205,6 +205,9 @@ int virPCIDeviceAddressFormat(virBufferPtr buf,
                               virPCIDeviceAddress addr,
                               bool includeTypeInAddr);
 
+char *virDomainPCIAddressAsString(virPCIDeviceAddressPtr addr)
+      ATTRIBUTE_NONNULL(1);
+
 bool virPCIDeviceAddressEqual(virPCIDeviceAddress *addr1,
                               virPCIDeviceAddress *addr2);
 
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index b62fd53c66..d2e1142462 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -573,20 +573,6 @@ virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs,
 }
 
 
-char *
-virDomainPCIAddressAsString(virPCIDeviceAddressPtr addr)
-{
-    char *str;
-
-    ignore_value(virAsprintf(&str, "%.4x:%.2x:%.2x.%.1x",
-                             addr->domain,
-                             addr->bus,
-                             addr->slot,
-                             addr->function));
-    return str;
-}
-
-
 /*
  * Check if the PCI slot is used by another device.
  */
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
index 5ad9d8ef3d..2a9af9c00b 100644
--- a/src/conf/domain_addr.h
+++ b/src/conf/domain_addr.h
@@ -124,9 +124,6 @@ struct _virDomainPCIAddressSet {
 typedef struct _virDomainPCIAddressSet virDomainPCIAddressSet;
 typedef virDomainPCIAddressSet *virDomainPCIAddressSetPtr;
 
-char *virDomainPCIAddressAsString(virPCIDeviceAddressPtr addr)
-      ATTRIBUTE_NONNULL(1);
-
 virDomainPCIAddressSetPtr virDomainPCIAddressSetAlloc(unsigned int nbuses);
 
 void virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr addrs);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 78307885dc..77f55b3c40 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -100,6 +100,7 @@ virDomainDeviceAddressTypeToString;
 virDomainDeviceCCWAddressIsValid;
 virDomainDeviceInfoAddressIsEqual;
 virDomainDeviceInfoCopy;
+virDomainPCIAddressAsString;
 virInterfaceLinkFormat;
 virInterfaceLinkParseXML;
 virPCIDeviceAddressEqual;
@@ -113,7 +114,6 @@ virPCIDeviceAddressParseXML;
 virDomainCCWAddressAssign;
 virDomainCCWAddressSetCreateFromDomain;
 virDomainCCWAddressSetFree;
-virDomainPCIAddressAsString;
 virDomainPCIAddressBusIsFullyReserved;
 virDomainPCIAddressBusSetModel;
 virDomainPCIAddressEnsureAddr;
-- 
2.17.1




More information about the libvir-list mailing list