Changeset 9c2c7d2 in mainline for uspace/app/fdisk/fdisk.c
- Timestamp:
- 2017-07-06T15:52:15Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5cd1eb9a
- Parents:
- d858a660
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/fdisk/fdisk.c
rd858a660 r9c2c7d2 42 42 #include <fdisk.h> 43 43 44 #define NO_LABEL_CAPTION "(No name)" 45 44 46 static bool quit = false; 45 47 static fdisk_t *fdisk; … … 445 447 fdisk_cap_t cap; 446 448 fdisk_cap_t mcap; 449 vol_label_supp_t vlsupp; 447 450 vol_fstype_t fstype = 0; 448 451 tinput_t *tinput = NULL; … … 450 453 char *scap; 451 454 char *smcap = NULL; 455 char *label = NULL; 452 456 453 457 if (pkind == lpk_logical) … … 502 506 } 503 507 508 fdisk_get_vollabel_support(dev, fstype, &vlsupp); 509 if (vlsupp.supported) { 510 tinput = tinput_new(); 511 if (tinput == NULL) { 512 rc = ENOMEM; 513 goto error; 514 } 515 516 rc = tinput_set_prompt(tinput, "?> "); 517 if (rc != EOK) 518 goto error; 519 520 /* Ask for volume label */ 521 printf("Enter volume label for new partition.\n"); 522 rc = tinput_read_i(tinput, "No name", &label); 523 if (rc != EOK) 524 goto error; 525 526 tinput_destroy(tinput); 527 tinput = NULL; 528 } 529 504 530 fdisk_pspec_init(&pspec); 505 531 pspec.capacity = cap; 506 532 pspec.pkind = pkind; 507 533 pspec.fstype = fstype; 534 pspec.label = label; 508 535 509 536 rc = fdisk_part_create(dev, &pspec, NULL); … … 513 540 } 514 541 542 free(label); 515 543 return EOK; 516 544 error: 517 545 free(smcap); 546 free(label); 518 547 if (tinput != NULL) 519 548 tinput_destroy(tinput); … … 530 559 char *sfstype = NULL; 531 560 char *sdesc = NULL; 561 const char *label; 532 562 bool confirm; 533 563 void *sel; … … 577 607 } 578 608 579 rc = asprintf(&sdesc, "%s, %s, %s", scap, spkind, sfstype); 609 if (str_size(pinfo.label) > 0) 610 label = pinfo.label; 611 else 612 label = "(No name)"; 613 614 rc = asprintf(&sdesc, "%s %s, %s, %s", label, 615 scap, spkind, sfstype); 580 616 if (rc < 0) { 581 617 rc = ENOMEM; … … 773 809 label = pinfo.label; 774 810 else 775 label = "(No label)";811 label = "(No name)"; 776 812 777 813 if (linfo.ltype == lt_none)
Note:
See TracChangeset
for help on using the changeset viewer.