Changeset 4285f384 in mainline for uspace/app/vol/vol.c


Ignore:
Timestamp:
2025-02-25T20:25:43Z (17 hours ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Parents:
d231a54
Message:

Allow physically ejecting CD-ROM using vol eject -s

File:
1 edited

Legend:

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

    rd231a54 r4285f384  
    11/*
    2  * Copyright (c) 2017 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3636#include <io/table.h>
    3737#include <loc.h>
     38#include <stdbool.h>
    3839#include <stdio.h>
    3940#include <stdlib.h>
     
    107108}
    108109
    109 static errno_t vol_cmd_eject(const char *volspec)
     110static errno_t vol_cmd_eject(const char *volspec, bool physical)
    110111{
    111112        vol_t *vol = NULL;
     
    125126        }
    126127
    127         rc = vol_part_eject(vol, part_id);
     128        rc = vol_part_eject(vol, part_id, physical ? vef_physical :
     129            vef_none);
    128130        if (rc != EOK) {
    129131                printf("Error ejecting volume.\n");
     
    323325{
    324326        printf("Syntax:\n");
    325         printf("  %s                List present volumes\n", NAME);
    326         printf("  %s -c             List volume configuration entries\n", NAME);
    327         printf("  %s -h             Print help\n", NAME);
    328         printf("  %s eject <mp>     Eject volume mounted in a directory\n", NAME);
    329         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);
     327        printf("  %s                 List present volumes\n", NAME);
     328        printf("  %s -c              List volume configuration entries\n", NAME);
     329        printf("  %s -h              Print help\n", NAME);
     330        printf("  %s eject [-s] <mp> Eject volume mounted in a directory\n", NAME);
     331        printf("                     -s to eject physically\n");
     332        printf("  %s insert <svc>    Insert volume based on service identifier\n", NAME);
     333        printf("  %s insert -p <mp>  Insert volume based on filesystem path\n", NAME);
    331334}
    332335
     
    336339        char *volspec;
    337340        vol_cmd_t vcmd;
     341        bool physical = false;
    338342        int i;
    339343        errno_t rc = EINVAL;
     
    351355                } else if (str_cmp(cmd, "eject") == 0) {
    352356                        vcmd = vcmd_eject;
     357                        if (str_cmp(argv[i], "-s") == 0) {
     358                                physical = true;
     359                                ++i;
     360                        }
     361
    353362                        if (argc <= i) {
    354363                                printf("Parameter missing.\n");
     
    382391        switch (vcmd) {
    383392        case vcmd_eject:
    384                 rc = vol_cmd_eject(volspec);
     393                rc = vol_cmd_eject(volspec, physical);
    385394                break;
    386395        case vcmd_insert:
Note: See TracChangeset for help on using the changeset viewer.