summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/commonlib/include/commonlib/region.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/commonlib/include/commonlib/region.h b/src/commonlib/include/commonlib/region.h
index 86b9ee39cc..08b9191a66 100644
--- a/src/commonlib/include/commonlib/region.h
+++ b/src/commonlib/include/commonlib/region.h
@@ -7,6 +7,7 @@
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
+#include <stdbool.h>
#include <commonlib/mem_pool.h>
/*
@@ -117,6 +118,12 @@ static inline size_t region_end(const struct region *r)
return region_offset(r) + region_sz(r);
}
+static inline bool region_overlap(const struct region *r1, const struct region *r2)
+{
+ return (region_end(r1) > region_offset(r2)) &&
+ (region_offset(r1) < region_end(r2));
+}
+
static inline const struct region *region_device_region(
const struct region_device *rdev)
{