Add XorExtentWriter

This class is built on top of BlockExtentWriter(block aligned writer)
and ExtentMap. It will look at the extent map, convert blocks in the
extent map to XOR type, and convert everythign else to COW_REPLACE.

Test: th
Bug: 177104308
Change-Id: I6f9df83ed09f1c5a6aae9f266412132b002acd29
diff --git a/common/utils.cc b/common/utils.cc
index 5dbb445..25df540 100644
--- a/common/utils.cc
+++ b/common/utils.cc
@@ -1040,6 +1040,11 @@
   return ErrorCode::kSuccess;
 }
 
+std::unique_ptr<android::base::MappedFile> GetReadonlyZeroBlock(size_t size) {
+  android::base::unique_fd fd{HANDLE_EINTR(open("/dev/zero", O_RDONLY))};
+  return android::base::MappedFile::FromFd(fd, 0, size, PROT_READ);
+}
+
 }  // namespace utils
 
 }  // namespace chromeos_update_engine