]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: add function virDevicePCIAddressEqual
authorShradha Shah <sshah@solarflare.com>
Thu, 16 Aug 2012 15:42:14 +0000 (16:42 +0100)
committerLaine Stump <laine@laine.org>
Fri, 17 Aug 2012 19:43:26 +0000 (15:43 -0400)
This function is needed by the network driver in a later commit.
It is useful in functions like networkNotifyActualDevice and
networkReleaseActualDevice

src/conf/device_conf.c
src/conf/device_conf.h
src/libvirt_private.syms

index d558ea785f4f2bc2cb394a7389ccba6ff479f93f..afd4eca5d9d02ebe85f7ddbc0e50edc461a3ebfc 100644 (file)
@@ -129,3 +129,19 @@ virDevicePCIAddressFormat(virBufferPtr buf,
                       addr.function);
     return 0;
 }
+
+int
+virDevicePCIAddressEqual(virDevicePCIAddress addr1,
+                         virDevicePCIAddress addr2)
+{
+    int ret = -1;
+
+    if (addr1.domain == addr2.domain &&
+        addr1.bus == addr2.bus &&
+        addr1.slot == addr2.slot &&
+        addr1.function == addr2.function) {
+        ret = 0;
+    }
+
+    return ret;
+}
index bbd5decba42388bb48e0d3a29d345a7fb1259c8c..264c8e0cd66af77fb98e0adb25a44ed1a6fb3421 100644 (file)
@@ -59,6 +59,9 @@ int virDevicePCIAddressFormat(virBufferPtr buf,
                               virDevicePCIAddress addr,
                               bool includeTypeInAddr);
 
+int virDevicePCIAddressEqual(virDevicePCIAddress addr1,
+                             virDevicePCIAddress addr2);
+
 
 VIR_ENUM_DECL(virDeviceAddressPciMulti)
 
index c52273bab0de6e358e5a01987c48c0d978367717..7539edc7b0825e205d783048bb6011b252c09033 100644 (file)
@@ -221,6 +221,7 @@ virStreamClass;
 # device_conf.h
 virDeviceAddressPciMultiTypeFromString;
 virDeviceAddressPciMultiTypeToString;
+virDevicePCIAddressEqual;
 virDevicePCIAddressFormat;
 virDevicePCIAddressIsValid;
 virDevicePCIAddressParseXML;