From: Kichan Kwon Date: Mon, 6 Nov 2017 02:52:48 +0000 (+0900) Subject: Remove unused parameter X-Git-Tag: submit/tizen/20180228.063935~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F17%2F158917%2F3;p=platform%2Fcore%2Fsystem%2Flibtota.git Remove unused parameter Change-Id: I23baef728f4d259a1c1df402240452efb9cc8974 Signed-off-by: Kichan Kwon --- diff --git a/ss_engine/SS_Common.c b/ss_engine/SS_Common.c index 6722938..a169dd6 100755 --- a/ss_engine/SS_Common.c +++ b/ss_engine/SS_Common.c @@ -42,7 +42,7 @@ void SS_Progress(void *pbUserData, SS_UINT32 uPercent) } /* Prints a string like the C printf() function */ -SS_UINT32 SS_Trace(void *pUser, const char *aFormat, ...) +SS_UINT32 SS_Trace(const char *aFormat, ...) { #if 0 LOGL(LOG_SSENGINE, aFormat); @@ -59,7 +59,7 @@ SS_UINT32 SS_Trace(void *pUser, const char *aFormat, ...) return S_SS_SUCCESS; } -long SS_FSTrace(void *pbUserData, const unsigned short *aFormat, ...) +long SS_FSTrace(const unsigned short *aFormat, ...) { va_list list; diff --git a/ss_engine/SS_Engine_Update.h b/ss_engine/SS_Engine_Update.h index 2f2ccc8..7c7fde9 100755 --- a/ss_engine/SS_Engine_Update.h +++ b/ss_engine/SS_Engine_Update.h @@ -517,15 +517,13 @@ extern "C" { * \li %s: Null-terminated string * \li %d: Signed decimal integer * - * \param pbUserData Optional opaque data-structure to pass to IPL - * functions * \param aFormat Printf-like format string * \param ... Items to insert in \a aFormat * * \return S_SS_SUCCESS on success or an \ref SS_vRM_Errors.h error code ******************************************************************************* */ - SS_UINT32 SS_Trace(void *pbUserData, const char *aFormat, ...); + SS_UINT32 SS_Trace(const char *aFormat, ...); /** ******************************************************************************* diff --git a/ss_engine/SS_FSUpdate.c b/ss_engine/SS_FSUpdate.c index 187d209..fd0b52a 100755 --- a/ss_engine/SS_FSUpdate.c +++ b/ss_engine/SS_FSUpdate.c @@ -119,8 +119,7 @@ long SS_recursive_folder_creater(const char *path, const mode_t mode) } long -SS_CopyFile(void *pbUserData, - const char *strFromPath, const char *strToPath) +SS_CopyFile(const char *strFromPath, const char *strToPath) { int fd1, fd2; int readCount = 0, writeCount = 0; @@ -143,7 +142,7 @@ SS_CopyFile(void *pbUserData, fd1 = open(path1, O_RDONLY); if (fd1 < 0) return E_SS_OPENFILE_ONLYR; - ret = SS_OpenFile(pbUserData, strToPath, ONLY_W, (long *)&fd2); + ret = SS_OpenFile(strToPath, ONLY_W, (long *)&fd2); if (ret != S_SS_SUCCESS || fd2 < 0) { close(fd1); LOGE(" SS_OpenFile fail leaved path1:%s | path2:%s\n", path1, path1); @@ -168,7 +167,7 @@ SS_CopyFile(void *pbUserData, return ret; } -long SS_DeleteFile(void *pbUserData, const char *strPath) +long SS_DeleteFile(const char *strPath) { char path[MAX_PATH] = { '\0' }; int ret = 0; @@ -195,14 +194,13 @@ int SS_unlink_cbf(const char *fpath, const struct stat *sb, int typeflag, struct } return rv; } -long SS_DeleteFolder(void *pbUserData, const char *strPath) +long SS_DeleteFolder(const char *strPath) { //runs till either tree is exhausted or when unlink_cbf returns non zero value. return ((long)nftw(strPath, SS_unlink_cbf, 64, FTW_DEPTH | FTW_PHYS) == 0) ? S_SS_SUCCESS : E_SS_FAILURE; - } -long SS_DeleteFolderEmpty(void *pbUserData, const char *strPath) +long SS_DeleteFolderEmpty(const char *strPath) { int ret = 0; @@ -220,7 +218,7 @@ long SS_DeleteFolderEmpty(void *pbUserData, const char *strPath) return E_SS_FAILURE; } -long SS_CreateFolder(void *pbUserData, const char *strPath) +long SS_CreateFolder(const char *strPath) { mode_t mode = 0; int ret = 0; @@ -283,8 +281,7 @@ mode_t SS_get_mode(E_RW_TYPE wFlag) } long -SS_OpenFile(void *pbUserData, - const char *strPath, E_RW_TYPE wFlag, long *pwHandle) +SS_OpenFile(const char *strPath, E_RW_TYPE wFlag, long *pwHandle) { mode_t mode; char path[MAX_PATH] = { '\0' }; @@ -327,7 +324,7 @@ SS_OpenFile(void *pbUserData, SS_char_to_unicode((const char *)dir, (char *)dirShort, MAX_PATH - 1); - if (SS_CreateFolder(pbUserData, dirShort)) { + if (SS_CreateFolder(dirShort)) { LOGE(" Fail create folder, Leave SS_OpenFile\n"); return E_SS_OPENFILE_WRITE; } @@ -349,7 +346,7 @@ SS_OpenFile(void *pbUserData, return S_SS_SUCCESS; } -long SS_ResizeFile(void *pbUserData, long wHandle, SS_UINT32 dwSize) +long SS_ResizeFile(long wHandle, SS_UINT32 dwSize) { int ret = 0; @@ -365,7 +362,7 @@ long SS_ResizeFile(void *pbUserData, long wHandle, SS_UINT32 dwSize) return ret; } -long SS_CloseFile(void *pbUserData, long wHandle) +long SS_CloseFile(long wHandle) { int ret = 0; LOGL(LOG_SSENGINE, "wHandle = %ld\n", wHandle); @@ -387,8 +384,7 @@ long SS_CloseFile(void *pbUserData, long wHandle) } long -SS_WriteFile(void *pbUserData, - long wHandle, +SS_WriteFile(long wHandle, SS_UINT32 dwPosition, unsigned char *pbBuffer, SS_UINT32 dwSize) { @@ -416,8 +412,7 @@ SS_WriteFile(void *pbUserData, return S_SS_SUCCESS; } -long SS_MoveFile(void *pbUserData, const char *strFromPath, - const char *strToPath) +long SS_MoveFile(const char *strFromPath, const char *strToPath) { int ret = 0; struct stat sbuf; @@ -451,7 +446,7 @@ long SS_MoveFile(void *pbUserData, const char *strFromPath, } } else if (errno == 18) { //EXDEV 18 /* Cross-device link */ //Moving file across partitions if mount point is different (Extremely rare) - ret = (int)SS_CopyFile(NULL, path1, path2); + ret = (int)SS_CopyFile(path1, path2); if (ret != S_SS_SUCCESS) { LOGE("failed to copy file [%s] result [%d]\n", path1, ret); return E_SS_WRITE_ERROR; @@ -469,14 +464,13 @@ long SS_MoveFile(void *pbUserData, const char *strFromPath, LOGL(LOG_INFO, "leaved path1:%s | path2:%s\n", path1, path2); return S_SS_SUCCESS; } -long SS_SyncFile(void *pbUserData, long wHandle) +long SS_SyncFile(long wHandle) { return (-1 == fsync(wHandle)) ? E_SS_FAILURE : S_SS_SUCCESS; } long -SS_ReadFile(void *pbUserData, - long wHandle, +SS_ReadFile(long wHandle, SS_UINT32 dwPosition, unsigned char *pbBuffer, SS_UINT32 dwSize) { @@ -501,7 +495,7 @@ SS_ReadFile(void *pbUserData, return E_SS_READ_ERROR; } - if (ret != dwSize && ((ret + dwPosition) != (unsigned long)SS_GetFileSize(pbUserData, wHandle))) + if (ret != dwSize && ((ret + dwPosition) != (unsigned long)SS_GetFileSize(wHandle))) return E_SS_READ_ERROR; #if 0 @@ -510,7 +504,7 @@ SS_ReadFile(void *pbUserData, return S_SS_SUCCESS; } -long SS_GetFileSize(void *pbUserData, long wHandle) +long SS_GetFileSize(long wHandle) { int ret = 0; @@ -527,7 +521,7 @@ long SS_GetFileSize(void *pbUserData, long wHandle) return ret; } -long SS_Unlink(void *pbUserData, char *pLinkName) +long SS_Unlink(char *pLinkName) { int ret = 0; char path[MAX_PATH] = { '\0' }; @@ -547,9 +541,7 @@ long SS_Unlink(void *pbUserData, char *pLinkName) } long -SS_VerifyLinkReference(void *pbUserData, - char *pLinkName, - char *pReferenceFileName) +SS_VerifyLinkReference(char *pLinkName, char *pReferenceFileName) { int ret = 0; char path[MAX_PATH] = { '\0' }; @@ -597,11 +589,11 @@ SS_Link(void *pbUserData, char *pLinkName, char *pReferenceFileName) if (ret >= 0) { if (S_ISREG(sbuf.st_mode)) { LOGL(LOG_SSENGINE, " stat->st_mode = regular file, To be deleted and create a LINK \n"); - SS_DeleteFile(pbUserData, sympath); + SS_DeleteFile(sympath); SS_Link(pbUserData, pLinkName, pReferenceFileName); } } - if (SS_VerifyLinkReference(pbUserData, pLinkName + if (SS_VerifyLinkReference(pLinkName , pReferenceFileName) == S_SS_SUCCESS) { return S_SS_SUCCESS; } else { @@ -618,8 +610,7 @@ SS_Link(void *pbUserData, char *pLinkName, char *pReferenceFileName) return S_SS_SUCCESS; } -long SS_GetFileType(void *pbUserData, - char *pLinkName, enumFileType * fileType) +long SS_GetFileType(char *pLinkName, enumFileType * fileType) { int ret = 0; char path[MAX_PATH] = { '\0' }; @@ -1064,10 +1055,7 @@ long SS_SetFileAttributes(const char *ui16pFilePath, } -long SS_CompareFileAttributes(void *pbUserData, - char *pFilePath, - unsigned char *pAdditionalAttribs, - unsigned long iAddiInfoSize) +long SS_CompareFileAttributes(void) { return S_SS_SUCCESS; } @@ -1078,7 +1066,7 @@ long SS_CompareFileAttributes(void *pbUserData, /* vrm functions */ long -SS_GetAvailableFreeSpace(void *pbUserData, const char *partition_name, +SS_GetAvailableFreeSpace(const char *partition_name, SS_UINT32 *available_flash_size) { // *available_flash_size = MAX_INT; @@ -1143,7 +1131,7 @@ void SS_Free(void *pMemBlock) free(pMemBlock); } -SS_UINT32 SS_GetMaxNumProcess(void *user) +SS_UINT32 SS_GetMaxNumProcess(void) { return SAMPLE_PROCS_NUM; } @@ -1176,12 +1164,12 @@ void* SS_WaitForProcess(const void *handle, SS_UINT32* process_exit_code) return (void*)pid; } -unsigned long SS_GetMaxProcRamSize(void *user) +unsigned long SS_GetMaxProcRamSize(void) { return UA_RAM_SIZE; } -void* SS_RunProcess(void *pbUserData, int argc, char* argv[]) +void* SS_RunProcess(void) { pid_t child_pid; diff --git a/ss_engine/SS_FSUpdate.h b/ss_engine/SS_FSUpdate.h index 49eda03..0cc839b 100755 --- a/ss_engine/SS_FSUpdate.h +++ b/ss_engine/SS_FSUpdate.h @@ -50,8 +50,6 @@ extern "C" { * in the old file, if any. Must check if the source file is a symbolic link. * If it is, instead create a new symbolic link using \ref SS_Link. * - * \param pbUserData Optional opaque data-structure to pass to IPL - * functions * \param strFromPath Path to old file * \param strToPath Path to new file * @@ -59,14 +57,12 @@ extern "C" { ******************************************************************************* */ - long SS_CopyFile(void *pbUserData, const char *strFromPath, const char *strToPath); + long SS_CopyFile(const char *strFromPath, const char *strToPath); /*! ******************************************************************************* * Move (rename) file.

* - * \param pbUserData Optional opaque data-structure to pass to IPL - * functions * \param strFromPath Path to old file location * \param strToPath Path to new file location * @@ -74,7 +70,7 @@ extern "C" { ******************************************************************************* */ - long SS_MoveFile(void *pbUserData, const char *strFromPath, const char *strToPath); + long SS_MoveFile(const char *strFromPath, const char *strToPath); /*! ******************************************************************************* @@ -82,8 +78,6 @@ extern "C" { * * Must return success if the file is deleted or didn't exist. * - * \param pbUserData Optional opaque data-structure to pass to IPL - * functions * \param strPath Path to file * * \return S_SS_SUCCESS on success, E_SS_DELETEFILE if the file cannot be @@ -91,7 +85,7 @@ extern "C" { ******************************************************************************* */ - long SS_DeleteFile(void *pbUserData, const char *strPath); + long SS_DeleteFile(const char *strPath); /*! ******************************************************************************* @@ -99,15 +93,13 @@ extern "C" { * * Must return success if the folder is now deleted or didn't exist. * - * \param pbUserData Optional opaque data-structure to pass to IPL - * functions * \param strPath Path to folder * * \return S_SS_SUCCESS on success or an \ref SS_vRM_Errors.h error code ******************************************************************************* */ - long SS_DeleteFolder(void *pbUserData, const char *strPath); + long SS_DeleteFolder(const char *strPath); /*! ******************************************************************************* @@ -117,15 +109,13 @@ extern "C" { * recommended that the new folder's attributes are a copy of its parent's * attributes. * - * \param pbUserData Optional opaque data-structure to pass to IPL - * functions * \param strPath Path to folder * * \return S_SS_SUCCESS on success or an \ref SS_vRM_Errors.h error code ******************************************************************************* */ - long SS_CreateFolder(void *pbUserData, const char *strPath); + long SS_CreateFolder(const char *strPath); /*! ******************************************************************************* @@ -134,8 +124,6 @@ extern "C" { * Must create the the file (and the path to the file) if it doesn't exist. Must * open in binary mode. * - * \param pbUserData Optional opaque data-structure to pass to IPL - * functions * \param strPath Path to file * \param wFlag Read/write mode, an \ref E_RW_TYPE value * \param pwHandle (out) File handle @@ -146,14 +134,12 @@ extern "C" { ******************************************************************************* */ - long SS_OpenFile(void *pbUserData, const char *strPath, E_RW_TYPE wFlag, long *pwHandle); + long SS_OpenFile(const char *strPath, E_RW_TYPE wFlag, long *pwHandle); /*! ******************************************************************************* * Set file size. * - * \param pbUserData Optional opaque data-structure to pass to IPL - * functions * \param wHandle File handle * \param dwSize New file size * @@ -161,21 +147,19 @@ extern "C" { ******************************************************************************* */ - long SS_ResizeFile(void *pbUserData, long wHandle, SS_UINT32 dwSize); + long SS_ResizeFile(long wHandle, SS_UINT32 dwSize); /*! ******************************************************************************* * Close file. * - * \param pbUserData Optional opaque data-structure to pass to IPL - * functions * \param wHandle File handle * * \return S_SS_SUCCESS on success or an \ref SS_vRM_Errors.h error code ******************************************************************************* */ - long SS_CloseFile(void *pbUserData, long wHandle); + long SS_CloseFile(long wHandle); /*! ******************************************************************************* @@ -184,8 +168,6 @@ extern "C" { * Must return success if the block is written or at least resides in * non-volatile memory. Use \ref SS_SyncFile to commit the file to storage. * - * \param pbUserData Optional opaque data-structure to pass to IPL - * functions * \param wHandle File handle * \param dwPosition Position within the file to which to write * \param pbBuffer Data to write @@ -195,7 +177,7 @@ extern "C" { ******************************************************************************* */ - long SS_WriteFile(void *pbUserData, long wHandle, SS_UINT32 dwPosition, unsigned char *pbBuffer, SS_UINT32 dwSize); + long SS_WriteFile(long wHandle, SS_UINT32 dwPosition, unsigned char *pbBuffer, SS_UINT32 dwSize); /*! ******************************************************************************* @@ -203,14 +185,12 @@ extern "C" { * * Generally called after \ref SS_WriteFile. * - * \param pbUserData Optional opaque data-structure to pass to IPL - * functions * \param wHandle File handle * * \return S_SS_SUCCESS on success or an \ref SS_vRM_Errors.h error code ******************************************************************************* */ - long SS_SyncFile(void *pbUserData, long wHandle); + long SS_SyncFile(long wHandle); /*! ******************************************************************************* @@ -218,8 +198,6 @@ extern "C" { * If fewer bytes than requested are available in the specified position, this * function should read up to the end of file and return S_SS_SUCCESS. * - * \param pbUserData Optional opaque data-structure to pass to IPL - * functions * \param wHandle File handle * \param dwPosition Position within the file from which to read * \param pbBuffer Buffer to contain data @@ -229,27 +207,23 @@ extern "C" { ******************************************************************************* */ - long SS_ReadFile(void *pbUserData, long wHandle, SS_UINT32 dwPosition, unsigned char *pbBuffer, SS_UINT32 dwSize); + long SS_ReadFile(long wHandle, SS_UINT32 dwPosition, unsigned char *pbBuffer, SS_UINT32 dwSize); /*! ******************************************************************************* * Get file size. * - * \param pbUserData Optional opaque data-structure to pass to IPL - * functions * \param wHandle File handle * * \return File size, -1 if file not found, or < -1 on error ******************************************************************************* */ - long SS_GetFileSize(void *pbUserData, long wHandle); + long SS_GetFileSize(long wHandle); /*! ******************************************************************************* * Get free space of a mounted file system. * - * \param pbUserData Optional opaque data-structure to pass to - * IPL functions * \param path Name of any directory within the mounted * file system * \param available_flash_size (out) Available space @@ -257,7 +231,7 @@ extern "C" { * \return S_SS_SUCCESS on success or an \ref SS_vRM_Errors.h error code ******************************************************************************* */ - long SS_GetAvailableFreeSpace(void *pbUserData, const char *path, SS_UINT32 * available_flash_size); + long SS_GetAvailableFreeSpace(const char *path, SS_UINT32 * available_flash_size); /*! ******************************************************************************* @@ -268,14 +242,12 @@ extern "C" { * If your platform does not support symbolic links, you do not need to * implement this. * - * \param pbUserData Optional opaque data-structure to pass to IPL - * functions * \param pLinkName Link * * \return S_SS_SUCCESS on success or an \ref SS_vRM_Errors.h error code ******************************************************************************* */ - long SS_Unlink(void *pbUserData, char *pLinkName); + long SS_Unlink(char *pLinkName); /*! ******************************************************************************* @@ -327,8 +299,6 @@ extern "C" { ******************************************************************************* * Print status and debug information. * - * \param pbUserData Optional opaque data-structure to pass to IPL - * functions * \param aFormat A NULL-terminated printf-like string with support for * the following tags: * \li %x: Hex number @@ -340,7 +310,7 @@ extern "C" { * \return S_SS_SUCCESS on success or an \ref SS_vRM_Errors.h error code ******************************************************************************* */ - SS_UINT32 SS_Trace(void *pbUserData, const char *aFormat, ...); + SS_UINT32 SS_Trace(const char *aFormat, ...); /** ******************************************************************************* diff --git a/ss_engine/SS_MultiProcessUpdate.h b/ss_engine/SS_MultiProcessUpdate.h index e0cfa12..825f337 100755 --- a/ss_engine/SS_MultiProcessUpdate.h +++ b/ss_engine/SS_MultiProcessUpdate.h @@ -116,39 +116,28 @@ extern "C" { * The new process must call \ref SS_HandleProcessRequest with the same * arguments. * - * \param user Optional opaque data-structure passed in during - * initialization - * \param argc Number of \a argv arguments - * \param argv Arguments to pass to the new process - * * \return Handle to the new process or NULL on error ******************************************************************************* */ - void *SS_RunProcess(void *user, int argc, char *argv[]); + void *SS_RunProcess(void); /** ******************************************************************************* * Get the maximum number of processes that are allowed to run. * - * \param user Optional opaque data-structure passed in during - * initialization - * * \return The number of allowed processes or 0 if multiple processes are not * allowed ******************************************************************************* */ - SS_UINT32 SS_GetMaxNumProcess(void *user); + SS_UINT32 SS_GetMaxNumProcess(void); /** ******************************************************************************* * Get the maximum available memory for processes to use. * - * \param user Optional opaque data-structure passed in during - * initialization - * * \return The memory amount available for processes or 0 if there is no available memory ******************************************************************************* */ - unsigned long SS_GetMaxProcRamSize(void *user); + unsigned long SS_GetMaxProcRamSize(void); /** ******************************************************************************* diff --git a/ss_engine/SS_PatchDelta.c b/ss_engine/SS_PatchDelta.c index d312d06..1294a09 100755 --- a/ss_engine/SS_PatchDelta.c +++ b/ss_engine/SS_PatchDelta.c @@ -279,7 +279,7 @@ int SS_UpdateDeltaFS(const char *source_filename, const char *target_filename, LOGL(LOG_SSENGINE, "SS_UpdateDeltaFS - Source was currupted, Try loading from backup source\n"); if (SS_LoadFile(SS_BACKUP_SOURCE, &source_file) == 0) { if (memcmp(source_file.sha1, source_sha1, SHA_DIGEST_SIZE) == 0) { - if (SS_CopyFile(NULL, SS_BACKUP_SOURCE, source_filename) != S_SS_SUCCESS) { + if (SS_CopyFile(SS_BACKUP_SOURCE, source_filename) != S_SS_SUCCESS) { strerror_r(errno, buf, sizeof(buf)); LOGE("copy of backup to \"%s\" failed: %s\n", source_filename, buf); SS_SetUpgradeState(E_SS_FSUPDATEFAILED); @@ -333,7 +333,7 @@ int SS_UpdateDeltaFS(const char *source_filename, const char *target_filename, tok = strrchr(source_filename, '/'); *tok = '\0'; } - SS_GetAvailableFreeSpace(NULL, source_filename, &free_space); + SS_GetAvailableFreeSpace(source_filename, &free_space); enough_space = (free_space > (256 << 10)) && // 256k (two-block) minimum (free_space > (patch_data_size * 3 / 2)); // 50% margin of error if (use_backup) @@ -564,11 +564,11 @@ int SS_UpdateDeltaKernel(ua_dataSS_t * ua_dataSS, int (*write_to_blkdev) (char * } } //Cleanup workspace and copy helper executables to it before proceeding - SS_DeleteFolder(NULL, SS_KERNEL_WORKSPACE); + SS_DeleteFolder(SS_KERNEL_WORKSPACE); create_dir(SS_KERNEL_WORKSPACE, 0755); - SS_CopyFile(NULL, SS_GZIP_SOURCE, SS_GZIP_TARGET); - SS_CopyFile(NULL, SS_STAT_SOURCE, SS_STAT_TARGET); - SS_CopyFile(NULL, SS_DD_SOURCE, SS_DD_TARGET); + SS_CopyFile(SS_GZIP_SOURCE, SS_GZIP_TARGET); + SS_CopyFile(SS_STAT_SOURCE, SS_STAT_TARGET); + SS_CopyFile(SS_DD_SOURCE, SS_DD_TARGET); if (tar_get_item_size(ua_dataSS->update_data->ua_delta_path, SS_KERNEL_UNPACK_SCRIPT) > 0) if (tar_extract_file(ua_dataSS->update_data->ua_delta_path, SS_KERNEL_UNPACK_SCRIPT, SS_KERN_UNPK_SCRIPT_PATH) > 0) @@ -755,8 +755,8 @@ int SS_UpdateDeltaKernel(ua_dataSS_t * ua_dataSS, int (*write_to_blkdev) (char * Cleanup: SS_BackupSourceClear(); SS_PatchSourceClear(); - SS_DeleteFile(NULL, SS_KERN_UNPK_SCRIPT_PATH); - SS_DeleteFolder(NULL, SS_KERNEL_WORKSPACE); + SS_DeleteFile(SS_KERN_UNPK_SCRIPT_PATH); + SS_DeleteFolder(SS_KERNEL_WORKSPACE); SS_Free(source_file.data); SS_Free(buf); SS_Free(outname);//wgid: 20740 @@ -907,7 +907,7 @@ int SS_UpdateDeltaIMG(ua_dataSS_t * ua_dataSS, int (*write_to_blkdev) (char *, i result = E_SS_FAILURE; goto Cleanup; } - result = SS_WriteFile(NULL, fd, 0, msi.buffer, msi.size); + result = SS_WriteFile(fd, 0, msi.buffer, msi.size); if (result != S_SS_SUCCESS) { LOGE("failed to write\n"); SS_SetUpgradeState(E_SS_IMGRECOVERYWRITEFAILED); diff --git a/ss_engine/SS_PatchDelta.h b/ss_engine/SS_PatchDelta.h index fd3bb66..d789419 100755 --- a/ss_engine/SS_PatchDelta.h +++ b/ss_engine/SS_PatchDelta.h @@ -62,17 +62,16 @@ int ApplyBSDiffPatchMem(const unsigned char *old_data, ssize_t old_size, int SS_LoadPartition(const char *filename, FileInfo * file); int SS_LoadFile(const char *filename, FileInfo * file); extern void SS_SetUpgradeState(int Val); -extern long SS_GetAvailableFreeSpace(void *pbUserData, const char *partition_name, SS_UINT32 * available_flash_size); +extern long SS_GetAvailableFreeSpace(const char *partition_name, SS_UINT32 * available_flash_size); extern int SS_BackupSource(const char *source_filename); extern int SS_ApplyBsdiff(char *oldfile, char *newfile, char *patch, SinkFn sink, void *token, sha1_ctx_t * ctx1); extern int SS_BackupSourceClear(); extern int SS_PatchSourceClear(); -extern long SS_WriteFile(void *pbUserData, - long wHandle, SS_UINT32 dwPosition, unsigned char *pbBuffer, SS_UINT32 dwSize); +extern long SS_WriteFile(long wHandle, SS_UINT32 dwPosition, unsigned char *pbBuffer, SS_UINT32 dwSize); extern void SS_Free(void * pMemBlock); -extern long SS_CopyFile(void * pbUserData, const char * strFromPath, const char * strToPath); -extern long SS_DeleteFolder(void * pbUserData, const char * strPath); -extern long SS_DeleteFile(void * pbUserData, const char * strPath); +extern long SS_CopyFile(const char * strFromPath, const char * strToPath); +extern long SS_DeleteFolder(const char * strPath); +extern long SS_DeleteFile(const char * strPath); extern int tar_get_item_size(char * tar, char * item); extern int tar_extract_file(char * tar, char * item, char * pathname); extern int _system_cmd_wait(const char * command); diff --git a/ss_engine/SS_UPI.c b/ss_engine/SS_UPI.c index 9dddd56..db19b99 100755 --- a/ss_engine/SS_UPI.c +++ b/ss_engine/SS_UPI.c @@ -124,7 +124,7 @@ static double get_time_stamp2(void) #endif //Check SS function if available -int file_exist(char *filename, int type) +int file_exist(char *filename) { struct stat buf; int ret = 0; @@ -292,8 +292,8 @@ int SS_verify_DELTA_image(char *filename) Cleanup: if (fp) fclose(fp); - if (file_exist(SS_IMAGE_MAGIC_KEY_VAL, 0)) - SS_DeleteFile(NULL, SS_IMAGE_MAGIC_KEY_VAL); + if (file_exist(SS_IMAGE_MAGIC_KEY_VAL)) + SS_DeleteFile(SS_IMAGE_MAGIC_KEY_VAL); return ulResult; } @@ -373,7 +373,7 @@ int SS_rename1(const char *old_file_name, const char *new_file_name) * ********************************************************************************* */ -int SS_FSVerifyNode(const char *ubDeltaPath, const char *path, const char *patchname, const char *sha1src, int type, +int SS_FSVerifyNode(const char *path, const char *patchname, const char *sha1src, int type, char *patchpath_name, int *data_size, int *data_offset) { char patch[MAX_FILE_PATH] = { 0 }; @@ -381,7 +381,7 @@ int SS_FSVerifyNode(const char *ubDeltaPath, const char *path, const char *patch uint8_t source_sha1[SHA_DIGEST_SIZE]; if (gvalid_session) { - if ((type == DIFFS || type == DELETES || type == MOVES) && !file_exist((char *)path, type)) { + if ((type == DIFFS || type == DELETES || type == MOVES) && !file_exist((char *)path)) { LOGE("failed to verifyNodes [does not exist], Path : [%s] Type[%d]\n", path, type); SS_SetUpgradeState(E_SS_FSBADNODES); return E_SS_FAILURE; @@ -467,7 +467,7 @@ int SS_AppendNode(const char *ubDeltaPath, fs_params ** headparam, fs_params ** return E_SS_FAILURE; } if ((E_SS_FAILURE == - SS_FSVerifyNode(ubDeltaPath, old_path, patchname, sha1src, type, patchpath_name, &data_size, &data_offset))) { + SS_FSVerifyNode(old_path, patchname, sha1src, type, patchpath_name, &data_size, &data_offset))) { LOGE("Bad Nodes, Failed to pass verification - [Delta Path - %s][OldPath - %s] [NewPath - %s] \n", ubDeltaPath, old_path, new_path); return E_SS_FAILURE; @@ -1077,7 +1077,7 @@ SYM:NEW:system/lib/firmware/vbc_eq:/opt/system/vbc_eq return fs_head_node; } -void SS_GetPartition_LocDetails(ua_dataSS_t * ua_dataSS, int part_idx) +void SS_GetPartition_LocDetails(ua_dataSS_t * ua_dataSS) { LOGL(LOG_SSENGINE, "PART NAME: [%s] \n", ua_dataSS->parti_info->ua_parti_name); snprintf(ua_dataSS->update_delta->ua_patch_path, MAX_FILE_PATH, "%s", ua_dataSS->parti_info->ua_subject_name); @@ -1286,7 +1286,7 @@ int SS_FSUpdateFile(int ubFileType, ua_dataSS_t * ua_dataSS, int ulPatchCount, f #endif while (pFsNode) { LOGL(LOG_SSENGINE, "MOVES update Index: [%d] \n", ulFileIndex++); - ulResult = SS_MoveFile(NULL, pFsNode->file_old_path, pFsNode->file_new_path); + ulResult = SS_MoveFile(pFsNode->file_old_path, pFsNode->file_new_path); if (ulResult != S_SS_SUCCESS) { LOGE("Move Failed for [%s] to [%s]\n", pFsNode->file_old_path, pFsNode->file_new_path); SS_SetUpgradeState(ulResult); @@ -1312,11 +1312,11 @@ int SS_FSUpdateFile(int ubFileType, ua_dataSS_t * ua_dataSS, int ulPatchCount, f while (pFsNode) { if (pFsNode->type == DELETES) { LOGL(LOG_SSENGINE, "DELETES update Index: [%d] \n", ulFileIndex++); - SS_GetFileType(NULL, pFsNode->file_old_path, (enumFileType *) & ulFiletype); + SS_GetFileType(pFsNode->file_old_path, (enumFileType *) & ulFiletype); if (ulFiletype == 2) //FT_FOLDER - ulResult = SS_DeleteFolder(NULL, pFsNode->file_old_path); + ulResult = SS_DeleteFolder(pFsNode->file_old_path); else - ulResult = SS_DeleteFile(NULL, pFsNode->file_old_path); + ulResult = SS_DeleteFile(pFsNode->file_old_path); if (ulResult != S_SS_SUCCESS) { LOGE("Delete Failed\n"); SS_SetUpgradeState(ulResult); @@ -1343,11 +1343,11 @@ int SS_FSUpdateFile(int ubFileType, ua_dataSS_t * ua_dataSS, int ulPatchCount, f while (pFsNode) { if (pFsNode->type == DELETE_END) { LOGL(LOG_SSENGINE, "DELETES update Index: [%d] \n", ulFileIndex++); - SS_GetFileType(NULL, pFsNode->file_old_path, (enumFileType *) & ulFiletype); + SS_GetFileType(pFsNode->file_old_path, (enumFileType *) & ulFiletype); if (ulFiletype == 2) //FT_FOLDER - ulResult = SS_DeleteFolder(NULL, pFsNode->file_old_path); + ulResult = SS_DeleteFolder(pFsNode->file_old_path); else - ulResult = SS_DeleteFile(NULL, pFsNode->file_old_path); + ulResult = SS_DeleteFile(pFsNode->file_old_path); if (ulResult != S_SS_SUCCESS) { LOGE("Delete Failed\n"); SS_SetUpgradeState(ulResult); @@ -1379,7 +1379,7 @@ int SS_FSUpdateFile(int ubFileType, ua_dataSS_t * ua_dataSS, int ulPatchCount, f LOGL(LOG_SSENGINE, "7zip extraction error for %s\n", ua_dataSS->parti_info->ua_parti_name); else LOGL(LOG_SSENGINE, "tar extraction error for %s\n", ua_dataSS->parti_info->ua_parti_name); - SS_DeleteFile(NULL, SS_NEW_COMPRESSED_FILE); + SS_DeleteFile(SS_NEW_COMPRESSED_FILE); #ifdef TIME_PROFILING get_time_stamp1(); //total time capturing t2 = atoi(ts1); @@ -1396,7 +1396,7 @@ int SS_FSUpdateFile(int ubFileType, ua_dataSS_t * ua_dataSS, int ulPatchCount, f while (pFsNode) { LOGL(LOG_SSENGINE, "SYMDIFFS update Index: [%d] \n", ulFileIndex++); //LOG("Sym Diff file paths: [Linkname - %s] [reference file name- %s][]\n", pFsNode->file_path,pFsNode->patch_name); - ulResult = SS_Unlink(NULL, pFsNode->file_old_path); + ulResult = SS_Unlink(pFsNode->file_old_path); if (ulResult == S_SS_SUCCESS) ulResult = SS_Link(NULL, pFsNode->file_new_path, pFsNode->patch_name); else { @@ -1507,7 +1507,7 @@ int SS_FSUpdatemain(ua_dataSS_t * ua_dataSS, int part_idx) if (!head_ptr_node) return E_SS_FSBADNODES; - SS_GetPartition_LocDetails(ua_dataSS, part_idx); + SS_GetPartition_LocDetails(ua_dataSS); LOGL(LOG_SSENGINE, "FS Update Entry PartIndex: [%d]\n", part_idx); @@ -1650,7 +1650,7 @@ int SS_FSVerifyPartition(ua_dataSS_t * ua_dataSS, int part_idx) LOGL(LOG_SSENGINE, "Enough space for Partition [%s]\n", ua_dataSS->parti_info->ua_parti_name); } - SS_GetAvailableFreeSpace(NULL, SS_COMMON_WORKSPACE, &free_space); + SS_GetAvailableFreeSpace(SS_COMMON_WORKSPACE, &free_space); //Checking for 2 times the file size free space , as delta can be worst case size of file. if ((free_space) < (2 * ua_dataSS->update_cfg->soure_img_size)) { LOGE("Not enough free space [%d] for max size [%d]\n", free_space, (2 * ua_dataSS->update_cfg->soure_img_size)); @@ -1662,7 +1662,7 @@ int SS_FSVerifyPartition(ua_dataSS_t * ua_dataSS, int part_idx) if (!(S_SS_SUCCESS == SS_Do_Memory_Profiling())) return E_SS_FAILURE; #endif - SS_GetPartition_LocDetails(ua_dataSS, 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) @@ -1690,7 +1690,7 @@ int SS_BackupSource(const char *source_filename) int ret = E_SS_FAILURE; if (source_filename) { - ret = (int)SS_CopyFile(NULL, source_filename, SS_BACKUP_SOURCE); + ret = (int)SS_CopyFile(source_filename, SS_BACKUP_SOURCE); if (ret != S_SS_SUCCESS) { LOGE("failed to back up source file Error [%d]\n", ret); SS_SetUpgradeState(E_SS_FSSRCBACKUPFAILED); @@ -1702,7 +1702,7 @@ int SS_BackupSource(const char *source_filename) int SS_BackupSourceClear(void) { int ret = E_SS_FAILURE; - ret = (int)SS_DeleteFile(NULL, SS_BACKUP_SOURCE); + ret = (int)SS_DeleteFile(SS_BACKUP_SOURCE); if (ret != S_SS_SUCCESS) { LOGE("failed to delete BACKUP file\n"); SS_SetUpgradeState(E_SS_FSSRCBACKUPFAILED); @@ -1713,7 +1713,7 @@ int SS_BackupSourceClear(void) int SS_PatchSourceClear(void) { int ret = E_SS_FAILURE; - ret = (int)SS_DeleteFile(NULL, SS_PATCHFILE_SOURCE); + ret = (int)SS_DeleteFile(SS_PATCHFILE_SOURCE); if (ret != S_SS_SUCCESS) { LOGE("failed to delete PATCHFILE file\n"); SS_SetUpgradeState(E_SS_PATCHFILE_DEL_ERROR); @@ -1793,8 +1793,8 @@ int SS_IMGVerifyFullImage(ua_dataSS_t * ua_dataSS) } Cleanup: - if (file_exist(SS_PATCHFILE_SOURCE, 0)) - SS_DeleteFile(NULL, SS_PATCHFILE_SOURCE); + if (file_exist(SS_PATCHFILE_SOURCE)) + SS_DeleteFile(SS_PATCHFILE_SOURCE); return ulResult; } @@ -1813,7 +1813,7 @@ int SS_IMGVerfiyPartition(ua_dataSS_t * ua_dataSS) } //We verify twice the image size for BACKUP source, not on Partition. As Patch will be created on RAM - SS_GetAvailableFreeSpace(NULL, SS_COMMON_WORKSPACE, &free_space); + SS_GetAvailableFreeSpace(SS_COMMON_WORKSPACE, &free_space); if ((free_space) < (2 * ua_dataSS->update_cfg->target_img_size)) { LOGE("Not enough free space [%d] for twice max size [%d]\n", free_space, (2 * ua_dataSS->update_cfg->target_img_size)); @@ -1915,7 +1915,7 @@ int SS_IMGUpdatemain(ua_dataSS_t * ua_dataSS, int update_type) //SS_FSUpdatePar ua_dataSS->ui_progress(ua_dataSS, 40); if (update_type == FULL_IMG && ua_dataSS->update_data->ua_temp_path) - ulResult = SS_MoveFile(ua_dataSS, SS_PATCHFILE_SOURCE, ua_dataSS->update_data->ua_temp_path); + ulResult = SS_MoveFile(SS_PATCHFILE_SOURCE, ua_dataSS->update_data->ua_temp_path); else if ((ua_dataSS->update_cfg->update_type == DELTA_IMG && ua_dataSS->write_data_to_blkdev) || ua_dataSS->update_cfg->update_type == EXTRA) { diff --git a/ss_engine/SS_UPI.h b/ss_engine/SS_UPI.h index 8a4e351..ce91f70 100755 --- a/ss_engine/SS_UPI.h +++ b/ss_engine/SS_UPI.h @@ -81,6 +81,6 @@ extern int SS_UpdateDeltaFS(const char *source_filename, const char *target_file extern int tar_extract_file(char *tar, char *item, char *pathname); extern int _7zdecompress(char *path); extern void tar_free_cfg_table(tar_Data_t ** delta_tar); -extern long SS_GetFileType(void *pbUserData, char *pLinkName, enumFileType * fileType); +extern long SS_GetFileType(char *pLinkName, enumFileType * fileType); #endif //_SS_UPI_H_ diff --git a/ss_engine/fota_tar.c b/ss_engine/fota_tar.c index 362dec5..6f82cec 100755 --- a/ss_engine/fota_tar.c +++ b/ss_engine/fota_tar.c @@ -169,7 +169,7 @@ void create_dir(char *pathname, int mode) } /* Create a file, including parent directory as necessary. */ -static FILE *create_file(char *pathname, int mode) +static FILE *create_file(char *pathname) { FILE *f; f = fopen(pathname, "w+"); @@ -944,7 +944,7 @@ int tar_extract_folder(char *tar, char *item, char *path) //LOG(" Extracting file %s\n", fullname); memset(dirPath, 0, sizeof(dirPath)); snprintf(dirPath, sizeof(dirPath), "%s/%s", path, fullname + folderpathlen); - f = create_file(dirPath, parseoct(fullname + 100, 8)); + f = create_file(dirPath); } }