[Feature][ZXW-65]merged P49 base code
Change-Id: I3e09c0c3d47483bc645f02310380ecb7fc6f4041
diff --git a/ap/app/zte_comm/nvserver/nvserver.c b/ap/app/zte_comm/nvserver/nvserver.c
index d00b176..bafb391 100755
--- a/ap/app/zte_comm/nvserver/nvserver.c
+++ b/ap/app/zte_comm/nvserver/nvserver.c
@@ -30,144 +30,145 @@
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=
-(0xf9d+1777-0x168e);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",(0x692+5200-0x1ae2)
-,(0x37d+8962-0x267f),(0xe2a+4064-0x1e0a));memset(&rcvBuf,(0x2bf+4784-0x156f),
-sizeof(rcvBuf));memset(&sndBuf,(0x135+7123-0x1d08),sizeof(sndBuf));memset(&
-msgInfo,(0x1335+1600-0x1975),sizeof(msgInfo));msgId=msgget(MODULE_ID_NV,
-IPC_CREAT|(0x1cf7+159-0x1c16));if(-(0x550+6473-0x1e98)==msgId){printf(
+(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(
"\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-(0x1e2+4748-0x146d);}if(-(0x15fb+3897-0x2533)!=msgctl(msgId,
-IPC_STAT,&msgInfo)){msgInfo.msg_qbytes=262144;if(-(0x4a0+8126-0x245d)==msgctl(
+,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(
"\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()!=(0x1386+1034-0x1790)){printf(
+,errno);}if(nvDirInit()!=(0x193+7308-0x1e1f)){printf(
"\x6e\x76\x44\x69\x72\x49\x6e\x69\x74\x20\x66\x61\x69\x6c\x65\x21" "\n");return-
-(0x103+4607-0x1301);}nvConfig();nvInit();while((0x92a+6724-0x236d)){if(-
-(0x713+565-0x947)==msgrcv(msgId,&rcvBuf,sizeof(T_NV_MSG_INFO)-sizeof(long),
-MSG_TYPE_NV,(0x160d+1056-0x1a2d))){printf(
+(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(
"\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(-(0x1723+2233-0x1fdb)==msgsnd(
-msgId,&sndBuf,sizeof(T_NV_MSG_RESULT)-sizeof(long),(0xc5a+11-0xc65))){printf(
+,errno);continue;}analyMsg(&rcvBuf,&sndBuf);if(-(0x8e0+3234-0x1581)==msgsnd(
+msgId,&sndBuf,sizeof(T_NV_MSG_RESULT)-sizeof(long),(0x1643+201-0x170c))){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((0x3b8+8720-0x25c8));}static void configdir(char*dir){
-DIR*dp;int ret;struct dirent*entry;struct stat statbuf;if((dp=opendir(dir))==
+,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))==
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<(0x409+5808-0x1ab9)){fprintf(stderr,
+d_name,&statbuf);if(ret<(0x1294+4731-0x250f)){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)==(0xb93+2285-0x1480)||strcmp("\x2e\x2e",entry->
-d_name)==(0xce3+3622-0x1b09))continue;if(!isNvConfiged(entry->d_name)){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(
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]={(0x97b+272-0xa8b)};fp=fopen(
-NV_CONFIG_FILE,"\x72\x6f");if(!fp){printf(
+val=NULL;FILE*fp=NULL;char buf[NV_MAX_CONFIG_LEN]={(0x4e2+6383-0x1dd1)};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[
-(0xf7d+5635-0x2580)]=='\n'||buf[(0x572+6671-0x1f81)]==((char)(0x377+1667-0x9d7))
-)continue;val=strchr(buf,((char)(0x17ab+3339-0x2479)));if(!val){printf(
+(0xbe8+1358-0x1136)]=='\n'||buf[(0x962+1248-0xe42)]==((char)(0x982+5121-0x1d60))
+)continue;val=strchr(buf,((char)(0xb7+5106-0x146c)));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)-(0x1cb9+1681-0x2349)]='\0';*val++
+,NV_CONFIG_FILE,buf);continue;}buf[strlen(buf)-(0x17b6+1612-0x1e01)]='\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)!=(0x967+3017-0x1530)){if(mkdir(NV_FS_PATH,(0xaba+2657-0x132e))
-!=(0xbc7+1659-0x1242)){printf(
+NV_FS_PATH,F_OK)!=(0x96+2717-0xb33)){if(mkdir(NV_FS_PATH,(0x541+7294-0x1fd2))!=
+(0xdb3+1109-0x1208)){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-(0x8d6+3871-0x17f4);}if(mkdir(NV_FS_MAIN_PATH,
-(0xe1a+713-0xef6))!=(0x1124+2701-0x1bb1)){printf(
+,NV_FS_PATH,errno);return-(0x202a+1643-0x2694);}if(mkdir(NV_FS_MAIN_PATH,
+(0x7eb+5252-0x1a82))!=(0x5af+4090-0x15a9)){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-(0xadc+3711-0x195a);}if(mkdir(NV_FS_BACKUP_PATH,
-(0x1133+5774-0x25d4))!=(0x10ef+1653-0x1764)){printf(
+,NV_FS_MAIN_PATH,errno);return-(0x1bda+2498-0x259b);}if(mkdir(NV_FS_BACKUP_PATH,
+(0x1d3a+2893-0x269a))!=(0x48+4657-0x1279)){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-(0x5b1+3287-0x1287);}}else{if(access(
-NV_FS_MAIN_PATH,F_OK)!=(0x838+2209-0x10d9)){if(mkdir(NV_FS_MAIN_PATH,
-(0x25a+3379-0xda0))!=(0x63d+3509-0x13f2)){printf(
+,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(
"\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-(0xd01+6301-0x259d);}}if(access(NV_FS_BACKUP_PATH
-,F_OK)!=(0x1a7f+1439-0x201e)){if(mkdir(NV_FS_BACKUP_PATH,(0xd63+905-0xeff))!=
-(0x13a9+1438-0x1947)){printf(
+,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(
"\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-(0x14c2+732-0x179d);}}}return
-(0xdc8+1270-0x12be);}static void nvInit(){T_NV_NODE*list=NULL;char nvMainFile[
-NV_PATH_LEN]={(0x1067+1826-0x1789)};char nvBackupFile[NV_PATH_LEN]={
-(0x15bd+2250-0x1e87)};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(
+,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()==
-(0x658+3729-0x14e7)){reloadFactroyParam(list);delete_not_needed(list);nvcommit(
+(0xe7a+3991-0x1e0f)){reloadFactroyParam(list);delete_not_needed(list);nvcommit(
list->nvFile);
#ifdef FOTA_AB
-dual_AB_set_fota_status_for_nv((0x10f+5819-0x17ca));
+dual_AB_set_fota_status_for_nv((0x427+7830-0x22bd));
#endif
-}}}uint hash(const char*s){uint hash=(0x506+7684-0x230a);while(*s){hash=
+}}}uint hash(const char*s){uint hash=(0xf22+439-0x10d9);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]={
-(0x1810+1389-0x1d7d)};for(config=list->fileList;config;config=config->next){fp=
+(0x13af+560-0x15df)};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[(0x519+663-0x7b0)]=='\n'||buf[(0x17dd+2775-0x22b4)]
-==((char)(0x5b+5361-0x1529)))continue;val=strchr(buf,((char)(0x210+1561-0x7ec)))
-;if(!val){printf(
+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(
"\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)-(0x1d91+1330-0x22c2)]==
-'\n')buf[strlen(buf)-(0x3ca+3390-0x1107)]='\0';*val++='\0';nvset(list->nvFile,
-buf,val,(0x1faa+588-0x21f5));}printf(
+,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(
"\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=(0x203+5707-0x184e);int cnt=(0xd2+428-0x27e);FILE*fp=NULL;
-char*buf=NULL;struct stat statbuff={(0xec2+4197-0x1f27)};if(stat(file,&statbuff)
-<(0x12e6+1104-0x1736))return false;len=statbuff.st_size;if(len<NV_CHECK_SIZE)
+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)
return false;fp=fopen(file,"\x72\x6f");if(!fp)return false;buf=(char*)malloc(len
-);if(!buf){fclose(fp);return false;}cnt=(0x256+5568-0x1816);while(cnt<len){cnt=
-cnt+fread(buf+cnt,(0x1865+293-0x1989),len-cnt,fp);if(ferror(fp)){clearerr(fp);
+);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);
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[(0x246b+2358-0x1da1)];ssize_t nread;int ret=-(0xb67+718-0xe34);fd_from=
-open(from,O_RDONLY);if(fd_from<(0x44a+113-0x4bb))return-(0x451+1685-0xae4);fd_to
-=open(to,O_RDWR|O_CREAT|O_TRUNC|O_SYNC,(0x73d+8248-0x25d5));if(fd_to<
-(0x102b+4386-0x214d)){ret=-(0xd21+6588-0x26da);goto out_error;}while(
-(0x677+4919-0x19ad)){char*out_ptr;ssize_t nwritten;nread=read(fd_from,buf,sizeof
-(buf));if(nread==(0x407+5708-0x1a53)){break;}else{if(nread<(0x1e38+2156-0x26a4))
-{if(errno==EINTR||errno==EAGAIN){continue;}else{ret=-(0x8b9+5996-0x2021);goto
-out_error;}}}out_ptr=buf;do{nwritten=write(fd_to,out_ptr,nread);if(nwritten>
-(0x1ad4+690-0x1d86)){nread-=nwritten;out_ptr+=nwritten;}else{if(nwritten<
-(0x13d5+2399-0x1d34)){if(errno==EINTR||errno==EAGAIN){continue;}else{ret=-
-(0x4ad+5382-0x19ae);goto out_error;}}}}while(nread>(0x935+2807-0x142c));}ret=
-fsync(fd_to);if(ret<(0xf8c+3864-0x1ea4)){printf(
+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(
"\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)<(0x1182+5388-0x268e)){fd_to
-=-(0x1fc9+961-0x2389);ret=-(0x13c5+1023-0x17be);goto out_error;}close(fd_from);
-return(0x1137+617-0x13a0);out_error:printf(
+,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(
"\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>=(0x9fd+3476-0x1791))close(fd_to);return
+,from,to,ret);close(fd_from);if(fd_to>=(0x2d0+5093-0x16b5))close(fd_to);return
ret;}static int restoreNvFs(char*dstFile,char*srcFile){if(copyfile(srcFile,
-dstFile)!=(0x1721+2720-0x21c1))return RESULT_FAIL;return RESULT_SUCCESS;}static
-int loadNvFs(char*file){int len=(0xf3f+654-0x11cd);int cnt=(0x1630+323-0x1773);
+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={(0x70a+3788-0x15d6)};char nvFile[NV_PATH_LEN]={
-(0xe23+2248-0x16eb)};sprintf(nvFile,"\x25\x73\x2f\x25\x73",NV_FS_MAIN_PATH,file)
-;if(stat(nvFile,&statbuff)<(0x502+149-0x597))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+
-(0xb1b+3129-0x1753));if(!buf){fclose(fp);return RESULT_MALLOC_FAIL;}memset(buf,
-(0xd63+4577-0x1f44),len+(0x1a7b+645-0x1cff));cnt=(0x8ef+2116-0x1133);while(cnt<
-len){cnt=cnt+fread(buf+cnt,(0x496+3505-0x1246),len-cnt,fp);if(ferror(fp)){
+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(
+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)){
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)(0x1ab1+653-0x1d01))))){break;}*eq='\0';value=
-eq+(0x50b+5471-0x1a69);nvset(file,name,value,(0xeb1+3329-0x1bb1));*eq=
-((char)(0x1805+782-0x1ad6));name=value+strlen(value)+(0x141+9350-0x25c6);}free(
-buf);fclose(fp);return RESULT_SUCCESS;}static void analyMsg(T_NV_MSG_INFO*
+*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*
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);
@@ -182,103 +183,104 @@
"\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-(0x8e2+877-0xc4e));newConfig->configFile[
-NV_PATH_LEN-(0x827+4579-0x1a09)]='\0';newConfig->next=NULL;}for(list=nv_list;
-list;list=list->next){if(strcmp(list->nvFile,nvFile)==(0x7ff+236-0x8eb))break;}
-if(!list){newList=(T_NV_NODE*)malloc(sizeof(T_NV_NODE));if(!newList){if(
+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;
+}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-(0x6d1+2315-0xfdb));newList->nvFile[
-NV_PATH_LEN-(0xcc4+406-0xe59)]='\0';memset(newList->nvTable,(0xca0+493-0xe8d),
-NV_HASH_LEN*(0xdd1+1493-0x13a2));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=
-(0x1424+4397-0x2551);char*data=(char*)s;while(len-- >(0x109d+4867-0x23a0)){sum+=
-(*data++);}return sum;}static int saveNvFs(char*nvName,char*nvFile){int i=
-(0xcaf+3241-0x1958);int sum=(0x7b1+3097-0x13ca);int bufSize=(0x38+2128-0x888);
-int itemSize=(0x194+5992-0x18fc);int ret=(0x11a+7134-0x1cf8);int fp=
-(0x779+6093-0x1f46);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,(0x590+8888-0x26a8));if(fp==-
-(0x7c2+6181-0x1fe6)){printf(
+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->
+nvFile,nvName))continue;fp=open(nvFile,O_SYNC|O_RDWR|O_CREAT|O_TRUNC,
+(0x4fb+5219-0x17be));if(fp==-(0x1c63+1855-0x23a1)){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=(0x855+4427-0x19a0);i<
+(!buf){close(fp);return RESULT_MALLOC_FAIL;}for(i=(0xc97+6691-0x26ba);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)+(0xaed+3813-0x19d0);if(bufSize+itemSize>NV_BLOCK_SIZE){if(write(fp,
-buf,bufSize)<(0x207+773-0x50c)){printf(
+item->value)+(0x6da+3834-0x15d2);if(bufSize+itemSize>NV_BLOCK_SIZE){if(write(fp,
+buf,bufSize)<(0xdc+3162-0xd36)){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=(0x72c+3029-0x1301);}sprintf(buf+bufSize,
++=getSum(buf,bufSize);bufSize=(0x22c5+97-0x2326);}sprintf(buf+bufSize,
"\x25\x73\x3d\x25\x73",item->key,item->value);bufSize+=itemSize;}}if(bufSize!=
-(0x9e0+6384-0x22d0)){if(write(fp,buf,bufSize)<(0x757+853-0xaac)){printf(
+(0xc03+4782-0x1eb1)){if(write(fp,buf,bufSize)<(0x1759+1299-0x1c6c)){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)<(0x127a+1921-0x19fb)
-){printf(
+bufSize);}sum+=NV_FILE_FLAG;if(write(fp,&sum,NV_CHECK_SIZE)<(0x359+8546-0x24bb))
+{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<(0x69c+591-0x8eb)){printf(
+buf);close(fp);if(ret<(0x445+564-0x679)){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=
-(0x1718+29-0x1735);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)%
+(0xcbf+5419-0x21ea);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-(0x124d+3545-0x2025))
-;value[NV_MAX_VAL_LEN-(0x181c+268-0x1927)]='\0';return RESULT_SUCCESS;}}return
+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
RESULT_NO_ITEM;}static int nvset(char*file,const char*key,const char*value,int
-saveFlag){int index=(0x15ff+1341-0x1b3c);int ret=(0x153a+1644-0x1ba6);int
-key_buf_len=(0x67+8383-0x2126);int value_buf_len=(0x7ad+5162-0x1bd7);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)+(0x200b+73-0x2053);value_buf_len=
-strlen(value)+(0x54d+4926-0x188a);for(list=nv_list;list;list=list->next){if(
+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
+*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(
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-
-(0xd1f+3066-0x1918));item->value[value_buf_len-(0x814+2114-0x1055)]='\0';return
+(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(
value_buf_len);if(!newItem->value){free(newItem->key);free(newItem);return
-RESULT_MALLOC_FAIL;}strncpy(newItem->key,key,key_buf_len-(0xa8+6175-0x18c6));
-newItem->key[key_buf_len-(0x7d2+1506-0xdb3)]='\0';strncpy(newItem->value,value,
-value_buf_len-(0xfa0+3677-0x1dfc));newItem->value[value_buf_len-
-(0x8c9+7665-0x26b9)]='\0';newItem->next=NULL;newItem->saveFlag=saveFlag;newItem
-->update_flag=(0x179+2470-0xb1f);if(!list->nvTable[index])list->nvTable[index]=
+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]=
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=(0x825+7553-0x25a6);T_NV_NODE*list=NULL;
+ nvunset(char*file,char*key){int index=(0x180+8747-0x23ab);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=(0x5ca+4630-0x17e0);
+RESULT_NO_ITEM;}static int nvreset(char*file){int ret=(0x24ec+29-0x2509);
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=(0x821+6218-0x206b);
-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=
-(0x1772+1118-0x1bd0);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=(0x125b+636-0x14d7);char nvMainFile[NV_PATH_LEN]={
-(0x689+7094-0x223f)};char nvBackupFile[NV_PATH_LEN]={(0xff4+613-0x1259)};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,nvMainFile);}
+}return RESULT_NO_FILE;}static int nvclear(char*file){int i=(0x1bc0+1858-0x2302)
+;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
+;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)};
+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,
+nvMainFile);}
#ifdef __cplusplus
}
#endif
diff --git a/ap/app/zte_comm/nvserver/nvserver_rpc.c b/ap/app/zte_comm/nvserver/nvserver_rpc.c
index eb1efee..c5e6c5e 100755
--- a/ap/app/zte_comm/nvserver/nvserver_rpc.c
+++ b/ap/app/zte_comm/nvserver/nvserver_rpc.c
@@ -82,59 +82,74 @@
* ·µ »Ø Öµ: 0±íʾ³É¹¦
* ÆäËü˵Ã÷: void
*******************************************************************************/
-static void analyMsg(T_NV_MSG_INFO *msgrecv, T_NV_MSG_RESULT *msgsnd, T_sc_rpc_header *rpc_data, T_sc_rpc_header *rpc_data2)
+static void analyMsg(T_NV_MSG_INFO *msgrecv, T_NV_MSG_RESULT *msgsnd, T_sc_rpc_msg *rpc_data, T_sc_rpc_msg *rpc_data2)
{
unsigned int timeout = 10;
- int try_cnt = 0;
+ int send_once_flag = 0;
+ int ret;
- memset(rpc_data, 0, sizeof(T_sc_rpc_header));
- memset(rpc_data2, 0, sizeof(T_sc_rpc_header));
-
- rpc_data->msg_type = RPC_MSG_TYPE_REQUEST;
- rpc_data->func_id = RPC_FUNC_ID_NV;
- rpc_data->data_len = sizeof(T_NV_MSG_INFO);
- memcpy(rpc_data->data, msgrecv, sizeof(T_NV_MSG_INFO));
+ rpc_data->header.msg_type = RPC_MSG_TYPE_REQUEST;
+ rpc_data->header.func_id = RPC_FUNC_ID_NV;
+ rpc_data->header.data_len = sizeof(T_NV_MSG_INFO) - NV_MAX_FILE_LEN - NV_MAX_KEY_LEN - NV_MAX_VAL_LEN;
+ rpc_data->header.file_len = strlen(msgrecv->file) + 1;
+ rpc_data->header.data_len += rpc_data->header.file_len;
+ memcpy(rpc_data->data, msgrecv, rpc_data->header.data_len);
+ rpc_data->header.key_len = strlen(msgrecv->key) + 1;
+ memcpy(rpc_data->data+rpc_data->header.data_len, msgrecv->key, rpc_data->header.key_len);
+ rpc_data->header.data_len += rpc_data->header.key_len;
+ rpc_data->header.value_len = strlen(msgrecv->value);
+ if (rpc_data->header.value_len > 0)
+ {
+ rpc_data->header.value_len += 1;
+ memcpy(rpc_data->data+rpc_data->header.data_len, msgrecv->value, rpc_data->header.value_len);
+ rpc_data->header.data_len += rpc_data->header.value_len;
+ }
do
{
- if (try_cnt > 0)
+ if (send_once_flag == 0)
{
- sc_rpc_clear(g_rpc_fd);
+ ret = sc_rpc_send(g_rpc_fd, rpc_data, 0);
+ if (ret == 0)
+ {
+ send_once_flag = 1; // send success
+ }
+ else
+ {
+ assert(0); // send fail
+ }
}
- sc_rpc_send(g_rpc_fd, rpc_data, 0);
- try_cnt++;
- //sleep(1);
- //continue;
- } while (0 != sc_rpc_recv(g_rpc_fd, rpc_data2, timeout)); //µÈ´ýÍê³É
- if (rpc_data2->msg_type != RPC_MSG_TYPE_REPLY)
+
+ ret = sc_rpc_recv(g_rpc_fd, rpc_data2, timeout);
+ if (ret == 0)
+ {
+ break; // recv success and break
+ }
+
+ } while (1); //µÈ´ýÍê³É
+
+ if (rpc_data2->header.msg_type != RPC_MSG_TYPE_REPLY)
assert(0);
- memcpy(msgsnd, rpc_data2->data, sizeof(T_NV_MSG_RESULT));
+ memcpy(msgsnd, rpc_data2->data, rpc_data2->header.data_len);
}
static int nv_rpc_wait_ready(int fd)
{
T_sc_rpc_header *rpc_data;
- unsigned int timeout = 200; // ms
- int write_flag = 1;
+ unsigned int timeout = 100; // ms
rpc_data = malloc(sizeof(T_sc_rpc_header));
if (rpc_data == NULL)
return -1;
+
while(1)
{
rpc_data->msg_type = RPC_MSG_TYPE_READY;
- if (write_flag)
- {
- if (write(fd, rpc_data, sizeof(T_sc_rpc_header)) != 0)
- write_flag = 0; // write ok and write sonly once
- }
- if (read(fd, rpc_data, sizeof(T_sc_rpc_header)) == 0)
- {
+ if (write(fd, rpc_data, sizeof(T_sc_rpc_header)) == sizeof(T_sc_rpc_header))
+ break;
+ else
usleep(timeout * 1000);
- continue;
- }
- break; /* read some data mean channel ok */
}
free(rpc_data);
@@ -159,11 +174,11 @@
T_NV_MSG_INFO rcvBuf;
T_NV_MSG_RESULT sndBuf;
struct msqid_ds msgInfo;
- T_sc_rpc_header *rpc_data;
- T_sc_rpc_header *rpc_data2;
+ T_sc_rpc_msg *rpc_data;
+ T_sc_rpc_msg *rpc_data2;
long pid_backup; /* app-libnvram pid backup */
- prctl(PR_SET_NAME, "nvserver", 0, 0, 0);
+ prctl(PR_SET_NAME, "nvserver_rpc", 0, 0, 0);
memset(&msgInfo, 0, sizeof(msgInfo));
@@ -185,13 +200,13 @@
}
}
- rpc_data = malloc(sizeof(T_sc_rpc_header));
+ rpc_data = malloc(sizeof(T_sc_rpc_msg));
if (rpc_data == NULL)
{
perror("[error]nvrpc malloc error\n");
return -2;
}
- rpc_data2 = malloc(sizeof(T_sc_rpc_header));
+ rpc_data2 = malloc(sizeof(T_sc_rpc_msg));
if (rpc_data2 == NULL)
{
perror("[error]nvrpc malloc2 error\n");
@@ -201,7 +216,7 @@
if (nv_rpc_wait_ready(g_rpc_fd) < 0)
{
- assert(0);
+ assert(0);
}
sc_rpc_clear(g_rpc_fd);
printf("apnv and nv-rpc-daemon are ready both.");
diff --git a/ap/app/zte_comm/nvserver/nvupdate.c b/ap/app/zte_comm/nvserver/nvupdate.c
index 34b867f..7f9fb65 100755
--- a/ap/app/zte_comm/nvserver/nvupdate.c
+++ b/ap/app/zte_comm/nvserver/nvupdate.c
@@ -23,80 +23,80 @@
extern T_NV_NODE*nv_list;
#ifdef FOTA_AB
int get_update_status(void){int ret=dual_AB_get_fota_status_for_nv();if(ret==
-(0x1b20+1519-0x210e))return(0x306+5932-0x1a30);else return(0x1f8f+1256-0x2477);}
+(0x999+318-0xad6))return(0x173+1220-0x635);else return(0x130a+602-0x1564);}
#else
-int get_update_status(void){int update_status;FILE*fd=(0xa5f+1004-0xe4b);int ret
-;char*filename=NULL;if(access(FOTA_UPDATE_STATUS_FILE_OLD,R_OK)==
-(0x20d+3207-0xe94)){filename=FOTA_UPDATE_STATUS_FILE_OLD;}else{filename=
+int get_update_status(void){int update_status;FILE*fd=(0xa38+3938-0x199a);int
+ret;char*filename=NULL;if(access(FOTA_UPDATE_STATUS_FILE_OLD,R_OK)==
+(0x870+3973-0x17f5)){filename=FOTA_UPDATE_STATUS_FILE_OLD;}else{filename=
FOTA_UPDATE_STATUS_FILE;}printf(
"get_update_status, read_update_status from %s\n",filename);fd=fopen(filename,
"\x72\x62\x2b");if(fd==NULL){printf(
"\x5b\x6e\x76\x73\x65\x72\x76\x65\x72\x5d\x75\x70\x64\x61\x74\x65\x5f\x73\x74\x61\x74\x75\x73\x20\x6f\x70\x65\x6e\x20\x20\x65\x72\x72\x6f\x72\x3a\x25\x73" "\n"
,strerror(errno));goto error0;}ret=fscanf(fd,"\x25\x64",(int*)&update_status);if
-(ret<(0xa56+5614-0x2044)){printf(
+(ret<(0x2a2+201-0x36b)){printf(
"\x67\x65\x74\x20\x69\x6e\x66\x6f\x20\x66\x72\x6f\x6d\x20\x66\x69\x6c\x65\x20\x65\x72\x72\x6f\x72\x3a\x25\x73" "\n"
,strerror(errno));fclose(fd);goto error0;}printf(
"\x75\x70\x64\x61\x74\x65\x5f\x73\x74\x61\x74\x75\x73\x3d\x25\x64" "\n",
-update_status);fclose(fd);return update_status;error0:return-
-(0x16ed+1906-0x1e5e);}
+update_status);fclose(fd);return update_status;error0:return-(0x7ad+7742-0x25ea)
+;}
#endif
int nvupdate(char*nv_file,char*config_file,const char*key,const char*value,int
-saveFlag){int index=(0x217d+308-0x22b1);int key_buf_len=(0x870+5158-0x1c96);int
-value_buf_len=(0x151f+3443-0x2292);T_NV_NODE*list=NULL;T_NV_ITEM*item=NULL;
+saveFlag){int index=(0x431+1502-0xa0f);int key_buf_len=(0xc71+64-0xcb1);int
+value_buf_len=(0x553+6951-0x207a);T_NV_NODE*list=NULL;T_NV_ITEM*item=NULL;
T_NV_ITEM*newItem=NULL;if(NULL==key||NULL==value)return RESULT_FAIL;printf(
"\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6e\x76\x75\x70\x64\x61\x74\x65\x20\x6e\x76\x5f\x66\x69\x6c\x65\x3a\x25\x73\x20\x6b\x65\x79\x3a\x25\x73\x20\x76\x61\x6c\x75\x65\x3a\x25\x73" "\n"
-,nv_file,key,value);key_buf_len=strlen(key)+(0x1395+382-0x1512);value_buf_len=
-strlen(value)+(0x11ca+3310-0x1eb7);for(list=nv_list;list;list=list->next){if(
+,nv_file,key,value);key_buf_len=strlen(key)+(0xda+4091-0x10d4);value_buf_len=
+strlen(value)+(0x8b+8660-0x225e);for(list=nv_list;list;list=list->next){if(
strcmp(list->nvFile,nv_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)){item->
-update_flag=(0xa11+4766-0x1cae);printf(
+update_flag=(0x5a4+6662-0x1fa9);printf(
"\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6e\x76\x75\x70\x64\x61\x74\x65\x20\x73\x61\x6d\x65\x73\x6b\x69\x70\x3a\x69\x74\x65\x6d\x2d\x3e\x6b\x65\x79\x3a\x25\x73\x20\x69\x74\x65\x6d\x2d\x3e\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x63\x6f\x6e\x66\x69\x67\x5f\x66\x69\x6c\x65\x3a\x25\x73" "\n"
,item->key,item->value,value,config_file);return RESULT_SUCCESS;}if(strstr(
-config_file,"\x75\x73\x65\x72")){if((0x366+6518-0x1cdb)==item->update_flag){
+config_file,"\x75\x73\x65\x72")){if((0xd8c+1756-0x1467)==item->update_flag){
printf(
"\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6e\x76\x75\x70\x64\x61\x74\x65\x20\x73\x65\x63\x6f\x6e\x64\x20\x63\x68\x61\x6e\x67\x65\x3a\x69\x74\x65\x6d\x2d\x3e\x6b\x65\x79\x3a\x25\x73\x20\x69\x74\x65\x6d\x2d\x3e\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x63\x6f\x6e\x66\x69\x67\x5f\x66\x69\x6c\x65\x3a\x25\x73" "\n"
,item->key,item->value,value,config_file);}else{item->update_flag=
-(0x1f23+1956-0x26c6);printf(
+(0x16fc+89-0x1754);printf(
"\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6e\x76\x75\x70\x64\x61\x74\x65\x20\x75\x73\x65\x72\x73\x6b\x69\x70\x3a\x69\x74\x65\x6d\x2d\x3e\x6b\x65\x79\x3a\x25\x73\x20\x69\x74\x65\x6d\x2d\x3e\x76\x61\x6c\x75\x65\x31\x3a\x25\x73\x20\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x63\x6f\x6e\x66\x69\x67\x5f\x66\x69\x6c\x65\x3a\x25\x73" "\n"
,item->key,item->value,value,config_file);return RESULT_SUCCESS;}}printf(
"\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x6b\x65\x79\x3d\x25\x73\x20\x63\x68\x61\x6e\x67\x65\x20\x76\x61\x6c\x75\x65\x3a\x25\x73\x20\x74\x6f\x20\x76\x61\x6c\x75\x65\x3d\x25\x73\x20" "\n"
,item->key,item->value,value);free(item->value);item->value=(char*)malloc(
value_buf_len);if(!item->value)return RESULT_MALLOC_FAIL;strncpy(item->value,
-value,value_buf_len-(0x2f0+7223-0x1f26));item->value[value_buf_len-
-(0xced+6218-0x2536)]='\0';item->update_flag=(0xd9+8465-0x21e9);return
+value,value_buf_len-(0x15e9+2371-0x1f2b));item->value[value_buf_len-
+(0x30+6450-0x1961)]='\0';item->update_flag=(0x1047+2801-0x1b37);return
RESULT_SUCCESS;}newItem=(T_NV_ITEM*)malloc(sizeof(T_NV_ITEM));if(!newItem){
printf(
"\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x52\x45\x53\x55\x4c\x54\x5f\x4d\x41\x4c\x4c\x4f\x43\x5f\x46\x41\x49\x4c\x31\x20" "\n"
);return RESULT_MALLOC_FAIL;}newItem->key=(char*)malloc(strlen(key)+
-(0xbb3+3338-0x18bc));if(!newItem->key){free(newItem);printf(
+(0x1bf+8770-0x2400));if(!newItem->key){free(newItem);printf(
"\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x52\x45\x53\x55\x4c\x54\x5f\x4d\x41\x4c\x4c\x4f\x43\x5f\x46\x41\x49\x4c\x32" "\n"
);return RESULT_MALLOC_FAIL;}newItem->value=(char*)malloc(value_buf_len);if(!
newItem->value){free(newItem->key);free(newItem);printf(
"\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x52\x45\x53\x55\x4c\x54\x5f\x4d\x41\x4c\x4c\x4f\x43\x5f\x46\x41\x49\x4c\x33\x20" "\n"
);return RESULT_MALLOC_FAIL;}strncpy(newItem->key,key,key_buf_len-
-(0x990+5357-0x1e7c));newItem->key[key_buf_len-(0x665+5789-0x1d01)]='\0';strncpy(
-newItem->value,value,value_buf_len-(0x1819+248-0x1910));newItem->value[
-value_buf_len-(0x1249+3460-0x1fcc)]='\0';newItem->next=NULL;newItem->saveFlag=
-saveFlag;newItem->update_flag=(0x456+5565-0x1a12);printf(
+(0x1737+3997-0x26d3));newItem->key[key_buf_len-(0x573+2465-0xf13)]='\0';strncpy(
+newItem->value,value,value_buf_len-(0x24c3+480-0x26a2));newItem->value[
+value_buf_len-(0xa5d+1659-0x10d7)]='\0';newItem->next=NULL;newItem->saveFlag=
+saveFlag;newItem->update_flag=(0x511+7176-0x2118);printf(
"\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x61\x64\x64\x20\x6b\x65\x79\x3d\x25\x73\x2c\x20\x76\x61\x6c\x75\x65\x3d\x25\x73\x20" "\n"
,newItem->key,newItem->value);if(!list->nvTable[index])list->nvTable[index]=
newItem;else{newItem->next=list->nvTable[index]->next;list->nvTable[index]->next
=newItem;}return RESULT_SUCCESS;}return RESULT_FAIL;}int reloadFactroyParam(
T_NV_NODE*list){char*val=NULL;FILE*fp=NULL;T_NV_CONFIG*config=NULL;char buf[
-NV_MAX_ITEM_LEN]={(0x1b5f+1247-0x203e)};printf(
+NV_MAX_ITEM_LEN]={(0x9e8+3243-0x1693)};printf(
"\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x72\x65\x6c\x6f\x61\x64\x46\x61\x63\x74\x72\x6f\x79\x50\x61\x72\x61\x6d\x20\x6e\x76\x46\x69\x6c\x65\x3a\x25\x73" "\n"
,list->nvFile);for(config=list->fileList;config;config=config->next){printf(
"\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x72\x65\x6c\x6f\x61\x64\x46\x61\x63\x74\x72\x6f\x79\x50\x61\x72\x61\x6d\x20\x63\x6f\x6e\x66\x69\x67\x46\x69\x6c\x65\x20\x73\x74\x61\x72\x74\x3a\x25\x73\x21" "\n"
,config->configFile);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[(0x1d54+38-0x1d7a)]=='\n'||buf[(0xe01+639-0x1080)]==
-((char)(0x263+1910-0x9b6)))continue;val=strchr(buf,((char)(0x543+1228-0x9d2)));
-if(!val){printf(
+NV_MAX_ITEM_LEN,fp)){if(buf[(0x579+4079-0x1568)]=='\n'||buf[(0x2b8+3136-0xef8)]
+==((char)(0xf70+3343-0x1c5c)))continue;val=strchr(buf,((char)(0x8a+4197-0x10b2))
+);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;}buf[strlen(buf)-(0x16b+4876-0x1476)]='\0';*
-val++='\0';nvupdate(list->nvFile,config->configFile,buf,val,(0x75a+7588-0x24fd))
+,config->configFile,buf);continue;}buf[strlen(buf)-(0x2299+1021-0x2695)]='\0';*
+val++='\0';nvupdate(list->nvFile,config->configFile,buf,val,(0x3fb+3242-0x10a4))
;}printf(
"\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x72\x65\x6c\x6f\x61\x64\x46\x61\x63\x74\x72\x6f\x79\x50\x61\x72\x61\x6d\x20\x63\x6f\x6e\x66\x69\x67\x46\x69\x6c\x65\x20\x65\x6e\x64\x3a\x25\x73\x21" "\n"
,config->configFile);fclose(fp);}return RESULT_SUCCESS;}void dump_list(T_NV_ITEM
@@ -105,12 +105,12 @@
list->next;while(p!=NULL){printf(
"\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x64\x75\x6d\x70\x20\x6b\x65\x79\x3d\x25\x73\x2c\x20\x76\x61\x6c\x75\x65\x3d\x25\x73\x2c\x20\x70\x3d\x30\x78\x25\x78" "\n"
,p->key,p->value,((unsigned int)p));p=p->next;}}int delete_not_needed(T_NV_NODE*
-list){int index=(0x197+7483-0x1ed2);T_NV_ITEM*item=NULL;T_NV_ITEM head={
-(0x21c1+57-0x21fa)};T_NV_ITEM*prev=&head;printf(
+list){int index=(0x286+7147-0x1e71);T_NV_ITEM*item=NULL;T_NV_ITEM head={
+(0x92b+3549-0x1708)};T_NV_ITEM*prev=&head;printf(
"\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x64\x65\x6c\x65\x74\x65\x5f\x6e\x6f\x74\x5f\x6e\x65\x65\x64\x65\x64\x20\x65\x6e\x74\x65\x72\x20\x2a\x2a\x2a" "\n"
-);for(index=(0x1d1c+2424-0x2694);index<NV_HASH_LEN;index++){head.next=list->
-nvTable[index];prev=&head;for(item=prev->next;item;){if((0x1b62+698-0x1e1b)==
-item->update_flag){prev=item;item=item->next;}else{printf(
+);for(index=(0x1394+248-0x148c);index<NV_HASH_LEN;index++){head.next=list->
+nvTable[index];prev=&head;for(item=prev->next;item;){if((0xe0+7470-0x1e0d)==item
+->update_flag){prev=item;item=item->next;}else{printf(
"\x6e\x76\x73\x65\x72\x76\x65\x72\x20\x64\x65\x6c\x65\x74\x65\x20\x6b\x65\x79\x3d\x25\x73\x2c\x20\x76\x61\x6c\x75\x65\x3d\x25\x73\x20" "\n"
,item->key,item->value);prev->next=item->next;free(item->key);free(item->value);
free(item);item=prev->next;}}list->nvTable[index]=head.next;}printf(
diff --git a/ap/app/zte_comm/nvserver/sc_rpc.c b/ap/app/zte_comm/nvserver/sc_rpc.c
index c741601..283db4f 100755
--- a/ap/app/zte_comm/nvserver/sc_rpc.c
+++ b/ap/app/zte_comm/nvserver/sc_rpc.c
@@ -38,7 +38,7 @@
/*******************************************************************************
* 宏定义 *
*******************************************************************************/
-#define RPC_CHN_MAX_BUF_LEN 8192
+#define RPC_CHN_MAX_BUF_LEN 18432
/*******************************************************************************
* 数据类型定义 *
@@ -130,21 +130,22 @@
return 0;
}
-int sc_rpc_send(int fd, T_sc_rpc_header *data, unsigned int flag)
+int sc_rpc_send(int fd, T_sc_rpc_msg *data, unsigned int flag)
{
ssize_t ret;
-
- ret = full_write(fd, data, sizeof(T_sc_rpc_header));
- if (ret != sizeof(T_sc_rpc_header))
+ T_sc_rpc_header *header = (T_sc_rpc_header *)data;
+
+ ret = full_write(fd, data, sizeof(T_sc_rpc_header) + header->data_len);
+ if (ret != sizeof(T_sc_rpc_header) + header->data_len)
{
- printf("[rpc] write error, len=%d != %d!\n", ret, (int)sizeof(T_sc_rpc_header));
+ printf("[rpc] write error, len=%d != %d!\n", ret, (int)sizeof(T_sc_rpc_header)+ header->data_len);
return -1;
}
return 0;
}
-int sc_rpc_recv(int fd, T_sc_rpc_header *data, unsigned int timeout)
+int sc_rpc_recv(int fd, T_sc_rpc_msg *data, unsigned int timeout)
{
#if 1
fd_set readfds;
@@ -152,7 +153,8 @@
int ret;
struct timeval timeout_t = {timeout, 0};
int errNo = 0;
-
+ T_sc_rpc_header *header = 0;
+
FD_ZERO(&readfds);
FD_SET(fd, &readfds);
@@ -172,10 +174,11 @@
return -2;
}
- len = full_read(fd, data, sizeof(T_sc_rpc_header));
- if (len != sizeof(T_sc_rpc_header))
+ len = safe_read(fd, data, sizeof(T_sc_rpc_msg));
+ header = (T_sc_rpc_header *)data;
+ if (len != sizeof(T_sc_rpc_header)+ header->data_len)
{
- printf("[nvrpc] read error, len=%d != %d!\n", len, (int)sizeof(T_sc_rpc_header));
+ printf("[nvrpc] read error, len=%d != %d!\n", len, (int)sizeof(T_sc_rpc_header)+ header->data_len);
return -3;
}
diff --git a/ap/app/zte_comm/nvserver/sc_rpc.h b/ap/app/zte_comm/nvserver/sc_rpc.h
index e49be97..ebf88c2 100755
--- a/ap/app/zte_comm/nvserver/sc_rpc.h
+++ b/ap/app/zte_comm/nvserver/sc_rpc.h
@@ -30,17 +30,26 @@
{
unsigned int msg_type;
unsigned int func_id;
+ unsigned int file_len;
+ unsigned int key_len;
+ unsigned int value_len;
unsigned int data_len;
- char data[4096];
+
} T_sc_rpc_header;
+typedef struct
+{
+ T_sc_rpc_header header;
+ char data[3072];
+} T_sc_rpc_msg;
+
int sc_rpc_open(const char *rpmsg_dev);
int sc_rpc_clear(int fd);
-int sc_rpc_send(int fd, T_sc_rpc_header *data, unsigned int flag);
+int sc_rpc_send(int fd, T_sc_rpc_msg *data, unsigned int flag);
-int sc_rpc_recv(int fd, T_sc_rpc_header *data, unsigned int timeout);
+int sc_rpc_recv(int fd, T_sc_rpc_msg *data, unsigned int timeout);
int sc_rpc_close(int fd);