1//
2// Copyright (C) 2014 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17#include "update_engine/payload_consumer/payload_constants.h"
18
19namespace chromeos_update_engine {
20
21const uint64_t kChromeOSMajorPayloadVersion = 1;
22const uint64_t kBrilloMajorPayloadVersion = 2;
23
24const uint32_t kFullPayloadMinorVersion = 0;
25const uint32_t kInPlaceMinorPayloadVersion = 1;
26const uint32_t kSourceMinorPayloadVersion = 2;
27const uint32_t kOpSrcHashMinorPayloadVersion = 3;
28const uint32_t kImgdiffMinorPayloadVersion = 4;
29
30const char kLegacyPartitionNameKernel[] = "boot";
31const char kLegacyPartitionNameRoot[] = "system";
32
33const char kDeltaMagic[4] = {'C', 'r', 'A', 'U'};
34const char kBspatchPath[] = "bspatch";
35
36// The zlib in Android and Chrome OS are currently compatible with each other,
37// so they are sharing the same array, but if in the future they are no longer
38// compatible with each other, we coule make the same change on the other one to
39// make them compatible again or use ifdef here.
40const char kCompatibleZlibFingerprint[][65] = {
41    "ea973605ccbbdb24f59f449c5f65861a1a9bc7a4353377aaaa06cb3e0f1cfbd7",
42    "3747fa404cceb00a5ec3606fc779510aaa784d5864ab1d5c28b9e267c40aad5c",
43};
44
45const char* InstallOperationTypeName(InstallOperation_Type op_type) {
46  switch (op_type) {
47    case InstallOperation::BSDIFF:
48      return "BSDIFF";
49    case InstallOperation::MOVE:
50      return "MOVE";
51    case InstallOperation::REPLACE:
52      return "REPLACE";
53    case InstallOperation::REPLACE_BZ:
54      return "REPLACE_BZ";
55    case InstallOperation::SOURCE_COPY:
56      return "SOURCE_COPY";
57    case InstallOperation::SOURCE_BSDIFF:
58      return "SOURCE_BSDIFF";
59    case InstallOperation::ZERO:
60      return "ZERO";
61    case InstallOperation::DISCARD:
62      return "DISCARD";
63    case InstallOperation::REPLACE_XZ:
64      return "REPLACE_XZ";
65    case InstallOperation::IMGDIFF:
66      return "IMGDIFF";
67  }
68  return "<unknown_op>";
69}
70
71};  // namespace chromeos_update_engine
72