Ignore:
File:
1 edited

Legend:

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

    rdf908b3 r4791e3c  
    3939#include <ipc/services.h>
    4040#include <async.h>
    41 #include <async_rel.h>
    4241#include <fibril.h>
    4342#include <fibril_synch.h>
     
    111110void vfs_register(ipc_callid_t rid, ipc_call_t *request)
    112111{
     112        int phone;
     113       
    113114        dprintf("Processing VFS_REGISTER request received from %p.\n",
    114115            request->in_phone_hash);
     
    136137       
    137138        link_initialize(&fs_info->fs_link);
    138         fibril_mutex_initialize(&fs_info->phone_lock);
    139139        fs_info->vfs_info = *vfs_info;
    140140        free(vfs_info);
     
    177177        ipc_call_t call;
    178178        ipc_callid_t callid = async_get_call(&call);
    179         if (IPC_GET_METHOD(call) != IPC_M_CONNECT_TO_ME) {
    180                 dprintf("Unexpected call, method = %d\n", IPC_GET_METHOD(call));
     179        if (IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) {
     180                dprintf("Unexpected call, method = %d\n", IPC_GET_IMETHOD(call));
    181181                list_remove(&fs_info->fs_link);
    182182                fibril_mutex_unlock(&fs_head_lock);
     
    186186                return;
    187187        }
    188         fs_info->phone = IPC_GET_ARG5(call);
     188       
     189        phone = IPC_GET_ARG5(call);
     190        async_session_create(&fs_info->session, phone);
    189191        ipc_answer_0(callid, EOK);
    190192       
     
    197199        size_t size;
    198200        if (!async_share_in_receive(&callid, &size)) {
    199                 dprintf("Unexpected call, method = %d\n", IPC_GET_METHOD(call));
     201                dprintf("Unexpected call, method = %d\n", IPC_GET_IMETHOD(call));
    200202                list_remove(&fs_info->fs_link);
    201203                fibril_mutex_unlock(&fs_head_lock);
    202                 ipc_hangup(fs_info->phone);
     204                async_session_destroy(&fs_info->session);
     205                ipc_hangup(phone);
    203206                free(fs_info);
    204207                ipc_answer_0(callid, EINVAL);
     
    214217                list_remove(&fs_info->fs_link);
    215218                fibril_mutex_unlock(&fs_head_lock);
    216                 ipc_hangup(fs_info->phone);
     219                async_session_destroy(&fs_info->session);
     220                ipc_hangup(phone);
    217221                free(fs_info);
    218222                ipc_answer_0(callid, EINVAL);
     
    235239         */
    236240        fs_info->fs_handle = (fs_handle_t) atomic_postinc(&fs_handle_next);
    237         ipc_answer_1(rid, EOK, (ipcarg_t) fs_info->fs_handle);
     241        ipc_answer_1(rid, EOK, (sysarg_t) fs_info->fs_handle);
    238242       
    239243        fibril_condvar_broadcast(&fs_head_cv);
     
    269273                if (fs->fs_handle == handle) {
    270274                        fibril_mutex_unlock(&fs_head_lock);
    271                         fibril_mutex_lock(&fs->phone_lock);
    272                         phone = async_relation_create(fs->phone);
    273                         fibril_mutex_unlock(&fs->phone_lock);
     275                        phone = async_exchange_begin(&fs->session);
    274276
    275277                        assert(phone > 0);
     
    295297                if (fs->fs_handle == handle) {
    296298                        fibril_mutex_unlock(&fs_head_lock);
    297                         fibril_mutex_lock(&fs->phone_lock);
    298                         async_relation_destroy(fs->phone, phone);
    299                         fibril_mutex_unlock(&fs->phone_lock);
     299                        async_exchange_end(&fs->session, phone);
    300300                        return;
    301301                }
     
    333333}
    334334
     335/** Find the VFS info structure.
     336 *
     337 * @param handle        FS handle for which the VFS info structure is sought.
     338 * @return              VFS info structure on success or NULL otherwise.
     339 */
     340vfs_info_t *fs_handle_to_info(fs_handle_t handle)
     341{
     342        vfs_info_t *info = NULL;
     343        link_t *cur;
     344
     345        fibril_mutex_lock(&fs_head_lock);
     346        for (cur = fs_head.next; cur != &fs_head; cur = cur->next) {
     347                fs_info_t *fs = list_get_instance(cur, fs_info_t, fs_link);
     348                if (fs->fs_handle == handle) {
     349                        info = &fs->vfs_info;
     350                        break;
     351                }
     352        }
     353        fibril_mutex_unlock(&fs_head_lock);
     354
     355        return info;
     356}
     357
    335358/**
    336359 * @}
Note: See TracChangeset for help on using the changeset viewer.