]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
memory: Provide an equality function for MemoryRegionSections
authorDr. David Alan Gilbert <dgilbert@redhat.com>
Wed, 14 Aug 2019 17:55:34 +0000 (18:55 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 12 Nov 2019 22:23:54 +0000 (16:23 -0600)
Provide a comparison function that checks all the fields are the same.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190814175535.2023-3-dgilbert@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 9366cf02e4e31c2a8128904d4d8290a0fad5f888)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
include/exec/memory.h

index e28d79cc592f776d822c9a82176a48c20d6f43e0..611a89122d1ef2de8d595ebe30c4cc06c8da56fd 100644 (file)
@@ -496,6 +496,18 @@ struct MemoryRegionSection {
     bool nonvolatile;
 };
 
+static inline bool MemoryRegionSection_eq(MemoryRegionSection *a,
+                                          MemoryRegionSection *b)
+{
+    return a->mr == b->mr &&
+           a->fv == b->fv &&
+           a->offset_within_region == b->offset_within_region &&
+           a->offset_within_address_space == b->offset_within_address_space &&
+           int128_eq(a->size, b->size) &&
+           a->readonly == b->readonly &&
+           a->nonvolatile == b->nonvolatile;
+}
+
 /**
  * memory_region_init: Initialize a memory region
  *