diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-05-14 01:09:55 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2021-05-14 01:09:55 +0000 |
commit | a6c543c64b135f521cae645c2f882d78bf7307e8 (patch) | |
tree | 3e0ef8551a610e593102d8ff0f0a2d8c9b682581 /payload_consumer/filesystem_verifier_action.h | |
parent | 3d4e6e0d7ed2b609e0fe2b4d0fcb250808f97476 (diff) | |
parent | 422e893875d4d1c8cf73db5d39a0eac19bce3065 (diff) |
Snap for 7360053 from 422e893875d4d1c8cf73db5d39a0eac19bce3065 to sc-release
Change-Id: I9d292ff0b5cbdc3e0ab778bcb3f9eca70d8a0277
Diffstat (limited to 'payload_consumer/filesystem_verifier_action.h')
-rw-r--r-- | payload_consumer/filesystem_verifier_action.h | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/payload_consumer/filesystem_verifier_action.h b/payload_consumer/filesystem_verifier_action.h index 78634cb3..850abdad 100644 --- a/payload_consumer/filesystem_verifier_action.h +++ b/payload_consumer/filesystem_verifier_action.h @@ -22,12 +22,14 @@ #include <memory> #include <string> +#include <utility> #include <vector> #include <brillo/message_loops/message_loop.h> #include "update_engine/common/action.h" #include "update_engine/common/hash_calculator.h" +#include "update_engine/common/scoped_task_id.h" #include "update_engine/payload_consumer/file_descriptor.h" #include "update_engine/payload_consumer/install_plan.h" #include "update_engine/payload_consumer/verity_writer_interface.h" @@ -84,6 +86,16 @@ class FilesystemVerifierAction : public InstallPlanAction { private: friend class FilesystemVerifierActionTestDelegate; + void WriteVerityAndHashPartition(FileDescriptorPtr fd, + const off64_t start_offset, + const off64_t end_offset, + void* buffer, + const size_t buffer_size); + void HashPartition(FileDescriptorPtr fd, + const off64_t start_offset, + const off64_t end_offset, + void* buffer, + const size_t buffer_size); // Return true if we need to write verity bytes. bool ShouldWriteVerity(); @@ -91,16 +103,11 @@ class FilesystemVerifierAction : public InstallPlanAction { // remaining to be hashed, it finishes the action. void StartPartitionHashing(); - // Schedules the asynchronous read of the filesystem part of this - // partition(not including hashtree/verity). - void ScheduleFileSystemRead(); + const std::string& GetPartitionPath() const; - // Read the verity part of this partition.(hash tree and FEC) - void ReadVerityAndFooter(); + bool IsVABC(const InstallPlan::Partition& partition) const; - // Called from the main loop when a single read from |src_stream_| succeeds or - // fails, calling OnReadDoneCallback() and OnReadErrorCallback() respectively. - void OnReadDone(size_t bytes_read); + size_t GetPartitionSize() const; // When the read is done, finalize the hash checking of the current partition // and continue checking the next one. @@ -114,9 +121,13 @@ class FilesystemVerifierAction : public InstallPlanAction { // Invoke delegate callback to report progress, if delegate is not null void UpdateProgress(double progress); + // Updates progress of current partition. |progress| should be in range [0, + // 1], and it will be scaled appropriately with # of partitions. + void UpdatePartitionProgress(double progress); + // Initialize read_fd_ and write_fd_ bool InitializeFd(const std::string& part_path); - bool InitializeFdVABC(); + bool InitializeFdVABC(bool should_write_verity); // The type of the partition that we are verifying. VerifierStep verifier_step_ = VerifierStep::kVerifyTargetHash; @@ -161,8 +172,7 @@ class FilesystemVerifierAction : public InstallPlanAction { // Callback that should be cancelled on |TerminateProcessing|. Usually this // points to pending read callbacks from async stream. - brillo::MessageLoop::TaskId pending_task_id_{ - brillo::MessageLoop::kTaskIdNull}; + ScopedTaskId pending_task_id_; DISALLOW_COPY_AND_ASSIGN(FilesystemVerifierAction); }; |