Modify ua.h to ua_types.h for integrating header with tota-ua 41/158841/3
authorKichan Kwon <k_c.kwon@samsung.com>
Fri, 3 Nov 2017 10:02:50 +0000 (19:02 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Mon, 6 Nov 2017 04:54:55 +0000 (13:54 +0900)
- ua_types.h : structure (both packages use)
- ua.h : macro, error code (only tota-ua uses)

Change-Id: Id7fa9900236ade160c0e9a2bfbbb63f851bb55c4
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
CMakeLists.txt
packaging/libtota.spec
ss_engine/SS_Common.c
ss_engine/SS_Common.h
ss_engine/SS_FSUpdate.c
ss_engine/SS_Nand.c
ss_engine/SS_PatchDelta.c
ss_engine/SS_UPI.c
ss_engine/fota_tar.c
ss_engine/ua.h [deleted file]
ss_engine/ua_types.h [new file with mode: 0755]

index fe4c89d35d8d553231db7b38bdc5a4cbdb2704ca..d437011b902a726c1d203c2638af897cf703e88b 100755 (executable)
@@ -25,6 +25,7 @@ SET(HEADERS
        ss_engine/SS_MultiProcessUpdate.h
        ss_engine/SS_Nand.h
        ss_engine/SS_UPI.h
+       ss_engine/ua_types.h
 )
 #SET(EXEC_PREFIX "\${prefix}")
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
index a277a095798bfd06d141f02f9c2b9a767aaf2be7..a79c8f2b32412ebf0edabf2e260fc3fd02042ffd 100755 (executable)
@@ -76,6 +76,7 @@ cp libtota.a %{buildroot}%{_libdir}/libtota.a
 %{_includedir}/SS_MultiProcessUpdate.h
 %{_includedir}/SS_Nand.h
 %{_includedir}/SS_UPI.h
+%{_includedir}/ua_types.h
 
 %files -n tota-bsdiff
 %{_bindir}/ss_bsdiff
index a169dd6e1447c9b4434c95790e1ab8bf6c2d22de..cf7714db37e8f2371134e14023fd3469a9eec418 100755 (executable)
@@ -29,7 +29,7 @@
 #include "SS_Engine_Errors.h"
 #include "SS_Common.h"
 
-#include "ua.h"
+#include "ua_types.h"
 #include "fota_tar.h"
 #include "fota_common.h"
 
index d7175ba64c583f3c71150ca8e86d446de96a0b4d..453b61b8ed6cb8de9ce9189d721e8ba225a228fd 100755 (executable)
@@ -24,7 +24,7 @@
 #include "SS_Engine_Errors.h"
 #include "SS_Engine_Update.h"
 
-#include "ua.h"
+#include "ua_types.h"
 
 #define MAX_PATH 256
 
index fd0b52a48c0f53f63e20f67a1e80d857a7ff44db..0e004c81e65eae97aa7cf6bbb4aaea62cda4faac 100755 (executable)
@@ -36,7 +36,7 @@
 #include "SS_Common.h"
 
 #include "fota_common.h"
-#include "ua.h"
+#include "ua_types.h"
 
 static int feature_support_capability;
 
index 21d1e65e5f66146f6358fd14788f41b822cbb8ee..9fcb51dc8cb9bb1afd8da6d6c47ff83f89da3cec 100755 (executable)
@@ -32,7 +32,7 @@
 #include "SS_ImageUpdate.h"
 #include "SS_Engine_Errors.h"
 #include "SS_Common.h"
-#include "ua.h"
+#include "ua_types.h"
 #include "fota_common.h"
 
 static int local_pid;
index 1294a09ba3df733f2b1cf14effe8a5c2ad9b17f2..d0f5eab564e04617712e893d67c79fd06a62151b 100755 (executable)
@@ -26,7 +26,7 @@
 #include <sys/types.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include "ua.h"
+#include "ua_types.h"
 #include "sha1.h"
 #include "SS_PatchDelta.h"
 #include "fota_common.h"
index db19b993a45b620fb57a116c098d6fe79b8451bd..290ba588289f34e3294968e741b885b32b7fccfa 100755 (executable)
@@ -32,7 +32,7 @@ Function Prototypes Mandatory
 #include <unistd.h>
 #include <sys/statfs.h>
 #include <mntent.h>
-#include "ua.h"
+#include "ua_types.h"
 #include "SS_Common.h"
 #include "fota_common.h"
 #include "SS_UPI.h"
@@ -1665,7 +1665,7 @@ int SS_FSVerifyPartition(ua_dataSS_t * ua_dataSS, int part_idx)
        SS_GetPartition_LocDetails(ua_dataSS);
        LOGL(LOG_SSENGINE, "FS Verification Start PartIndex:[%d]\n", part_idx);
        if (ua_dataSS->ua_operation == UI_OP_SCOUT)
-               gvalid_session = TRUE;  // (shd b true if called during verification)
+               gvalid_session = 1;  // (shd b true if called during verification)
        headptr_list[part_idx] = SS_FSBuildNodes(ua_dataSS);
 #ifdef TIME_PROFILING
        LOGL(LOG_SSENGINE, "fast_tar_get_item_size_time :[%lf]\n", fast_tar_get_item_size_time);
index 6f82cecac14f6a7ab50a19d0fc07649ba0141695..7f8ba304e0f439dfa5de8d8ae97babe3972f0163 100755 (executable)
@@ -28,7 +28,7 @@
 #include "SS_FSUpdate.h"
 #include "fota_common.h"
 #include "fota_tar.h"
-#include "ua.h"
+#include "ua_types.h"
 
 /* tar Header Block, from POSIX 1003.1-1990. for reference */
 #if 0
diff --git a/ss_engine/ua.h b/ss_engine/ua.h
deleted file mode 100755 (executable)
index 7d2971f..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * libtota
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __UA_H__
-#define __UA_H__
-
-#include <stdio.h>
-
-#define MAX_FILE_PATH          512
-#define MAX_PART_NAME          32
-
-/*
- * FOTA Adaptaion header
- */
-
-#define ERROR -1                // 0XFFFFFFFF
-
-#define INVALID 0
-#define VALID 1
-#define TRUE 1
-#define FALSE 0
-#define OK 0
-#define SUCCESS 0
-#define FAIL 1
-#define RESTORING 2
-#define UA_PARTI_MAX                   20      //currently supporting max 20 partitions
-#define DEFAULT_DELTA_NAME             "delta.tar"
-#define UPDATTE_CFG_FILE               "update.cfg"
-
-#define UI_OP_SCOUT_UPDATE             0
-#define UI_OP_SCOUT                    1
-#define UI_OP_UPDATE                   3
-//SS_ENGINE && BSDIFF
-#define SS_RECOVERYRAMDISK
-
-
-typedef enum {
-       FULL_IMG,
-       DELTA_IMG,
-       DELTA_FS,
-       EXTRA
-} UA_DATA_FORMAT;
-
-typedef enum {
-       UA_MODE_SCOUT_UPDATE,
-       UA_MODE_SCOUT,
-       UA_MODE_VERIFYTARGET,
-       UA_MODE_UPDATE,
-       UA_MODE_SUPPLYIMFOM = 200
-} UA_OPERATION_MODE;
-
-typedef struct _ua_update_data_t {
-       unsigned int exist_check;
-       unsigned int verify_check;
-       unsigned int update_check;
-       unsigned int weight;        // the sum of weight should be 100
-       unsigned int weight_offset; // start offset
-       unsigned int data_size;     // byte
-       char *ua_delta_path;        // it will be allocated to copy delta file path, need to free memory
-       char *ua_temp_path;         // it will be allocated to copy delta file path, need to free memory
-} ua_update_data_t;
-
-typedef struct _ua_update_cfg_t {
-       unsigned int update_type;
-       int skip_verify;
-       int skip_update;
-       int soure_img_size;         //TOTA
-       int target_img_size;
-       char *soure_sha1;
-       char *target_sha1;
-} ua_update_cfg_t;
-
-typedef struct _ua_part_info_t {
-       char *ua_parti_name;
-       char *ua_subject_name;
-       char *ua_blk_name;
-       int ua_blk_offset;
-} ua_part_info_t;
-
-// User data structure
-typedef struct _ua_data_t {     // partition operations
-       ua_part_info_t *parti_info;
-       ua_update_cfg_t *update_cfg;
-       ua_update_data_t *update_data;
-       unsigned long ua_operation;
-
-       int (*ua_op_read_block) (void *, unsigned char *, unsigned long, unsigned long);
-       int (*ua_op_write_block) (void *, unsigned char *, unsigned long);
-       void (*ui_progress) (void *, unsigned long);
-} ua_data_t;
-
-typedef struct _ua_delta_info_t {
-       char ua_patch_path[MAX_FILE_PATH];
-       char ua_patch_info[MAX_FILE_PATH];
-       char ua_delta_path[MAX_FILE_PATH];
-       char ua_attrib_path[MAX_FILE_PATH];
-} ua_delta_info_t;
-
-typedef struct _ua_dataSS_t {   // partition operations
-       ua_part_info_t *parti_info;
-       ua_update_cfg_t *update_cfg;
-       ua_update_data_t *update_data;
-       ua_delta_info_t *update_delta;
-       unsigned long ua_operation;
-       void (*ui_progress) (void *, unsigned long);
-       int (*write_data_to_blkdev) (char *, int, int, char *);
-} ua_dataSS_t;
-
-#endif
diff --git a/ss_engine/ua_types.h b/ss_engine/ua_types.h
new file mode 100755 (executable)
index 0000000..c7d70b1
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * libtota
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __UA_TYPES_H__
+#define __UA_TYPES_H__
+
+#include <stdio.h>
+
+#define MAX_FILE_PATH          512
+
+/*
+ * FOTA Adaptaion header
+ */
+
+#define UA_PARTI_MAX                   20      //currently supporting max 20 partitions
+
+#define UI_OP_SCOUT_UPDATE             0
+#define UI_OP_SCOUT                    1
+#define UI_OP_UPDATE                   3
+
+typedef enum {
+       FULL_IMG,
+       DELTA_IMG,
+       DELTA_FS,
+       EXTRA
+} UA_DATA_FORMAT;
+
+typedef enum {
+       UA_MODE_SCOUT_UPDATE,
+       UA_MODE_SCOUT,
+       UA_MODE_VERIFYTARGET,
+       UA_MODE_UPDATE,
+       UA_MODE_SUPPLYIMFOM = 200
+} UA_OPERATION_MODE;
+
+typedef struct _ua_update_data_t {
+       unsigned int exist_check;
+       unsigned int verify_check;
+       unsigned int update_check;
+       unsigned int weight; // the sum of weight should be 100
+       unsigned int weight_offset; // start offset
+       unsigned int data_size; // byte
+       char *ua_delta_path; // it will be allocated to copy delta file path, need to free memory
+       char *ua_temp_path; // it will be allocated to copy delta file path, need to free memory
+} ua_update_data_t;
+
+typedef struct _ua_update_cfg_t {
+       unsigned int update_type;
+       int skip_verify;
+       int skip_update;
+       int soure_img_size; //TOTA
+       int target_img_size;
+       char *soure_sha1;
+       char *target_sha1;
+} ua_update_cfg_t;
+
+typedef struct _ua_part_info_t {
+       char *ua_parti_name;
+       char *ua_subject_name;
+       char *ua_blk_name;
+       int ua_blk_offset;
+} ua_part_info_t;
+
+// User data structure
+typedef struct _ua_data_t { // partition operations
+       ua_part_info_t *parti_info;
+       ua_update_cfg_t *update_cfg;
+       ua_update_data_t *update_data;
+       unsigned long ua_operation;
+
+       int (*ua_op_read_block)(void *, unsigned char *, unsigned long, unsigned long);
+       int (*ua_op_write_block)(void *, unsigned char *, unsigned long);
+       void (*ui_progress)(void *, unsigned long);
+} ua_data_t;
+
+typedef struct _ua_delta_info_t {
+       char ua_patch_path[MAX_FILE_PATH];
+       char ua_patch_info[MAX_FILE_PATH];
+       char ua_delta_path[MAX_FILE_PATH];
+       char ua_attrib_path[MAX_FILE_PATH];
+} ua_delta_info_t;
+
+typedef struct _ua_dataSS_t { // partition operations
+       ua_part_info_t *parti_info;
+       ua_update_cfg_t *update_cfg;
+       ua_update_data_t *update_data;
+       ua_delta_info_t *update_delta;
+       unsigned long ua_operation;
+       void (*ui_progress)(void *, unsigned long);
+       int (*write_data_to_blkdev)(char *, int, int, char *);
+} ua_dataSS_t;
+
+#endif