blob: 452e303f56b54039b9ac6aa16bd019a9407f9c76 [file] [log] [blame]
Thieu Le5c7d9752010-12-15 16:09:28 -08001// 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
3// found in the LICENSE file.
4
Alex Deymo161c4a12014-05-16 15:56:21 -07005#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_METADATA_H_
6#define CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_METADATA_H_
Thieu Le5c7d9752010-12-15 16:09:28 -08007
Alex Deymo161c4a12014-05-16 15:56:21 -07008#include "update_engine/payload_generator/delta_diff_generator.h"
9#include "update_engine/payload_generator/graph_types.h"
Thieu Le5c7d9752010-12-15 16:09:28 -080010
11namespace chromeos_update_engine {
12
13class Metadata {
14 public:
15 // Reads metadata from old image and new image and determines
16 // the smallest way to encode the metadata for the diff.
17 // If there's no change in the metadata, it creates a MOVE
18 // operation. If there is a change, the smallest of REPLACE, REPLACE_BZ,
19 // or BSDIFF wins. It writes the diff to data_fd and updates data_file_size
20 // accordingly. It also adds the required operation to the graph and adds the
21 // metadata extents to blocks.
22 // Returns true on success.
23 static bool DeltaReadMetadata(Graph* graph,
24 std::vector<DeltaDiffGenerator::Block>* blocks,
25 const std::string& old_image,
26 const std::string& new_image,
27 int data_fd,
28 off_t* data_file_size);
29
30 private:
31 // This should never be constructed.
32 DISALLOW_IMPLICIT_CONSTRUCTORS(Metadata);
33};
34
35}; // namespace chromeos_update_engine
36
Alex Deymo161c4a12014-05-16 15:56:21 -070037#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_GENERATOR_METADATA_H_