- char yaffs_file_list[x][100];
- yaffs_rewinddir(yaffs_open_dir);
-
- for (x=0 ;NULL!=yaffs_current_file;x++)
- {
- yaffs_current_file =yaffs_readdir(yaffs_open_dir);
- if (NULL!=yaffs_current_file){
- strcpy(yaffs_file_list[x],yaffs_current_file->d_name);
+
+
+ for (x=0;x<number_of_files_in_yaffs;x++){
+ sprintf(message,"searching 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 modes of the files
+ if (yaffs_stat(yaffs_file_list[x],&yaffs_stat_struct)&&
+ stat(linux_file_list[y],&linux_stat_struct)){
+ 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;
+ }
+ } else {
+ print_message(2,"failed to stat one of the files\n");
+ }
+
+ //read file contents
+
+ linux_file_list[y][0]=NULL;
+ yaffs_file_list[x][0]=NULL;
+ break;
+ }