Remove unused parameter
[platform/core/system/libtota.git] / ss_engine / ua_types.h
1 /*
2  * libtota
3  *
4  * Copyright (c) 2017 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 UA_PARTI_MAX                    20      //currently supporting max 20 partitions
31
32 #define UI_OP_SCOUT_UPDATE              0
33 #define UI_OP_SCOUT                     1
34 #define UI_OP_UPDATE                    3
35
36 typedef enum {
37         FULL_IMG,
38         DELTA_IMG,
39         DELTA_FS,
40         EXTRA
41 } UA_DATA_FORMAT;
42
43 typedef enum {
44         UA_MODE_SCOUT_UPDATE,
45         UA_MODE_SCOUT,
46         UA_MODE_VERIFYTARGET,
47         UA_MODE_UPDATE,
48         UA_MODE_SUPPLYIMFOM = 200
49 } UA_OPERATION_MODE;
50
51 typedef struct _ua_update_data_t {
52         unsigned int exist_check;
53         unsigned int verify_check;
54         unsigned int update_check;
55         unsigned int weight; // the sum of weight should be 100
56         unsigned int weight_offset; // start offset
57         unsigned int data_size; // byte
58         char *ua_delta_path; // it will be allocated to copy delta file path, need to free memory
59         char *ua_temp_path; // it will be allocated to copy delta file path, need to free memory
60 } ua_update_data_t;
61
62 typedef struct _ua_update_cfg_t {
63         unsigned int update_type;
64         int skip_verify;
65         int skip_update;
66         int soure_img_size; //TOTA
67         int target_img_size;
68         char *soure_sha1;
69         char *target_sha1;
70 } ua_update_cfg_t;
71
72 typedef struct _ua_part_info_t {
73         char *ua_parti_name;
74         char *ua_subject_name;
75         char *ua_blk_name;
76         int ua_blk_offset;
77 } ua_part_info_t;
78
79 // User data structure
80 typedef struct _ua_data_t { // partition operations
81         ua_part_info_t *parti_info;
82         ua_update_cfg_t *update_cfg;
83         ua_update_data_t *update_data;
84         unsigned long ua_operation;
85
86         int (*ua_op_read_block)(void *, unsigned char *, unsigned long, unsigned long);
87         int (*ua_op_write_block)(void *, unsigned char *, unsigned long);
88         void (*ui_progress)(void *, unsigned long);
89 } ua_data_t;
90
91 typedef struct _ua_delta_info_t {
92         char ua_patch_path[MAX_FILE_PATH];
93         char ua_patch_info[MAX_FILE_PATH];
94         char ua_delta_path[MAX_FILE_PATH];
95         char ua_attrib_path[MAX_FILE_PATH];
96 } ua_delta_info_t;
97
98 typedef struct _ua_dataSS_t { // partition operations
99         ua_part_info_t *parti_info;
100         ua_update_cfg_t *update_cfg;
101         ua_update_data_t *update_data;
102         ua_delta_info_t *update_delta;
103         unsigned long ua_operation;
104         void (*ui_progress)(void *, unsigned long);
105         int (*write_data_to_blkdev)(char *, int, int, char *);
106 } ua_dataSS_t;
107
108 #endif