Darin Petkov | 9b23057 | 2010-10-08 10:20:09 -0700 | [diff] [blame] | 1 | // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "update_engine/filesystem_copier_action.h" |
Darin Petkov | 9b23057 | 2010-10-08 10:20:09 -0700 | [diff] [blame] | 6 | |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 7 | #include <sys/stat.h> |
| 8 | #include <sys/types.h> |
| 9 | #include <errno.h> |
| 10 | #include <fcntl.h> |
Darin Petkov | 9b23057 | 2010-10-08 10:20:09 -0700 | [diff] [blame] | 11 | |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 12 | #include <algorithm> |
Darin Petkov | 9b23057 | 2010-10-08 10:20:09 -0700 | [diff] [blame] | 13 | #include <cstdlib> |
Andrew de los Reyes | 4fe15d0 | 2009-12-10 19:01:36 -0800 | [diff] [blame] | 14 | #include <map> |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 15 | #include <string> |
| 16 | #include <vector> |
Darin Petkov | 9b23057 | 2010-10-08 10:20:09 -0700 | [diff] [blame] | 17 | |
Andrew de los Reyes | c702078 | 2010-04-28 10:46:04 -0700 | [diff] [blame] | 18 | #include <gio/gio.h> |
| 19 | #include <gio/gunixinputstream.h> |
| 20 | #include <gio/gunixoutputstream.h> |
| 21 | #include <glib.h> |
Darin Petkov | 9b23057 | 2010-10-08 10:20:09 -0700 | [diff] [blame] | 22 | |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 23 | #include "update_engine/filesystem_iterator.h" |
| 24 | #include "update_engine/subprocess.h" |
| 25 | #include "update_engine/utils.h" |
| 26 | |
Andrew de los Reyes | 4fe15d0 | 2009-12-10 19:01:36 -0800 | [diff] [blame] | 27 | using std::map; |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 28 | using std::min; |
| 29 | using std::string; |
| 30 | using std::vector; |
| 31 | |
| 32 | namespace chromeos_update_engine { |
| 33 | |
| 34 | namespace { |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 35 | const off_t kCopyFileBufferSize = 128 * 1024; |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 36 | } // namespace {} |
| 37 | |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 38 | FilesystemCopierAction::FilesystemCopierAction( |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 39 | bool copying_kernel_install_path, |
| 40 | bool verify_hash) |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 41 | : copying_kernel_install_path_(copying_kernel_install_path), |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 42 | verify_hash_(verify_hash), |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 43 | src_stream_(NULL), |
| 44 | dst_stream_(NULL), |
| 45 | read_done_(false), |
| 46 | failed_(false), |
| 47 | cancelled_(false), |
| 48 | filesystem_size_(kint64max) { |
| 49 | // A lot of code works on the implicit assumption that processing is done on |
| 50 | // exactly 2 ping-pong buffers. |
| 51 | COMPILE_ASSERT(arraysize(buffer_) == 2 && |
| 52 | arraysize(buffer_state_) == 2 && |
| 53 | arraysize(buffer_valid_size_) == 2 && |
| 54 | arraysize(canceller_) == 2, |
| 55 | ping_pong_buffers_not_two); |
| 56 | for (int i = 0; i < 2; ++i) { |
| 57 | buffer_state_[i] = kBufferStateEmpty; |
| 58 | buffer_valid_size_[i] = 0; |
| 59 | canceller_[i] = NULL; |
| 60 | } |
| 61 | } |
| 62 | |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 63 | void FilesystemCopierAction::PerformAction() { |
Andrew de los Reyes | c702078 | 2010-04-28 10:46:04 -0700 | [diff] [blame] | 64 | // Will tell the ActionProcessor we've failed if we return. |
| 65 | ScopedActionCompleter abort_action_completer(processor_, this); |
| 66 | |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 67 | if (!HasInputObject()) { |
Andrew de los Reyes | c702078 | 2010-04-28 10:46:04 -0700 | [diff] [blame] | 68 | LOG(ERROR) << "FilesystemCopierAction missing input object."; |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 69 | return; |
| 70 | } |
| 71 | install_plan_ = GetInputObject(); |
| 72 | |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 73 | // Note that we do need to run hash verification for new-style full updates |
| 74 | // but currently the |is_full_update| field is set to true only for old-style |
| 75 | // full updates and we don't have any expected partition info in that case. |
| 76 | if (install_plan_.is_full_update || |
| 77 | (!verify_hash_ && install_plan_.is_resume)) { |
| 78 | // No copy or hash verification needed. Done! |
Andrew de los Reyes | f98bff8 | 2010-05-06 13:33:25 -0700 | [diff] [blame] | 79 | if (HasOutputPipe()) |
| 80 | SetOutputObject(install_plan_); |
Darin Petkov | c1a8b42 | 2010-07-19 11:34:49 -0700 | [diff] [blame] | 81 | abort_action_completer.set_code(kActionCodeSuccess); |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 82 | return; |
| 83 | } |
| 84 | |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 85 | const string destination = copying_kernel_install_path_ ? |
| 86 | install_plan_.kernel_install_path : |
| 87 | install_plan_.install_path; |
| 88 | string source = verify_hash_ ? destination : copy_source_; |
Andrew de los Reyes | f918517 | 2010-05-03 11:07:05 -0700 | [diff] [blame] | 89 | if (source.empty()) { |
| 90 | source = copying_kernel_install_path_ ? |
| 91 | utils::BootKernelDevice(utils::BootDevice()) : |
| 92 | utils::BootDevice(); |
| 93 | } |
Andrew de los Reyes | c702078 | 2010-04-28 10:46:04 -0700 | [diff] [blame] | 94 | int src_fd = open(source.c_str(), O_RDONLY); |
| 95 | if (src_fd < 0) { |
| 96 | PLOG(ERROR) << "Unable to open " << source << " for reading:"; |
| 97 | return; |
| 98 | } |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 99 | |
| 100 | if (!verify_hash_) { |
| 101 | int dst_fd = open(destination.c_str(), |
| 102 | O_WRONLY | O_TRUNC | O_CREAT, |
Andrew de los Reyes | c702078 | 2010-04-28 10:46:04 -0700 | [diff] [blame] | 103 | 0644); |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 104 | if (dst_fd < 0) { |
| 105 | close(src_fd); |
| 106 | PLOG(ERROR) << "Unable to open " << install_plan_.install_path |
| 107 | << " for writing:"; |
| 108 | return; |
| 109 | } |
| 110 | |
| 111 | dst_stream_ = g_unix_output_stream_new(dst_fd, TRUE); |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 112 | } |
| 113 | |
Darin Petkov | 698d041 | 2010-10-13 10:59:44 -0700 | [diff] [blame] | 114 | DetermineFilesystemSize(src_fd); |
Andrew de los Reyes | c702078 | 2010-04-28 10:46:04 -0700 | [diff] [blame] | 115 | src_stream_ = g_unix_input_stream_new(src_fd, TRUE); |
Andrew de los Reyes | c702078 | 2010-04-28 10:46:04 -0700 | [diff] [blame] | 116 | |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 117 | for (int i = 0; i < 2; i++) { |
| 118 | buffer_[i].resize(kCopyFileBufferSize); |
| 119 | canceller_[i] = g_cancellable_new(); |
| 120 | } |
Andrew de los Reyes | c702078 | 2010-04-28 10:46:04 -0700 | [diff] [blame] | 121 | |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 122 | // Start the first read. |
| 123 | SpawnAsyncActions(); |
Andrew de los Reyes | c702078 | 2010-04-28 10:46:04 -0700 | [diff] [blame] | 124 | |
| 125 | abort_action_completer.set_should_complete(false); |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | void FilesystemCopierAction::TerminateProcessing() { |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 129 | for (int i = 0; i < 2; i++) { |
| 130 | if (canceller_[i]) { |
| 131 | g_cancellable_cancel(canceller_[i]); |
| 132 | } |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 133 | } |
| 134 | } |
| 135 | |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 136 | void FilesystemCopierAction::Cleanup(ActionExitCode code) { |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 137 | for (int i = 0; i < 2; i++) { |
| 138 | g_object_unref(canceller_[i]); |
| 139 | canceller_[i] = NULL; |
| 140 | } |
Andrew de los Reyes | c702078 | 2010-04-28 10:46:04 -0700 | [diff] [blame] | 141 | g_object_unref(src_stream_); |
| 142 | src_stream_ = NULL; |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 143 | if (dst_stream_) { |
| 144 | g_object_unref(dst_stream_); |
| 145 | dst_stream_ = NULL; |
| 146 | } |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 147 | if (cancelled_) |
Andrew de los Reyes | c702078 | 2010-04-28 10:46:04 -0700 | [diff] [blame] | 148 | return; |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 149 | if (code == kActionCodeSuccess && HasOutputPipe()) |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 150 | SetOutputObject(install_plan_); |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 151 | processor_->ActionComplete(this, code); |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 152 | } |
| 153 | |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 154 | void FilesystemCopierAction::AsyncReadReadyCallback(GObject *source_object, |
| 155 | GAsyncResult *res) { |
| 156 | int index = buffer_state_[0] == kBufferStateReading ? 0 : 1; |
| 157 | CHECK(buffer_state_[index] == kBufferStateReading); |
| 158 | |
Andrew de los Reyes | c702078 | 2010-04-28 10:46:04 -0700 | [diff] [blame] | 159 | GError* error = NULL; |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 160 | CHECK(canceller_[index]); |
| 161 | cancelled_ = g_cancellable_is_cancelled(canceller_[index]) == TRUE; |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 162 | |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 163 | ssize_t bytes_read = g_input_stream_read_finish(src_stream_, res, &error); |
| 164 | if (bytes_read < 0) { |
| 165 | LOG(ERROR) << "Read failed: " << utils::GetGErrorMessage(error); |
| 166 | failed_ = true; |
| 167 | buffer_state_[index] = kBufferStateEmpty; |
| 168 | } else if (bytes_read == 0) { |
| 169 | read_done_ = true; |
| 170 | buffer_state_[index] = kBufferStateEmpty; |
| 171 | } else { |
| 172 | buffer_valid_size_[index] = bytes_read; |
| 173 | buffer_state_[index] = kBufferStateFull; |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 174 | filesystem_size_ -= bytes_read; |
| 175 | } |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 176 | SpawnAsyncActions(); |
| 177 | |
| 178 | if (bytes_read > 0) { |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 179 | // If read_done_ is set, SpawnAsyncActions may finalize the hash so the hash |
| 180 | // update below would happen too late. |
| 181 | CHECK(!read_done_); |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 182 | if (!hasher_.Update(buffer_[index].data(), bytes_read)) { |
| 183 | LOG(ERROR) << "Unable to update the hash."; |
| 184 | failed_ = true; |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 185 | } |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 186 | if (verify_hash_) { |
| 187 | buffer_state_[index] = kBufferStateEmpty; |
| 188 | } |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 189 | } |
| 190 | } |
Andrew de los Reyes | c702078 | 2010-04-28 10:46:04 -0700 | [diff] [blame] | 191 | |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 192 | void FilesystemCopierAction::StaticAsyncReadReadyCallback( |
| 193 | GObject *source_object, |
| 194 | GAsyncResult *res, |
| 195 | gpointer user_data) { |
| 196 | reinterpret_cast<FilesystemCopierAction*>(user_data)-> |
| 197 | AsyncReadReadyCallback(source_object, res); |
| 198 | } |
| 199 | |
| 200 | void FilesystemCopierAction::AsyncWriteReadyCallback(GObject *source_object, |
| 201 | GAsyncResult *res) { |
| 202 | int index = buffer_state_[0] == kBufferStateWriting ? 0 : 1; |
| 203 | CHECK(buffer_state_[index] == kBufferStateWriting); |
| 204 | buffer_state_[index] = kBufferStateEmpty; |
| 205 | |
| 206 | GError* error = NULL; |
| 207 | CHECK(canceller_[index]); |
| 208 | cancelled_ = g_cancellable_is_cancelled(canceller_[index]) == TRUE; |
| 209 | |
| 210 | ssize_t bytes_written = g_output_stream_write_finish(dst_stream_, |
| 211 | res, |
| 212 | &error); |
| 213 | if (bytes_written < static_cast<ssize_t>(buffer_valid_size_[index])) { |
| 214 | if (bytes_written < 0) { |
| 215 | LOG(ERROR) << "Write failed: " << utils::GetGErrorMessage(error); |
| 216 | } else { |
| 217 | LOG(ERROR) << "Write was short: wrote " << bytes_written |
| 218 | << " but expected to write " << buffer_valid_size_[index]; |
| 219 | } |
| 220 | failed_ = true; |
| 221 | } |
| 222 | |
| 223 | SpawnAsyncActions(); |
| 224 | } |
| 225 | |
| 226 | void FilesystemCopierAction::StaticAsyncWriteReadyCallback( |
| 227 | GObject *source_object, |
| 228 | GAsyncResult *res, |
| 229 | gpointer user_data) { |
| 230 | reinterpret_cast<FilesystemCopierAction*>(user_data)-> |
| 231 | AsyncWriteReadyCallback(source_object, res); |
| 232 | } |
| 233 | |
| 234 | void FilesystemCopierAction::SpawnAsyncActions() { |
| 235 | bool reading = false; |
| 236 | bool writing = false; |
| 237 | for (int i = 0; i < 2; i++) { |
| 238 | if (buffer_state_[i] == kBufferStateReading) { |
| 239 | reading = true; |
| 240 | } |
| 241 | if (buffer_state_[i] == kBufferStateWriting) { |
| 242 | writing = true; |
| 243 | } |
| 244 | } |
| 245 | if (failed_ || cancelled_) { |
| 246 | if (!reading && !writing) { |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 247 | Cleanup(kActionCodeError); |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 248 | } |
| 249 | return; |
| 250 | } |
| 251 | for (int i = 0; i < 2; i++) { |
| 252 | if (!reading && !read_done_ && buffer_state_[i] == kBufferStateEmpty) { |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 253 | int64_t bytes_to_read = std::min(static_cast<int64_t>(buffer_[0].size()), |
| 254 | filesystem_size_); |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 255 | g_input_stream_read_async( |
| 256 | src_stream_, |
| 257 | buffer_[i].data(), |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 258 | bytes_to_read, |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 259 | G_PRIORITY_DEFAULT, |
| 260 | canceller_[i], |
| 261 | &FilesystemCopierAction::StaticAsyncReadReadyCallback, |
| 262 | this); |
| 263 | reading = true; |
| 264 | buffer_state_[i] = kBufferStateReading; |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 265 | } else if (!writing && !verify_hash_ && |
| 266 | buffer_state_[i] == kBufferStateFull) { |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 267 | g_output_stream_write_async( |
| 268 | dst_stream_, |
| 269 | buffer_[i].data(), |
| 270 | buffer_valid_size_[i], |
| 271 | G_PRIORITY_DEFAULT, |
| 272 | canceller_[i], |
| 273 | &FilesystemCopierAction::StaticAsyncWriteReadyCallback, |
| 274 | this); |
| 275 | writing = true; |
| 276 | buffer_state_[i] = kBufferStateWriting; |
| 277 | } |
| 278 | } |
| 279 | if (!reading && !writing) { |
| 280 | // We're done! |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 281 | ActionExitCode code = kActionCodeSuccess; |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 282 | if (hasher_.Finalize()) { |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 283 | LOG(INFO) << "Hash: " << hasher_.hash(); |
| 284 | if (verify_hash_) { |
| 285 | if (copying_kernel_install_path_) { |
| 286 | if (install_plan_.kernel_hash != hasher_.raw_hash()) { |
| 287 | code = kActionCodeNewKernelVerificationError; |
| 288 | LOG(ERROR) << "New kernel verification failed."; |
| 289 | } |
| 290 | } else { |
| 291 | if (install_plan_.rootfs_hash != hasher_.raw_hash()) { |
| 292 | code = kActionCodeNewRootfsVerificationError; |
| 293 | LOG(ERROR) << "New rootfs verification failed."; |
| 294 | } |
| 295 | } |
Darin Petkov | 698d041 | 2010-10-13 10:59:44 -0700 | [diff] [blame] | 296 | } else { |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 297 | if (copying_kernel_install_path_) { |
| 298 | install_plan_.kernel_hash = hasher_.raw_hash(); |
| 299 | } else { |
| 300 | install_plan_.rootfs_hash = hasher_.raw_hash(); |
| 301 | } |
Darin Petkov | 698d041 | 2010-10-13 10:59:44 -0700 | [diff] [blame] | 302 | } |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 303 | } else { |
Darin Petkov | c2e4a7d | 2010-12-02 14:47:06 -0800 | [diff] [blame] | 304 | LOG(ERROR) << "Unable to finalize the hash."; |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 305 | code = kActionCodeError; |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 306 | } |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 307 | Cleanup(code); |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 308 | } |
Andrew de los Reyes | c702078 | 2010-04-28 10:46:04 -0700 | [diff] [blame] | 309 | } |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 310 | |
Darin Petkov | 698d041 | 2010-10-13 10:59:44 -0700 | [diff] [blame] | 311 | void FilesystemCopierAction::DetermineFilesystemSize(int fd) { |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame^] | 312 | if (verify_hash_) { |
| 313 | filesystem_size_ = copying_kernel_install_path_ ? |
| 314 | install_plan_.kernel_size : install_plan_.rootfs_size; |
| 315 | LOG(INFO) << "Filesystem size: " << filesystem_size_; |
| 316 | return; |
| 317 | } |
Darin Petkov | 698d041 | 2010-10-13 10:59:44 -0700 | [diff] [blame] | 318 | filesystem_size_ = kint64max; |
| 319 | int block_count = 0, block_size = 0; |
| 320 | if (!copying_kernel_install_path_ && |
| 321 | utils::GetFilesystemSizeFromFD(fd, &block_count, &block_size)) { |
| 322 | filesystem_size_ = static_cast<int64_t>(block_count) * block_size; |
| 323 | LOG(INFO) << "Filesystem size: " << filesystem_size_ << " bytes (" |
| 324 | << block_count << "x" << block_size << ")."; |
| 325 | } |
| 326 | } |
| 327 | |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 328 | } // namespace chromeos_update_engine |