Changeset 10e4cd7 in mainline for uspace/srv/vfs/vfs_ops.c


Ignore:
Timestamp:
2011-11-03T21:45:35Z (13 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
76a67ce
Parents:
3ce78580
Message:

Initial implementation of vfs mtab_read support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs_ops.c

    r3ce78580 r10e4cd7  
    5252#include <assert.h>
    5353#include <vfs/canonify.h>
     54#include <vfs/vfs_mtab.h>
     55
     56FIBRIL_MUTEX_INITIALIZE(mtab_list_lock);
     57LIST_INITIALIZE(mtab_list);
     58static size_t mtab_size = 0;
    5459
    5560/* Forward declarations of static functions. */
     
    353358        fibril_mutex_unlock(&fs_list_lock);
    354359       
     360        /* Do the mount */
     361        vfs_mount_internal(rid, service_id, fs_handle, mp, opts);
     362
     363        /* Add the filesystem info to the list of mounted filesystems */
     364        mtab_list_ent_t *mtab_list_ent = malloc(sizeof(mtab_list_ent_t));
     365        if (!mtab_list_ent) {
     366                async_answer_0(callid, ENOMEM);
     367                async_answer_0(rid, ENOMEM);
     368                free(mp);
     369                free(fs_name);
     370                free(opts);
     371                return;
     372        }
     373
     374        mtab_ent_t *mtab_ent = &mtab_list_ent->mtab_ent;
     375
     376        mtab_ent->fs_handle = fs_handle;
     377        str_cpy(mtab_ent->mp, MAX_PATH_LEN, mp);
     378        str_cpy(mtab_ent->fs_name, FS_NAME_MAXLEN, fs_name);
     379        str_cpy(mtab_ent->opts, MAX_MNTOPTS_LEN, opts);
     380        mtab_ent->flags = flags;
     381        mtab_ent->instance = instance;
     382
     383        link_initialize(&mtab_list_ent->link);
     384
     385        fibril_mutex_lock(&mtab_list_lock);
     386        list_append(&mtab_list_ent->link, &mtab_list);
     387        mtab_size++;
     388        fibril_mutex_unlock(&mtab_list_lock);
     389
     390        free(mp);
     391
    355392        /* Acknowledge that we know fs_name. */
    356393        async_answer_0(callid, EOK);
    357        
    358         /* Do the mount */
    359         vfs_mount_internal(rid, service_id, fs_handle, mp, opts);
    360         free(mp);
    361         free(fs_name);
    362         free(opts);
    363394}
    364395
Note: See TracChangeset for help on using the changeset viewer.