summaryrefslogtreecommitdiff
path: root/payload_generator/graph_utils.cc
diff options
context:
space:
mode:
authorAlex Deymo <deymo@chromium.org>2015-06-03 19:06:50 +0200
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-04 10:43:16 +0000
commit5c6c65570013bbdbd67f9bf6391dd295ef5b5ee6 (patch)
treec2655ce831e0428ff87d3c065a9702b9b3564b82 /payload_generator/graph_utils.cc
parentcef5cd6acf26b518523511f6d633a730baef4d7e (diff)
update_engine: Split Extent utils from graph_utils.
"Graph" related utils should only concern parts of the code using the inplace generator, since other generators don't use a dependency graph. This patch splits the Extent related utils from the graph related ones creating a new extent_utils.h file. BUG=None TEST=unittest still pass. Change-Id: I0941698b0a47a6cc222e8dc062fc54eb3cdf4de2 Reviewed-on: https://chromium-review.googlesource.com/274899 Reviewed-by: Gilad Arnold <garnold@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org>
Diffstat (limited to 'payload_generator/graph_utils.cc')
-rw-r--r--payload_generator/graph_utils.cc34
1 files changed, 1 insertions, 33 deletions
diff --git a/payload_generator/graph_utils.cc b/payload_generator/graph_utils.cc
index 3f9b28ff..7b03236d 100644
--- a/payload_generator/graph_utils.cc
+++ b/payload_generator/graph_utils.cc
@@ -13,6 +13,7 @@
#include "update_engine/payload_constants.h"
#include "update_engine/payload_generator/annotated_operation.h"
+#include "update_engine/payload_generator/extent_utils.h"
using std::make_pair;
using std::pair;
@@ -20,7 +21,6 @@ using std::string;
using std::vector;
namespace chromeos_update_engine {
-
namespace graph_utils {
uint64_t EdgeWeight(const Graph& graph, const Edge& edge) {
@@ -35,24 +35,6 @@ uint64_t EdgeWeight(const Graph& graph, const Edge& edge) {
return weight;
}
-void AppendBlockToExtents(vector<Extent>* extents, uint64_t block) {
- // First try to extend the last extent in |extents|, if any.
- if (!extents->empty()) {
- Extent& extent = extents->back();
- uint64_t next_block = extent.start_block() == kSparseHole ?
- kSparseHole : extent.start_block() + extent.num_blocks();
- if (next_block == block) {
- extent.set_num_blocks(extent.num_blocks() + 1);
- return;
- }
- }
- // If unable to extend the last extent, append a new single-block extent.
- Extent new_extent;
- new_extent.set_start_block(block);
- new_extent.set_num_blocks(1);
- extents->push_back(new_extent);
-}
-
void AddReadBeforeDep(Vertex* src,
Vertex::Index dst,
uint64_t block) {
@@ -106,15 +88,6 @@ void DropIncomingEdgesTo(Graph* graph, Vertex::Index index) {
}
}
-Extent GetElement(const vector<Extent>& collection, size_t index) {
- return collection[index];
-}
-Extent GetElement(
- const google::protobuf::RepeatedPtrField<Extent>& collection,
- size_t index) {
- return collection.Get(index);
-}
-
namespace {
template<typename T>
void DumpExtents(const T& field, int prepend_space_count) {
@@ -154,9 +127,4 @@ void DumpGraph(const Graph& graph) {
}
} // namespace graph_utils
-
-bool operator==(const Extent& a, const Extent& b) {
- return a.start_block() == b.start_block() && a.num_blocks() == b.num_blocks();
-}
-
} // namespace chromeos_update_engine