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 namespace chromeos_update_engine {
20 
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;
27 const uint32_t kOpSrcHashMinorPayloadVersion = 3;
28 const uint32_t kBrotliBsdiffMinorPayloadVersion = 4;
29 const uint32_t kPuffdiffMinorPayloadVersion = 5;
30 
31 const uint64_t kMaxPayloadHeaderSize = 24;
32 
33 const char kLegacyPartitionNameKernel[] = "boot";
34 const char kLegacyPartitionNameRoot[] = "system";
35 
36 const char kDeltaMagic[4] = {'C', 'r', 'A', 'U'};
37 
InstallOperationTypeName(InstallOperation_Type op_type)38 const char* InstallOperationTypeName(InstallOperation_Type op_type) {
39   switch (op_type) {
40     case InstallOperation::BSDIFF:
41       return "BSDIFF";
42     case InstallOperation::MOVE:
43       return "MOVE";
44     case InstallOperation::REPLACE:
45       return "REPLACE";
46     case InstallOperation::REPLACE_BZ:
47       return "REPLACE_BZ";
48     case InstallOperation::SOURCE_COPY:
49       return "SOURCE_COPY";
50     case InstallOperation::SOURCE_BSDIFF:
51       return "SOURCE_BSDIFF";
52     case InstallOperation::ZERO:
53       return "ZERO";
54     case InstallOperation::DISCARD:
55       return "DISCARD";
56     case InstallOperation::REPLACE_XZ:
57       return "REPLACE_XZ";
58     case InstallOperation::PUFFDIFF:
59       return "PUFFDIFF";
60     case InstallOperation::BROTLI_BSDIFF:
61       return "BROTLI_BSDIFF";
62   }
63   return "<unknown_op>";
64 }
65 
66 };  // namespace chromeos_update_engine
67