| 594 | } |
| 595 | |
| 596 | static int file2entry(struct msdos_dir_entry *de, const file_info_t *current_file) |
| 597 | { |
| 598 | unsigned int i,j; |
| 599 | /* Name */ |
| 600 | for(i=0; |
| 601 | i<8 && current_file->name[i]!='.' && current_file->name[i]!='\0'; |
| 602 | i++) |
| 603 | { |
| 604 | de->name[i]=current_file->name[i]; |
| 605 | } |
| 606 | for(j=i;j<8;j++) |
| 607 | { |
| 608 | de->name[j]=' '; |
| 609 | } |
| 610 | /* Extension */ |
| 611 | for(; |
| 612 | current_file->name[i]!='.' && current_file->name[i]!='\0'; |
| 613 | i++); |
| 614 | for(j=0; |
| 615 | j<3 && current_file->name[i]!='\0'; |
| 616 | j++) |
| 617 | { |
| 618 | de->ext[j]=current_file->name[i]; |
| 619 | } |
| 620 | for(;j<3;j++) |
| 621 | { |
| 622 | de->ext[j]=' '; |
| 623 | } |
| 624 | de->attr=(LINUX_S_ISDIR(current_file->st_mode)!=0?ATTR_DIR:ATTR_NONE); |
| 625 | fat_date_unix2dos(current_file->td_mtime,&de->time,&de->date); |
| 626 | de->start=le16(current_file->st_ino); |
| 627 | de->starthi=le16(current_file->st_ino>>16); |
| 628 | de->size=le32(current_file->st_size); |
| 629 | return 0; |
| 630 | } |
| 631 | |
| 632 | static int fat32_create_rootdir(disk_t *disk_car,const partition_t *partition, const unsigned int reserved, const unsigned int fat_length, const unsigned int root_cluster, const unsigned int sectors_per_cluster, const int verbose, file_info_t *rootdir_list, const unsigned int fats) |
| 633 | { |
no test coverage detected