OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_FILESYSTEM_COPIER_ACTION_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_FILESYSTEM_COPIER_ACTION_H__ |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_FILESYSTEM_COPIER_ACTION_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_FILESYSTEM_COPIER_ACTION_H__ |
7 | 7 |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include <string> | 10 #include <string> |
(...skipping 14 matching lines...) Expand all Loading... |
25 class ActionTraits<FilesystemCopierAction> { | 25 class ActionTraits<FilesystemCopierAction> { |
26 public: | 26 public: |
27 // Takes the install plan as input | 27 // Takes the install plan as input |
28 typedef InstallPlan InputObjectType; | 28 typedef InstallPlan InputObjectType; |
29 // Passes the install plan as output | 29 // Passes the install plan as output |
30 typedef InstallPlan OutputObjectType; | 30 typedef InstallPlan OutputObjectType; |
31 }; | 31 }; |
32 | 32 |
33 class FilesystemCopierAction : public Action<FilesystemCopierAction> { | 33 class FilesystemCopierAction : public Action<FilesystemCopierAction> { |
34 public: | 34 public: |
35 FilesystemCopierAction() | 35 explicit FilesystemCopierAction(bool copying_kernel_install_path) |
36 : src_stream_(NULL), | 36 : copying_kernel_install_path_(copying_kernel_install_path), |
| 37 src_stream_(NULL), |
37 dst_stream_(NULL), | 38 dst_stream_(NULL), |
38 canceller_(NULL), | 39 canceller_(NULL), |
39 read_in_flight_(false), | 40 read_in_flight_(false), |
40 buffer_valid_size_(0) {} | 41 buffer_valid_size_(0) {} |
41 typedef ActionTraits<FilesystemCopierAction>::InputObjectType | 42 typedef ActionTraits<FilesystemCopierAction>::InputObjectType |
42 InputObjectType; | 43 InputObjectType; |
43 typedef ActionTraits<FilesystemCopierAction>::OutputObjectType | 44 typedef ActionTraits<FilesystemCopierAction>::OutputObjectType |
44 OutputObjectType; | 45 OutputObjectType; |
45 void PerformAction(); | 46 void PerformAction(); |
46 void TerminateProcessing(); | 47 void TerminateProcessing(); |
(...skipping 15 matching lines...) Expand all Loading... |
62 gpointer user_data) { | 63 gpointer user_data) { |
63 reinterpret_cast<FilesystemCopierAction*>(user_data)->AsyncReadyCallback( | 64 reinterpret_cast<FilesystemCopierAction*>(user_data)->AsyncReadyCallback( |
64 source_object, res); | 65 source_object, res); |
65 } | 66 } |
66 | 67 |
67 // Cleans up all the variables we use for async operations and tells | 68 // Cleans up all the variables we use for async operations and tells |
68 // the ActionProcessor we're done w/ success as passed in. | 69 // the ActionProcessor we're done w/ success as passed in. |
69 // was_cancelled should be true if TerminateProcessing() was called. | 70 // was_cancelled should be true if TerminateProcessing() was called. |
70 void Cleanup(bool success, bool was_cancelled); | 71 void Cleanup(bool success, bool was_cancelled); |
71 | 72 |
| 73 // If true, this action is copying to the kernel_install_path from |
| 74 // the install plan, otherwise it's copying just to the install_path. |
| 75 const bool copying_kernel_install_path_; |
| 76 |
72 // The path to copy from. If empty (the default), the source is from the | 77 // The path to copy from. If empty (the default), the source is from the |
73 // passed in InstallPlan. | 78 // passed in InstallPlan. |
74 std::string copy_source_; | 79 std::string copy_source_; |
75 | 80 |
76 // If non-NULL, these are GUnixInputStream objects for the opened | 81 // If non-NULL, these are GUnixInputStream objects for the opened |
77 // source/destination partitions. | 82 // source/destination partitions. |
78 GInputStream* src_stream_; | 83 GInputStream* src_stream_; |
79 GOutputStream* dst_stream_; | 84 GOutputStream* dst_stream_; |
80 | 85 |
81 // If non-NULL, the cancellable object for the in-flight async call. | 86 // If non-NULL, the cancellable object for the in-flight async call. |
(...skipping 11 matching lines...) Expand all Loading... |
93 | 98 |
94 // The install plan we're passed in via the input pipe. | 99 // The install plan we're passed in via the input pipe. |
95 InstallPlan install_plan_; | 100 InstallPlan install_plan_; |
96 | 101 |
97 DISALLOW_COPY_AND_ASSIGN(FilesystemCopierAction); | 102 DISALLOW_COPY_AND_ASSIGN(FilesystemCopierAction); |
98 }; | 103 }; |
99 | 104 |
100 } // namespace chromeos_update_engine | 105 } // namespace chromeos_update_engine |
101 | 106 |
102 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_FILESYSTEM_COPIER_ACTION_H__ | 107 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_FILESYSTEM_COPIER_ACTION_H__ |
OLD | NEW |