| 1476 | } |
| 1477 | |
| 1478 | int interface_recovery(disk_t *disk_car, const list_part_t *list_part_org, const int verbose, const int dump_ind, const int align, const int ask_part_order, const unsigned int expert, char **current_cmd) |
| 1479 | { |
| 1480 | int res_interface_write; |
| 1481 | int fast_mode=0; |
| 1482 | do |
| 1483 | { |
| 1484 | list_part_t *list_part; |
| 1485 | const list_part_t *element; |
| 1486 | unsigned int menu=0; |
| 1487 | if(fast_mode==0) |
| 1488 | menu=4; /* Search! */ |
| 1489 | #ifdef HAVE_NCURSES |
| 1490 | aff_copy(stdscr); |
| 1491 | wmove(stdscr,4,0); |
| 1492 | wprintw(stdscr,"%s",disk_car->description(disk_car)); |
| 1493 | wmove(stdscr,5,0); |
| 1494 | #endif |
| 1495 | list_part=search_part(disk_car, list_part_org, verbose, dump_ind, fast_mode, current_cmd); |
| 1496 | warning_geometry(list_part, disk_car, verbose, current_cmd); |
| 1497 | align_structure(list_part, disk_car, align); |
| 1498 | |
| 1499 | disk_car->arch->init_structure(disk_car,list_part,verbose); |
| 1500 | if(verbose>0) |
| 1501 | { |
| 1502 | #ifdef TARGET_LINUX |
| 1503 | unsigned int i=0; |
| 1504 | #endif |
| 1505 | /* Write found partitions in the log file */ |
| 1506 | log_info("\nResults\n"); |
| 1507 | for(element=list_part;element!=NULL;element=element->next) |
| 1508 | log_partition(disk_car,element->part); |
| 1509 | #ifdef TARGET_LINUX |
| 1510 | if(list_part!=NULL) |
| 1511 | log_info("\nHint for advanced users: dmsetup may be used if you prefer to avoid rewriting the partition table for the moment:\n"); |
| 1512 | for(element=list_part;element!=NULL;element=element->next) |
| 1513 | { |
| 1514 | const partition_t *partition=element->part; |
| 1515 | log_info("echo \"0 %llu linear %s %llu\" | dmsetup create test%u\n", |
| 1516 | (long long unsigned)(partition->part_size/512), |
| 1517 | disk_car->device, |
| 1518 | (long long unsigned)(partition->part_offset/512), |
| 1519 | i++); |
| 1520 | } |
| 1521 | #endif |
| 1522 | } |
| 1523 | log_flush(); |
| 1524 | do |
| 1525 | { |
| 1526 | list_part=ask_structure(disk_car,list_part,verbose,current_cmd); |
| 1527 | if(disk_car->arch->test_structure(list_part)==0) |
| 1528 | { |
| 1529 | res_interface_write=ask_write_partition_table(list_part, disk_car, verbose, dump_ind, ask_part_order, expert, current_cmd, &menu, &fast_mode); |
| 1530 | } |
| 1531 | else |
| 1532 | { |
| 1533 | display_message("Invalid partition structure.\n"); |
| 1534 | res_interface_write=0; |
| 1535 | } |
no test coverage detected