]> xenbits.xensource.com Git - qemu-xen.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 S. Tsirkin <mst@redhat.com>
Wed, 25 Sep 2019 14:15:59 +0000 (10:15 -0400)
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>
include/exec/memory.h

index a1e6d846cc5e9e636fb5015f3215252990713831..6e67043ee03b1a11a8a7bd62263e2e4fe69333f0 100644 (file)
@@ -504,6 +504,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
  *