Rework interactions between AvbOps and AvbABOps.

Use pointers instead of aggregation and introduce a |user_data| field
that can be used for platform-specific resources. This makes it easier
for bootloader vendors since they don't have to "subclass" AvbOps or
AvbABOps - instead they can just point to their platform-specific data
using the |user_data| member in AvbOps. Additionally, this change
makes it possible to add other libraries on top (such as libavb_atx)
whilst still using both libavb and libavb_ab.

Bug: None
Test: Unit tests pass.
Test: Manually tested on UEFI based bootloader.

Change-Id: I72963cde94fdc922060e3cc42d7f360f6da01bb0
diff --git a/test/fake_avb_ops.cc b/test/fake_avb_ops.cc
index 6f5be76..b2a2080 100644
--- a/test/fake_avb_ops.cc
+++ b/test/fake_avb_ops.cc
@@ -284,12 +284,8 @@
 }
 
 FakeAvbOps::FakeAvbOps() {
-  if (!instance_map_) {
-    instance_map_ = new std::map<AvbOps*, FakeAvbOps*>;
-  }
-  (*instance_map_)[&avb_ops_] = this;
-  (*instance_map_)[&avb_ab_ops_.ops] = this;
-
+  avb_ops_.ab_ops = &avb_ab_ops_;
+  avb_ops_.user_data = this;
   avb_ops_.read_from_partition = my_ops_read_from_partition;
   avb_ops_.write_to_partition = my_ops_write_to_partition;
   avb_ops_.validate_vbmeta_public_key = my_ops_validate_vbmeta_public_key;
@@ -299,7 +295,7 @@
   avb_ops_.get_unique_guid_for_partition = my_ops_get_unique_guid_for_partition;
 
   // Just use the built-in A/B metadata read/write routines.
-  avb_ab_ops_.ops = avb_ops_;
+  avb_ab_ops_.ops = &avb_ops_;
   avb_ab_ops_.read_ab_metadata = avb_ab_data_read;
   avb_ab_ops_.write_ab_metadata = avb_ab_data_write;
 
@@ -308,6 +304,4 @@
 
 FakeAvbOps::~FakeAvbOps() {}
 
-std::map<AvbOps*, FakeAvbOps*>* FakeAvbOps::instance_map_ = nullptr;
-
 }  // namespace avb