Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/async.c

    rf302586 r36e2b55  
    118118#define CONN_HASH_TABLE_BUCKETS    32
    119119
    120 /** Session data */
    121 struct async_sess {
    122         /** List of inactive exchanges */
    123         list_t exch_list;
    124        
    125         /** Exchange management style */
    126         exch_mgmt_t mgmt;
    127        
    128         /** Session identification */
    129         int phone;
    130        
    131         /** First clone connection argument */
    132         sysarg_t arg1;
    133        
    134         /** Second clone connection argument */
    135         sysarg_t arg2;
    136        
    137         /** Third clone connection argument */
    138         sysarg_t arg3;
    139        
    140         /** Exchange mutex */
    141         fibril_mutex_t mutex;
    142        
    143         /** Number of opened exchanges */
    144         atomic_t refcnt;
    145        
    146         /** Mutex for stateful connections */
    147         fibril_mutex_t remote_state_mtx;
    148        
    149         /** Data for stateful connections */
    150         void *remote_state_data;
    151 };
    152 
    153 /** Exchange data */
    154 struct async_exch {
    155         /** Link into list of inactive exchanges */
    156         link_t sess_link;
    157        
    158         /** Link into global list of inactive exchanges */
    159         link_t global_link;
    160        
    161         /** Session pointer */
    162         async_sess_t *sess;
    163        
    164         /** Exchange identification */
    165         int phone;
    166 };
    167 
    168120/** Async framework global futex */
    169121atomic_t async_futex = FUTEX_INITIALIZER;
     
    182134        ipc_call_t call;
    183135} msg_t;
    184 
    185 /** Message data */
    186 typedef struct {
    187         awaiter_t wdata;
    188        
    189         /** If reply was received. */
    190         bool done;
    191        
    192         /** Pointer to where the answer data is stored. */
    193         ipc_call_t *dataptr;
    194        
    195         sysarg_t retval;
    196 } amsg_t;
    197136
    198137/* Client connection data */
     
    257196void async_set_client_data_constructor(async_client_data_ctor_t ctor)
    258197{
    259         assert(async_client_data_create == default_client_data_constructor);
    260198        async_client_data_create = ctor;
    261199}
     
    263201void async_set_client_data_destructor(async_client_data_dtor_t dtor)
    264202{
    265         assert(async_client_data_destroy == default_client_data_destructor);
    266203        async_client_data_destroy = dtor;
    267204}
     
    305242void async_set_client_connection(async_client_conn_t conn)
    306243{
    307         assert(client_connection == default_client_connection);
    308244        client_connection = conn;
    309245}
     
    18511787       
    18521788        int rc = async_hangup_internal(sess->phone);
     1789        if (rc == EOK)
     1790                free(sess);
    18531791       
    18541792        while (!list_empty(&sess->exch_list)) {
     
    18621800                free(exch);
    18631801        }
    1864 
    1865         free(sess);
    18661802       
    18671803        fibril_mutex_unlock(&async_sess_mutex);
     
    20011937 *
    20021938 * @param exch  Exchange for sending the message.
     1939 * @param dst   Destination address space area base.
    20031940 * @param size  Size of the destination address space area.
    20041941 * @param arg   User defined argument.
    20051942 * @param flags Storage for the received flags. Can be NULL.
    2006  * @param dst   Destination address space area base. Cannot be NULL.
    20071943 *
    20081944 * @return Zero on success or a negative error code from errno.h.
    20091945 *
    20101946 */
    2011 int async_share_in_start(async_exch_t *exch, size_t size, sysarg_t arg,
    2012     unsigned int *flags, void **dst)
     1947int async_share_in_start(async_exch_t *exch, void *dst, size_t size,
     1948    sysarg_t arg, unsigned int *flags)
    20131949{
    20141950        if (exch == NULL)
    20151951                return ENOENT;
    20161952       
    2017         sysarg_t _flags = 0;
    2018         sysarg_t _dst = (sysarg_t) -1;
    2019         int res = async_req_2_4(exch, IPC_M_SHARE_IN, (sysarg_t) size,
    2020             arg, NULL, &_flags, NULL, &_dst);
     1953        sysarg_t tmp_flags;
     1954        int res = async_req_3_2(exch, IPC_M_SHARE_IN, (sysarg_t) dst,
     1955            (sysarg_t) size, arg, NULL, &tmp_flags);
    20211956       
    20221957        if (flags)
    2023                 *flags = (unsigned int) _flags;
    2024        
    2025         *dst = (void *) _dst;
     1958                *flags = (unsigned int) tmp_flags;
     1959       
    20261960        return res;
    20271961}
     
    20521986                return false;
    20531987       
    2054         *size = (size_t) IPC_GET_ARG1(data);
     1988        *size = (size_t) IPC_GET_ARG2(data);
    20551989        return true;
    20561990}
     
    20581992/** Wrapper for answering the IPC_M_SHARE_IN calls using the async framework.
    20591993 *
    2060  * This wrapper only makes it more comfortable to answer IPC_M_SHARE_IN
     1994 * This wrapper only makes it more comfortable to answer IPC_M_DATA_READ
    20611995 * calls so that the user doesn't have to remember the meaning of each IPC
    20621996 * argument.
     
    21362070 *
    21372071 */
    2138 int async_share_out_finalize(ipc_callid_t callid, void **dst)
     2072int async_share_out_finalize(ipc_callid_t callid, void *dst)
    21392073{
    21402074        return ipc_share_out_finalize(callid, dst);
Note: See TracChangeset for help on using the changeset viewer.