| 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 #include <sys/types.h> | 5 #include <sys/types.h> |
| 6 #include <sys/stat.h> | 6 #include <sys/stat.h> |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 FLAGS_old_kernel, | 83 FLAGS_old_kernel, |
| 84 &kern_info)); | 84 &kern_info)); |
| 85 CHECK(DeltaDiffGenerator::InitializePartitionInfo(false, // is_kernel | 85 CHECK(DeltaDiffGenerator::InitializePartitionInfo(false, // is_kernel |
| 86 FLAGS_old_image, | 86 FLAGS_old_image, |
| 87 &root_info)); | 87 &root_info)); |
| 88 vector<char> kern_hash(kern_info.hash().begin(), | 88 vector<char> kern_hash(kern_info.hash().begin(), |
| 89 kern_info.hash().end()); | 89 kern_info.hash().end()); |
| 90 vector<char> root_hash(root_info.hash().begin(), | 90 vector<char> root_hash(root_info.hash().begin(), |
| 91 root_info.hash().end()); | 91 root_info.hash().end()); |
| 92 DeltaPerformer performer(&prefs); | 92 DeltaPerformer performer(&prefs); |
| 93 performer.set_current_kernel_hash(&kern_hash); | 93 performer.set_current_kernel_hash(kern_hash); |
| 94 performer.set_current_rootfs_hash(&root_hash); | 94 performer.set_current_rootfs_hash(root_hash); |
| 95 CHECK_EQ(performer.Open(FLAGS_old_image.c_str(), 0, 0), 0); | 95 CHECK_EQ(performer.Open(FLAGS_old_image.c_str(), 0, 0), 0); |
| 96 CHECK(performer.OpenKernel(FLAGS_old_kernel.c_str())); | 96 CHECK(performer.OpenKernel(FLAGS_old_kernel.c_str())); |
| 97 vector<char> buf(1024 * 1024); | 97 vector<char> buf(1024 * 1024); |
| 98 int fd = open(FLAGS_apply_delta.c_str(), O_RDONLY, 0); | 98 int fd = open(FLAGS_apply_delta.c_str(), O_RDONLY, 0); |
| 99 CHECK_GE(fd, 0); | 99 CHECK_GE(fd, 0); |
| 100 ScopedFdCloser fd_closer(&fd); | 100 ScopedFdCloser fd_closer(&fd); |
| 101 for (off_t offset = 0;; offset += buf.size()) { | 101 for (off_t offset = 0;; offset += buf.size()) { |
| 102 ssize_t bytes_read; | 102 ssize_t bytes_read; |
| 103 CHECK(utils::PReadAll(fd, &buf[0], buf.size(), offset, &bytes_read)); | 103 CHECK(utils::PReadAll(fd, &buf[0], buf.size(), offset, &bytes_read)); |
| 104 if (bytes_read == 0) | 104 if (bytes_read == 0) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 135 return 0; | 135 return 0; |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace {} | 138 } // namespace {} |
| 139 | 139 |
| 140 } // namespace chromeos_update_engine | 140 } // namespace chromeos_update_engine |
| 141 | 141 |
| 142 int main(int argc, char** argv) { | 142 int main(int argc, char** argv) { |
| 143 return chromeos_update_engine::Main(argc, argv); | 143 return chromeos_update_engine::Main(argc, argv); |
| 144 } | 144 } |
| OLD | NEW |