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

Function recover_APFS

src/apfs.c:65–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65int recover_APFS(const disk_t *disk, const nx_superblock_t *sb, partition_t *partition, const int verbose, const int dump_ind)
66{
67 if(test_APFS(sb, partition)!=0)
68 return 1;
69 if(dump_ind!=0)
70 {
71 if(partition!=NULL && disk!=NULL)
72 log_info("\nAPFS magic value at %u/%u/%u\n",
73 offset2cylinder(disk,partition->part_offset),
74 offset2head(disk,partition->part_offset),
75 offset2sector(disk,partition->part_offset));
76 /* There is a little offset ... */
77 dump_log(sb,DEFAULT_SECTOR_SIZE);
78 }
79 if(partition==NULL)
80 return 0;
81 set_APFS_info(sb, partition);
82 partition->part_type_i386=P_LINUX;
83 partition->part_type_mac=PMAC_LINUX;
84 partition->part_type_sun=PSUN_LINUX;
85 partition->part_type_gpt=GPT_ENT_TYPE_MAC_APFS;
86 partition->part_size=le32(sb->nx_block_size) * le64(sb->nx_block_count);
87 guid_cpy(&partition->part_uuid, (const efi_guid_t *)&sb->nx_uuid);
88 if(verbose>0)
89 {
90 log_info("\n");
91 }
92 partition->sborg_offset=0;
93 partition->sb_size=le32(sb->nx_block_size);
94 partition->sb_offset=0;
95 if(verbose>0)
96 {
97 log_info("recover_APFS: s_blocksize=%u\n", partition->blocksize);
98 log_info("recover_APFS: s_blocks_count %lu\n", (long unsigned int)le64(sb->nx_block_count));
99 if(disk==NULL)
100 log_info("recover_APFS: part_size %lu\n", (long unsigned)(partition->part_size / DEFAULT_SECTOR_SIZE));
101 else
102 log_info("recover_APFS: part_size %lu\n", (long unsigned)(partition->part_size / disk->sector_size));
103 }
104 return 0;
105}

Callers 1

search_type_0Function · 0.85

Calls 7

test_APFSFunction · 0.85
offset2cylinderFunction · 0.85
offset2headFunction · 0.85
offset2sectorFunction · 0.85
dump_logFunction · 0.85
set_APFS_infoFunction · 0.85
guid_cpyFunction · 0.85

Tested by

no test coverage detected