@@ -201,25 +201,13 @@ void FilesystemVerifierAction::StartPartitionHashing() {
201
201
}
202
202
const InstallPlan::Partition& partition =
203
203
install_plan_.partitions [partition_index_];
204
- string part_path;
205
- switch (verifier_step_) {
206
- case VerifierStep::kVerifySourceHash :
207
- part_path = partition.source_path ;
208
- partition_size_ = partition.source_size ;
209
- break ;
210
- case VerifierStep::kVerifyTargetHash :
211
- part_path = partition.target_path ;
212
- partition_size_ = partition.target_size ;
213
- break ;
214
- }
204
+ const auto & part_path = GetPartitionPath ();
205
+ partition_size_ = GetPartitionSize ();
215
206
216
207
LOG (INFO) << " Hashing partition " << partition_index_ << " ("
217
208
<< partition.name << " ) on device " << part_path;
218
209
auto success = false ;
219
- if (dynamic_control_->UpdateUsesSnapshotCompression () &&
220
- verifier_step_ == VerifierStep::kVerifyTargetHash &&
221
- dynamic_control_->IsDynamicPartition (partition.name ,
222
- install_plan_.target_slot )) {
210
+ if (IsVABC (partition)) {
223
211
success = InitializeFdVABC ();
224
212
} else {
225
213
if (part_path.empty ()) {
@@ -268,6 +256,40 @@ void FilesystemVerifierAction::StartPartitionHashing() {
268
256
ScheduleFileSystemRead ();
269
257
}
270
258
259
+ bool FilesystemVerifierAction::IsVABC (
260
+ const InstallPlan::Partition& partition) const {
261
+ return dynamic_control_->UpdateUsesSnapshotCompression () &&
262
+ verifier_step_ == VerifierStep::kVerifyTargetHash &&
263
+ dynamic_control_->IsDynamicPartition (partition.name ,
264
+ install_plan_.target_slot );
265
+ }
266
+
267
+ const std::string& FilesystemVerifierAction::GetPartitionPath () const {
268
+ const InstallPlan::Partition& partition =
269
+ install_plan_.partitions [partition_index_];
270
+ switch (verifier_step_) {
271
+ case VerifierStep::kVerifySourceHash :
272
+ return partition.source_path ;
273
+ case VerifierStep::kVerifyTargetHash :
274
+ if (IsVABC (partition)) {
275
+ return partition.readonly_target_path ;
276
+ } else {
277
+ return partition.target_path ;
278
+ }
279
+ }
280
+ }
281
+
282
+ size_t FilesystemVerifierAction::GetPartitionSize () const {
283
+ const InstallPlan::Partition& partition =
284
+ install_plan_.partitions [partition_index_];
285
+ switch (verifier_step_) {
286
+ case VerifierStep::kVerifySourceHash :
287
+ return partition.source_size ;
288
+ case VerifierStep::kVerifyTargetHash :
289
+ return partition.target_size ;
290
+ }
291
+ }
292
+
271
293
bool FilesystemVerifierAction::ShouldWriteVerity () {
272
294
const InstallPlan::Partition& partition =
273
295
install_plan_.partitions [partition_index_];
0 commit comments