Merge "fs_mgr: support 'check_at_most_once' for dm-verity"

This commit is contained in:
Treehugger Robot 2021-06-15 05:27:34 +00:00 committed by Gerrit Code Review
commit 79e0890f6d
3 changed files with 9 additions and 0 deletions

View file

@ -109,6 +109,10 @@ void DmTargetVerity::IgnoreZeroBlocks() {
optional_args_.emplace_back("ignore_zero_blocks");
}
void DmTargetVerity::CheckAtMostOnce() {
optional_args_.emplace_back("check_at_most_once");
}
std::string DmTargetVerity::GetParameterString() const {
std::string base = android::base::Join(base_args_, " ");
if (optional_args_.empty()) {

View file

@ -127,6 +127,7 @@ class DmTargetVerity final : public DmTarget {
void UseFec(const std::string& device, uint32_t num_roots, uint32_t num_blocks, uint32_t start);
void SetVerityMode(const std::string& mode);
void IgnoreZeroBlocks();
void CheckAtMostOnce();
std::string name() const override { return "verity"; }
std::string GetParameterString() const override;

View file

@ -92,6 +92,10 @@ bool ConstructVerityTable(const FsAvbHashtreeDescriptor& hashtree_desc,
// Always use ignore_zero_blocks.
target.IgnoreZeroBlocks();
if (hashtree_desc.flags & AVB_HASHTREE_DESCRIPTOR_FLAGS_CHECK_AT_MOST_ONCE) {
target.CheckAtMostOnce();
}
LINFO << "Built verity table: '" << target.GetParameterString() << "'";
return table->AddTarget(std::make_unique<android::dm::DmTargetVerity>(target));