Changeset 8f6c7785 in mainline for uspace/app/hdisk
- Timestamp:
- 2013-04-26T02:55:32Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 700f89e
- Parents:
- d617050
- Location:
- uspace/app/hdisk
- Files:
-
- 3 edited
-
func_gpt.c (modified) (8 diffs)
-
func_mbr.c (modified) (3 diffs)
-
hdisk.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/hdisk/func_gpt.c
rd617050 r8f6c7785 49 49 return ENOMEM; 50 50 } 51 51 52 52 return set_gpt_partition(in, p); 53 53 } … … 59 59 printf("Number of the partition to delete (counted from 0): "); 60 60 idx = get_input_size_t(in); 61 61 62 62 if (gpt_remove_partition(data->gpt.parts, idx) == -1) { 63 63 printf("Warning: running low on memory, not resizing...\n"); 64 64 } 65 65 66 66 return EOK; 67 67 } … … 69 69 int print_gpt_parts(union table_data * data) 70 70 { 71 //int rc; 71 72 printf("Current partition scheme (GPT):\n"); 72 73 printf("\t\tStart:\tEnd:\tLength:\tType:\tName:\n"); 73 74 74 gpt_foreach(data->gpt.parts, i, iter) { 75 printf("\t%10u %10u %10u %3d\n", iter->start_addr, iter->start_addr + iter->length, 76 iter->length, gpt_get_part_type(iter), gpt_get_part_name(iter)); 75 size_t i = 0; 76 77 gpt_part_foreach(data->gpt.parts, iter) { 78 //printf("\t%10u %10u %10u %3d\n", iter->start_addr, iter->start_addr + iter->length, 79 // iter->length, gpt_get_part_type(iter), gpt_get_part_name(iter)); 80 printf("%3u\t%10llu %10llu %10llu %3d %s\n", i, gpt_get_start_lba(iter), gpt_get_end_lba(iter), 81 gpt_get_end_lba(iter) - gpt_get_start_lba(iter), gpt_get_part_type(iter), 82 gpt_get_part_name(iter)); 83 i++; 77 84 } 78 79 return rc; 85 86 //return rc; 87 return EOK; 80 88 } 81 89 … … 83 91 { 84 92 int rc; 85 93 86 94 rc = gpt_write_partitions(data->gpt.parts, data->gpt.gpt, dev_handle); 87 95 if (rc != EOK) { … … 89 97 return rc; 90 98 } 91 99 92 100 rc = gpt_write_gpt_header(data->gpt.gpt, dev_handle); 93 101 if (rc != EOK) { … … 95 103 return rc; 96 104 } 97 105 98 106 return EOK; 99 107 } … … 106 114 static int set_gpt_partition(tinput_t * in, gpt_part_t * p) 107 115 { 108 int rc;109 116 //int rc; 117 110 118 uint64_t sa, ea; 111 119 112 120 printf("Set starting address (number): "); 113 121 sa = get_input_uint64(in); … … 115 123 printf("Set end addres (number): "); 116 124 ea = get_input_uint64(in); 117 125 118 126 if (ea <= sa) { 119 127 printf("Invalid value.\n"); 120 128 return EINVAL; 121 129 } 122 123 124 p->start_addr = sa; 125 p->length = ea - sa; 126 130 131 132 //p->start_addr = sa; 133 gpt_set_start_lba(p, sa); 134 //p->length = ea - sa; 135 gpt_set_end_lba(p, ea); 136 127 137 return EOK; 128 138 } -
uspace/app/hdisk/func_mbr.c
rd617050 r8f6c7785 83 83 84 84 printf("Current partition scheme:\n"); 85 printf("\t\tBootable:\tStart:\tEnd:\tLength:\tType:\n"); 86 85 //printf("\t\tBootable:\tStart:\tEnd:\tLength:\tType:\n"); 86 printf("\t\t%10s %10s %10s %10s %7s\n", "Bootable:", "Start:", "End:", "Length:", "Type:"); 87 88 mbr_part_t * it; 87 89 mbr_part_foreach(data->mbr.parts, it) { 88 90 if (it->type == PT_UNUSED) 89 91 continue; 90 92 91 printf("\t P%d:\t", num);93 printf("\tP%d:\t", num); 92 94 if (mbr_get_flag(it, ST_BOOT)) 93 95 printf("*"); … … 95 97 printf(" "); 96 98 97 printf("\t%10u %10u %10u % 3d\n", it->start_addr, it->start_addr + it->length, it->length, it->type);99 printf("\t%10u %10u %10u %7x\n", it->start_addr, it->start_addr + it->length, it->length, it->type); 98 100 99 101 ++num; … … 101 103 102 104 printf("%d partitions found.\n", num); 105 printf("DEBUG: primary: %hhu, logical: %u\n", data->mbr.parts->n_primary, data->mbr.parts->n_logical); 103 106 104 107 return EOK; -
uspace/app/hdisk/hdisk.c
rd617050 r8f6c7785 73 73 return -1; 74 74 } 75 75 76 76 init_table(); 77 77 78 78 mbr_t * mbr = mbr_read_mbr(dev_handle); 79 79 if(mbr == NULL) { … … 98 98 mbr_free_mbr(mbr); 99 99 gpt_t * gpt = gpt_read_gpt_header(dev_handle); 100 printf("here3\n"); 100 101 if(gpt == NULL) { 101 102 printf("Failed to read and parse GPT header. Exiting.\n"); … … 103 104 } 104 105 set_table_gpt(gpt); 106 printf("here4\n"); 105 107 gpt_partitions_t * parts = gpt_read_partitions(gpt); 108 printf("here5\n"); 106 109 if(parts == NULL) { 107 110 printf("Failed to read and parse partitions.\n" \ … … 114 117 115 118 rc = interact(dev_handle); 116 119 117 120 free_table(); 118 121 119 122 return rc; 120 123 } … … 188 191 input = getchar(); 189 192 printf("%c\n", input); 190 193 191 194 192 195 //rc = tinput_read(in, &str);
Note:
See TracChangeset
for help on using the changeset viewer.
