Ignore:
Timestamp:
2017-05-05T17:37:36Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
951f6b9e
Parents:
75b24cd
Message:

Mount should be able to print the list of available file system types.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/mount/mount.c

    r75b24cd rb14d9f9  
    4949        { "help", no_argument, 0, 'h' },
    5050        { "instance", required_argument, 0, 'i' },
     51        { "types", no_argument, 0, 't' },
    5152        { 0, 0, 0, 0 }
    5253};
     
    5758{
    5859        static char helpfmt[] =
    59             "Usage:  %s <fstype> <mp> [dev] [<moptions>]\n";
     60            "Usage:  %s <fstype> <mp> [dev] [<moptions>]\n"
     61            "Options:\n"
     62            "  -h, --help       A short option summary\n"
     63            "  -i, --instance ## Mount a specific instance\n"
     64            "  -t, --types      List available file system types\n";
     65
    6066        if (level == HELP_SHORT) {
    6167                printf("'%s' mounts a file system.\n", cmdname);
     
    101107}
    102108
     109static void print_fstypes(void)
     110{
     111        int rc;
     112        vfs_fstypes_t fstypes;
     113        char **p;
     114
     115        rc = vfs_fstypes(&fstypes);
     116        if (rc != EOK) {
     117                printf("Error getting list of available file system types.\n");
     118                return;
     119        }
     120
     121        printf("Available file system types:\n");
     122        p = fstypes.fstypes;
     123        while (*p != NULL)
     124                printf("\t%s\n", *p++);
     125        vfs_fstypes_free(&fstypes);
     126}
     127
    103128/* Main entry point for mount, accepts an array of arguments */
    104129int cmd_mount(char **argv)
     
    115140
    116141        for (c = 0, optreset = 1, optind = 0, opt_ind = 0; c != -1;) {
    117                 c = getopt_long(argc, argv, "i:h", long_options, &opt_ind);
     142                c = getopt_long(argc, argv, "i:ht", long_options, &opt_ind);
    118143                switch (c) {
    119144                case 'h':
     
    124149                        instance_set = true;
    125150                        break;
     151                case 't':
     152                        print_fstypes();
     153                        return CMD_SUCCESS;
    126154                }
    127155        }
     
    151179                printf("Unable to mount %s filesystem to %s on %s (rc=%s)\n",
    152180                    t_argv[2], t_argv[1], t_argv[3], str_error(rc));
     181                if (rc == ENOFS)
     182                        print_fstypes();
    153183                return CMD_FAILURE;
    154184        }
Note: See TracChangeset for help on using the changeset viewer.