Changeset b598460a in mainline for uspace/app/fdisk/fdisk.c


Ignore:
Timestamp:
2015-10-21T09:27:06Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
852664b9
Parents:
68b5dd11
Message:

Suggest maximum available free space as the default for partition size.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/fdisk/fdisk.c

    r68b5dd11 rb598460a  
    338338        fdisk_part_spec_t pspec;
    339339        fdisk_cap_t cap;
     340        fdisk_cap_t mcap;
    340341        vol_fstype_t fstype = 0;
    341342        tinput_t *tinput = NULL;
     343        fdisk_spc_t spc;
    342344        char *scap;
     345        char *smcap = NULL;
     346
     347        if (pkind == lpk_logical)
     348                spc = spc_log;
     349        else
     350                spc = spc_pri;
     351
     352        rc = fdisk_part_get_max_avail(dev, spc, &mcap);
     353        if (rc != EOK) {
     354                rc = EIO;
     355                goto error;
     356        }
     357
     358        rc = fdisk_cap_format(&mcap, &smcap);
     359        if (rc != EOK) {
     360                rc = ENOMEM;
     361                goto error;
     362        }
    343363
    344364        tinput = tinput_new();
     
    354374        while (true) {
    355375                printf("Enter capacity of new partition.\n");
    356                 rc = tinput_read(tinput, &scap);
     376                rc = tinput_read_i(tinput, smcap, &scap);
    357377                if (rc != EOK)
    358378                        goto error;
     
    365385        tinput_destroy(tinput);
    366386        tinput = NULL;
     387        free(smcap);
     388        smcap = NULL;
    367389
    368390        if (pkind != lpk_extended) {
     
    385407        return EOK;
    386408error:
     409        free(smcap);
    387410        if (tinput != NULL)
    388411                tinput_destroy(tinput);
Note: See TracChangeset for help on using the changeset viewer.