Changeset 64ffd83 in mainline for uspace/app/fdisk/fdisk.c


Ignore:
Timestamp:
2018-07-24T09:43:38Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bec18a9
Parents:
05208d9
git-author:
Jiri Svoboda <jiri@…> (2018-07-23 18:41:45)
git-committer:
Jiri Svoboda <jiri@…> (2018-07-24 09:43:38)
Message:

Configuring mount point for (newly created) paritions.

File:
1 edited

Legend:

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

    r05208d9 r64ffd83  
    11/*
    2  * Copyright (c) 2015 Jiri Svoboda
     2 * Copyright (c) 2018 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    432432        char *smcap = NULL;
    433433        char *label = NULL;
     434        char *mountp = NULL;
    434435
    435436        if (pkind == lpk_logical)
     
    506507        }
    507508
     509        /* Ask for mount point */
     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        while (true) {
     521                printf("Enter mount point for new partition (Auto, None or /path).\n");
     522                rc = tinput_read_i(tinput, "Auto", &mountp);
     523                if (rc != EOK)
     524                        goto error;
     525
     526                rc = vol_mountp_validate(mountp);
     527                if (rc == EOK)
     528                        break;
     529
     530                free(mountp);
     531                mountp = NULL;
     532        }
     533
     534        tinput_destroy(tinput);
     535        tinput = NULL;
     536
    508537        fdisk_pspec_init(&pspec);
    509538        pspec.capacity = cap;
     
    511540        pspec.fstype = fstype;
    512541        pspec.label = label;
     542        pspec.mountp = mountp;
    513543
    514544        rc = fdisk_part_create(dev, &pspec, NULL);
     
    519549
    520550        free(label);
     551        free(mountp);
    521552        return EOK;
    522553error:
    523554        free(smcap);
    524555        free(label);
     556        free(mountp);
    525557        if (tinput != NULL)
    526558                tinput_destroy(tinput);
Note: See TracChangeset for help on using the changeset viewer.