5adb0ad191080ec0c73c9f2e9ab78f94668181ce
[platform/core/system/upgrade.git] / src / delta-ua / engine / ua_types.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_TYPES_H__
20 #define __UA_TYPES_H__
21
22 #include <stdio.h>
23
24 #define MAX_FILE_PATH           512
25
26 /*
27  * FOTA Adaptaion header
28  */
29
30 #define UI_OP_SCOUT_UPDATE              0
31 #define UI_OP_SCOUT                     1
32 #define UI_OP_UPDATE                    3
33
34 typedef struct _ua_update_data_t {
35         unsigned int weight; // the sum of weight should be 100
36         unsigned int weight_offset; // start offset
37         unsigned int data_size; // byte
38         char *ua_delta_path; // it will be allocated to copy delta file path, need to free memory
39         char *ua_temp_path; // it will be allocated to copy delta file path, need to free memory
40         char *ua_delta_folder;
41 } ua_update_data_t;
42
43 typedef struct _ua_update_cfg_t {
44         int skip_verify;
45         int skip_update;
46         int source_img_size; //TOTA
47 } ua_update_cfg_t;
48
49 typedef struct _ua_part_info_t {
50         char *ua_parti_name;
51         char *ua_subject_name;
52 } ua_part_info_t;
53
54 // User data structure
55 typedef struct _ua_data_t { // partition operations
56         ua_part_info_t *parti_info;
57         ua_update_cfg_t *update_cfg;
58         ua_update_data_t *update_data;
59         unsigned long ua_operation;
60
61         int (*ua_op_read_block)(void *, unsigned char *, unsigned long, unsigned long);
62         int (*ua_op_write_block)(void *, unsigned char *, unsigned long);
63         void (*ui_progress)(void *, unsigned long);
64 } ua_data_t;
65
66 typedef struct _ua_delta_info_t {
67         char ua_patch_path[MAX_FILE_PATH];
68         char ua_patch_info[MAX_FILE_PATH];
69         char ua_delta_path[MAX_FILE_PATH];
70         char ua_attrib_path[MAX_FILE_PATH];
71 } ua_delta_info_t;
72
73 typedef struct _ua_dataSS_t { // partition operations
74         ua_part_info_t *parti_info;
75         ua_update_cfg_t *update_cfg;
76         ua_update_data_t *update_data;
77         ua_delta_info_t *update_delta;
78         unsigned long ua_operation;
79         void (*ui_progress)(void *, unsigned long);
80         int (*write_data_to_blkdev)(char *, int, int, char *);
81 } ua_dataSS_t;
82
83 typedef unsigned int SS_UINT32;
84
85 #endif