|
|
|
@@ -103,9 +103,10 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi |
|
|
|
GE_CHK_BOOL_EXEC(WriteData(data, static_cast<uint32_t>(len), fd) == SUCCESS, ret = FAILED, "WriteData FAILED"); |
|
|
|
} while (0); |
|
|
|
// Close file |
|
|
|
if (mmClose(fd) != 0) { // mmClose 0: success |
|
|
|
GELOGE(FAILED, "Close file failed."); |
|
|
|
ret = FAILED; |
|
|
|
auto ret_close = mmClose(fd); |
|
|
|
if (ret_close != EN_OK) { |
|
|
|
GELOGE(FAILED, "Close file failed. mmpa_errorno = %d, %s", ret_close, strerror(errno)); |
|
|
|
return FAILED; |
|
|
|
} |
|
|
|
return ret; |
|
|
|
} |
|
|
|
@@ -140,7 +141,11 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi |
|
|
|
} |
|
|
|
} while (0); |
|
|
|
// Close file |
|
|
|
GE_CHK_BOOL_RET_STATUS(mmClose(fd) == EN_OK, FAILED, "Close file failed."); |
|
|
|
auto ret_close = mmClose(fd); |
|
|
|
if (ret_close != EN_OK) { |
|
|
|
GELOGE(FAILED, "Close file failed. mmpa_errorno = %d, %s", ret_close, strerror(errno)); |
|
|
|
return FAILED; |
|
|
|
} |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
@@ -305,7 +310,7 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi |
|
|
|
// Write partition data |
|
|
|
auto &cur_partition_datas = all_partition_datas[index]; |
|
|
|
for (const auto &partition_data : cur_partition_datas) { |
|
|
|
GELOGI("GC:size[%u]", partition_data.size); |
|
|
|
GELOGI("part_size[%u]", partition_data.size); |
|
|
|
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( |
|
|
|
WriteData(static_cast<const void *>(partition_data.data), partition_data.size, fd) != SUCCESS, ret = FAILED; |
|
|
|
break); |
|
|
|
@@ -313,7 +318,11 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi |
|
|
|
} |
|
|
|
} while (0); |
|
|
|
// Close file |
|
|
|
GE_CHK_BOOL_RET_STATUS(mmClose(fd) == EN_OK, FAILED, "Close file failed."); |
|
|
|
auto ret_close = mmClose(fd); |
|
|
|
if (ret_close != EN_OK) { |
|
|
|
GELOGE(FAILED, "Close file failed. mmpa_errorno = %d, %s", ret_close, strerror(errno)); |
|
|
|
return FAILED; |
|
|
|
} |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
@@ -334,9 +343,10 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::SaveToFile(co |
|
|
|
GE_CHK_BOOL_EXEC(SUCCESS == WriteData(data, (uint32_t)len, fd), ret = FAILED, "WriteData FAILED"); |
|
|
|
|
|
|
|
// Close file |
|
|
|
if (mmClose(fd) != 0) { // mmClose 0: success |
|
|
|
GELOGE(FAILED, "Close file failed."); |
|
|
|
ret = FAILED; |
|
|
|
auto ret_close = mmClose(fd); |
|
|
|
if (ret_close != EN_OK) { |
|
|
|
GELOGE(FAILED, "Close file failed. mmpa_errorno = %d, %s", ret_close, strerror(errno)); |
|
|
|
return FAILED; |
|
|
|
} |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|