Changeset 0435fe41 in mainline for uspace/app/hdisk/hdisk.c
- Timestamp:
- 2013-08-27T00:32:08Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 61ab4a9, 802898f
- Parents:
- 493b881
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/hdisk/hdisk.c
r493b881 r0435fe41 84 84 init_label(); 85 85 86 /*87 mbr_t * mbr = mbr_read_mbr(dev_handle);88 if(mbr == NULL) {89 printf("Failed to read the Master Boot Record.\n" \90 "Either memory allocation or disk access failed. Exiting.\n");91 return -1;92 }93 94 if(mbr_is_mbr(mbr)) {95 label.layout = LYT_MBR;96 set_label_mbr(mbr);97 mbr_partitions_t * parts = mbr_read_partitions(mbr);98 if(parts == NULL) {99 printf("Failed to read and parse partitions.\n" \100 "Creating new partition table.");101 parts = mbr_alloc_partitions();102 }103 set_label_mbr_parts(parts);104 fill_label_funcs();105 goto interact;106 }107 108 109 mbr_free_mbr(mbr);*/110 111 86 rc = try_read_mbr(dev_handle); 112 87 if (rc == EOK) 113 88 goto interact; 114 115 /*116 gpt_t * gpt = gpt_read_gpt_header(dev_handle);117 118 if(gpt != NULL) {119 label.layout = LYT_GPT;120 set_label_gpt(gpt);121 122 gpt_partitions_t * parts = gpt_read_partitions(gpt);123 124 if(parts == NULL) {125 printf("Failed to read and parse partitions.\n" \126 "Creating new partition table.");127 parts = gpt_alloc_partitions();128 }129 set_label_gpt_parts(parts);130 fill_label_funcs();131 goto interact;132 }133 */134 89 135 90 rc = try_read_gpt(dev_handle); … … 167 122 printf("%c\n", input); 168 123 169 switch (input) {170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 124 switch (input) { 125 case 'a': 126 label.add_part(&label, in); 127 break; 128 case 'd': 129 label.delete_part(&label, in); 130 break; 131 case 'e': 132 label.extra_funcs(&label, in, dev_handle); 133 break; 134 case 'f': 135 select_label_format(in); 136 break; 137 case 'h': 138 print_help(); 139 break; 140 case 'l': 141 set_alignment(in); 142 break; 143 case 'n': 144 printf("Discarding label...\n"); 145 free_label(); 146 label.new_label(&label); 147 break; 148 case 'p': 149 label.print_parts(&label); 150 break; 151 case 'q': 152 putchar('\n'); 153 free_label(); 154 goto end; 155 case 'r': 156 label.read_parts(&label, dev_handle); 157 case 'w': 158 label.write_parts(&label, dev_handle); 159 break; 160 default: 161 printf("Unknown command. Try 'h' for help.\n"); 162 break; 208 163 } 209 164 } … … 241 196 242 197 uint8_t val = get_input_uint8(in); 243 switch (val) {244 245 246 247 248 249 250 251 252 253 254 255 198 switch (val) { 199 case 0: 200 free_label(); 201 construct_label(LYT_NONE); 202 break; 203 case 1: 204 free_label(); 205 construct_label(LYT_MBR); 206 break; 207 case 2: 208 free_label(); 209 construct_label(LYT_GPT); 210 break; 256 211 } 257 212 } … … 259 214 void construct_label(layouts_t layout) 260 215 { 261 switch (layout) {262 263 264 265 266 267 268 269 270 271 272 273 216 switch (layout) { 217 case LYT_MBR: 218 label.layout = LYT_MBR; 219 construct_mbr_label(&label); 220 break; 221 case LYT_GPT: 222 label.layout = LYT_GPT; 223 construct_gpt_label(&label); 224 break; 225 default: 226 label.layout = LYT_NONE; 227 construct_none_label(&label); 228 break; 274 229 } 275 230 } … … 306 261 307 262 308 309 310 311 312 313 314
Note:
See TracChangeset
for help on using the changeset viewer.