MCPcopy Create free account
hub / github.com/cgsecurity/testdisk / fat_unformat

Function fat_unformat

src/fat_unformat.c:415–443  ·  view source on GitHub ↗

fat_unformat() * @param struct ph_param *params * @param const struct ph_options *options * @param alloc_data_t *list_search_space * * @returns: * 0: Completed or not possible * 1: Stop by user request * params->offset is set */

Source from the content-addressed store, hash-verified

413 * params->offset is set
414 */
415pstatus_t fat_unformat(struct ph_param *params, const struct ph_options *options, alloc_data_t *list_search_space)
416{
417 unsigned int sectors_per_cluster=0;
418 uint64_t start_data=0;
419 params->blocksize=0;
420 if(pfind_sectors_per_cluster(params->disk, params->partition, options->verbose, &sectors_per_cluster, &start_data, list_search_space)==0)
421 {
422 display_message("Can't find FAT cluster size\n");
423 return PSTATUS_OK;
424 }
425 if(start_data <= params->partition->part_offset)
426 {
427 display_message("FAT filesystem was beginning before the actual partition.");
428 return PSTATUS_OK;
429 }
430 start_data *= params->disk->sector_size;
431 del_search_space(list_search_space, params->partition->part_offset, start_data - 1);
432 {
433 uint64_t offset=start_data;
434 params->blocksize=sectors_per_cluster * params->disk->sector_size;
435#ifdef HAVE_NCURSES
436 if(options->expert>0)
437 menu_choose_blocksize(&params->blocksize, &offset, params->disk->sector_size);
438#endif
439 update_blocksize(params->blocksize, list_search_space, offset);
440 }
441 /* start_data is relative to the disk */
442 return fat_unformat_aux(params, options, start_data, list_search_space);
443}
444#endif

Callers 1

photorecFunction · 0.85

Calls 6

display_messageFunction · 0.85
del_search_spaceFunction · 0.85
menu_choose_blocksizeFunction · 0.85
update_blocksizeFunction · 0.85
fat_unformat_auxFunction · 0.85

Tested by

no test coverage detected