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 // 16 17 #include "update_engine/payload_consumer/payload_constants.h" 18 19 #include <base/logging.h> 20 21 namespace chromeos_update_engine { 22 23 // const uint64_t kChromeOSMajorPayloadVersion = 1; DEPRECATED 24 const uint64_t kBrilloMajorPayloadVersion = 2; 25 26 const uint64_t kMinSupportedMajorPayloadVersion = kBrilloMajorPayloadVersion; 27 const uint64_t kMaxSupportedMajorPayloadVersion = kBrilloMajorPayloadVersion; 28 29 const uint32_t kFullPayloadMinorVersion = 0; 30 // const uint32_t kInPlaceMinorPayloadVersion = 1; DEPRECATED 31 const uint32_t kSourceMinorPayloadVersion = 2; 32 const uint32_t kOpSrcHashMinorPayloadVersion = 3; 33 const uint32_t kBrotliBsdiffMinorPayloadVersion = 4; 34 const uint32_t kPuffdiffMinorPayloadVersion = 5; 35 const uint32_t kVerityMinorPayloadVersion = 6; 36 const uint32_t kPartialUpdateMinorPayloadVersion = 7; 37 38 const uint32_t kMinSupportedMinorPayloadVersion = kSourceMinorPayloadVersion; 39 const uint32_t kMaxSupportedMinorPayloadVersion = 40 kPartialUpdateMinorPayloadVersion; 41 42 const uint64_t kMaxPayloadHeaderSize = 24; 43 44 const char kPartitionNameKernel[] = "kernel"; 45 const char kPartitionNameRoot[] = "root"; 46 47 const char kDeltaMagic[4] = {'C', 'r', 'A', 'U'}; 48 InstallOperationTypeName(InstallOperation::Type op_type)49const char* InstallOperationTypeName(InstallOperation::Type op_type) { 50 switch (op_type) { 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"; 65 case InstallOperation::PUFFDIFF: 66 return "PUFFDIFF"; 67 case InstallOperation::BROTLI_BSDIFF: 68 return "BROTLI_BSDIFF"; 69 70 case InstallOperation::BSDIFF: 71 case InstallOperation::MOVE: 72 NOTREACHED(); 73 } 74 return "<unknown_op>"; 75 } 76 77 }; // namespace chromeos_update_engine 78