OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium 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 #include <set> | 10 #include <set> |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 logging::InitLogging("delta_generator.log", | 58 logging::InitLogging("delta_generator.log", |
59 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, | 59 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, |
60 logging::DONT_LOCK_LOG_FILE, | 60 logging::DONT_LOCK_LOG_FILE, |
61 logging::APPEND_TO_OLD_LOG_FILE); | 61 logging::APPEND_TO_OLD_LOG_FILE); |
62 if (!FLAGS_apply_delta.empty()) { | 62 if (!FLAGS_apply_delta.empty()) { |
63 if (FLAGS_old_image.empty()) { | 63 if (FLAGS_old_image.empty()) { |
64 LOG(FATAL) << "Must pass --old_image with --apply_delta."; | 64 LOG(FATAL) << "Must pass --old_image with --apply_delta."; |
65 } | 65 } |
66 DeltaPerformer performer; | 66 DeltaPerformer performer; |
67 CHECK_EQ(performer.Open(FLAGS_old_image.c_str(), 0, 0), 0); | 67 CHECK_EQ(performer.Open(FLAGS_old_image.c_str(), 0, 0), 0); |
| 68 CHECK(performer.OpenKernel(FLAGS_old_kernel.c_str())); |
68 vector<char> buf(1024 * 1024); | 69 vector<char> buf(1024 * 1024); |
69 int fd = open(FLAGS_apply_delta.c_str(), O_RDONLY, 0); | 70 int fd = open(FLAGS_apply_delta.c_str(), O_RDONLY, 0); |
70 CHECK_GE(fd, 0); | 71 CHECK_GE(fd, 0); |
71 ScopedFdCloser fd_closer(&fd); | 72 ScopedFdCloser fd_closer(&fd); |
72 for (off_t offset = 0;; offset += buf.size()) { | 73 for (off_t offset = 0;; offset += buf.size()) { |
73 ssize_t bytes_read; | 74 ssize_t bytes_read; |
74 CHECK(utils::PReadAll(fd, &buf[0], buf.size(), offset, &bytes_read)); | 75 CHECK(utils::PReadAll(fd, &buf[0], buf.size(), offset, &bytes_read)); |
75 if (bytes_read == 0) | 76 if (bytes_read == 0) |
76 break; | 77 break; |
77 CHECK_EQ(performer.Write(&buf[0], bytes_read), bytes_read); | 78 CHECK_EQ(performer.Write(&buf[0], bytes_read), bytes_read); |
(...skipping 24 matching lines...) Expand all Loading... |
102 return 0; | 103 return 0; |
103 } | 104 } |
104 | 105 |
105 } // namespace {} | 106 } // namespace {} |
106 | 107 |
107 } // namespace chromeos_update_engine | 108 } // namespace chromeos_update_engine |
108 | 109 |
109 int main(int argc, char** argv) { | 110 int main(int argc, char** argv) { |
110 return chromeos_update_engine::Main(argc, argv); | 111 return chromeos_update_engine::Main(argc, argv); |
111 } | 112 } |
OLD | NEW |