delta_diff_generator.h revision 14158570d3995008dc93a628004118b87a6bca01
1// Copyright (c) 2012 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
5#ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_DELTA_DIFF_GENERATOR_H_
6#define UPDATE_ENGINE_PAYLOAD_GENERATOR_DELTA_DIFF_GENERATOR_H_
7
8#include <string>
9
10#include "update_engine/payload_generator/payload_generation_config.h"
11
12// There is one function in DeltaDiffGenerator of importance to users
13// of the class: GenerateDeltaUpdateFile(). Before calling it,
14// the old and new images must be mounted. Call GenerateDeltaUpdateFile()
15// with both the mount-points of the images in addition to the paths of
16// the images (both old and new). A delta from old to new will be
17// generated and stored in output_path.
18
19namespace chromeos_update_engine {
20
21extern const size_t kBlockSize;
22extern const size_t kRootFSPartitionSize;
23
24// The |config| describes the payload generation request, describing both
25// old and new images for delta payloads and only the new image for full
26// payloads.
27// For delta payloads, the images should be already mounted read-only at
28// the respective rootfs_mountpt.
29// |private_key_path| points to a private key used to sign the update.
30// Pass empty string to not sign the update.
31// |output_path| is the filename where the delta update should be written.
32// Returns true on success. Also writes the size of the metadata into
33// |metadata_size|.
34bool GenerateUpdatePayloadFile(const PayloadGenerationConfig& config,
35                               const std::string& output_path,
36                               const std::string& private_key_path,
37                               uint64_t* metadata_size);
38
39
40};  // namespace chromeos_update_engine
41
42#endif  // UPDATE_ENGINE_PAYLOAD_GENERATOR_DELTA_DIFF_GENERATOR_H_
43