Changeset 4979403 in mainline for uspace/app


Ignore:
Timestamp:
2011-09-23T15:39:07Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
286286c
Parents:
8895d05
git-author:
Maurizio Lombardi <m.lombardi85@…> (2011-09-23 15:39:07)
git-committer:
Jakub Jermar <jakub@…> (2011-09-23 15:39:07)
Message:

Allow more instances of the same FS to be used.
(Thanks to Maurizio Lombardi.)

Location:
uspace/app
Files:
2 edited

Legend:

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

    r8895d05 r4979403  
    4343static struct option const long_options[] = {
    4444        { "help", no_argument, 0, 'h' },
     45        { "instance", required_argument, 0, 'i' },
    4546        { 0, 0, 0, 0 }
    4647};
     
    6869        const char *dev = "";
    6970        int rc, c, opt_ind;
     71        unsigned int instance = 0;
     72        bool instance_set = false;
     73        char **t_argv;
    7074
    7175        argc = cli_count_args(argv);
    7276
    7377        for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
    74                 c = getopt_long(argc, argv, "h", long_options, &opt_ind);
     78                c = getopt_long(argc, argv, "i:h", long_options, &opt_ind);
    7579                switch (c) {
    7680                case 'h':
    7781                        help_cmd_mount(HELP_LONG);
    7882                        return CMD_SUCCESS;
     83                case 'i':
     84                        instance = (unsigned int) strtol(optarg, NULL, 10);
     85                        instance_set = true;
     86                        break;
    7987                }
    8088        }
     89
     90        if (instance_set) {
     91                argc -= 2;
     92                t_argv = &argv[2];
     93        } else
     94                t_argv = &argv[0];
    8195
    8296        if ((argc < 3) || (argc > 5)) {
     
    86100        }
    87101        if (argc > 3)
    88                 dev = argv[3];
     102                dev = t_argv[3];
    89103        if (argc == 5)
    90                 mopts = argv[4];
     104                mopts = t_argv[4];
    91105
    92         rc = mount(argv[1], argv[2], dev, mopts, 0);
     106        rc = mount(t_argv[1], t_argv[2], dev, mopts, 0, instance);
    93107        if (rc != EOK) {
    94108                printf("Unable to mount %s filesystem to %s on %s (rc=%d)\n",
    95                     argv[1], argv[2], argv[3], rc);
     109                        t_argv[1], t_argv[2], t_argv[3], rc);
    96110                return CMD_FAILURE;
    97111        }
  • uspace/app/init/init.c

    r8895d05 r4979403  
    121121       
    122122        int rc = mount(fstype, ROOT_MOUNT_POINT, ROOT_DEVICE, opts,
    123             IPC_FLAG_BLOCKING);
     123            IPC_FLAG_BLOCKING, 0);
    124124        return mount_report("Root filesystem", ROOT_MOUNT_POINT, fstype,
    125125            ROOT_DEVICE, rc);
     
    138138{
    139139        int rc = mount(LOCFS_FS_TYPE, LOCFS_MOUNT_POINT, "", "",
    140             IPC_FLAG_BLOCKING);
     140            IPC_FLAG_BLOCKING, 0);
    141141        return mount_report("Location service filesystem", LOCFS_MOUNT_POINT,
    142142            LOCFS_FS_TYPE, NULL, rc);
     
    261261static bool mount_tmpfs(void)
    262262{
    263         int rc = mount(TMPFS_FS_TYPE, TMPFS_MOUNT_POINT, "", "", 0);
     263        int rc = mount(TMPFS_FS_TYPE, TMPFS_MOUNT_POINT, "", "", 0, 0);
    264264        return mount_report("Temporary filesystem", TMPFS_MOUNT_POINT,
    265265            TMPFS_FS_TYPE, NULL, rc);
     
    268268static bool mount_data(void)
    269269{
    270         int rc = mount(DATA_FS_TYPE, DATA_MOUNT_POINT, DATA_DEVICE, "wtcache", 0);
     270        int rc = mount(DATA_FS_TYPE, DATA_MOUNT_POINT, DATA_DEVICE, "wtcache", 0, 0);
    271271        return mount_report("Data filesystem", DATA_MOUNT_POINT, DATA_FS_TYPE,
    272272            DATA_DEVICE, rc);
Note: See TracChangeset for help on using the changeset viewer.