Alex Deymo | 477aec2 | 2015-03-24 23:40:48 -0700 | [diff] [blame] | 1 | // Copyright 2015 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_ANNOTATED_OPERATION_H_ |
| 6 | #define UPDATE_ENGINE_PAYLOAD_GENERATOR_ANNOTATED_OPERATION_H_ |
| 7 | |
| 8 | #include <ostream> // NOLINT(readability/streams) |
| 9 | #include <string> |
| 10 | |
Gilad Arnold | 41e3474 | 2015-05-11 11:31:50 -0700 | [diff] [blame] | 11 | #include <chromeos/secure_blob.h> |
Sen Jiang | 8cc502d | 2015-08-10 10:04:54 -0700 | [diff] [blame] | 12 | |
| 13 | #include "update_engine/payload_generator/blob_file_writer.h" |
Alex Deymo | 477aec2 | 2015-03-24 23:40:48 -0700 | [diff] [blame] | 14 | #include "update_engine/update_metadata.pb.h" |
| 15 | |
| 16 | namespace chromeos_update_engine { |
| 17 | |
| 18 | struct AnnotatedOperation { |
| 19 | // The name given to the operation, for logging and debugging purposes only. |
| 20 | // This normally includes the path to the file and the chunk used, if any. |
| 21 | std::string name; |
| 22 | |
| 23 | // The InstallOperation, as defined by the protobuf. |
Alex Deymo | a12ee11 | 2015-08-12 22:19:32 -0700 | [diff] [blame^] | 24 | InstallOperation op; |
Alex Deymo | 477aec2 | 2015-03-24 23:40:48 -0700 | [diff] [blame] | 25 | |
Gilad Arnold | 41e3474 | 2015-05-11 11:31:50 -0700 | [diff] [blame] | 26 | // Writes |blob| to the end of |data_fd|, and updates |data_file_size| to |
| 27 | // match the new size of |data_fd|. It sets the data_offset and data_length |
| 28 | // in AnnotatedOperation to match the offset and size of |blob| in |data_fd|. |
Sen Jiang | 8cc502d | 2015-08-10 10:04:54 -0700 | [diff] [blame] | 29 | bool SetOperationBlob(chromeos::Blob* blob, BlobFileWriter* blob_file); |
Alex Deymo | 477aec2 | 2015-03-24 23:40:48 -0700 | [diff] [blame] | 30 | }; |
| 31 | |
| 32 | // For logging purposes. |
| 33 | std::ostream& operator<<(std::ostream& os, const AnnotatedOperation& aop); |
| 34 | |
Alex Deymo | a12ee11 | 2015-08-12 22:19:32 -0700 | [diff] [blame^] | 35 | std::string InstallOperationTypeName(InstallOperation_Type op_type); |
Alex Deymo | 477aec2 | 2015-03-24 23:40:48 -0700 | [diff] [blame] | 36 | |
| 37 | } // namespace chromeos_update_engine |
| 38 | |
| 39 | #endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_ANNOTATED_OPERATION_H_ |