| 407 | } |
| 408 | |
| 409 | int recover_MD(const disk_t *disk_car, const struct mdp_superblock_s *sb, partition_t *partition, const int verbose, const int dump_ind) |
| 410 | { |
| 411 | #ifndef DISABLED_FOR_FRAMAC |
| 412 | if(test_MD(disk_car, sb, partition, dump_ind)==0) |
| 413 | { |
| 414 | set_MD_info(sb, partition, verbose); |
| 415 | partition->part_type_i386=P_RAID; |
| 416 | partition->part_type_sun=PSUN_RAID; |
| 417 | partition->part_type_gpt=GPT_ENT_TYPE_LINUX_RAID; |
| 418 | if(le32(sb->major_version)==0) |
| 419 | { |
| 420 | partition->part_size=(uint64_t)(le32(sb->size)<<1)*512+MD_RESERVED_BYTES; /* 512-byte sectors */ |
| 421 | memcpy(&partition->part_uuid, &sb->set_uuid0, 4); |
| 422 | memcpy((char*)(&partition->part_uuid)+4, &sb->set_uuid1, 3*4); |
| 423 | } |
| 424 | else |
| 425 | { |
| 426 | const struct mdp_superblock_1 *sb1=(const struct mdp_superblock_1 *)sb; |
| 427 | partition->part_size=(uint64_t)le64(sb1->size) * 512 + 4096; /* 512-byte sectors */ |
| 428 | memcpy(&partition->part_uuid, &sb1->set_uuid, 16); |
| 429 | } |
| 430 | return 0; |
| 431 | } |
| 432 | if(test_MD_be(disk_car, sb, partition, dump_ind)==0) |
| 433 | { |
| 434 | set_MD_info_be(sb, partition, verbose); |
| 435 | partition->part_type_i386=P_RAID; |
| 436 | partition->part_type_sun=PSUN_RAID; |
| 437 | partition->part_type_gpt=GPT_ENT_TYPE_LINUX_RAID; |
| 438 | if(be32(sb->major_version)==0) |
| 439 | { |
| 440 | partition->part_size=(uint64_t)(be32(sb->size)<<1)*512+MD_RESERVED_BYTES; /* 512-byte sectors */ |
| 441 | memcpy(&partition->part_uuid, &sb->set_uuid0, 4); |
| 442 | memcpy((char*)(&partition->part_uuid)+4, &sb->set_uuid1, 3*4); |
| 443 | } |
| 444 | else |
| 445 | { |
| 446 | const struct mdp_superblock_1 *sb1=(const struct mdp_superblock_1 *)sb; |
| 447 | partition->part_size=(uint64_t)be64(sb1->size) * 512 + 4096; /* 512-byte sectors */ |
| 448 | memcpy(&partition->part_uuid, &sb1->set_uuid, 16); |
| 449 | } |
| 450 | return 0; |
| 451 | } |
| 452 | #endif |
| 453 | return 1; |
| 454 | } |
no test coverage detected