diff options
Diffstat (limited to 'apexd/apex_database.h')
-rw-r--r-- | apexd/apex_database.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/apexd/apex_database.h b/apexd/apex_database.h index e9e1c32..5b738b7 100644 --- a/apexd/apex_database.h +++ b/apexd/apex_database.h @@ -35,15 +35,20 @@ class MountedApexDatabase { std::string full_path; // Full path to the apex file. std::string mount_point; // Path this apex is mounted on. std::string device_name; // Name of the dm verity device. + // Name of the loop device backing up hashtree or empty string in case + // hashtree is embedded inside an APEX. + std::string hashtree_loop_name; MountedApexData() {} MountedApexData(const std::string& loop_name, const std::string& full_path, const std::string& mount_point, - const std::string& device_name) + const std::string& device_name, + const std::string& hashtree_loop_name) : loop_name(loop_name), full_path(full_path), mount_point(mount_point), - device_name(device_name) {} + device_name(device_name), + hashtree_loop_name(hashtree_loop_name) {} inline bool operator<(const MountedApexData& rhs) const { int compare_val = loop_name.compare(rhs.loop_name); @@ -64,7 +69,13 @@ class MountedApexDatabase { } else if (compare_val > 0) { return false; } - return device_name < rhs.device_name; + compare_val = device_name.compare(rhs.device_name); + if (compare_val < 0) { + return true; + } else if (compare_val > 0) { + return false; + } + return hashtree_loop_name < rhs.hashtree_loop_name; } }; @@ -93,6 +104,10 @@ class MountedApexDatabase { CHECK(dm_devices.insert(pair.first.device_name).second) << "Duplicate dm device: " << pair.first.device_name; } + if (pair.first.hashtree_loop_name != "") { + CHECK(loop_devices.insert(pair.first.hashtree_loop_name).second) + << "Duplicate loop device: " << pair.first.hashtree_loop_name; + } } } } |