blob: 908a89339b81d992f257ad41922cce3f5c4c286a [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;
28
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;
Alex Deymocbf09892015-09-11 16:13:16 -070036
Amin Hassani0f59a9a2019-09-27 10:24:31 -070037const uint32_t kMinSupportedMinorPayloadVersion = kSourceMinorPayloadVersion;
38const uint32_t kMaxSupportedMinorPayloadVersion = kVerityMinorPayloadVersion;
39
Sen Jiangb5f601d2018-02-02 13:51:21 -080040const uint64_t kMaxPayloadHeaderSize = 24;
41
Tudor Brindusdda79e22018-06-28 18:03:21 -070042const char kPartitionNameKernel[] = "kernel";
43const char kPartitionNameRoot[] = "root";
Sen Jiang70a6ab02015-08-28 13:23:27 -070044
Sen Jiangb8060e42015-09-24 17:30:50 -070045const char kDeltaMagic[4] = {'C', 'r', 'A', 'U'};
Alex Deymo161c4a12014-05-16 15:56:21 -070046
Alex Deymo2d621a32015-10-01 11:09:01 -070047const char* InstallOperationTypeName(InstallOperation_Type op_type) {
48 switch (op_type) {
Alex Deymo2d621a32015-10-01 11:09:01 -070049 case InstallOperation::REPLACE:
50 return "REPLACE";
51 case InstallOperation::REPLACE_BZ:
52 return "REPLACE_BZ";
53 case InstallOperation::SOURCE_COPY:
54 return "SOURCE_COPY";
55 case InstallOperation::SOURCE_BSDIFF:
56 return "SOURCE_BSDIFF";
57 case InstallOperation::ZERO:
58 return "ZERO";
59 case InstallOperation::DISCARD:
60 return "DISCARD";
61 case InstallOperation::REPLACE_XZ:
62 return "REPLACE_XZ";
Amin Hassani5ef5d452017-08-04 13:10:59 -070063 case InstallOperation::PUFFDIFF:
64 return "PUFFDIFF";
Amin Hassaniefa62d92017-11-09 13:46:56 -080065 case InstallOperation::BROTLI_BSDIFF:
66 return "BROTLI_BSDIFF";
Amin Hassani0f59a9a2019-09-27 10:24:31 -070067
68 case InstallOperation::BSDIFF:
69 case InstallOperation::MOVE:
70 NOTREACHED();
Alex Deymo2d621a32015-10-01 11:09:01 -070071 }
72 return "<unknown_op>";
73}
74
Alex Deymo161c4a12014-05-16 15:56:21 -070075}; // namespace chromeos_update_engine