From: Dr. David Alan Gilbert Date: Wed, 14 Aug 2019 17:55:34 +0000 (+0100) Subject: memory: Provide an equality function for MemoryRegionSections X-Git-Tag: v4.2.0-rc0~80^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9366cf02e4e31c2a8128904d4d8290a0fad5f888;p=thirdparty%2Fqemu.git memory: Provide an equality function for MemoryRegionSections Provide a comparison function that checks all the fields are the same. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20190814175535.2023-3-dgilbert@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- diff --git a/include/exec/memory.h b/include/exec/memory.h index a1e6d846cc5..6e67043ee03 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -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 *