fs_mgr: support 'check_at_most_once' for dm-verity
Parse the hashtree descriptor of the AVB-protected partitions
and add 'check_at_most_once' option to dm-verity table.
Test: build & check dm-verity table
Test: atest --host libfs_avb_test
Test: atest --host libfs_avb_internal_test -- --test-arg \
com.android.tradefed.testtype.HostGTest:native-test-timeout:5m
Signed-off-by: JeongHyeon Lee <jhs2.lee@samsung.com>
Change-Id: I226a545aa95e07ebd7096dde18c357ac1ed1241c
This commit is contained in:
parent
a6c57d5752
commit
14e9a70e7a
3 changed files with 9 additions and 0 deletions
|
|
@ -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()) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue