Add Extent map
When installing OTA, we stream operations as data becomes available. For
each operation, update_engine needs to look at the merge sequence and
figure out which blocks should be converted to COW_XOR. To do that, we
need a data structure for querying a disjoint set of extents.
Test: th
Bug: 177104308
Change-Id: I14ec9d72a32e859b65516b894ca94d0153aa7e17
diff --git a/common/utils.h b/common/utils.h
index 59f236e..4e78097 100644
--- a/common/utils.h
+++ b/common/utils.h
@@ -465,6 +465,17 @@
DISALLOW_COPY_AND_ASSIGN(ScopedActionCompleter);
};
+// Simple wrapper for creating a slice of some container,
+// similar to string_view but for other containers.
+template <typename T>
+struct Range {
+ Range(T t1, T t2) : t1_(t1), t2_(t2) {}
+ constexpr auto begin() const noexcept { return t1_; }
+ constexpr auto end() const noexcept { return t2_; }
+ T t1_;
+ T t2_;
+};
+
} // namespace chromeos_update_engine
#define TEST_AND_RETURN_FALSE_ERRNO(_x) \