Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Side by Side Diff: filesystem_copier_action.cc

Issue 3620013: AU: Resume interrupted update attempts. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: fix setup download Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « download_action.h ('k') | filesystem_copier_action_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium 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 "update_engine/filesystem_copier_action.h" 5 #include "update_engine/filesystem_copier_action.h"
6
6 #include <sys/stat.h> 7 #include <sys/stat.h>
7 #include <sys/types.h> 8 #include <sys/types.h>
8 #include <errno.h> 9 #include <errno.h>
9 #include <fcntl.h> 10 #include <fcntl.h>
10 #include <stdlib.h> 11
11 #include <algorithm> 12 #include <algorithm>
13 #include <cstdlib>
12 #include <map> 14 #include <map>
13 #include <string> 15 #include <string>
14 #include <vector> 16 #include <vector>
17
15 #include <gio/gio.h> 18 #include <gio/gio.h>
16 #include <gio/gunixinputstream.h> 19 #include <gio/gunixinputstream.h>
17 #include <gio/gunixoutputstream.h> 20 #include <gio/gunixoutputstream.h>
18 #include <glib.h> 21 #include <glib.h>
22
19 #include "update_engine/filesystem_iterator.h" 23 #include "update_engine/filesystem_iterator.h"
20 #include "update_engine/subprocess.h" 24 #include "update_engine/subprocess.h"
21 #include "update_engine/utils.h" 25 #include "update_engine/utils.h"
22 26
23 using std::map; 27 using std::map;
24 using std::min; 28 using std::min;
25 using std::string; 29 using std::string;
26 using std::vector; 30 using std::vector;
27 31
28 namespace chromeos_update_engine { 32 namespace chromeos_update_engine {
29 33
30 namespace { 34 namespace {
31 const off_t kCopyFileBufferSize = 2 * 1024 * 1024; 35 const off_t kCopyFileBufferSize = 2 * 1024 * 1024;
32 } // namespace {} 36 } // namespace {}
33 37
34 void FilesystemCopierAction::PerformAction() { 38 void FilesystemCopierAction::PerformAction() {
35 // Will tell the ActionProcessor we've failed if we return. 39 // Will tell the ActionProcessor we've failed if we return.
36 ScopedActionCompleter abort_action_completer(processor_, this); 40 ScopedActionCompleter abort_action_completer(processor_, this);
37 41
38 if (!HasInputObject()) { 42 if (!HasInputObject()) {
39 LOG(ERROR) << "FilesystemCopierAction missing input object."; 43 LOG(ERROR) << "FilesystemCopierAction missing input object.";
40 return; 44 return;
41 } 45 }
42 install_plan_ = GetInputObject(); 46 install_plan_ = GetInputObject();
43 47
44 if (install_plan_.is_full_update) { 48 if (install_plan_.is_full_update || install_plan_.is_resume) {
45 // No copy needed. Done! 49 // No copy needed. Done!
46 if (HasOutputPipe()) 50 if (HasOutputPipe())
47 SetOutputObject(install_plan_); 51 SetOutputObject(install_plan_);
48 abort_action_completer.set_code(kActionCodeSuccess); 52 abort_action_completer.set_code(kActionCodeSuccess);
49 return; 53 return;
50 } 54 }
51 55
52 string source = copy_source_; 56 string source = copy_source_;
53 if (source.empty()) { 57 if (source.empty()) {
54 source = copying_kernel_install_path_ ? 58 source = copying_kernel_install_path_ ?
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 src_stream_, 176 src_stream_,
173 &buffer_[0], 177 &buffer_[0],
174 buffer_.size(), 178 buffer_.size(),
175 G_PRIORITY_DEFAULT, 179 G_PRIORITY_DEFAULT,
176 canceller_, 180 canceller_,
177 &FilesystemCopierAction::StaticAsyncReadyCallback, 181 &FilesystemCopierAction::StaticAsyncReadyCallback,
178 this); 182 this);
179 } 183 }
180 184
181 } // namespace chromeos_update_engine 185 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « download_action.h ('k') | filesystem_copier_action_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698