Alex Deymo | aea4c1c | 2015-08-19 20:24:43 -0700 | [diff] [blame] | 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 | // |
Alex Deymo | 161c4a1 | 2014-05-16 15:56:21 -0700 | [diff] [blame] | 16 | |
Alex Deymo | 39910dc | 2015-11-09 17:04:30 -0800 | [diff] [blame] | 17 | #include "update_engine/payload_consumer/payload_constants.h" |
Alex Deymo | 161c4a1 | 2014-05-16 15:56:21 -0700 | [diff] [blame] | 18 | |
Amin Hassani | 0f59a9a | 2019-09-27 10:24:31 -0700 | [diff] [blame] | 19 | #include <base/logging.h> |
| 20 | |
Alex Deymo | 161c4a1 | 2014-05-16 15:56:21 -0700 | [diff] [blame] | 21 | namespace chromeos_update_engine { |
| 22 | |
Amin Hassani | 822d485 | 2020-03-10 01:50:42 +0000 | [diff] [blame] | 23 | // const uint64_t kChromeOSMajorPayloadVersion = 1; DEPRECATED |
Alex Deymo | cbf0989 | 2015-09-11 16:13:16 -0700 | [diff] [blame] | 24 | const uint64_t kBrilloMajorPayloadVersion = 2; |
| 25 | |
Amin Hassani | 55c7541 | 2019-10-07 11:20:39 -0700 | [diff] [blame] | 26 | const uint64_t kMinSupportedMajorPayloadVersion = kBrilloMajorPayloadVersion; |
| 27 | const uint64_t kMaxSupportedMajorPayloadVersion = kBrilloMajorPayloadVersion; |
Sen Jiang | dcaf797 | 2018-05-11 16:03:23 -0700 | [diff] [blame] | 28 | |
Alex Deymo | cbf0989 | 2015-09-11 16:13:16 -0700 | [diff] [blame] | 29 | const uint32_t kFullPayloadMinorVersion = 0; |
Amin Hassani | 0f59a9a | 2019-09-27 10:24:31 -0700 | [diff] [blame] | 30 | // const uint32_t kInPlaceMinorPayloadVersion = 1; DEPRECATED |
Alex Deymo | cbf0989 | 2015-09-11 16:13:16 -0700 | [diff] [blame] | 31 | const uint32_t kSourceMinorPayloadVersion = 2; |
Sen Jiang | 82352f9 | 2015-11-09 16:36:53 -0800 | [diff] [blame] | 32 | const uint32_t kOpSrcHashMinorPayloadVersion = 3; |
Amin Hassani | 77d7cbc | 2018-02-07 16:21:33 -0800 | [diff] [blame] | 33 | const uint32_t kBrotliBsdiffMinorPayloadVersion = 4; |
| 34 | const uint32_t kPuffdiffMinorPayloadVersion = 5; |
Sen Jiang | 3a4dfac | 2018-08-30 16:57:38 -0700 | [diff] [blame] | 35 | const uint32_t kVerityMinorPayloadVersion = 6; |
Tianjie | f5baff4 | 2020-07-17 21:43:22 -0700 | [diff] [blame] | 36 | const uint32_t kPartialUpdateMinorPayloadVersion = 7; |
Alex Deymo | cbf0989 | 2015-09-11 16:13:16 -0700 | [diff] [blame] | 37 | |
Amin Hassani | 0f59a9a | 2019-09-27 10:24:31 -0700 | [diff] [blame] | 38 | const uint32_t kMinSupportedMinorPayloadVersion = kSourceMinorPayloadVersion; |
Tianjie | c380666 | 2020-07-13 19:28:15 -0700 | [diff] [blame] | 39 | const uint32_t kMaxSupportedMinorPayloadVersion = |
| 40 | kPartialUpdateMinorPayloadVersion; |
Sen Jiang | dcaf797 | 2018-05-11 16:03:23 -0700 | [diff] [blame] | 41 | |
Sen Jiang | b5f601d | 2018-02-02 13:51:21 -0800 | [diff] [blame] | 42 | const uint64_t kMaxPayloadHeaderSize = 24; |
| 43 | |
Tudor Brindus | dda79e2 | 2018-06-28 18:03:21 -0700 | [diff] [blame] | 44 | const char kPartitionNameKernel[] = "kernel"; |
| 45 | const char kPartitionNameRoot[] = "root"; |
Sen Jiang | 70a6ab0 | 2015-08-28 13:23:27 -0700 | [diff] [blame] | 46 | |
Sen Jiang | b8060e4 | 2015-09-24 17:30:50 -0700 | [diff] [blame] | 47 | const char kDeltaMagic[4] = {'C', 'r', 'A', 'U'}; |
Alex Deymo | 161c4a1 | 2014-05-16 15:56:21 -0700 | [diff] [blame] | 48 | |
Sen Jiang | cebb688 | 2019-02-26 16:23:28 +0800 | [diff] [blame] | 49 | const char* InstallOperationTypeName(InstallOperation::Type op_type) { |
Alex Deymo | 2d621a3 | 2015-10-01 11:09:01 -0700 | [diff] [blame] | 50 | switch (op_type) { |
Alex Deymo | 2d621a3 | 2015-10-01 11:09:01 -0700 | [diff] [blame] | 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"; |
Amin Hassani | 5ef5d45 | 2017-08-04 13:10:59 -0700 | [diff] [blame] | 65 | case InstallOperation::PUFFDIFF: |
| 66 | return "PUFFDIFF"; |
Amin Hassani | efa62d9 | 2017-11-09 13:46:56 -0800 | [diff] [blame] | 67 | case InstallOperation::BROTLI_BSDIFF: |
| 68 | return "BROTLI_BSDIFF"; |
Amin Hassani | 0f59a9a | 2019-09-27 10:24:31 -0700 | [diff] [blame] | 69 | |
| 70 | case InstallOperation::BSDIFF: |
| 71 | case InstallOperation::MOVE: |
| 72 | NOTREACHED(); |
Alex Deymo | 2d621a3 | 2015-10-01 11:09:01 -0700 | [diff] [blame] | 73 | } |
| 74 | return "<unknown_op>"; |
| 75 | } |
| 76 | |
Alex Deymo | 161c4a1 | 2014-05-16 15:56:21 -0700 | [diff] [blame] | 77 | }; // namespace chromeos_update_engine |