+
+ //match the files in both folders
+ for (x=0;x<number_of_files_in_yaffs;x++){
+ sprintf(message,"\nsearching for yaffs file: %s\n",yaffs_file_list[x]);
+ print_message(3,message);
+ for (y=0;y<number_of_files_in_linux;y++){
+ sprintf(message,"comparing to linux file: %s\n",linux_file_list[y]);
+ print_message(7,message);
+
+ if (0==strcmp(yaffs_file_list[x],linux_file_list[y])){
+ sprintf(message,"file matched: %s\n",linux_file_list[y]);
+ print_message(3,message);
+ //check that the modes of both files are the same
+ join_paths(yaffs_struct.root_path,yaffs_file_list[x],y_path);
+ join_paths(linux_struct.root_path,linux_file_list[y],l_path);
+ if (yaffs_stat(y_path,&yaffs_stat_struct)>=0&&
+ stat(l_path,&linux_stat_struct)>=0){
+ sprintf(message," yaffs file mode is %d\n",(yaffs_stat_struct.st_mode & (S_IREAD| S_IWRITE)));
+ print_message(3,message);
+ sprintf(message,"mode S_IREAD %d S_IWRITE %d\n",(yaffs_stat_struct.st_mode & S_IREAD),(yaffs_stat_struct.st_mode & S_IWRITE));
+ print_message(3,message);
+ sprintf(message," linux file mode is %d\n",(linux_stat_struct.st_mode & (S_IREAD|S_IWRITE)));
+ print_message(3,message);
+ sprintf(message,"mode S_IREAD %d S_IWRITE %d\n",(linux_stat_struct.st_mode & S_IREAD),(linux_stat_struct.st_mode & S_IWRITE));
+ print_message(3,message);
+ if ((yaffs_stat_struct.st_mode & (S_IREAD| S_IWRITE))==
+ ( linux_stat_struct.st_mode & (S_IREAD|S_IWRITE))){
+ print_message(2,"file modes match\n");
+ } else {
+ print_message(2,"file modes do not match\n");
+ exit_bool=1;
+ }
+ linux_file_list[y][0]=NULL;
+ yaffs_file_list[x][0]=NULL;
+ } else {
+ print_message(2,"failed to stat one of the files\n");
+ get_error_yaffs();
+ get_error_linux();
+ }
+
+ //read file contents
+
+
+ break;
+ }
+ }
+ }
+
+ //print remaining files
+ for (x=0;x<number_of_files_in_linux;x++){
+ if (linux_file_list[x][0]){
+ sprintf(message,"unmatched file in linux: %s\n",linux_file_list[x]);
+ print_message(2,message);
+ exit_bool=1;
+ }
+ }
+ for (x=0;x<number_of_files_in_yaffs;x++){
+ if (yaffs_file_list[x][0]){
+ sprintf(message,"unmatched file in yaffs: %s\n",yaffs_file_list[x]);
+ print_message(2,message);
+ exit_bool=1;
+ }
+ }
+ if (exit_bool==1&& get_exit_on_error()==1){
+ print_message(2,"exiting program\n");
+ exit(0);
+ }
+
+ for (x=0;x<number_of_files_in_yaffs;x++) {
+ free(yaffs_file_list[x]);
+ }
+ free(yaffs_file_list);
+
+ for (x=0;x<number_of_files_in_linux;x++) {
+ free(linux_file_list[x]);
+ }
+ free(linux_file_list);
+
+