f001bf4078a47178f28366b2b7ac5065682f76f3
[platform/core/system/upgrade.git] / src / upgrade-apply-deltafs / engine / SS_UPI.h
1 /*
2  * upgrade-apply-deltafs
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 _SS_UPI_H_
20 #define _SS_UPI_H_
21 #include "fota_common.h"
22 #include "SS_Common.h"
23
24 #define DISPLAYRESOLUTION_SIZE 50
25
26 struct details {
27         int diffs;
28         int moves;
29         int news;
30         int deletes;
31         int symdiffs;
32         int symnews;
33         int harddiffs;
34         int hardnews;
35 };
36
37 enum DEL_TYPE { DELETES = 1, DIFFS, MOVES, DELETE_END, NEWFILES, SYMDIFFS, SYMNEWFILES, HARDDIFFS, HARDNEWFILES, DEL_TYPE_MAX };
38 struct fs_params {                        // Use Macros
39         char file_old_path[512];
40         char file_new_path[512];
41         char patch_name[256];
42         char sha1src[64];
43         char sha1trg[64];
44         int data_size;
45         int data_offset;
46         int type;                                  //0 is for diff and 1 is for verbatim
47         struct fs_params *nextnode;
48 };
49 typedef struct fs_params fs_params;
50
51 struct fs_list {
52         fs_params *dif_ref;
53         fs_params *move_ref;
54         fs_params *new_ref;
55         fs_params *del_ref;
56         fs_params *sym_difref;
57         fs_params *sym_newref;
58         fs_params *hard_difref;
59         fs_params *hard_newref;
60         int ulPatchCount;
61 };
62 typedef struct fs_list fs_list;
63
64 int SS_AppendNode(const char *ubDeltaPath, fs_params ** headparam, fs_params ** tailparam, const char *old_path,
65                                   const char *new_path, const char *patchname, const char *sha1src, const char *sha1trg, int type,
66                                   char *patchpath_name);
67 long SS_GetUPIVersion(unsigned char *ver_str);
68 int decompress_tar_brotli(const char *path);
69 extern int SS_FSUpdatemain(ua_dataSS_t * ua_dataSS);
70 extern int SS_FSVerifyPartition(ua_dataSS_t * ua_dataSS);
71
72 //extra functions
73 extern void *SS_Malloc(unsigned int size);
74 extern void SS_Free(void *pMemBlock);
75 extern int SS_UpdateDeltaFS(const char *source_filename, const char *target_filename,
76                                                         const char *source_sha1_str, const char *target_sha1_str, int patch_data_size, TAR* tar_file);
77 extern long SS_GetFileType(char *pLinkName, enumFileType * fileType);
78
79 #endif                                            //_SS_UPI_H_