blob: 6e7cd00d1e29be36cb89590d05a276c84dd92737 [file] [log] [blame]
Alex Deymoaea4c1c2015-08-19 20:24:43 -07001//
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//
Alex Deymo161c4a12014-05-16 15:56:21 -070016
Alex Deymo39910dc2015-11-09 17:04:30 -080017#include "update_engine/payload_consumer/payload_constants.h"
Alex Deymo161c4a12014-05-16 15:56:21 -070018
19namespace chromeos_update_engine {
20
Alex Deymocbf09892015-09-11 16:13:16 -070021const uint64_t kChromeOSMajorPayloadVersion = 1;
22const uint64_t kBrilloMajorPayloadVersion = 2;
23
Sen Jiangdcaf7972018-05-11 16:03:23 -070024const uint32_t kMinSupportedMinorPayloadVersion = 1;
25const uint32_t kMaxSupportedMinorPayloadVersion = 5;
26
Alex Deymocbf09892015-09-11 16:13:16 -070027const uint32_t kFullPayloadMinorVersion = 0;
28const uint32_t kInPlaceMinorPayloadVersion = 1;
29const uint32_t kSourceMinorPayloadVersion = 2;
Sen Jiang82352f92015-11-09 16:36:53 -080030const uint32_t kOpSrcHashMinorPayloadVersion = 3;
Amin Hassani77d7cbc2018-02-07 16:21:33 -080031const uint32_t kBrotliBsdiffMinorPayloadVersion = 4;
32const uint32_t kPuffdiffMinorPayloadVersion = 5;
Alex Deymocbf09892015-09-11 16:13:16 -070033
Sen Jiangdcaf7972018-05-11 16:03:23 -070034const uint64_t kMinSupportedMajorPayloadVersion = 1;
35const uint64_t kMaxSupportedMajorPayloadVersion = 2;
36
Sen Jiangb5f601d2018-02-02 13:51:21 -080037const uint64_t kMaxPayloadHeaderSize = 24;
38
Tudor Brindusdda79e22018-06-28 18:03:21 -070039const char kPartitionNameKernel[] = "kernel";
40const char kPartitionNameRoot[] = "root";
Sen Jiang70a6ab02015-08-28 13:23:27 -070041
Sen Jiangb8060e42015-09-24 17:30:50 -070042const char kDeltaMagic[4] = {'C', 'r', 'A', 'U'};
Alex Deymo161c4a12014-05-16 15:56:21 -070043
Alex Deymo2d621a32015-10-01 11:09:01 -070044const char* InstallOperationTypeName(InstallOperation_Type op_type) {
45 switch (op_type) {
46 case InstallOperation::BSDIFF:
47 return "BSDIFF";
48 case InstallOperation::MOVE:
49 return "MOVE";
50 case InstallOperation::REPLACE:
51 return "REPLACE";
52 case InstallOperation::REPLACE_BZ:
53 return "REPLACE_BZ";
54 case InstallOperation::SOURCE_COPY:
55 return "SOURCE_COPY";
56 case InstallOperation::SOURCE_BSDIFF:
57 return "SOURCE_BSDIFF";
58 case InstallOperation::ZERO:
59 return "ZERO";
60 case InstallOperation::DISCARD:
61 return "DISCARD";
62 case InstallOperation::REPLACE_XZ:
63 return "REPLACE_XZ";
Amin Hassani5ef5d452017-08-04 13:10:59 -070064 case InstallOperation::PUFFDIFF:
65 return "PUFFDIFF";
Amin Hassaniefa62d92017-11-09 13:46:56 -080066 case InstallOperation::BROTLI_BSDIFF:
67 return "BROTLI_BSDIFF";
Alex Deymo2d621a32015-10-01 11:09:01 -070068 }
69 return "<unknown_op>";
70}
71
Alex Deymo161c4a12014-05-16 15:56:21 -070072}; // namespace chromeos_update_engine