[Feature][ZXW-88]merge P50 version

Only Configure: No
Affected branch: master
Affected module: unknown
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: I34667719d9e0e7e29e8e4368848601cde0a48408
diff --git a/ap/app/zte_comm/nvserver/nvserver.c b/ap/app/zte_comm/nvserver/nvserver.c
index bafb391..7644730 100755
--- a/ap/app/zte_comm/nvserver/nvserver.c
+++ b/ap/app/zte_comm/nvserver/nvserver.c
@@ -14,7 +14,8 @@
 #include "nv_typedef.h"
 #include <message.h>
 #ifdef FOTA_AB
-#include "zxic_fota_ab_upgrade.h"
+#include "pub_flags.h"
+#include "flags_api.h"
 #endif
 #ifdef __cplusplus
 extern"C"{
@@ -30,145 +31,148 @@
 file,char*key,char*value);static int nvunset(char*file,char*key);static int 
 nvclear(char*file);static int nvreset(char*file);static int nvcommit(char*file);
 T_NV_NODE*nv_list;int nvserver_main(int argc,char*argv[]){int msgId=
-(0xbcf+3132-0x180b);T_NV_MSG_INFO rcvBuf;T_NV_MSG_RESULT sndBuf;struct msqid_ds 
-msgInfo;prctl(PR_SET_NAME,"\x6e\x76\x73\x65\x72\x76\x65\x72",
-(0x1288+5023-0x2627),(0x1526+2305-0x1e27),(0x10af+1375-0x160e));memset(&rcvBuf,
-(0x1342+863-0x16a1),sizeof(rcvBuf));memset(&sndBuf,(0x1ea7+622-0x2115),sizeof(
-sndBuf));memset(&msgInfo,(0xe22+5489-0x2393),sizeof(msgInfo));msgId=msgget(
-MODULE_ID_NV,IPC_CREAT|(0x1837+1448-0x1c5f));if(-(0x86c+1477-0xe30)==msgId){
-printf(
+(0xa45+6326-0x22fb);T_NV_MSG_INFO rcvBuf;T_NV_MSG_RESULT sndBuf;struct msqid_ds 
+msgInfo;prctl(PR_SET_NAME,"\x6e\x76\x73\x65\x72\x76\x65\x72",(0x1bbd+671-0x1e5c)
+,(0xaed+2394-0x1447),(0x142c+2161-0x1c9d));memset(&rcvBuf,(0x1858+1369-0x1db1),
+sizeof(rcvBuf));memset(&sndBuf,(0x1dc4+1865-0x250d),sizeof(sndBuf));memset(&
+msgInfo,(0x1b27+400-0x1cb7),sizeof(msgInfo));msgId=msgget(MODULE_ID_NV,IPC_CREAT
+|(0x360+1470-0x79e));if(-(0x1c73+2047-0x2471)==msgId){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x20\x6d\x73\x67\x67\x65\x74\x20\x6d\x73\x67\x49\x64\x20\x66\x61\x69\x6c\x2c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64" "\n"
-,errno);return-(0x4bc+8531-0x260e);}if(-(0xb3+7137-0x1c93)!=msgctl(msgId,
-IPC_STAT,&msgInfo)){msgInfo.msg_qbytes=262144;if(-(0x30a+4585-0x14f2)==msgctl(
-msgId,IPC_SET,&msgInfo))printf(
+,errno);return-(0xfe6+5484-0x2551);}if(-(0xb+711-0x2d1)!=msgctl(msgId,IPC_STAT,&
+msgInfo)){msgInfo.msg_qbytes=262144;if(-(0x585+5019-0x191f)==msgctl(msgId,
+IPC_SET,&msgInfo))printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x20\x6d\x73\x67\x63\x74\x6c\x20\x6d\x73\x67\x49\x64\x20\x66\x61\x69\x6c\x2c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64" "\n"
-,errno);}if(nvDirInit()!=(0x193+7308-0x1e1f)){printf(
+,errno);}if(nvDirInit()!=(0xab2+109-0xb1f)){printf(
 "\x6e\x76\x44\x69\x72\x49\x6e\x69\x74\x20\x66\x61\x69\x6c\x65\x21" "\n");return-
-(0x9bc+1602-0xffd);}nvConfig();nvInit();while((0x1e51+613-0x20b5)){if(-
-(0x312+7393-0x1ff2)==msgrcv(msgId,&rcvBuf,sizeof(T_NV_MSG_INFO)-sizeof(long),
-MSG_TYPE_NV,(0x1197+4387-0x22ba))){printf(
+(0x6a0+1792-0xd9f);}nvConfig();nvInit();while((0x1015+968-0x13dc)){if(-
+(0x195f+2189-0x21eb)==msgrcv(msgId,&rcvBuf,sizeof(T_NV_MSG_INFO)-sizeof(long),
+MSG_TYPE_NV,(0x180b+3551-0x25ea))){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x20\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6d\x73\x67\x72\x63\x76\x20\x66\x61\x69\x6c\x2c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64\x21" "\n"
-,errno);continue;}analyMsg(&rcvBuf,&sndBuf);if(-(0x8e0+3234-0x1581)==msgsnd(
-msgId,&sndBuf,sizeof(T_NV_MSG_RESULT)-sizeof(long),(0x1643+201-0x170c))){printf(
+,errno);continue;}analyMsg(&rcvBuf,&sndBuf);if(-(0xc0b+6174-0x2428)==msgsnd(
+msgId,&sndBuf,sizeof(T_NV_MSG_RESULT)-sizeof(long),(0x70+2788-0xb54))){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x20\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6d\x73\x67\x73\x6e\x64\x20\x66\x61\x69\x6c\x2c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64\x21" "\n"
-,errno);continue;}}return((0x1b99+1384-0x2101));}static void configdir(char*dir)
-{DIR*dp;int ret;struct dirent*entry;struct stat statbuf;if((dp=opendir(dir))==
+,errno);continue;}}return((0x4dc+2279-0xdc3));}static void configdir(char*dir){
+DIR*dp;int ret;struct dirent*entry;struct stat statbuf;if((dp=opendir(dir))==
 NULL){fprintf(stderr,
 "\x63\x61\x6e\x6e\x6f\x74\x20\x6f\x70\x65\x6e\x20\x64\x69\x72\x65\x63\x74\x6f\x72\x79\x3a\x20\x25\x73" "\n"
 ,dir);return;}chdir(dir);while((entry=readdir(dp))!=NULL){ret=lstat(entry->
-d_name,&statbuf);if(ret<(0x1294+4731-0x250f)){fprintf(stderr,
+d_name,&statbuf);if(ret<(0xfd6+3411-0x1d29)){fprintf(stderr,
 "\x6c\x73\x74\x61\x74\x20\x65\x72\x72\x6f\x72\x3a\x20\x25\x73" "\n",strerror(
 errno));chdir("\x2e\x2e");closedir(dp);return;}if(!S_ISDIR(statbuf.st_mode)){if(
-strcmp("\x2e",entry->d_name)==(0x22ec+961-0x26ad)||strcmp("\x2e\x2e",entry->
-d_name)==(0x97f+5608-0x1f67))continue;if(!isNvConfiged(entry->d_name)){if(
+strcmp("\x2e",entry->d_name)==(0x6fb+3061-0x12f0)||strcmp("\x2e\x2e",entry->
+d_name)==(0x22b+4542-0x13e9))continue;if(!isNvConfiged(entry->d_name)){if(
 addConfigFile(entry->d_name,NULL)!=RESULT_SUCCESS)printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x63\x6f\x6e\x66\x69\x67\x20\x25\x73\x20\x65\x72\x72\x6f\x72\x21" "\n"
 ,entry->d_name);}}}chdir("\x2e\x2e");closedir(dp);}static void nvConfig(){char*
-val=NULL;FILE*fp=NULL;char buf[NV_MAX_CONFIG_LEN]={(0x4e2+6383-0x1dd1)};fp=fopen
-(NV_CONFIG_FILE,"\x72\x6f");if(!fp){printf(
+val=NULL;FILE*fp=NULL;char buf[NV_MAX_CONFIG_LEN]={(0x10f1+3423-0x1e50)};fp=
+fopen(NV_CONFIG_FILE,"\x72\x6f");if(!fp){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x6f\x70\x65\x6e\x20\x25\x73\x20\x66\x69\x6c\x65\x20\x66\x61\x69\x6c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64\x21" "\n"
 ,NV_CONFIG_FILE,errno);return;}while(fgets(buf,NV_MAX_CONFIG_LEN,fp)){if(buf[
-(0xbe8+1358-0x1136)]=='\n'||buf[(0x962+1248-0xe42)]==((char)(0x982+5121-0x1d60))
-)continue;val=strchr(buf,((char)(0xb7+5106-0x146c)));if(!val){printf(
+(0xdd+4634-0x12f7)]=='\n'||buf[(0x140a+4479-0x2589)]==
+((char)(0xf20+5352-0x23e5)))continue;val=strchr(buf,((char)(0x51+5420-0x1540)));
+if(!val){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x25\x73\x20\x66\x69\x6c\x65\x20\x66\x6f\x72\x6d\x61\x74\x20\x65\x72\x72\x6f\x72\x3a\x20\x73\x74\x72\x20\x3d\x20\x25\x73\x21" "\n"
-,NV_CONFIG_FILE,buf);continue;}buf[strlen(buf)-(0x17b6+1612-0x1e01)]='\0';*val++
-='\0';if(!isCfgConfiged(buf)){if(addConfigFile(val,buf)!=RESULT_SUCCESS)printf(
+,NV_CONFIG_FILE,buf);continue;}buf[strlen(buf)-(0xc70+5408-0x218f)]='\0';*val++=
+'\0';if(!isCfgConfiged(buf)){if(addConfigFile(val,buf)!=RESULT_SUCCESS)printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x63\x6f\x6e\x66\x69\x67\x20\x25\x73\x20\x65\x72\x72\x6f\x72\x21" "\n"
 ,buf);}}fclose(fp);configdir(NV_FS_MAIN_PATH);}static int nvDirInit(){if(access(
-NV_FS_PATH,F_OK)!=(0x96+2717-0xb33)){if(mkdir(NV_FS_PATH,(0x541+7294-0x1fd2))!=
-(0xdb3+1109-0x1208)){printf(
+NV_FS_PATH,F_OK)!=(0x8af+2781-0x138c)){if(mkdir(NV_FS_PATH,(0xa6c+485-0xa64))!=
+(0x1131+1304-0x1649)){printf(
 "\x6e\x65\x72\x76\x65\x72\x20\x6d\x6b\x64\x69\x72\x20\x25\x73\x20\x66\x61\x6c\x69\x2c\x65\x72\x72\x6e\x6f\x3d\x25\x64" "\n"
-,NV_FS_PATH,errno);return-(0x202a+1643-0x2694);}if(mkdir(NV_FS_MAIN_PATH,
-(0x7eb+5252-0x1a82))!=(0x5af+4090-0x15a9)){printf(
+,NV_FS_PATH,errno);return-(0x571+961-0x931);}if(mkdir(NV_FS_MAIN_PATH,
+(0x4e6+1099-0x744))!=(0xc7+7296-0x1d47)){printf(
 "\x6e\x65\x72\x76\x65\x72\x20\x6d\x6b\x64\x69\x72\x20\x25\x73\x20\x66\x61\x6c\x69\x2c\x65\x72\x72\x6e\x6f\x3d\x25\x64" "\n"
-,NV_FS_MAIN_PATH,errno);return-(0x1bda+2498-0x259b);}if(mkdir(NV_FS_BACKUP_PATH,
-(0x1d3a+2893-0x269a))!=(0x48+4657-0x1279)){printf(
+,NV_FS_MAIN_PATH,errno);return-(0x66c+2334-0xf89);}if(mkdir(NV_FS_BACKUP_PATH,
+(0x357+6778-0x1be4))!=(0xdec+249-0xee5)){printf(
 "\x6e\x65\x72\x76\x65\x72\x20\x6d\x6b\x64\x69\x72\x20\x25\x73\x20\x66\x61\x6c\x69\x2c\x65\x72\x72\x6e\x6f\x3d\x25\x64" "\n"
-,NV_FS_BACKUP_PATH,errno);return-(0x1366+4000-0x2305);}}else{if(access(
-NV_FS_MAIN_PATH,F_OK)!=(0x140d+2932-0x1f81)){if(mkdir(NV_FS_MAIN_PATH,
-(0xbd3+3999-0x1985))!=(0x173b+3553-0x251c)){printf(
+,NV_FS_BACKUP_PATH,errno);return-(0x644+1897-0xdac);}}else{if(access(
+NV_FS_MAIN_PATH,F_OK)!=(0xa0c+5186-0x1e4e)){if(mkdir(NV_FS_MAIN_PATH,
+(0x6b4+6122-0x1cb1))!=(0x407+558-0x635)){printf(
 "\x6e\x65\x72\x76\x65\x72\x20\x6d\x6b\x64\x69\x72\x20\x25\x73\x20\x66\x61\x6c\x69\x2c\x65\x72\x72\x6e\x6f\x3d\x25\x64" "\n"
-,NV_FS_MAIN_PATH,errno);return-(0x38d+7953-0x229d);}}if(access(NV_FS_BACKUP_PATH
-,F_OK)!=(0x952+6362-0x222c)){if(mkdir(NV_FS_BACKUP_PATH,(0x2089+616-0x2104))!=
-(0x28a+8367-0x2339)){printf(
+,NV_FS_MAIN_PATH,errno);return-(0x1ef7+377-0x206f);}}if(access(NV_FS_BACKUP_PATH
+,F_OK)!=(0x168f+3216-0x231f)){if(mkdir(NV_FS_BACKUP_PATH,(0x1f25+1379-0x229b))!=
+(0x13fc+2308-0x1d00)){printf(
 "\x6e\x65\x72\x76\x65\x72\x20\x6d\x6b\x64\x69\x72\x20\x25\x73\x20\x66\x61\x6c\x69\x2c\x65\x72\x72\x6e\x6f\x3d\x25\x64" "\n"
-,NV_FS_BACKUP_PATH,errno);return-(0x18e5+1427-0x1e77);}}}return
-(0x465+7647-0x2244);}static void nvInit(){T_NV_NODE*list=NULL;char nvMainFile[
-NV_PATH_LEN]={(0x11d3+1068-0x15ff)};char nvBackupFile[NV_PATH_LEN]={
-(0x595+3941-0x14fa)};for(list=nv_list;list;list=list->next){snprintf(nvMainFile,
-NV_PATH_LEN,"\x25\x73\x2f\x25\x73",NV_FS_MAIN_PATH,list->nvFile);snprintf(
-nvBackupFile,NV_PATH_LEN,"\x25\x73\x2f\x25\x73",NV_FS_BACKUP_PATH,list->nvFile);
-if(checkNvFs(nvMainFile)){if(!checkNvFs(nvBackupFile))restoreNvFs(nvBackupFile,
-nvMainFile);}else if(checkNvFs(nvBackupFile)){restoreNvFs(nvMainFile,
-nvBackupFile);}else{loadFactroyParam(list);nvcommit(list->nvFile);continue;}
-loadNvFs(list->nvFile);if(!strcmp(list->nvFile,NV_CFG)&&get_update_status()==
-(0xe7a+3991-0x1e0f)){reloadFactroyParam(list);delete_not_needed(list);nvcommit(
-list->nvFile);
+,NV_FS_BACKUP_PATH,errno);return-(0x4a+8057-0x1fc2);}}}return(0xb8+863-0x417);}
+static void nvInit(){T_NV_NODE*list=NULL;char nvMainFile[NV_PATH_LEN]={
+(0x101f+5190-0x2465)};char nvBackupFile[NV_PATH_LEN]={(0xa23+5220-0x1e87)};
 #ifdef FOTA_AB
-dual_AB_set_fota_status_for_nv((0x427+7830-0x22bd));
+T_FLAGS_INFO flags_info={(0xb63+2651-0x15be)};int ret=(0x7df+2822-0x12e5);
 #endif
-}}}uint hash(const char*s){uint hash=(0xf22+439-0x10d9);while(*s){hash=
+for(list=nv_list;list;list=list->next){snprintf(nvMainFile,NV_PATH_LEN,
+"\x25\x73\x2f\x25\x73",NV_FS_MAIN_PATH,list->nvFile);snprintf(nvBackupFile,
+NV_PATH_LEN,"\x25\x73\x2f\x25\x73",NV_FS_BACKUP_PATH,list->nvFile);if(checkNvFs(
+nvMainFile)){if(!checkNvFs(nvBackupFile))restoreNvFs(nvBackupFile,nvMainFile);}
+else if(checkNvFs(nvBackupFile)){restoreNvFs(nvMainFile,nvBackupFile);}else{
+loadFactroyParam(list);nvcommit(list->nvFile);continue;}loadNvFs(list->nvFile);
+if(!strcmp(list->nvFile,NV_CFG)&&get_update_status()==(0x1c8f+1353-0x21d6)){
+reloadFactroyParam(list);delete_not_needed(list);nvcommit(list->nvFile);
+#ifdef FOTA_AB
+ret=flags_get(&flags_info);flags_info.boot_fota_flag.fota_status=
+(0xd66+5151-0x2185);ret=flags_set(&flags_info);
+#endif
+}}}uint hash(const char*s){uint hash=(0x637+6165-0x1e4c);while(*s){hash=
 NV_HASH_MUL*hash+*s++;}return hash;}static int loadFactroyParam(T_NV_NODE*list){
 char*val=NULL;FILE*fp=NULL;T_NV_CONFIG*config=NULL;char buf[NV_MAX_ITEM_LEN]={
-(0x13af+560-0x15df)};for(config=list->fileList;config;config=config->next){fp=
+(0xda4+5954-0x24e6)};for(config=list->fileList;config;config=config->next){fp=
 fopen(config->configFile,"\x72\x6f");if(!fp){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x6f\x70\x65\x6e\x20\x25\x73\x20\x66\x69\x6c\x65\x20\x66\x61\x69\x6c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64\x21" "\n"
 ,config->configFile,errno);return RESULT_FILE_OPEN_FAIL;}while(fgets(buf,
-NV_MAX_ITEM_LEN,fp)){if(buf[(0xd07+2175-0x1586)]=='\n'||buf[(0x10dd+2946-0x1c5f)
-]==((char)(0xe0f+5201-0x223d)))continue;val=strchr(buf,
-((char)(0x99c+3118-0x158d)));if(!val){printf(
+NV_MAX_ITEM_LEN,fp)){if(buf[(0xe37+5509-0x23bc)]=='\n'||buf[(0x89b+5941-0x1fd0)]
+==((char)(0x18c5+2145-0x2103)))continue;val=strchr(buf,
+((char)(0x320+3965-0x1260)));if(!val){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x25\x73\x20\x66\x69\x6c\x65\x20\x66\x6f\x72\x6d\x61\x74\x20\x65\x72\x72\x6f\x72\x3a\x73\x74\x72\x69\x6e\x67\x20\x3d\x20\x25\x73" "\n"
-,config->configFile,buf);continue;}if(buf[strlen(buf)-(0x1679+1250-0x1b5a)]==
-'\n')buf[strlen(buf)-(0x1267+321-0x13a7)]='\0';*val++='\0';nvset(list->nvFile,
-buf,val,(0x7d8+1773-0xec4));}printf(
+,config->configFile,buf);continue;}if(buf[strlen(buf)-(0x19ad+2520-0x2384)]==
+'\n')buf[strlen(buf)-(0x1fc+875-0x566)]='\0';*val++='\0';nvset(list->nvFile,buf,
+val,(0x13f5+24-0x140c));}printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6c\x6f\x61\x64\x46\x61\x63\x74\x72\x6f\x79\x50\x61\x72\x61\x6d\x20\x25\x73\x21" "\n"
 ,config->configFile);fclose(fp);}return RESULT_SUCCESS;}static bool checkNvFs(
-char*file){int len=(0x942+1170-0xdd4);int cnt=(0x17aa+1648-0x1e1a);FILE*fp=NULL;
-char*buf=NULL;struct stat statbuff={(0x20a+8437-0x22ff)};if(stat(file,&statbuff)
-<(0x74d+6896-0x223d))return false;len=statbuff.st_size;if(len<NV_CHECK_SIZE)
+char*file){int len=(0x59c+1074-0x9ce);int cnt=(0xd16+168-0xdbe);FILE*fp=NULL;
+char*buf=NULL;struct stat statbuff={(0x14ea+4058-0x24c4)};if(stat(file,&statbuff
+)<(0x46a+8107-0x2415))return false;len=statbuff.st_size;if(len<NV_CHECK_SIZE)
 return false;fp=fopen(file,"\x72\x6f");if(!fp)return false;buf=(char*)malloc(len
-);if(!buf){fclose(fp);return false;}cnt=(0x1ae6+606-0x1d44);while(cnt<len){cnt=
-cnt+fread(buf+cnt,(0xd4a+4244-0x1ddd),len-cnt,fp);if(ferror(fp)){clearerr(fp);
+);if(!buf){fclose(fp);return false;}cnt=(0xa89+5585-0x205a);while(cnt<len){cnt=
+cnt+fread(buf+cnt,(0x1a84+1515-0x206e),len-cnt,fp);if(ferror(fp)){clearerr(fp);
 free(buf);fclose(fp);return false;}}if(len!=cnt){free(buf);fclose(fp);return 
 false;}if(getSum(buf,len-NV_CHECK_SIZE)+NV_FILE_FLAG!=*(uint*)(buf+len-
 NV_CHECK_SIZE)){free(buf);fclose(fp);return false;}free(buf);fclose(fp);return 
 true;}static int copyfile(const char*from,const char*to){int fd_to;int fd_from;
-char buf[(0x12d1+2121-0xb1a)];ssize_t nread;int ret=-(0x15cb+2856-0x20f2);
-fd_from=open(from,O_RDONLY);if(fd_from<(0xf0c+4428-0x2058))return-
-(0x5b9+4654-0x17e5);fd_to=open(to,O_RDWR|O_CREAT|O_TRUNC|O_SYNC,
-(0xe35+4298-0x1d5f));if(fd_to<(0x1609+4181-0x265e)){ret=-(0xbaa+4678-0x1ded);
-goto out_error;}while((0xab5+436-0xc68)){char*out_ptr;ssize_t nwritten;nread=
-read(fd_from,buf,sizeof(buf));if(nread==(0x32c+2809-0xe25)){break;}else{if(nread
-<(0x17+6967-0x1b4e)){if(errno==EINTR||errno==EAGAIN){continue;}else{ret=-
-(0x88c+4026-0x1842);goto out_error;}}}out_ptr=buf;do{nwritten=write(fd_to,
-out_ptr,nread);if(nwritten>(0x452+6890-0x1f3c)){nread-=nwritten;out_ptr+=
-nwritten;}else{if(nwritten<(0x1f6f+130-0x1ff1)){if(errno==EINTR||errno==EAGAIN){
-continue;}else{ret=-(0x1033+160-0x10ce);goto out_error;}}}}while(nread>
-(0xaad+5676-0x20d9));}ret=fsync(fd_to);if(ret<(0x9e3+6117-0x21c8)){printf(
+char buf[(0x191f+4976-0x1c8f)];ssize_t nread;int ret=-(0x186f+457-0x1a37);
+fd_from=open(from,O_RDONLY);if(fd_from<(0xe1c+1109-0x1271))return-
+(0xec8+5950-0x2604);fd_to=open(to,O_RDWR|O_CREAT|O_TRUNC|O_SYNC,
+(0x422+8380-0x233e));if(fd_to<(0x18f+7237-0x1dd4)){ret=-(0x1fcd+1080-0x2402);
+goto out_error;}while((0x100+1817-0x818)){char*out_ptr;ssize_t nwritten;nread=
+read(fd_from,buf,sizeof(buf));if(nread==(0x137c+4147-0x23af)){break;}else{if(
+nread<(0xa05+1313-0xf26)){if(errno==EINTR||errno==EAGAIN){continue;}else{ret=-
+(0x18ad+1614-0x1ef7);goto out_error;}}}out_ptr=buf;do{nwritten=write(fd_to,
+out_ptr,nread);if(nwritten>(0x23a+5946-0x1974)){nread-=nwritten;out_ptr+=
+nwritten;}else{if(nwritten<(0x50a+6862-0x1fd8)){if(errno==EINTR||errno==EAGAIN){
+continue;}else{ret=-(0x2c+261-0x12c);goto out_error;}}}}while(nread>
+(0x11a4+215-0x127b));}ret=fsync(fd_to);if(ret<(0x497+4869-0x179c)){printf(
 "\x53\x79\x6e\x63\x20\x46\x61\x69\x6c\x65\x64\x3a\x25\x73\x2c\x20\x66\x69\x6c\x65\x20\x70\x61\x74\x68\x3a\x25\x73"
-,strerror(errno),to);goto out_error;}if(close(fd_to)<(0xcd5+2193-0x1566)){fd_to=
--(0x4dc+5175-0x1912);ret=-(0x156a+2827-0x206f);goto out_error;}close(fd_from);
-return(0x1025+16-0x1035);out_error:printf(
+,strerror(errno),to);goto out_error;}if(close(fd_to)<(0x1651+894-0x19cf)){fd_to=
+-(0x6bb+7641-0x2493);ret=-(0xafd+3211-0x1782);goto out_error;}close(fd_from);
+return(0xb0a+2985-0x16b3);out_error:printf(
 "\x63\x6f\x70\x79\x66\x69\x6c\x65\x20\x25\x73\x20\x74\x6f\x20\x25\x73\x20\x65\x72\x72\x6f\x72\x3a\x25\x64" "\n"
-,from,to,ret);close(fd_from);if(fd_to>=(0x2d0+5093-0x16b5))close(fd_to);return 
+,from,to,ret);close(fd_from);if(fd_to>=(0xfbc+5369-0x24b5))close(fd_to);return 
 ret;}static int restoreNvFs(char*dstFile,char*srcFile){if(copyfile(srcFile,
-dstFile)!=(0x2008+226-0x20ea))return RESULT_FAIL;return RESULT_SUCCESS;}static 
-int loadNvFs(char*file){int len=(0x4ba+7636-0x228e);int cnt=(0x57f+3363-0x12a2);
-FILE*fp=NULL;char*buf=NULL;char*name=NULL;char*value=NULL;char*eq=NULL;struct 
-stat statbuff={(0x92b+4766-0x1bc9)};char nvFile[NV_PATH_LEN]={(0x5af+1084-0x9eb)
-};sprintf(nvFile,"\x25\x73\x2f\x25\x73",NV_FS_MAIN_PATH,file);if(stat(nvFile,&
-statbuff)<(0x1225+2211-0x1ac8))return RESULT_FAIL;len=statbuff.st_size;if(
+dstFile)!=(0xf37+3371-0x1c62))return RESULT_FAIL;return RESULT_SUCCESS;}static 
+int loadNvFs(char*file){int len=(0xb2+893-0x42f);int cnt=(0x11c+569-0x355);FILE*
+fp=NULL;char*buf=NULL;char*name=NULL;char*value=NULL;char*eq=NULL;struct stat 
+statbuff={(0x8e8+552-0xb10)};char nvFile[NV_PATH_LEN]={(0x1a7a+493-0x1c67)};
+sprintf(nvFile,"\x25\x73\x2f\x25\x73",NV_FS_MAIN_PATH,file);if(stat(nvFile,&
+statbuff)<(0x2b9+8744-0x24e1))return RESULT_FAIL;len=statbuff.st_size;if(
 NV_CHECK_SIZE>len)return RESULT_FAIL;fp=fopen(nvFile,"\x72\x6f");if(!fp)return 
 RESULT_FILE_OPEN_FAIL;len=len-NV_CHECK_SIZE;buf=(char*)malloc(len+
-(0xe6d+2069-0x1681));if(!buf){fclose(fp);return RESULT_MALLOC_FAIL;}memset(buf,
-(0x60a+7514-0x2364),len+(0x35c+1903-0xaca));cnt=(0x18c1+723-0x1b94);while(cnt<
-len){cnt=cnt+fread(buf+cnt,(0xb44+5102-0x1f31),len-cnt,fp);if(ferror(fp)){
+(0x4ec+2144-0xd4b));if(!buf){fclose(fp);return RESULT_MALLOC_FAIL;}memset(buf,
+(0xff1+5628-0x25ed),len+(0x3a8+3822-0x1295));cnt=(0x846+4747-0x1ad1);while(cnt<
+len){cnt=cnt+fread(buf+cnt,(0x1d25+1586-0x2356),len-cnt,fp);if(ferror(fp)){
 clearerr(fp);fclose(fp);free(buf);return RESULT_FILE_READ_FAIL;}}if(cnt!=len){
 fclose(fp);free(buf);return RESULT_FILE_READ_FAIL;}buf[len]='\0';name=buf;while(
-*name){if(!(eq=strchr(name,((char)(0x18c1+550-0x1aaa))))){break;}*eq='\0';value=
-eq+(0x1bf0+2740-0x26a3);nvset(file,name,value,(0x95a+4190-0x19b7));*eq=
-((char)(0x1458+1395-0x198e));name=value+strlen(value)+(0x1a27+2930-0x2598);}free
-(buf);fclose(fp);return RESULT_SUCCESS;}static void analyMsg(T_NV_MSG_INFO*
+*name){if(!(eq=strchr(name,((char)(0xb15+5901-0x21e5))))){break;}*eq='\0';value=
+eq+(0x726+7250-0x2377);nvset(file,name,value,(0x2359+401-0x24e9));*eq=
+((char)(0x10dd+3642-0x1eda));name=value+strlen(value)+(0xc4a+3029-0x181e);}free(
+buf);fclose(fp);return RESULT_SUCCESS;}static void analyMsg(T_NV_MSG_INFO*
 msgrecv,T_NV_MSG_RESULT*msgsnd){switch(msgrecv->nvType){case MSG_GET:msgsnd->
 result=nvget(msgrecv->file,msgrecv->key,msgsnd->value);break;case MSG_SET:msgsnd
 ->result=nvset(msgrecv->file,msgrecv->key,msgrecv->value,msgrecv->saveflag);
@@ -183,100 +187,100 @@
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x20\x70\x61\x72\x61\x6d\x20\x69\x6c\x6c\x65\x67\x61\x6c\x21" "\n"
 );return RESULT_INVAL;}if(configFile){newConfig=(T_NV_CONFIG*)malloc(sizeof(
 T_NV_CONFIG));if(!newConfig)return RESULT_MALLOC_FAIL;strncpy(newConfig->
-configFile,configFile,NV_PATH_LEN-(0xc4b+1299-0x115d));newConfig->configFile[
-NV_PATH_LEN-(0xe3d+3313-0x1b2d)]='\0';newConfig->next=NULL;}for(list=nv_list;
-list;list=list->next){if(strcmp(list->nvFile,nvFile)==(0x674+3934-0x15d2))break;
+configFile,configFile,NV_PATH_LEN-(0x289+6736-0x1cd8));newConfig->configFile[
+NV_PATH_LEN-(0x3c8+4008-0x136f)]='\0';newConfig->next=NULL;}for(list=nv_list;
+list;list=list->next){if(strcmp(list->nvFile,nvFile)==(0x15e2+729-0x18bb))break;
 }if(!list){newList=(T_NV_NODE*)malloc(sizeof(T_NV_NODE));if(!newList){if(
 newConfig)free(newConfig);return RESULT_MALLOC_FAIL;}newList->next=NULL;strncpy(
-newList->nvFile,nvFile,NV_PATH_LEN-(0x764+6527-0x20e2));newList->nvFile[
-NV_PATH_LEN-(0x6f5+6917-0x21f9)]='\0';memset(newList->nvTable,
-(0xf21+5584-0x24f1),NV_HASH_LEN*(0x19b0+758-0x1ca2));newList->fileList=newConfig
-;if(!nv_list)nv_list=newList;else{newList->next=nv_list->next;nv_list->next=
-newList;}}else if(!list->fileList)list->fileList=newConfig;else{if(newConfig==
-NULL)return RESULT_FAIL;newConfig->next=list->fileList->next;list->fileList->
-next=newConfig;}return RESULT_SUCCESS;}static bool isCfgConfiged(char*configFile
-){T_NV_NODE*list=NULL;T_NV_CONFIG*config=NULL;for(list=nv_list;list;list=list->
-next){for(config=list->fileList;config;config=config->next){if(!strcmp(config->
-configFile,configFile))return true;}}return false;}static bool isNvConfiged(char
-*nvFile){T_NV_NODE*list=NULL;for(list=nv_list;list;list=list->next){if(!strcmp(
-list->nvFile,nvFile))return true;}return false;}static uint getSum(const char*s,
-int len){uint sum=(0x122c+4412-0x2368);char*data=(char*)s;while(len-- >
-(0xe55+5822-0x2513)){sum+=(*data++);}return sum;}static int saveNvFs(char*nvName
-,char*nvFile){int i=(0x1014+15-0x1023);int sum=(0x1a66+267-0x1b71);int bufSize=
-(0x120+8267-0x216b);int itemSize=(0x1cf9+2208-0x2599);int ret=
-(0x33b+4287-0x13fa);int fp=(0x235+749-0x522);char*buf=NULL;T_NV_NODE*list=NULL;
-T_NV_ITEM*item=NULL;for(list=nv_list;list;list=list->next){if(strcmp(list->
+newList->nvFile,nvFile,NV_PATH_LEN-(0x1aad+2851-0x25cf));newList->nvFile[
+NV_PATH_LEN-(0xbf8+185-0xcb0)]='\0';memset(newList->nvTable,(0x884+7104-0x2444),
+NV_HASH_LEN*(0x1507+3329-0x2204));newList->fileList=newConfig;if(!nv_list)
+nv_list=newList;else{newList->next=nv_list->next;nv_list->next=newList;}}else if
+(!list->fileList)list->fileList=newConfig;else{if(newConfig==NULL)return 
+RESULT_FAIL;newConfig->next=list->fileList->next;list->fileList->next=newConfig;
+}return RESULT_SUCCESS;}static bool isCfgConfiged(char*configFile){T_NV_NODE*
+list=NULL;T_NV_CONFIG*config=NULL;for(list=nv_list;list;list=list->next){for(
+config=list->fileList;config;config=config->next){if(!strcmp(config->configFile,
+configFile))return true;}}return false;}static bool isNvConfiged(char*nvFile){
+T_NV_NODE*list=NULL;for(list=nv_list;list;list=list->next){if(!strcmp(list->
+nvFile,nvFile))return true;}return false;}static uint getSum(const char*s,int 
+len){uint sum=(0xfeb+5059-0x23ae);char*data=(char*)s;while(len-- >
+(0x114+3514-0xece)){sum+=(*data++);}return sum;}static int saveNvFs(char*nvName,
+char*nvFile){int i=(0xeb9+5391-0x23c8);int sum=(0x22a2+109-0x230f);int bufSize=
+(0x19e1+2874-0x251b);int itemSize=(0x1365+3673-0x21be);int ret=
+(0x66c+4700-0x18c8);int fp=(0x1180+3346-0x1e92);char*buf=NULL;T_NV_NODE*list=
+NULL;T_NV_ITEM*item=NULL;for(list=nv_list;list;list=list->next){if(strcmp(list->
 nvFile,nvName))continue;fp=open(nvFile,O_SYNC|O_RDWR|O_CREAT|O_TRUNC,
-(0x4fb+5219-0x17be));if(fp==-(0x1c63+1855-0x23a1)){printf(
+(0xf23+6534-0x2709));if(fp==-(0x313+27-0x32d)){printf(
 "\x6f\x70\x65\x6e\x20\x25\x73\x20\x66\x61\x69\x6c\x2c\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64" "\n"
 ,nvFile,errno);return RESULT_FILE_OPEN_FAIL;}buf=(char*)malloc(NV_BLOCK_SIZE);if
-(!buf){close(fp);return RESULT_MALLOC_FAIL;}for(i=(0xc97+6691-0x26ba);i<
+(!buf){close(fp);return RESULT_MALLOC_FAIL;}for(i=(0xfdd+5797-0x2682);i<
 NV_HASH_LEN;i++){for(item=list->nvTable[i];item;item=item->next){if(strcmp(
 nvFile,NV_FS_SHOW)&&!item->saveFlag)continue;itemSize=strlen(item->key)+strlen(
-item->value)+(0x6da+3834-0x15d2);if(bufSize+itemSize>NV_BLOCK_SIZE){if(write(fp,
-buf,bufSize)<(0xdc+3162-0xd36)){printf(
+item->value)+(0x1158+4058-0x2130);if(bufSize+itemSize>NV_BLOCK_SIZE){if(write(fp
+,buf,bufSize)<(0x95b+3110-0x1581)){printf(
 "\x65\x72\x72\x6f\x72\x20\x25\x73\x20\x25\x64\x3a\x20\x77\x72\x69\x74\x65\x20\x66\x61\x69\x6c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64" "\n"
 ,__FILE__,__LINE__,errno);close(fp);free(buf);return RESULT_FILE_WRITE_FAIL;}sum
-+=getSum(buf,bufSize);bufSize=(0x22c5+97-0x2326);}sprintf(buf+bufSize,
++=getSum(buf,bufSize);bufSize=(0x1140+3589-0x1f45);}sprintf(buf+bufSize,
 "\x25\x73\x3d\x25\x73",item->key,item->value);bufSize+=itemSize;}}if(bufSize!=
-(0xc03+4782-0x1eb1)){if(write(fp,buf,bufSize)<(0x1759+1299-0x1c6c)){printf(
+(0xb44+4885-0x1e59)){if(write(fp,buf,bufSize)<(0xf73+3468-0x1cff)){printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x20\x77\x72\x69\x74\x65\x20\x66\x61\x69\x6c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64" "\n"
 ,errno);close(fp);free(buf);return RESULT_FILE_WRITE_FAIL;}sum+=getSum(buf,
-bufSize);}sum+=NV_FILE_FLAG;if(write(fp,&sum,NV_CHECK_SIZE)<(0x359+8546-0x24bb))
+bufSize);}sum+=NV_FILE_FLAG;if(write(fp,&sum,NV_CHECK_SIZE)<(0x23a7+455-0x256e))
 {printf(
 "\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x65\x72\x72\x6f\x72\x3a\x20\x77\x72\x69\x74\x65\x20\x66\x61\x69\x6c\x20\x65\x72\x72\x6e\x6f\x20\x3d\x20\x25\x64" "\n"
 ,errno);close(fp);free(buf);return RESULT_FILE_WRITE_FAIL;}ret=fsync(fp);free(
-buf);close(fp);if(ret<(0x445+564-0x679)){printf(
+buf);close(fp);if(ret<(0x0+222-0xde)){printf(
 "\x53\x79\x6e\x63\x20\x46\x61\x69\x6c\x65\x64\x3a\x25\x73\x2c\x20\x66\x69\x6c\x65\x20\x70\x61\x74\x68\x3a\x25\x73"
 ,strerror(errno),nvFile);return ret;}return RESULT_SUCCESS;}return 
 RESULT_NO_FILE;}static int nvget(char*file,char*key,char*value){int index=
-(0xcbf+5419-0x21ea);T_NV_NODE*list=NULL;T_NV_ITEM*item=NULL;for(list=nv_list;
+(0xbfd+3722-0x1a87);T_NV_NODE*list=NULL;T_NV_ITEM*item=NULL;for(list=nv_list;
 list;list=list->next){if(strcmp(list->nvFile,file))continue;index=hash(key)%
 NV_HASH_LEN;for(item=list->nvTable[index];item;item=item->next){if(strcmp(item->
-key,key))continue;strncpy(value,item->value,NV_MAX_VAL_LEN-(0x12bc+4341-0x23b0))
-;value[NV_MAX_VAL_LEN-(0x701+6117-0x1ee5)]='\0';return RESULT_SUCCESS;}}return 
+key,key))continue;strncpy(value,item->value,NV_MAX_VAL_LEN-(0xb6d+2794-0x1656));
+value[NV_MAX_VAL_LEN-(0x20f6+1419-0x2680)]='\0';return RESULT_SUCCESS;}}return 
 RESULT_NO_ITEM;}static int nvset(char*file,const char*key,const char*value,int 
-saveFlag){int index=(0x3f7+3888-0x1327);int ret=(0xe76+295-0xf9d);int 
-key_buf_len=(0x1667+1744-0x1d37);int value_buf_len=(0x5ba+5145-0x19d3);T_NV_NODE
+saveFlag){int index=(0xf88+5574-0x254e);int ret=(0xc0a+2175-0x1489);int 
+key_buf_len=(0xd53+5424-0x2283);int value_buf_len=(0x13b6+3552-0x2196);T_NV_NODE
 *list=NULL;T_NV_ITEM*item=NULL;T_NV_ITEM*newItem=NULL;if(NULL==key||NULL==value)
-return RESULT_FAIL;key_buf_len=strlen(key)+(0xec4+4523-0x206e);value_buf_len=
-strlen(value)+(0x34b+8639-0x2509);for(list=nv_list;list;list=list->next){if(
+return RESULT_FAIL;key_buf_len=strlen(key)+(0x32b+3822-0x1218);value_buf_len=
+strlen(value)+(0x4fd+6295-0x1d93);for(list=nv_list;list;list=list->next){if(
 strcmp(list->nvFile,file))continue;index=hash(key)%NV_HASH_LEN;for(item=list->
 nvTable[index];item;item=item->next){if(strcmp(item->key,key))continue;if(
 saveFlag)item->saveFlag=saveFlag;if(!strcmp(item->value,value))return 
 RESULT_SUCCESS;free(item->value);item->value=(char*)malloc(value_buf_len);if(!
 item->value)return RESULT_MALLOC_FAIL;strncpy(item->value,value,value_buf_len-
-(0xaa3+6760-0x250a));item->value[value_buf_len-(0x239+7917-0x2125)]='\0';return 
-RESULT_SUCCESS;}newItem=(T_NV_ITEM*)malloc(sizeof(T_NV_ITEM));if(!newItem)return
- RESULT_MALLOC_FAIL;newItem->key=(char*)malloc(key_buf_len);if(!newItem->key){
-free(newItem);return RESULT_MALLOC_FAIL;}newItem->value=(char*)malloc(
+(0x26a+6525-0x1be6));item->value[value_buf_len-(0x1cef+1258-0x21d8)]='\0';return
+ RESULT_SUCCESS;}newItem=(T_NV_ITEM*)malloc(sizeof(T_NV_ITEM));if(!newItem)
+return RESULT_MALLOC_FAIL;newItem->key=(char*)malloc(key_buf_len);if(!newItem->
+key){free(newItem);return RESULT_MALLOC_FAIL;}newItem->value=(char*)malloc(
 value_buf_len);if(!newItem->value){free(newItem->key);free(newItem);return 
-RESULT_MALLOC_FAIL;}strncpy(newItem->key,key,key_buf_len-(0x11f+793-0x437));
-newItem->key[key_buf_len-(0x1fa4+112-0x2013)]='\0';strncpy(newItem->value,value,
-value_buf_len-(0x4cb+2289-0xdbb));newItem->value[value_buf_len-
-(0x132b+3439-0x2099)]='\0';newItem->next=NULL;newItem->saveFlag=saveFlag;newItem
-->update_flag=(0xcd7+5313-0x2198);if(!list->nvTable[index])list->nvTable[index]=
+RESULT_MALLOC_FAIL;}strncpy(newItem->key,key,key_buf_len-(0x855+1834-0xf7e));
+newItem->key[key_buf_len-(0x898+5067-0x1c62)]='\0';strncpy(newItem->value,value,
+value_buf_len-(0xa06+2682-0x147f));newItem->value[value_buf_len-
+(0x20bf+1010-0x24b0)]='\0';newItem->next=NULL;newItem->saveFlag=saveFlag;newItem
+->update_flag=(0xe50+2792-0x1938);if(!list->nvTable[index])list->nvTable[index]=
 newItem;else{newItem->next=list->nvTable[index]->next;list->nvTable[index]->next
 =newItem;}return RESULT_SUCCESS;}ret=addConfigFile(file,NULL);if(ret==
 RESULT_SUCCESS)return nvset(file,key,value,saveFlag);else return ret;}static int
- nvunset(char*file,char*key){int index=(0x180+8747-0x23ab);T_NV_NODE*list=NULL;
+ nvunset(char*file,char*key){int index=(0x33c+8579-0x24bf);T_NV_NODE*list=NULL;
 T_NV_ITEM*item=NULL;T_NV_ITEM*prev=NULL;for(list=nv_list;list;list=list->next){
 if(strcmp(list->nvFile,file))continue;index=hash(key)%NV_HASH_LEN;for(item=list
 ->nvTable[index];item;prev=item,item=item->next){if(strcmp(item->key,key))
 continue;if(!prev)list->nvTable[index]=item->next;else prev->next=item->next;
 free(item->key);free(item->value);free(item);return RESULT_SUCCESS;}}return 
-RESULT_NO_ITEM;}static int nvreset(char*file){int ret=(0x24ec+29-0x2509);
+RESULT_NO_ITEM;}static int nvreset(char*file){int ret=(0x12d3+4286-0x2391);
 T_NV_NODE*list=NULL;for(list=nv_list;list;list=list->next){if(strcmp(list->
 nvFile,file))continue;ret=nvclear(file);if(ret!=RESULT_SUCCESS)return ret;if(
 loadFactroyParam(list)!=RESULT_SUCCESS)return RESULT_FAIL;return nvcommit(file);
-}return RESULT_NO_FILE;}static int nvclear(char*file){int i=(0x1bc0+1858-0x2302)
+}return RESULT_NO_FILE;}static int nvclear(char*file){int i=(0x162f+3322-0x2329)
 ;T_NV_NODE*list=NULL;T_NV_ITEM*cur=NULL;T_NV_ITEM*item=NULL;for(list=nv_list;
 list;list=list->next){if(strcmp(list->nvFile,file))continue;for(i=
-(0x8ad+5240-0x1d25);i<NV_HASH_LEN;i++){for(item=list->nvTable[i];item;){cur=item
+(0x2ca+4750-0x1558);i<NV_HASH_LEN;i++){for(item=list->nvTable[i];item;){cur=item
 ;item=item->next;free(cur->key);free(cur->value);free(cur);}list->nvTable[i]=
 NULL;}return RESULT_SUCCESS;}return RESULT_NO_FILE;}static int nvcommit(char*
-file){int ret=(0x61f+7281-0x2290);char nvMainFile[NV_PATH_LEN]={
-(0x1b4a+2406-0x24b0)};char nvBackupFile[NV_PATH_LEN]={(0x1459+2394-0x1db3)};
+file){int ret=(0x1c8c+543-0x1eab);char nvMainFile[NV_PATH_LEN]={
+(0x60f+3217-0x12a0)};char nvBackupFile[NV_PATH_LEN]={(0x482+7617-0x2243)};
 sprintf(nvMainFile,"\x25\x73\x2f\x25\x73",NV_FS_MAIN_PATH,file);sprintf(
 nvBackupFile,"\x25\x73\x2f\x25\x73",NV_FS_BACKUP_PATH,file);ret=saveNvFs(file,
 nvMainFile);if(ret!=RESULT_SUCCESS)return ret;return restoreNvFs(nvBackupFile,