diff --git a/Makefile.in b/Makefile.in
index d08f8cf..e54fbd5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -36,6 +36,7 @@ all: $(PROGRAMS)
SOURCE=\
base/base64.cc \
+ base/endian_utils.cc \
base/error_state.cc \
\
caching/hint_array.cc \
@@ -46,8 +47,9 @@ SOURCE=\
caching/restore_emitter.cc \
caching/xml_format.cc \
\
+ era/era_detail.cc \
+ \
persistent-data/checksum.cc \
- persistent-data/endian_utils.cc \
persistent-data/error_set.cc \
persistent-data/file_utils.cc \
persistent-data/hex_dump.cc \
@@ -154,8 +156,9 @@ THIN_REPAIR_SOURCE=$(SOURCE)
THIN_RESTORE_SOURCE=$(SOURCE)
THIN_CHECK_SOURCE=\
base/error_state.cc \
+ base/endian_utils.cc \
+ \
persistent-data/checksum.cc \
- persistent-data/endian_utils.cc \
persistent-data/error_set.cc \
persistent-data/file_utils.cc \
persistent-data/hex_dump.cc \
@@ -166,6 +169,7 @@ THIN_CHECK_SOURCE=\
persistent-data/space-maps/recursive.cc \
persistent-data/space-maps/careful_alloc.cc \
persistent-data/transaction_manager.cc \
+ \
thin-provisioning/device_tree.cc \
thin-provisioning/mapping_tree.cc \
thin-provisioning/metadata.cc \
@@ -173,8 +177,9 @@ THIN_CHECK_SOURCE=\
thin-provisioning/superblock.cc
THIN_RMAP_SOURCE=\
+ base/endian_utils.cc \
+ \
persistent-data/checksum.cc \
- persistent-data/endian_utils.cc \
persistent-data/error_set.cc \
persistent-data/file_utils.cc \
persistent-data/hex_dump.cc \
@@ -233,8 +238,9 @@ thin_metadata_size: thin-provisioning/thin_metadata_size.o
CACHE_CHECK_SOURCE=\
base/base64.cc \
base/error_state.cc \
+ base/endian_utils.cc \
+ \
persistent-data/checksum.cc \
- persistent-data/endian_utils.cc \
persistent-data/error_set.cc \
persistent-data/file_utils.cc \
persistent-data/hex_dump.cc \
@@ -246,6 +252,7 @@ CACHE_CHECK_SOURCE=\
persistent-data/space-maps/recursive.cc \
persistent-data/space-maps/careful_alloc.cc \
persistent-data/transaction_manager.cc \
+ \
caching/hint_array.cc \
caching/superblock.cc \
caching/mapping_array.cc \
diff --git a/persistent-data/endian_utils.cc b/base/endian_utils.cc
similarity index 100%
rename from persistent-data/endian_utils.cc
rename to base/endian_utils.cc
diff --git a/persistent-data/endian_utils.h b/base/endian_utils.h
similarity index 97%
rename from persistent-data/endian_utils.h
rename to base/endian_utils.h
index 39276e6..3ad75ae 100644
--- a/persistent-data/endian_utils.h
+++ b/base/endian_utils.h
@@ -16,8 +16,8 @@
// with thin-provisioning-tools. If not, see
// .
-#ifndef ENDIAN_H
-#define ENDIAN_H
+#ifndef BASE_ENDIAN_H
+#define BASE_ENDIAN_H
#include
#include
@@ -25,7 +25,6 @@
//----------------------------------------------------------------
-// FIXME: rename to endian
namespace base {
// These are just little wrapper types to make the compiler
diff --git a/caching/mapping_array.cc b/caching/mapping_array.cc
index d31c2c9..c6af4ef 100644
--- a/caching/mapping_array.cc
+++ b/caching/mapping_array.cc
@@ -1,5 +1,5 @@
+#include "base/endian_utils.h"
#include "caching/mapping_array.h"
-#include "persistent-data/endian_utils.h"
#include
diff --git a/caching/metadata.h b/caching/metadata.h
index 611b424..a606878 100644
--- a/caching/metadata.h
+++ b/caching/metadata.h
@@ -1,10 +1,11 @@
#ifndef CACHE_METADATA_H
#define CACHE_METADATA_H
+#include "base/endian_utils.h"
+
#include "persistent-data/block.h"
#include "persistent-data/data-structures/array.h"
#include "persistent-data/data-structures/bitset.h"
-#include "persistent-data/endian_utils.h"
#include "persistent-data/space-maps/disk.h"
#include "persistent-data/transaction_manager.h"
diff --git a/caching/superblock.h b/caching/superblock.h
index 2c2cf30..d1a24aa 100644
--- a/caching/superblock.h
+++ b/caching/superblock.h
@@ -1,7 +1,7 @@
#ifndef CACHE_SUPERBLOCK_H
#define CACHE_SUPERBLOCK_H
-#include "persistent-data/endian_utils.h"
+#include "base/endian_utils.h"
#include "persistent-data/data-structures/btree.h"
#include
diff --git a/persistent-data/data-structures/array_block.h b/persistent-data/data-structures/array_block.h
index 1bb3d4c..638e164 100644
--- a/persistent-data/data-structures/array_block.h
+++ b/persistent-data/data-structures/array_block.h
@@ -19,7 +19,7 @@
#ifndef ARRAY_BLOCK_H
#define ARRAY_BLOCK_H
-#include "persistent-data/endian_utils.h"
+#include "base/endian_utils.h"
//----------------------------------------------------------------
diff --git a/persistent-data/data-structures/btree.h b/persistent-data/data-structures/btree.h
index 26e687a..93c3284 100644
--- a/persistent-data/data-structures/btree.h
+++ b/persistent-data/data-structures/btree.h
@@ -19,7 +19,7 @@
#ifndef BTREE_H
#define BTREE_H
-#include "persistent-data/endian_utils.h"
+#include "base/endian_utils.h"
#include "persistent-data/transaction_manager.h"
#include "persistent-data/data-structures/ref_counter.h"
diff --git a/persistent-data/space-maps/disk.cc b/persistent-data/space-maps/disk.cc
index 36937ec..1de3688 100644
--- a/persistent-data/space-maps/disk.cc
+++ b/persistent-data/space-maps/disk.cc
@@ -16,6 +16,8 @@
// with thin-provisioning-tools. If not, see
// .
+#include "base/endian_utils.h"
+
#include "persistent-data/space-maps/disk.h"
#include "persistent-data/space-maps/disk_structures.h"
#include "persistent-data/space-maps/recursive.h"
@@ -23,7 +25,6 @@
#include "persistent-data/data-structures/btree_checker.h"
#include "persistent-data/checksum.h"
-#include "persistent-data/endian_utils.h"
#include "persistent-data/math_utils.h"
#include "persistent-data/transaction_manager.h"
diff --git a/persistent-data/space-maps/disk_structures.h b/persistent-data/space-maps/disk_structures.h
index a92f490..1429d36 100644
--- a/persistent-data/space-maps/disk_structures.h
+++ b/persistent-data/space-maps/disk_structures.h
@@ -19,7 +19,7 @@
#ifndef SPACE_MAP_DISK_STRUCTURES_H
#define SPACE_MAP_DISK_STRUCTURES_H
-#include "persistent-data/endian_utils.h"
+#include "base/endian_utils.h"
// FIXME: what's this included for?
#include "persistent-data/data-structures/btree.h"
diff --git a/thin-provisioning/metadata.h b/thin-provisioning/metadata.h
index 9749acb..c0913a0 100644
--- a/thin-provisioning/metadata.h
+++ b/thin-provisioning/metadata.h
@@ -19,9 +19,10 @@
#ifndef METADATA_LL_H
#define METADATA_LL_H
+#include "base/endian_utils.h"
+
#include "persistent-data/block.h"
#include "persistent-data/data-structures/btree.h"
-#include "persistent-data/endian_utils.h"
#include "persistent-data/space-maps/disk.h"
#include "persistent-data/transaction_manager.h"
diff --git a/thin-provisioning/superblock.h b/thin-provisioning/superblock.h
index d6d78e3..3a3d90a 100644
--- a/thin-provisioning/superblock.h
+++ b/thin-provisioning/superblock.h
@@ -1,8 +1,9 @@
#ifndef THIN_SUPERBLOCK_H
#define THIN_SUPERBLOCK_H
+#include "base/endian_utils.h"
+
#include "persistent-data/block.h"
-#include "persistent-data/endian_utils.h"
#include "persistent-data/data-structures/ref_counter.h"
//----------------------------------------------------------------