Primary superblock is at 1024 (SUPERBLOCK_OFFSET) Group 0 begin at s_first_data_block */
| 75 | Group 0 begin at s_first_data_block |
| 76 | */ |
| 77 | int recover_btrfs(const disk_t *disk, const struct btrfs_super_block *sb, partition_t *partition, const int verbose, const int dump_ind) |
| 78 | { |
| 79 | if(test_btrfs(sb)!=0) |
| 80 | return 1; |
| 81 | if(dump_ind!=0) |
| 82 | { |
| 83 | if(partition!=NULL && disk!=NULL) |
| 84 | log_info("\nbtrfs magic value at %u/%u/%u\n", |
| 85 | offset2cylinder(disk,partition->part_offset), |
| 86 | offset2head(disk,partition->part_offset), |
| 87 | offset2sector(disk,partition->part_offset)); |
| 88 | dump_log(sb, BTRFS_SUPER_INFO_SIZE); |
| 89 | } |
| 90 | if(partition==NULL) |
| 91 | return 0; |
| 92 | set_btrfs_info(sb, partition); |
| 93 | partition->part_type_i386=P_LINUX; |
| 94 | partition->part_type_mac=PMAC_LINUX; |
| 95 | partition->part_type_sun=PSUN_LINUX; |
| 96 | partition->part_type_gpt=GPT_ENT_TYPE_LINUX_DATA; |
| 97 | partition->part_size=(uint64_t)le64(sb->dev_item.total_bytes); |
| 98 | guid_cpy(&partition->part_uuid, (const efi_guid_t *)&sb->fsid); |
| 99 | if(verbose>0) |
| 100 | { |
| 101 | log_info("\n"); |
| 102 | } |
| 103 | partition->sborg_offset=BTRFS_SUPER_INFO_OFFSET; |
| 104 | partition->sb_size=BTRFS_SUPER_INFO_SIZE; |
| 105 | if(verbose>0) |
| 106 | { |
| 107 | if(disk==NULL) |
| 108 | log_info("recover_btrfs: part_size %lu\n", (long unsigned)(partition->part_size / le32(sb->dev_item.sector_size))); |
| 109 | else |
| 110 | log_info("recover_btrfs: part_size %lu\n", (long unsigned)(partition->part_size / disk->sector_size)); |
| 111 | } |
| 112 | return 0; |
| 113 | } |
| 114 | |
| 115 | static int test_btrfs(const struct btrfs_super_block *sb) |
| 116 | { |
no test coverage detected