Changeset b82985e in mainline for uspace/app/vol/vol.c


Ignore:
Timestamp:
2018-10-12T13:16:04Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d09eeb2
Parents:
6d00aff
Message:

Inserting volume by path.

File:
1 edited

Legend:

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

    r6d00aff rb82985e  
    4747        vcmd_eject,
    4848        vcmd_insert,
     49        vcmd_insert_by_path,
    4950        vcmd_help,
    5051        vcmd_list,
     
    155156
    156157        rc = vol_part_insert(vol, svc_id);
     158        if (rc != EOK) {
     159                printf("Error inserting volume.\n");
     160                goto out;
     161        }
     162
     163        rc = EOK;
     164out:
     165        vol_destroy(vol);
     166        return rc;
     167}
     168
     169static errno_t vol_cmd_insert_by_path(const char *volspec)
     170{
     171        vol_t *vol = NULL;
     172        errno_t rc;
     173
     174        rc = vol_create(&vol);
     175        if (rc != EOK) {
     176                printf("Error contacting volume service.\n");
     177                goto out;
     178        }
     179
     180        rc = vol_part_insert_by_path(vol, volspec);
    157181        if (rc != EOK) {
    158182                printf("Error inserting volume.\n");
     
    304328        printf("  %s eject <mp>     Eject volume mounted in a directory\n", NAME);
    305329        printf("  %s insert <svc>   Insert volume based on service identifier\n", NAME);
     330        printf("  %s insert -p <mp> Insert volume based on filesystem path\n", NAME);
    306331}
    307332
     
    332357                        volspec = argv[i++];
    333358                } else if (str_cmp(cmd, "insert") == 0) {
    334                         vcmd = vcmd_insert;
     359                        if (str_cmp(argv[i], "-p") == 0) {
     360                                vcmd = vcmd_insert_by_path;
     361                                ++i;
     362                        } else {
     363                                vcmd = vcmd_insert;
     364                        }
     365
    335366                        if (argc <= i) {
    336367                                printf("Parameter missing.\n");
     
    356387                rc = vol_cmd_insert(volspec);
    357388                break;
     389        case vcmd_insert_by_path:
     390                rc = vol_cmd_insert_by_path(volspec);
     391                break;
    358392        case vcmd_help:
    359393                print_syntax();
Note: See TracChangeset for help on using the changeset viewer.