| 280 | } |
| 281 | |
| 282 | int check_FAT(disk_t *disk_car, partition_t *partition, const int verbose) |
| 283 | { |
| 284 | unsigned char *buffer; |
| 285 | buffer=(unsigned char *)MALLOC(3*disk_car->sector_size); |
| 286 | if((unsigned)disk_car->pread(disk_car, buffer, 3 * disk_car->sector_size, partition->part_offset) != 3 * disk_car->sector_size) |
| 287 | { |
| 288 | #ifndef DISABLED_FOR_FRAMAC |
| 289 | screen_buffer_add("check_FAT: can't read FAT boot sector\n"); |
| 290 | log_error("check_FAT: can't read FAT boot sector\n"); |
| 291 | #endif |
| 292 | free(buffer); |
| 293 | return 1; |
| 294 | } |
| 295 | if(test_FAT(disk_car,(const struct fat_boot_sector *)buffer,partition,verbose,0)!=0) |
| 296 | { |
| 297 | #ifndef DISABLED_FOR_FRAMAC |
| 298 | if(verbose>0) |
| 299 | { |
| 300 | log_error("\n\ntest_FAT()\n"); |
| 301 | log_partition(disk_car,partition); |
| 302 | log_fat_info((const struct fat_boot_sector*)buffer, partition->upart_type,disk_car->sector_size); |
| 303 | } |
| 304 | #endif |
| 305 | free(buffer); |
| 306 | return 1; |
| 307 | } |
| 308 | set_FAT_info(disk_car,(const struct fat_boot_sector *)buffer,partition); |
| 309 | /* screen_buffer_add("Ok\n"); */ |
| 310 | free(buffer); |
| 311 | return 0; |
| 312 | } |
| 313 | |
| 314 | /*@ |
| 315 | @ requires \valid(disk); |
no test coverage detected