Add delta.ua - a binary to apply an upgrade of DELTA_FS type.
[platform/core/system/upgrade.git] / src / delta-ua / ua.h
1 /*
2  * delta-ua
3  *
4  * Copyright (c) 2017 - 2022 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the License);
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19 #ifndef __UA_H__
20 #define __UA_H__
21
22 #include <stdio.h>
23
24 /*
25  * FEATURE
26  */
27
28 //#define USE_POST_UPDATE
29 //#define USE_DELTA_DOWNLOAD
30 //#define USE_DUALSBL
31
32 #define LOG_FILE_PATH "/opt/data/update/last_update.log"
33 #define MAX_FILE_PATH           512
34 #define MAX_FOLDER_PATH         384
35
36 /*
37  * FOTA Adaptaion header
38  */
39
40 #define ERROR -1 // 0XFFFFFFFF
41
42 #define INVALID    0
43 #define VALID      1
44 #define TRUE 1
45 #define FALSE 0
46 #define OK 0
47 #define SUCCESS 0
48 #define FAIL 1
49 #define RESTORING 2
50
51 #define UPI_ERROR(code) 0xFD##code
52
53 #define UPI_CONFIG_ERROR        UPI_ERROR(9A)
54
55 #define UPI_DELTA_PATH_ERROR                    UPI_ERROR(AA)
56 #define UPI_DELTA_PATH_LENGTH_ERROR     UPI_ERROR(AB)
57
58 #define UPI_VERSION_ERROR                               UPI_ERROR(BB)
59
60 #define UPI_VERIFY_ERROR        UPI_ERROR(C0)
61 #define UPI_UPDATE_ERROR        UPI_ERROR(D0)
62
63 #define UPI_INVALID_PARAM_ERROR         UPI_ERROR(EA)
64 #define UPI_DELTACOUNT_ERROR                    UPI_ERROR(EC)
65 #define UPI_PARTINFO_ERROR                              UPI_ERROR(ED)
66
67 #define DEFAULT_DELTA_NAME              "delta.tar"
68 #define UPDATTE_CFG_FILE                "update.cfg"
69
70 #define UP_STATUS_FILE  "UP.STATUS"
71 #define UP_START_NONE   0
72
73 enum {
74         UA_OP_MODE_FG = 0,
75         UA_OP_MODE_BG
76 };
77
78 enum {
79         DM_VERITY_DISABLED = 0,
80         DM_VERITY_ENABLED = 1
81 };
82
83 void log_deinit(void);
84
85 #endif