Changeset 6681222 in mainline


Ignore:
Timestamp:
2010-12-26T18:35:33Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6e5b4e7
Parents:
3750c06 (diff), 4791e3c (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 async session improvements.

Location:
uspace
Files:
1 added
1 deleted
6 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/Makefile

    r3750c06 r6681222  
    8787        generic/ipc.c \
    8888        generic/async.c \
    89         generic/async_rel.c \
     89        generic/async_sess.c \
    9090        generic/loader.c \
    9191        generic/getopt.c \
  • uspace/lib/c/generic/async.c

    r3750c06 r6681222  
    749749                return ENOMEM;
    750750        }
     751
     752        _async_sess_init();
    751753       
    752754        return 0;
  • uspace/lib/c/generic/libc.c

    r3750c06 r6681222  
    5050#include <ipc/ipc.h>
    5151#include <async.h>
    52 #include <async_rel.h>
    5352#include <as.h>
    5453#include <loader/pcb.h>
     
    6665        __heap_init();
    6766        __async_init();
    68         (void) async_rel_init();
    6967        fibril_t *fibril = fibril_setup();
    7068        __tcb_set(fibril->tcb);
  • uspace/lib/c/include/async.h

    r3750c06 r6681222  
    3737
    3838#include <ipc/ipc.h>
     39#include <async_sess.h>
    3940#include <fibril.h>
    4041#include <sys/time.h>
  • uspace/lib/c/include/async_sess.h

    r3750c06 r6681222  
    3333 */
    3434
    35 #ifndef LIBC_ASYNC_REL_H_
    36 #define LIBC_ASYNC_REL_H_
     35#ifndef LIBC_ASYNC_SESS_H_
     36#define LIBC_ASYNC_SESS_H_
    3737
    38 extern int async_rel_init(void);
    39 extern int async_relation_create(int);
    40 extern void async_relation_destroy(int, int);
     38#include <adt/list.h>
     39
     40typedef struct {
     41        int sess_phone;         /**< Phone for cloning off the connections. */
     42        link_t conn_head;       /**< List of open data connections. */
     43        link_t sess_link;       /**< Link in global list of open sessions. */
     44} async_sess_t;
     45
     46extern void _async_sess_init(void);
     47extern void async_session_create(async_sess_t *, int);
     48extern void async_session_destroy(async_sess_t *);
     49extern int async_exchange_begin(async_sess_t *);
     50extern void async_exchange_end(async_sess_t *, int);
    4151
    4252#endif
  • uspace/srv/vfs/vfs.h

    r3750c06 r6681222  
    3434#define VFS_VFS_H_
    3535
     36#include <async.h>
    3637#include <ipc/ipc.h>
    3738#include <adt/list.h>
     
    5354        vfs_info_t vfs_info;
    5455        fs_handle_t fs_handle;
    55         fibril_mutex_t phone_lock;
    56         sysarg_t phone;
     56        async_sess_t session;
    5757} fs_info_t;
    5858
  • uspace/srv/vfs/vfs_register.c

    r3750c06 r6681222  
    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);
     
    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       
     
    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);
     
    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                }
Note: See TracChangeset for help on using the changeset viewer.