| 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 "update_engine/delta_diff_generator.h" | 5 #include "update_engine/delta_diff_generator.h" |
| 6 #include <sys/stat.h> | 6 #include <sys/stat.h> |
| 7 #include <sys/types.h> | 7 #include <sys/types.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 TEST_AND_RETURN_FALSE(utils::WriteAll(blobs_fd, &data_bz[0], data_bz.size())); | 446 TEST_AND_RETURN_FALSE(utils::WriteAll(blobs_fd, &data_bz[0], data_bz.size())); |
| 447 *blobs_length += data_bz.size(); | 447 *blobs_length += data_bz.size(); |
| 448 | 448 |
| 449 off_t new_part_size = utils::FileSize(new_kernel_part); | 449 off_t new_part_size = utils::FileSize(new_kernel_part); |
| 450 TEST_AND_RETURN_FALSE(new_part_size >= 0); | 450 TEST_AND_RETURN_FALSE(new_part_size >= 0); |
| 451 | 451 |
| 452 op->set_data_length(data_bz.size()); | 452 op->set_data_length(data_bz.size()); |
| 453 | 453 |
| 454 op->set_dst_length(new_part_size); | 454 op->set_dst_length(new_part_size); |
| 455 | 455 |
| 456 // Theres a single dest extent | 456 // There's a single dest extent |
| 457 Extent* dst_extent = op->add_dst_extents(); | 457 Extent* dst_extent = op->add_dst_extents(); |
| 458 dst_extent->set_start_block(0); | 458 dst_extent->set_start_block(0); |
| 459 dst_extent->set_num_blocks((new_part_size + kBlockSize - 1) / kBlockSize); | 459 dst_extent->set_num_blocks((new_part_size + kBlockSize - 1) / kBlockSize); |
| 460 | 460 |
| 461 LOG(INFO) << "Done compressing kernel partition."; | 461 LOG(INFO) << "Done compressing kernel partition."; |
| 462 return true; | 462 return true; |
| 463 } | 463 } |
| 464 | 464 |
| 465 } // namespace {} | 465 } // namespace {} |
| 466 | 466 |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 | 980 |
| 981 LOG(INFO) << "All done. Successfully created delta file."; | 981 LOG(INFO) << "All done. Successfully created delta file."; |
| 982 return true; | 982 return true; |
| 983 } | 983 } |
| 984 | 984 |
| 985 const char* const kBsdiffPath = "/usr/bin/bsdiff"; | 985 const char* const kBsdiffPath = "/usr/bin/bsdiff"; |
| 986 const char* const kBspatchPath = "/usr/bin/bspatch"; | 986 const char* const kBspatchPath = "/usr/bin/bspatch"; |
| 987 const char* const kDeltaMagic = "CrAU"; | 987 const char* const kDeltaMagic = "CrAU"; |
| 988 | 988 |
| 989 }; // namespace chromeos_update_engine | 989 }; // namespace chromeos_update_engine |
| OLD | NEW |