| 39 | #include "ext2_sb.h" |
| 40 | |
| 41 | int interface_superblock(disk_t *disk_car, const list_part_t *list_part, char**current_cmd) |
| 42 | { |
| 43 | const list_part_t *parts; |
| 44 | const partition_t *old_part=NULL; |
| 45 | #ifdef HAVE_NCURSES |
| 46 | const struct MenuItem menuSuperblock[]= |
| 47 | { |
| 48 | { 'P', "Previous",""}, |
| 49 | { 'N', "Next","" }, |
| 50 | { 'Q',"Quit","Return to Advanced menu"}, |
| 51 | { 0, NULL, NULL } |
| 52 | }; |
| 53 | #endif |
| 54 | screen_buffer_reset(); |
| 55 | #ifdef HAVE_NCURSES |
| 56 | aff_copy(stdscr); |
| 57 | wmove(stdscr,4,0); |
| 58 | wprintw(stdscr,"%s",disk_car->description(disk_car)); |
| 59 | wmove(stdscr,5,0); |
| 60 | mvwaddstr(stdscr,6,0,msg_PART_HEADER_LONG); |
| 61 | #endif |
| 62 | for(parts=list_part;parts!=NULL;parts=parts->next) |
| 63 | { |
| 64 | const partition_t *partition=parts->part; |
| 65 | if(old_part==NULL || |
| 66 | old_part->part_offset!=partition->part_offset || |
| 67 | old_part->part_size!=partition->part_size || |
| 68 | guid_cmp(old_part->part_type_gpt, partition->part_type_gpt)!=0 || |
| 69 | old_part->part_type_i386!=partition->part_type_i386 || |
| 70 | old_part->part_type_sun!=partition->part_type_sun || |
| 71 | old_part->part_type_mac!=partition->part_type_mac || |
| 72 | old_part->upart_type!=partition->upart_type) |
| 73 | { |
| 74 | aff_part_buffer(AFF_PART_BASE, disk_car, partition); |
| 75 | old_part=partition; |
| 76 | } |
| 77 | if(partition->blocksize!=0) |
| 78 | screen_buffer_add("superblock %lu, blocksize=%u [%s]\n", |
| 79 | (long unsigned)(partition->sb_offset/partition->blocksize), |
| 80 | partition->blocksize, partition->fsname); |
| 81 | } |
| 82 | if(list_part!=NULL) |
| 83 | { |
| 84 | const partition_t *partition=list_part->part; |
| 85 | screen_buffer_add("\n"); |
| 86 | screen_buffer_add("To repair the filesystem using alternate superblock, run\n"); |
| 87 | screen_buffer_add("fsck.ext%u -p -b superblock -B blocksize device\n", |
| 88 | (partition->upart_type==UP_EXT2?2: |
| 89 | (partition->upart_type==UP_EXT3?3:4))); |
| 90 | } |
| 91 | screen_buffer_to_log(); |
| 92 | if(*current_cmd==NULL) |
| 93 | { |
| 94 | log_flush(); |
| 95 | #ifdef HAVE_NCURSES |
| 96 | screen_buffer_display(stdscr,"",menuSuperblock); |
| 97 | #endif |
| 98 | } |
no test coverage detected