| 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 |  | 
|  | 19 | namespace chromeos_update_engine { | 
|  | 20 |  | 
| Alex Deymo | cbf0989 | 2015-09-11 16:13:16 -0700 | [diff] [blame] | 21 | const uint64_t kChromeOSMajorPayloadVersion = 1; | 
|  | 22 | const uint64_t kBrilloMajorPayloadVersion = 2; | 
|  | 23 |  | 
|  | 24 | const uint32_t kFullPayloadMinorVersion = 0; | 
|  | 25 | const uint32_t kInPlaceMinorPayloadVersion = 1; | 
|  | 26 | const uint32_t kSourceMinorPayloadVersion = 2; | 
| Sen Jiang | 82352f9 | 2015-11-09 16:36:53 -0800 | [diff] [blame] | 27 | const uint32_t kOpSrcHashMinorPayloadVersion = 3; | 
| Amin Hassani | 5ef5d45 | 2017-08-04 13:10:59 -0700 | [diff] [blame] | 28 | const uint32_t kPuffdiffMinorPayloadVersion = 4; | 
| Alex Deymo | cbf0989 | 2015-09-11 16:13:16 -0700 | [diff] [blame] | 29 |  | 
| Sen Jiang | 9c89e84 | 2018-02-02 13:51:21 -0800 | [diff] [blame] | 30 | const uint64_t kMaxPayloadHeaderSize = 24; | 
|  | 31 |  | 
| Sen Jiang | 70a6ab0 | 2015-08-28 13:23:27 -0700 | [diff] [blame] | 32 | const char kLegacyPartitionNameKernel[] = "boot"; | 
|  | 33 | const char kLegacyPartitionNameRoot[] = "system"; | 
|  | 34 |  | 
| Sen Jiang | b8060e4 | 2015-09-24 17:30:50 -0700 | [diff] [blame] | 35 | const char kDeltaMagic[4] = {'C', 'r', 'A', 'U'}; | 
| Alex Deymo | 161c4a1 | 2014-05-16 15:56:21 -0700 | [diff] [blame] | 36 |  | 
| Alex Deymo | 2d621a3 | 2015-10-01 11:09:01 -0700 | [diff] [blame] | 37 | const char* InstallOperationTypeName(InstallOperation_Type op_type) { | 
|  | 38 | switch (op_type) { | 
|  | 39 | case InstallOperation::BSDIFF: | 
|  | 40 | return "BSDIFF"; | 
|  | 41 | case InstallOperation::MOVE: | 
|  | 42 | return "MOVE"; | 
|  | 43 | case InstallOperation::REPLACE: | 
|  | 44 | return "REPLACE"; | 
|  | 45 | case InstallOperation::REPLACE_BZ: | 
|  | 46 | return "REPLACE_BZ"; | 
|  | 47 | case InstallOperation::SOURCE_COPY: | 
|  | 48 | return "SOURCE_COPY"; | 
|  | 49 | case InstallOperation::SOURCE_BSDIFF: | 
|  | 50 | return "SOURCE_BSDIFF"; | 
|  | 51 | case InstallOperation::ZERO: | 
|  | 52 | return "ZERO"; | 
|  | 53 | case InstallOperation::DISCARD: | 
|  | 54 | return "DISCARD"; | 
|  | 55 | case InstallOperation::REPLACE_XZ: | 
|  | 56 | return "REPLACE_XZ"; | 
| Amin Hassani | 5ef5d45 | 2017-08-04 13:10:59 -0700 | [diff] [blame] | 57 | case InstallOperation::PUFFDIFF: | 
|  | 58 | return "PUFFDIFF"; | 
| Amin Hassani | efa62d9 | 2017-11-09 13:46:56 -0800 | [diff] [blame] | 59 | case InstallOperation::BROTLI_BSDIFF: | 
|  | 60 | return "BROTLI_BSDIFF"; | 
| Alex Deymo | 2d621a3 | 2015-10-01 11:09:01 -0700 | [diff] [blame] | 61 | } | 
|  | 62 | return "<unknown_op>"; | 
|  | 63 | } | 
|  | 64 |  | 
| Alex Deymo | 161c4a1 | 2014-05-16 15:56:21 -0700 | [diff] [blame] | 65 | };  // namespace chromeos_update_engine |