OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__ |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 uint64_t size, | 22 uint64_t size, |
23 const std::string& hash, | 23 const std::string& hash, |
24 const std::string& install_path, | 24 const std::string& install_path, |
25 const std::string& kernel_install_path) | 25 const std::string& kernel_install_path) |
26 : is_full_update(is_full), | 26 : is_full_update(is_full), |
27 is_resume(is_resume), | 27 is_resume(is_resume), |
28 download_url(url), | 28 download_url(url), |
29 size(size), | 29 size(size), |
30 download_hash(hash), | 30 download_hash(hash), |
31 install_path(install_path), | 31 install_path(install_path), |
32 kernel_install_path(kernel_install_path) {} | 32 kernel_install_path(kernel_install_path), |
| 33 kernel_size(0), |
| 34 rootfs_size(0) {} |
33 InstallPlan() : is_full_update(false), is_resume(false), size(0) {} | 35 InstallPlan() : is_full_update(false), is_resume(false), size(0) {} |
34 | 36 |
35 bool is_full_update; | 37 bool is_full_update; |
36 bool is_resume; | 38 bool is_resume; |
37 std::string download_url; // url to download from | 39 std::string download_url; // url to download from |
38 uint64_t size; // size of the download url's data | 40 uint64_t size; // size of the download url's data |
39 std::string download_hash; // hash of the data at the url | 41 std::string download_hash; // hash of the data at the url |
40 std::string install_path; // path to install device | 42 std::string install_path; // path to install device |
41 std::string kernel_install_path; // path to kernel install device | 43 std::string kernel_install_path; // path to kernel install device |
42 std::vector<char> current_kernel_hash; // computed by FileSystemCopierAction | 44 |
43 std::vector<char> current_rootfs_hash; // computed by FileSystemCopierAction | 45 // The fields below are used for kernel and rootfs verification. The flow is: |
| 46 // |
| 47 // 1. FilesystemCopierAction(verify_hash=false) computes and fills in the |
| 48 // source partition sizes and hashes. |
| 49 // |
| 50 // 2. DownloadAction verifies the source partition sizes and hashes against |
| 51 // the expected values transmitted in the update manifest. It fills in the |
| 52 // expected applied partition sizes and hashes based on the manifest. |
| 53 // |
| 54 // 4. FilesystemCopierAction(verify_hashes=true) computes and verifies the |
| 55 // applied partition sizes and hashes against the expected values. |
| 56 uint64_t kernel_size; |
| 57 uint64_t rootfs_size; |
| 58 std::vector<char> kernel_hash; |
| 59 std::vector<char> rootfs_hash; |
44 | 60 |
45 bool operator==(const InstallPlan& that) const { | 61 bool operator==(const InstallPlan& that) const { |
46 return (is_full_update == that.is_full_update) && | 62 return (is_full_update == that.is_full_update) && |
47 (is_resume == that.is_resume) && | 63 (is_resume == that.is_resume) && |
48 (download_url == that.download_url) && | 64 (download_url == that.download_url) && |
49 (size == that.size) && | 65 (size == that.size) && |
50 (download_hash == that.download_hash) && | 66 (download_hash == that.download_hash) && |
51 (install_path == that.install_path) && | 67 (install_path == that.install_path) && |
52 (kernel_install_path == that.kernel_install_path); | 68 (kernel_install_path == that.kernel_install_path); |
53 } | 69 } |
54 bool operator!=(const InstallPlan& that) const { | 70 bool operator!=(const InstallPlan& that) const { |
55 return !((*this) == that); | 71 return !((*this) == that); |
56 } | 72 } |
57 void Dump() const { | 73 void Dump() const { |
58 LOG(INFO) << "InstallPlan: " | 74 LOG(INFO) << "InstallPlan: " |
59 << (is_full_update ? "full_update" : "delta_update") | 75 << (is_full_update ? "full_update" : "delta_update") |
60 << (is_resume ? ", resume" : ", new_update") | 76 << (is_resume ? ", resume" : ", new_update") |
61 << ", url: " << download_url | 77 << ", url: " << download_url |
62 << ", size: " << size | 78 << ", size: " << size |
63 << ", hash: " << download_hash | 79 << ", hash: " << download_hash |
64 << ", install_path: " << install_path | 80 << ", install_path: " << install_path |
65 << ", kernel_install_path: " << kernel_install_path; | 81 << ", kernel_install_path: " << kernel_install_path; |
66 } | 82 } |
67 }; | 83 }; |
68 | 84 |
69 } // namespace chromeos_update_engine | 85 } // namespace chromeos_update_engine |
70 | 86 |
71 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__ | 87 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__ |
OLD | NEW |