Changeset 4f100f4 in mainline for uspace/app/bdsh/cmds/modules/mount


Ignore:
Timestamp:
2011-11-06T16:58:23Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
41047bf
Parents:
3ce78580 (diff), 460514d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge support for listing mounted file systems.

File:
1 edited

Legend:

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

    r3ce78580 r4f100f4  
    3030#include <stdlib.h>
    3131#include <vfs/vfs.h>
     32#include <adt/list.h>
    3233#include <errno.h>
    3334#include <getopt.h>
     
    6061        }
    6162        return;
     63}
     64
     65static void print_mtab_list(void)
     66{
     67        LIST_INITIALIZE(mtab_list);
     68        get_mtab_list(&mtab_list);
     69
     70        mtab_ent_t *old_ent = NULL;
     71
     72        list_foreach(mtab_list, cur) {
     73                mtab_ent_t *mtab_ent = list_get_instance(cur, mtab_ent_t,
     74                    link);
     75
     76                if (old_ent)
     77                        free(old_ent);
     78
     79                old_ent = mtab_ent;
     80
     81                printf("%s on %s ", mtab_ent->fs_name, mtab_ent->mp);
     82
     83                if (str_size(mtab_ent->opts) > 0)
     84                        printf("opts=%s ", mtab_ent->opts);
     85
     86                printf("(instance=%d, service_id=%" PRIu64 ")\n",
     87                    mtab_ent->instance, mtab_ent->service_id);
     88        }
     89
     90        if (old_ent)
     91                free(old_ent);
    6292}
    6393
     
    94124                t_argv = &argv[0];
    95125
    96         if ((argc < 3) || (argc > 5)) {
     126        if ((argc == 2) || (argc > 5)) {
    97127                printf("%s: invalid number of arguments. Try `mount --help'\n",
    98128                    cmdname);
    99129                return CMD_FAILURE;
     130        }
     131        if (argc == 1) {
     132                print_mtab_list();
     133                return CMD_SUCCESS;
    100134        }
    101135        if (argc > 3)
Note: See TracChangeset for help on using the changeset viewer.