blob: d62a0ec6fa04f9070b09251142038b12ef748532 [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
Amin Hassani0f59a9a2019-09-27 10:24:31 -070019#include <base/logging.h>
20
Alex Deymo161c4a12014-05-16 15:56:21 -070021namespace chromeos_update_engine {
22
Amin Hassani822d4852020-03-10 01:50:42 +000023// const uint64_t kChromeOSMajorPayloadVersion = 1; DEPRECATED
Alex Deymocbf09892015-09-11 16:13:16 -070024const uint64_t kBrilloMajorPayloadVersion = 2;
25
Amin Hassani55c75412019-10-07 11:20:39 -070026const uint64_t kMinSupportedMajorPayloadVersion = kBrilloMajorPayloadVersion;
27const uint64_t kMaxSupportedMajorPayloadVersion = kBrilloMajorPayloadVersion;
Sen Jiangdcaf7972018-05-11 16:03:23 -070028
Alex Deymocbf09892015-09-11 16:13:16 -070029const uint32_t kFullPayloadMinorVersion = 0;
Amin Hassani0f59a9a2019-09-27 10:24:31 -070030// const uint32_t kInPlaceMinorPayloadVersion = 1; DEPRECATED
Alex Deymocbf09892015-09-11 16:13:16 -070031const uint32_t kSourceMinorPayloadVersion = 2;
Sen Jiang82352f92015-11-09 16:36:53 -080032const uint32_t kOpSrcHashMinorPayloadVersion = 3;
Amin Hassani77d7cbc2018-02-07 16:21:33 -080033const uint32_t kBrotliBsdiffMinorPayloadVersion = 4;
34const uint32_t kPuffdiffMinorPayloadVersion = 5;
Sen Jiang3a4dfac2018-08-30 16:57:38 -070035const uint32_t kVerityMinorPayloadVersion = 6;
Tianjief5baff42020-07-17 21:43:22 -070036const uint32_t kPartialUpdateMinorPayloadVersion = 7;
Alex Deymocbf09892015-09-11 16:13:16 -070037
Amin Hassani0f59a9a2019-09-27 10:24:31 -070038const uint32_t kMinSupportedMinorPayloadVersion = kSourceMinorPayloadVersion;
Tianjiec3806662020-07-13 19:28:15 -070039const uint32_t kMaxSupportedMinorPayloadVersion =
40 kPartialUpdateMinorPayloadVersion;
Sen Jiangdcaf7972018-05-11 16:03:23 -070041
Sen Jiangb5f601d2018-02-02 13:51:21 -080042const uint64_t kMaxPayloadHeaderSize = 24;
43
Tudor Brindusdda79e22018-06-28 18:03:21 -070044const char kPartitionNameKernel[] = "kernel";
45const char kPartitionNameRoot[] = "root";
Sen Jiang70a6ab02015-08-28 13:23:27 -070046
Sen Jiangb8060e42015-09-24 17:30:50 -070047const char kDeltaMagic[4] = {'C', 'r', 'A', 'U'};
Alex Deymo161c4a12014-05-16 15:56:21 -070048
Sen Jiangcebb6882019-02-26 16:23:28 +080049const char* InstallOperationTypeName(InstallOperation::Type op_type) {
Alex Deymo2d621a32015-10-01 11:09:01 -070050 switch (op_type) {
Alex Deymo2d621a32015-10-01 11:09:01 -070051 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";
Amin Hassani5ef5d452017-08-04 13:10:59 -070065 case InstallOperation::PUFFDIFF:
66 return "PUFFDIFF";
Amin Hassaniefa62d92017-11-09 13:46:56 -080067 case InstallOperation::BROTLI_BSDIFF:
68 return "BROTLI_BSDIFF";
Amin Hassani0f59a9a2019-09-27 10:24:31 -070069
70 case InstallOperation::BSDIFF:
71 case InstallOperation::MOVE:
72 NOTREACHED();
Alex Deymo2d621a32015-10-01 11:09:01 -070073 }
74 return "<unknown_op>";
75}
76
Alex Deymo161c4a12014-05-16 15:56:21 -070077}; // namespace chromeos_update_engine