2 * upgrade-apply-deltafs
4 * Copyright (c) 2017 - 2022 Samsung Electronics Co., Ltd.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #ifndef __UA_TYPES_H__
20 #define __UA_TYPES_H__
25 #define MAX_FILE_PATH 512
26 // every delta should have a patchlist text file, and can have
27 // an attribute file additionally
28 #define NO_OF_TEXT_FILES 2
30 // the following macros define the meaning of indexes in tar_info.text_files_info array
32 // this file has a list of diff files and the number of all operations (DIFFS, NEWS, MOVES etc.)
33 // this file is required to be present in a delta
34 #define PATCHLIST_FILE 0
36 // this files lists files whose attributes changed and their new values
40 * FOTA Adaptaion header
43 #define UI_OP_SCOUT_UPDATE 0
45 #define UI_OP_UPDATE 3
47 typedef struct _ua_update_data_t {
48 unsigned int weight; // the sum of weight should be 100
49 unsigned int weight_offset; // start offset
50 unsigned int data_size; // byte
51 char *ua_delta_path; // it will be allocated to copy delta file path, need to free memory
52 char *ua_temp_path; // it will be allocated to copy delta file path, need to free memory
53 char *ua_delta_folder;
56 typedef struct _ua_update_cfg_t {
59 int source_img_size; //TOTA
62 typedef struct _ua_part_info_t {
64 char *ua_subject_name;
67 // User data structure
68 typedef struct _ua_data_t { // partition operations
69 ua_part_info_t *parti_info;
70 ua_update_cfg_t *update_cfg;
71 ua_update_data_t *update_data;
72 unsigned long ua_operation;
74 int (*ua_op_read_block)(void *, unsigned char *, unsigned long, unsigned long);
75 int (*ua_op_write_block)(void *, unsigned char *, unsigned long);
76 void (*ui_progress)(void *, unsigned long);
79 typedef struct _ua_delta_info_t {
80 char ua_patch_path[MAX_FILE_PATH];
81 char ua_patch_info[MAX_FILE_PATH];
82 char ua_delta_path[MAX_FILE_PATH];
83 char ua_attrib_path[MAX_FILE_PATH];
86 typedef struct _file_text_info {
88 char item_name[MAX_FILE_PATH];
89 char extracted_name[MAX_FILE_PATH];
92 typedef struct _file_7z_info {
94 char item_name[MAX_FILE_PATH];
95 char extracted_name[MAX_FILE_PATH];
98 typedef struct _tar_info {
101 int uncompressed_folder_size;
102 off_t subject_offset;
103 file_7z_info new_files_info;
104 // id = 0 -> config file, id = 1 -> attribute file
105 text_file_info text_files_info[NO_OF_TEXT_FILES];
108 typedef struct _ua_dataSS_t { // partition operations
109 ua_part_info_t *parti_info;
110 ua_update_cfg_t *update_cfg;
111 ua_update_data_t *update_data;
112 ua_delta_info_t *update_delta;
114 unsigned long ua_operation;
115 void (*ui_progress)(void *, unsigned long);
116 int (*write_data_to_blkdev)(char *, int, int, char *);
119 typedef unsigned int SS_UINT32;