Changeset 4979403 in mainline for uspace/srv


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/srv
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/cdfs/cdfs.c

    r8895d05 r4979403  
    5252        .concurrent_read_write = false,
    5353        .write_retains_size = false,
     54        .instance = 0,
    5455};
    5556
     
    5859        printf("%s: HelenOS cdfs file system server\n", NAME);
    5960       
     61        if (argc == 3) {
     62                if (!str_cmp(argv[1], "--instance"))
     63                        cdfs_vfs_info.instance = strtol(argv[2], NULL, 10);
     64                else {
     65                        printf(NAME " Unrecognized parameters");
     66                        return -1;
     67                }
     68        }
     69
    6070        if (!cdfs_init()) {
    6171                printf("%s: failed to initialize cdfs\n", NAME);
  • uspace/srv/fs/exfat/exfat.c

    r8895d05 r4979403  
    5454        .name = NAME,
    5555        .concurrent_read_write = false,
    56         .write_retains_size = false,   
     56        .write_retains_size = false,
     57        .instance = 0,
    5758};
    5859
     
    6061{
    6162        printf(NAME ": HelenOS exFAT file system server\n");
     63
     64        if (argc == 3) {
     65                if (!str_cmp(argv[1], "--instance"))
     66                        exfat_vfs_info.instance = strtol(argv[2], NULL, 10);
     67                else {
     68                        printf(NAME " Unrecognized parameters");
     69                        return -1;
     70                }
     71        }
    6272
    6373        int rc = exfat_idx_init();
  • uspace/srv/fs/ext2fs/ext2fs.c

    r8895d05 r4979403  
    5252vfs_info_t ext2fs_vfs_info = {
    5353        .name = NAME,
     54        .instance = 0,
    5455};
    5556
     
    5758{
    5859        printf(NAME ": HelenOS EXT2 file system server\n");
     60
     61        if (argc == 3) {
     62                if (!str_cmp(argv[1], "--instance"))
     63                        ext2fs_vfs_info.instance = strtol(argv[2], NULL, 10);
     64                else {
     65                        printf(NAME " Unrecognized parameters");
     66                        return -1;
     67                }
     68        }
    5969       
    6070        async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
  • uspace/srv/fs/fat/fat.c

    r8895d05 r4979403  
    5454        .name = NAME,
    5555        .concurrent_read_write = false,
    56         .write_retains_size = false,   
     56        .write_retains_size = false,
     57        .instance = 0,
    5758};
    5859
     
    6162        printf(NAME ": HelenOS FAT file system server\n");
    6263       
     64        if (argc == 3) {
     65                if (!str_cmp(argv[1], "--instance"))
     66                        fat_vfs_info.instance = strtol(argv[2], NULL, 10);
     67                else {
     68                        printf(NAME " Unrecognized parameters");
     69                        return -1;
     70                }
     71        }
     72
    6373        int rc = fat_idx_init();
    6474        if (rc != EOK)
  • uspace/srv/fs/locfs/locfs.c

    r8895d05 r4979403  
    5555        .concurrent_read_write = false,
    5656        .write_retains_size = false,
     57        .instance = 0,
    5758};
    5859
     
    6162        printf("%s: HelenOS Device Filesystem\n", NAME);
    6263       
     64        if (argc == 3) {
     65                if (!str_cmp(argv[1], "--instance"))
     66                        locfs_vfs_info.instance = strtol(argv[2], NULL, 10);
     67                else {
     68                        printf(NAME " Unrecognized parameters");
     69                        return -1;
     70                }
     71        }
     72
     73
    6374        if (!locfs_init()) {
    6475                printf("%s: failed to initialize locfs\n", NAME);
  • uspace/srv/fs/mfs/mfs.c

    r8895d05 r4979403  
    3939
    4040#include <ipc/services.h>
     41#include <stdlib.h>
     42#include <str.h>
    4143#include <ns.h>
    4244#include <async.h>
     
    5254        .concurrent_read_write = false,
    5355        .write_retains_size = false,
     56        .instance = 0,
    5457};
    5558
     
    5962
    6063        printf(NAME ": HelenOS Minix file system server\n");
     64
     65        if (argc == 3) {
     66                if (!str_cmp(argv[1], "--instance"))
     67                        mfs_vfs_info.instance = strtol(argv[2], NULL, 10);
     68                else {
     69                        printf(NAME " Unrecognized parameters");
     70                        rc = -1;
     71                        goto err;
     72                }
     73        }
    6174
    6275        async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
  • uspace/srv/fs/tmpfs/tmpfs.c

    r8895d05 r4979403  
    5959        .concurrent_read_write = false,
    6060        .write_retains_size = false,
     61        .instance = 0,
    6162};
    6263
     
    6465{
    6566        printf(NAME ": HelenOS TMPFS file system server\n");
     67
     68        if (argc == 3) {
     69                if (!str_cmp(argv[1], "--instance"))
     70                        tmpfs_vfs_info.instance = strtol(argv[2], NULL, 10);
     71                else {
     72                        printf(NAME " Unrecognized parameters");
     73                        return -1;
     74                }
     75        }
    6676       
    6777        if (!tmpfs_init()) {
  • uspace/srv/vfs/vfs.h

    r8895d05 r4979403  
    171171extern void vfs_exchange_release(async_exch_t *);
    172172
    173 extern fs_handle_t fs_name_to_handle(char *, bool);
     173extern fs_handle_t fs_name_to_handle(unsigned int instance, char *, bool);
    174174extern vfs_info_t *fs_handle_to_info(fs_handle_t);
    175175
  • uspace/srv/vfs/vfs_ops.c

    r8895d05 r4979403  
    276276       
    277277        /*
     278         * Instance number is passed as ARG3.
     279         */
     280        unsigned int instance = IPC_GET_ARG3(*request);
     281
     282        /*
    278283         * For now, don't make use of ARG3, but it can be used to
    279284         * carry mount options in the future.
     
    335340        fs_handle_t fs_handle;
    336341recheck:
    337         fs_handle = fs_name_to_handle(fs_name, false);
     342        fs_handle = fs_name_to_handle(instance, fs_name, false);
    338343        if (!fs_handle) {
    339344                if (flags & IPC_FLAG_BLOCKING) {
  • uspace/srv/vfs/vfs_register.c

    r8895d05 r4979403  
    154154         * Check for duplicit registrations.
    155155         */
    156         if (fs_name_to_handle(fs_info->vfs_info.name, false)) {
     156        if (fs_name_to_handle(fs_info->vfs_info.instance,
     157                        fs_info->vfs_info.name, false)) {
    157158                /*
    158159                 * We already register a fs like this.
     
    297298 *
    298299 */
    299 fs_handle_t fs_name_to_handle(char *name, bool lock)
     300fs_handle_t fs_name_to_handle(unsigned int instance, char *name, bool lock)
    300301{
    301302        int handle = 0;
     
    306307        list_foreach(fs_list, cur) {
    307308                fs_info_t *fs = list_get_instance(cur, fs_info_t, fs_link);
    308                 if (str_cmp(fs->vfs_info.name, name) == 0) {
     309                if (str_cmp(fs->vfs_info.name, name) == 0 &&
     310                                instance == fs->vfs_info.instance) {
    309311                        handle = fs->fs_handle;
    310312                        break;
Note: See TracChangeset for help on using the changeset viewer.