diff options
Diffstat (limited to 'payload_consumer/filesystem_verifier_action.h')
-rw-r--r-- | payload_consumer/filesystem_verifier_action.h | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/payload_consumer/filesystem_verifier_action.h b/payload_consumer/filesystem_verifier_action.h index 850abdad..78634cb3 100644 --- a/payload_consumer/filesystem_verifier_action.h +++ b/payload_consumer/filesystem_verifier_action.h @@ -22,14 +22,12 @@ #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" @@ -86,16 +84,6 @@ 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(); @@ -103,11 +91,16 @@ class FilesystemVerifierAction : public InstallPlanAction { // remaining to be hashed, it finishes the action. void StartPartitionHashing(); - const std::string& GetPartitionPath() const; + // Schedules the asynchronous read of the filesystem part of this + // partition(not including hashtree/verity). + void ScheduleFileSystemRead(); - bool IsVABC(const InstallPlan::Partition& partition) const; + // Read the verity part of this partition.(hash tree and FEC) + void ReadVerityAndFooter(); - size_t GetPartitionSize() 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); // When the read is done, finalize the hash checking of the current partition // and continue checking the next one. @@ -121,13 +114,9 @@ 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 should_write_verity); + bool InitializeFdVABC(); // The type of the partition that we are verifying. VerifierStep verifier_step_ = VerifierStep::kVerifyTargetHash; @@ -172,7 +161,8 @@ class FilesystemVerifierAction : public InstallPlanAction { // Callback that should be cancelled on |TerminateProcessing|. Usually this // points to pending read callbacks from async stream. - ScopedTaskId pending_task_id_; + brillo::MessageLoop::TaskId pending_task_id_{ + brillo::MessageLoop::kTaskIdNull}; DISALLOW_COPY_AND_ASSIGN(FilesystemVerifierAction); }; |