Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/async.h

    r5da7199 r8e80d3f  
    4141
    4242#include <ipc/common.h>
     43#include <async_sess.h>
    4344#include <fibril.h>
    4445#include <sys/time.h>
     
    5253typedef void (*async_client_data_dtor_t)(void *);
    5354
    54 /** Client connection handler
    55  *
    56  * @param callid ID of incoming call or 0 if connection initiated from
    57  *               inside using async_connect_to_me()
    58  * @param call   Incoming call or 0 if connection initiated from inside
    59  * @param arg    Local argument passed from async_new_connection() or
    60  *               async_connect_to_me()
    61  */
    62 typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *, void *);
    63 
    64 /** Interrupt handler */
    65 typedef void (*async_interrupt_handler_t)(ipc_callid_t, ipc_call_t *);
    66 
    67 /** Exchange management style
    68  *
    69  */
    70 typedef enum {
    71         /** No explicit exchange management
    72          *
    73          * Suitable for protocols which use a single
    74          * IPC message per exchange only.
    75          *
    76          */
    77         EXCHANGE_ATOMIC = 0,
    78        
    79         /** Exchange management via phone cloning
    80          *
    81          * Suitable for servers which support client
    82          * data tracking by task hashes and do not
    83          * mind cloned phones.
    84          *
    85          */
    86         EXCHANGE_PARALLEL,
    87        
    88         /** Exchange management via mutual exclusion
    89          *
    90          * Suitable for any kind of client/server communication,
    91          * but can limit parallelism.
    92          *
    93          */
    94         EXCHANGE_SERIALIZE
    95 } exch_mgmt_t;
    96 
    97 /** Forward declarations */
    98 struct async_exch;
    99 struct async_sess;
    100 
    101 typedef struct async_sess async_sess_t;
    102 typedef struct async_exch async_exch_t;
     55typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *);
    10356
    10457extern atomic_t threads_in_ipc_wait;
     
    11568 * User-friendly wrappers for async_send_fast() and async_send_slow(). The
    11669 * macros are in the form async_send_m(), where m denotes the number of payload
    117  * arguments. Each macros chooses between the fast and the slow version based
     70 * arguments.  Each macros chooses between the fast and the slow version based
    11871 * on m.
    11972 */
    12073
    121 #define async_send_0(exch, method, dataptr) \
    122         async_send_fast(exch, method, 0, 0, 0, 0, dataptr)
    123 #define async_send_1(exch, method, arg1, dataptr) \
    124         async_send_fast(exch, method, arg1, 0, 0, 0, dataptr)
    125 #define async_send_2(exch, method, arg1, arg2, dataptr) \
    126         async_send_fast(exch, method, arg1, arg2, 0, 0, dataptr)
    127 #define async_send_3(exch, method, arg1, arg2, arg3, dataptr) \
    128         async_send_fast(exch, method, arg1, arg2, arg3, 0, dataptr)
    129 #define async_send_4(exch, method, arg1, arg2, arg3, arg4, dataptr) \
    130         async_send_fast(exch, method, arg1, arg2, arg3, arg4, dataptr)
    131 #define async_send_5(exch, method, arg1, arg2, arg3, arg4, arg5, dataptr) \
    132         async_send_slow(exch, method, arg1, arg2, arg3, arg4, arg5, dataptr)
    133 
    134 extern aid_t async_send_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
     74#define async_send_0(phoneid, method, dataptr) \
     75        async_send_fast((phoneid), (method), 0, 0, 0, 0, (dataptr))
     76#define async_send_1(phoneid, method, arg1, dataptr) \
     77        async_send_fast((phoneid), (method), (arg1), 0, 0, 0, (dataptr))
     78#define async_send_2(phoneid, method, arg1, arg2, dataptr) \
     79        async_send_fast((phoneid), (method), (arg1), (arg2), 0, 0, (dataptr))
     80#define async_send_3(phoneid, method, arg1, arg2, arg3, dataptr) \
     81        async_send_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (dataptr))
     82#define async_send_4(phoneid, method, arg1, arg2, arg3, arg4, dataptr) \
     83        async_send_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     84            (dataptr))
     85#define async_send_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, dataptr) \
     86        async_send_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     87            (arg5), (dataptr))
     88
     89extern aid_t async_send_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     90    sysarg_t, ipc_call_t *);
     91extern aid_t async_send_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    13592    sysarg_t, sysarg_t, ipc_call_t *);
    136 extern aid_t async_send_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
    137     sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
    138 
    13993extern void async_wait_for(aid_t, sysarg_t *);
    14094extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
    14195
    142 extern fid_t async_new_connection(task_id_t, sysarg_t, ipc_callid_t,
    143     ipc_call_t *, async_client_conn_t, void *);
    144 
     96extern fid_t async_new_connection(sysarg_t, sysarg_t, ipc_callid_t,
     97    ipc_call_t *, void (*)(ipc_callid_t, ipc_call_t *));
    14598extern void async_usleep(suseconds_t);
    14699extern void async_create_manager(void);
     
    149102extern void async_set_client_data_constructor(async_client_data_ctor_t);
    150103extern void async_set_client_data_destructor(async_client_data_dtor_t);
    151 extern void *async_get_client_data(void);
    152 extern void *async_get_client_data_by_id(task_id_t);
    153 extern void async_put_client_data_by_id(task_id_t);
     104
     105extern void *async_client_data_get(void);
    154106
    155107extern void async_set_client_connection(async_client_conn_t);
    156 extern void async_set_interrupt_received(async_interrupt_handler_t);
     108extern void async_set_interrupt_received(async_client_conn_t);
    157109
    158110/*
     
    160112 */
    161113
    162 extern void async_msg_0(async_exch_t *, sysarg_t);
    163 extern void async_msg_1(async_exch_t *, sysarg_t, sysarg_t);
    164 extern void async_msg_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
    165 extern void async_msg_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
    166 extern void async_msg_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     114extern void async_msg_0(int, sysarg_t);
     115extern void async_msg_1(int, sysarg_t, sysarg_t);
     116extern void async_msg_2(int, sysarg_t, sysarg_t, sysarg_t);
     117extern void async_msg_3(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
     118extern void async_msg_4(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
     119extern void async_msg_5(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    167120    sysarg_t);
    168 extern void async_msg_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    169     sysarg_t, sysarg_t);
    170121
    171122/*
     
    187138 */
    188139
    189 extern int async_forward_fast(ipc_callid_t, async_exch_t *, sysarg_t, sysarg_t,
    190     sysarg_t, unsigned int);
    191 extern int async_forward_slow(ipc_callid_t, async_exch_t *, sysarg_t, sysarg_t,
    192     sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int);
     140extern int async_forward_fast(ipc_callid_t, int, sysarg_t, sysarg_t, sysarg_t,
     141    unsigned int);
     142extern int async_forward_slow(ipc_callid_t, int, sysarg_t, sysarg_t, sysarg_t,
     143    sysarg_t, sysarg_t, sysarg_t, unsigned int);
    193144
    194145/*
     
    199150 */
    200151
    201 #define async_req_0_0(exch, method) \
    202         async_req_fast(exch, method, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL)
    203 #define async_req_0_1(exch, method, r1) \
    204         async_req_fast(exch, method, 0, 0, 0, 0, r1, NULL, NULL, NULL, NULL)
    205 #define async_req_0_2(exch, method, r1, r2) \
    206         async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, NULL, NULL, NULL)
    207 #define async_req_0_3(exch, method, r1, r2, r3) \
    208         async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, NULL, NULL)
    209 #define async_req_0_4(exch, method, r1, r2, r3, r4) \
    210         async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, NULL)
    211 #define async_req_0_5(exch, method, r1, r2, r3, r4, r5) \
    212         async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, r5)
    213 
    214 #define async_req_1_0(exch, method, arg1) \
    215         async_req_fast(exch, method, arg1, 0, 0, 0, NULL, NULL, NULL, NULL, \
    216             NULL)
    217 #define async_req_1_1(exch, method, arg1, rc1) \
    218         async_req_fast(exch, method, arg1, 0, 0, 0, rc1, NULL, NULL, NULL, \
    219             NULL)
    220 #define async_req_1_2(exch, method, arg1, rc1, rc2) \
    221         async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, NULL, NULL, \
    222             NULL)
    223 #define async_req_1_3(exch, method, arg1, rc1, rc2, rc3) \
    224         async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, NULL, \
    225             NULL)
    226 #define async_req_1_4(exch, method, arg1, rc1, rc2, rc3, rc4) \
    227         async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
    228             NULL)
    229 #define async_req_1_5(exch, method, arg1, rc1, rc2, rc3, rc4, rc5) \
    230         async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \
    231             rc5)
    232 
    233 #define async_req_2_0(exch, method, arg1, arg2) \
    234         async_req_fast(exch, method, arg1, arg2, 0, 0, NULL, NULL, NULL, \
     152#define async_req_0_0(phoneid, method) \
     153        async_req_fast((phoneid), (method), 0, 0, 0, 0, NULL, NULL, NULL, NULL, \
     154            NULL)
     155#define async_req_0_1(phoneid, method, r1) \
     156        async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), NULL, NULL, NULL, \
     157            NULL)
     158#define async_req_0_2(phoneid, method, r1, r2) \
     159        async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), NULL, NULL, \
     160            NULL)
     161#define async_req_0_3(phoneid, method, r1, r2, r3) \
     162        async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), (r3), NULL, \
     163            NULL)
     164#define async_req_0_4(phoneid, method, r1, r2, r3, r4) \
     165        async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), (r3), (r4), \
     166            NULL)
     167#define async_req_0_5(phoneid, method, r1, r2, r3, r4, r5) \
     168        async_req_fast((phoneid), (method), 0, 0, 0, 0, (r1), (r2), (r3), (r4), \
     169            (r5))
     170#define async_req_1_0(phoneid, method, arg1) \
     171        async_req_fast((phoneid), (method), (arg1), 0, 0, 0, NULL, NULL, NULL, \
    235172            NULL, NULL)
    236 #define async_req_2_1(exch, method, arg1, arg2, rc1) \
    237         async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, NULL, NULL, \
     173#define async_req_1_1(phoneid, method, arg1, rc1) \
     174        async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), NULL, NULL, \
    238175            NULL, NULL)
    239 #define async_req_2_2(exch, method, arg1, arg2, rc1, rc2) \
    240         async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, NULL, NULL, \
    241             NULL)
    242 #define async_req_2_3(exch, method, arg1, arg2, rc1, rc2, rc3) \
    243         async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, NULL, \
    244             NULL)
    245 #define async_req_2_4(exch, method, arg1, arg2, rc1, rc2, rc3, rc4) \
    246         async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
    247             NULL)
    248 #define async_req_2_5(exch, method, arg1, arg2, rc1, rc2, rc3, rc4, rc5) \
    249         async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \
    250             rc5)
    251 
    252 #define async_req_3_0(exch, method, arg1, arg2, arg3) \
    253         async_req_fast(exch, method, arg1, arg2, arg3, 0, NULL, NULL, NULL, \
     176#define async_req_1_2(phoneid, method, arg1, rc1, rc2) \
     177        async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), NULL, \
    254178            NULL, NULL)
    255 #define async_req_3_1(exch, method, arg1, arg2, arg3, rc1) \
    256         async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, NULL, NULL, \
     179#define async_req_1_3(phoneid, method, arg1, rc1, rc2, rc3) \
     180        async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), (rc3), \
    257181            NULL, NULL)
    258 #define async_req_3_2(exch, method, arg1, arg2, arg3, rc1, rc2) \
    259         async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, NULL, \
    260             NULL, NULL)
    261 #define async_req_3_3(exch, method, arg1, arg2, arg3, rc1, rc2, rc3) \
    262         async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
    263             NULL, NULL)
    264 #define async_req_3_4(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4) \
    265         async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
    266             rc4, NULL)
    267 #define async_req_3_5(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4, \
     182#define async_req_1_4(phoneid, method, arg1, rc1, rc2, rc3, rc4) \
     183        async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), (rc3), \
     184            (rc4), NULL)
     185#define async_req_1_5(phoneid, method, arg1, rc1, rc2, rc3, rc4, rc5) \
     186        async_req_fast((phoneid), (method), (arg1), 0, 0, 0, (rc1), (rc2), (rc3), \
     187            (rc4), (rc5))
     188#define async_req_2_0(phoneid, method, arg1, arg2) \
     189        async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, NULL, NULL, \
     190            NULL, NULL, NULL)
     191#define async_req_2_1(phoneid, method, arg1, arg2, rc1) \
     192        async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), NULL, \
     193            NULL, NULL, NULL)
     194#define async_req_2_2(phoneid, method, arg1, arg2, rc1, rc2) \
     195        async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
     196            NULL, NULL, NULL)
     197#define async_req_2_3(phoneid, method, arg1, arg2, rc1, rc2, rc3) \
     198        async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
     199            (rc3), NULL, NULL)
     200#define async_req_2_4(phoneid, method, arg1, arg2, rc1, rc2, rc3, rc4) \
     201        async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
     202            (rc3), (rc4), NULL)
     203#define async_req_2_5(phoneid, method, arg1, arg2, rc1, rc2, rc3, rc4, rc5) \
     204        async_req_fast((phoneid), (method), (arg1), (arg2), 0, 0, (rc1), (rc2), \
     205            (rc3), (rc4), (rc5))
     206#define async_req_3_0(phoneid, method, arg1, arg2, arg3) \
     207        async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, NULL, NULL, \
     208            NULL, NULL, NULL)
     209#define async_req_3_1(phoneid, method, arg1, arg2, arg3, rc1) \
     210        async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
     211            NULL, NULL, NULL, NULL)
     212#define async_req_3_2(phoneid, method, arg1, arg2, arg3, rc1, rc2) \
     213        async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
     214            (rc2), NULL, NULL, NULL)
     215#define async_req_3_3(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3) \
     216        async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
     217            (rc2), (rc3), NULL, NULL)
     218#define async_req_3_4(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4) \
     219        async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
     220            (rc2), (rc3), (rc4), NULL)
     221#define async_req_3_5(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4, \
    268222    rc5) \
    269         async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \
    270             rc4, rc5)
    271 
    272 #define async_req_4_0(exch, method, arg1, arg2, arg3, arg4) \
    273         async_req_fast(exch, method, arg1, arg2, arg3, arg4, NULL, NULL, \
    274             NULL, NULL, NULL)
    275 #define async_req_4_1(exch, method, arg1, arg2, arg3, arg4, rc1) \
    276         async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, NULL, \
    277             NULL, NULL, NULL)
    278 #define async_req_4_2(exch, method, arg1, arg2, arg3, arg4, rc1, rc2) \
    279         async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, NULL, \
    280             NULL, NULL)
    281 #define async_req_4_3(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3) \
    282         async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
    283             NULL, NULL)
    284 #define async_req_4_4(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
     223        async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (rc1), \
     224            (rc2), (rc3), (rc4), (rc5))
     225#define async_req_4_0(phoneid, method, arg1, arg2, arg3, arg4) \
     226        async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), NULL, \
     227            NULL, NULL, NULL, NULL)
     228#define async_req_4_1(phoneid, method, arg1, arg2, arg3, arg4, rc1) \
     229        async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), (rc1), \
     230            NULL, NULL, NULL, NULL)
     231#define async_req_4_2(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2) \
     232        async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), (rc1), \
     233            (rc2), NULL, NULL, NULL)
     234#define async_req_4_3(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3) \
     235        async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), (rc1), \
     236            (rc2), (rc3), NULL, NULL)
     237#define async_req_4_4(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
    285238    rc4) \
    286         async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
    287             rc4, NULL)
    288 #define async_req_4_5(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
     239        async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     240            (rc1), (rc2), (rc3), (rc4), NULL)
     241#define async_req_4_5(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
    289242    rc4, rc5) \
    290         async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \
    291             rc4, rc5)
    292 
    293 #define async_req_5_0(exch, method, arg1, arg2, arg3, arg4, arg5) \
    294         async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, NULL, \
    295             NULL, NULL, NULL, NULL)
    296 #define async_req_5_1(exch, method, arg1, arg2, arg3, arg4, arg5, rc1) \
    297         async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, \
    298             NULL, NULL, NULL, NULL)
    299 #define async_req_5_2(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2) \
    300         async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
    301             NULL, NULL, NULL)
    302 #define async_req_5_3(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
     243        async_req_fast((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     244            (rc1), (rc2), (rc3), (rc4), (rc5))
     245#define async_req_5_0(phoneid, method, arg1, arg2, arg3, arg4, arg5) \
     246        async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     247            (arg5), NULL, NULL, NULL, NULL, NULL)
     248#define async_req_5_1(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1) \
     249        async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     250            (arg5), (rc1), NULL, NULL, NULL, NULL)
     251#define async_req_5_2(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2) \
     252        async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     253            (arg5), (rc1), (rc2), NULL, NULL, NULL)
     254#define async_req_5_3(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
    303255    rc3) \
    304         async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
    305             rc3, NULL, NULL)
    306 #define async_req_5_4(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
     256        async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     257            (arg5), (rc1), (rc2), (rc3), NULL, NULL)
     258#define async_req_5_4(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
    307259    rc3, rc4) \
    308         async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
    309             rc3, rc4, NULL)
    310 #define async_req_5_5(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
     260        async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     261            (arg5), (rc1), (rc2), (rc3), (rc4), NULL)
     262#define async_req_5_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
    311263    rc3, rc4, rc5) \
    312         async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
    313             rc3, rc4, rc5)
    314 
    315 extern sysarg_t async_req_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
     264        async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
     265            (arg5), (rc1), (rc2), (rc3), (rc4), (rc5))
     266
     267extern sysarg_t async_req_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     268    sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
     269extern sysarg_t async_req_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    316270    sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
    317271    sysarg_t *);
    318 extern sysarg_t async_req_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
    319     sysarg_t, sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *,
    320     sysarg_t *, sysarg_t *);
    321 
    322 extern async_sess_t *async_connect_me(exch_mgmt_t, async_exch_t *);
    323 extern async_sess_t *async_connect_me_to(exch_mgmt_t, async_exch_t *, sysarg_t,
    324     sysarg_t, sysarg_t);
    325 extern async_sess_t *async_connect_me_to_blocking(exch_mgmt_t, async_exch_t *,
    326     sysarg_t, sysarg_t, sysarg_t);
    327 extern async_sess_t *async_connect_kbox(task_id_t);
    328 
    329 extern int async_connect_to_me(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
    330     async_client_conn_t, void *);
    331 
    332 extern int async_hangup(async_sess_t *);
     272
     273static inline void async_serialize_start(void)
     274{
     275        fibril_inc_sercount();
     276}
     277
     278static inline void async_serialize_end(void)
     279{
     280        fibril_dec_sercount();
     281}
     282
     283extern int async_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t,
     284    async_client_conn_t);
     285extern int async_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t);
     286extern int async_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t);
     287extern int async_connect_kbox(task_id_t);
     288extern int async_hangup(int);
    333289extern void async_poke(void);
    334290
    335 extern async_exch_t *async_exchange_begin(async_sess_t *);
    336 extern void async_exchange_end(async_exch_t *);
    337 
    338 /*
    339  * FIXME These functions just work around problems with parallel exchange
    340  * management. Proper solution needs to be implemented.
    341  */
    342 void async_sess_args_set(async_sess_t *sess, sysarg_t, sysarg_t, sysarg_t);
    343 
    344291/*
    345292 * User-friendly wrappers for async_share_in_start().
    346293 */
    347294
    348 #define async_share_in_start_0_0(exch, dst, size) \
    349         async_share_in_start(exch, dst, size, 0, NULL)
    350 #define async_share_in_start_0_1(exch, dst, size, flags) \
    351         async_share_in_start(exch, dst, size, 0, flags)
    352 #define async_share_in_start_1_0(exch, dst, size, arg) \
    353         async_share_in_start(exch, dst, size, arg, NULL)
    354 #define async_share_in_start_1_1(exch, dst, size, arg, flags) \
    355         async_share_in_start(exch, dst, size, arg, flags)
    356 
    357 extern int async_share_in_start(async_exch_t *, void *, size_t, sysarg_t,
    358     unsigned int *);
     295#define async_share_in_start_0_0(phoneid, dst, size) \
     296        async_share_in_start((phoneid), (dst), (size), 0, NULL)
     297#define async_share_in_start_0_1(phoneid, dst, size, flags) \
     298        async_share_in_start((phoneid), (dst), (size), 0, (flags))
     299#define async_share_in_start_1_0(phoneid, dst, size, arg) \
     300        async_share_in_start((phoneid), (dst), (size), (arg), NULL)
     301#define async_share_in_start_1_1(phoneid, dst, size, arg, flags) \
     302        async_share_in_start((phoneid), (dst), (size), (arg), (flags))
     303
     304extern int async_share_in_start(int, void *, size_t, sysarg_t, unsigned int *);
    359305extern bool async_share_in_receive(ipc_callid_t *, size_t *);
    360306extern int async_share_in_finalize(ipc_callid_t, void *, unsigned int);
    361307
    362 extern int async_share_out_start(async_exch_t *, void *, unsigned int);
     308extern int async_share_out_start(int, void *, unsigned int);
    363309extern bool async_share_out_receive(ipc_callid_t *, size_t *, unsigned int *);
    364310extern int async_share_out_finalize(ipc_callid_t, void *);
     
    368314 */
    369315
    370 #define async_data_read_forward_0_0(exch, method, answer) \
    371         async_data_read_forward_fast(exch, method, 0, 0, 0, 0, NULL)
    372 #define async_data_read_forward_0_1(exch, method, answer) \
    373         async_data_read_forward_fast(exch, method, 0, 0, 0, 0, answer)
    374 #define async_data_read_forward_1_0(exch, method, arg1, answer) \
    375         async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
    376 #define async_data_read_forward_1_1(exch, method, arg1, answer) \
    377         async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, answer)
    378 #define async_data_read_forward_2_0(exch, method, arg1, arg2, answer) \
    379         async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
    380 #define async_data_read_forward_2_1(exch, method, arg1, arg2, answer) \
    381         async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
    382 #define async_data_read_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
    383         async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, NULL)
    384 #define async_data_read_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
    385         async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, \
    386             answer)
    387 #define async_data_read_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
    388     answer) \
    389         async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
    390             NULL)
    391 #define async_data_read_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
    392     answer) \
    393         async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
    394             answer)
    395 
    396 extern aid_t async_data_read(async_exch_t *, void *, size_t, ipc_call_t *);
    397 extern int async_data_read_start(async_exch_t *, void *, size_t);
     316#define async_data_read_forward_0_0(phoneid, method, answer) \
     317        async_data_read_forward_fast((phoneid), (method), 0, 0, 0, 0, NULL)
     318#define async_data_read_forward_0_1(phoneid, method, answer) \
     319        async_data_read_forward_fast((phoneid), (method), 0, 0, 0, 0, (answer))
     320#define async_data_read_forward_1_0(phoneid, method, arg1, answer) \
     321        async_data_read_forward_fast((phoneid), (method), (arg1), 0, 0, 0, NULL)
     322#define async_data_read_forward_1_1(phoneid, method, arg1, answer) \
     323        async_data_read_forward_fast((phoneid), (method), (arg1), 0, 0, 0, (answer))
     324#define async_data_read_forward_2_0(phoneid, method, arg1, arg2, answer) \
     325        async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, NULL)
     326#define async_data_read_forward_2_1(phoneid, method, arg1, arg2, answer) \
     327        async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
     328            (answer))
     329#define async_data_read_forward_3_0(phoneid, method, arg1, arg2, arg3, answer) \
     330        async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
     331            NULL)
     332#define async_data_read_forward_3_1(phoneid, method, arg1, arg2, arg3, answer) \
     333        async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
     334            (answer))
     335#define async_data_read_forward_4_0(phoneid, method, arg1, arg2, arg3, arg4, answer) \
     336        async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
     337            (arg4), NULL)
     338#define async_data_read_forward_4_1(phoneid, method, arg1, arg2, arg3, arg4, answer) \
     339        async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
     340            (arg4), (answer))
     341
     342#define async_data_read_start(p, buf, len) \
     343        async_data_read_start_generic((p), (buf), (len), IPC_XF_NONE)
     344
     345extern int async_data_read_start_generic(int, void *, size_t, int);
    398346extern bool async_data_read_receive(ipc_callid_t *, size_t *);
    399347extern int async_data_read_finalize(ipc_callid_t, const void *, size_t);
    400348
    401 extern int async_data_read_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
    402     sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
     349extern int async_data_read_forward_fast(int, sysarg_t, sysarg_t, sysarg_t,
     350    sysarg_t, sysarg_t, ipc_call_t *);
    403351
    404352/*
     
    406354 */
    407355
    408 #define async_data_write_forward_0_0(exch, method, answer) \
    409         async_data_write_forward_fast(exch, method, 0, 0, 0, 0, NULL)
    410 #define async_data_write_forward_0_1(exch, method, answer) \
    411         async_data_write_forward_fast(exch, method, 0, 0, 0, 0, answer)
    412 #define async_data_write_forward_1_0(exch, method, arg1, answer) \
    413         async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, NULL)
    414 #define async_data_write_forward_1_1(exch, method, arg1, answer) \
    415         async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, answer)
    416 #define async_data_write_forward_2_0(exch, method, arg1, arg2, answer) \
    417         async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, NULL)
    418 #define async_data_write_forward_2_1(exch, method, arg1, arg2, answer) \
    419         async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, answer)
    420 #define async_data_write_forward_3_0(exch, method, arg1, arg2, arg3, answer) \
    421         async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
    422             NULL)
    423 #define async_data_write_forward_3_1(exch, method, arg1, arg2, arg3, answer) \
    424         async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \
    425             answer)
    426 #define async_data_write_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \
    427     answer) \
    428         async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
    429             NULL)
    430 #define async_data_write_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \
    431     answer) \
    432         async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \
    433             answer)
    434 
    435 extern int async_data_write_start(async_exch_t *, const void *, size_t);
     356#define async_data_write_forward_0_0(phoneid, method, answer) \
     357        async_data_write_forward_fast((phoneid), (method), 0, 0, 0, 0, NULL)
     358#define async_data_write_forward_0_1(phoneid, method, answer) \
     359        async_data_write_forward_fast((phoneid), (method), 0, 0, 0, 0, (answer))
     360#define async_data_write_forward_1_0(phoneid, method, arg1, answer) \
     361        async_data_write_forward_fast((phoneid), (method), (arg1), 0, 0, 0, NULL)
     362#define async_data_write_forward_1_1(phoneid, method, arg1, answer) \
     363        async_data_write_forward_fast((phoneid), (method), (arg1), 0, 0, 0, \
     364            (answer))
     365#define async_data_write_forward_2_0(phoneid, method, arg1, arg2, answer) \
     366        async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
     367            NULL)
     368#define async_data_write_forward_2_1(phoneid, method, arg1, arg2, answer) \
     369        async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
     370            (answer))
     371#define async_data_write_forward_3_0(phoneid, method, arg1, arg2, arg3, answer) \
     372        async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
     373            0, NULL)
     374#define async_data_write_forward_3_1(phoneid, method, arg1, arg2, arg3, answer) \
     375        async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
     376            0, (answer))
     377#define async_data_write_forward_4_0(phoneid, method, arg1, arg2, arg3, arg4, answer) \
     378        async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
     379            (arg4), NULL)
     380#define async_data_write_forward_4_1(phoneid, method, arg1, arg2, arg3, arg4, answer) \
     381        async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
     382            (arg4), (answer))
     383
     384#define async_data_write_start(p, buf, len) \
     385        async_data_write_start_generic((p), (buf), (len), IPC_XF_NONE)
     386
     387extern int async_data_write_start_generic(int, const void *, size_t, int);
    436388extern bool async_data_write_receive(ipc_callid_t *, size_t *);
    437389extern int async_data_write_finalize(ipc_callid_t, void *, size_t);
     
    441393extern void async_data_write_void(sysarg_t);
    442394
    443 extern int async_data_write_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
    444     sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
    445 
    446 extern int async_exchange_clone(async_exch_t *, async_exch_t *);
    447 extern async_sess_t *async_clone_receive(exch_mgmt_t);
    448 extern async_sess_t *async_callback_receive(exch_mgmt_t);
    449 extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
    450 
    451 extern int async_state_change_start(async_exch_t *, sysarg_t, sysarg_t,
    452     sysarg_t, async_exch_t *);
    453 extern bool async_state_change_receive(ipc_callid_t *, sysarg_t *, sysarg_t *,
    454     sysarg_t *);
    455 extern int async_state_change_finalize(ipc_callid_t, async_exch_t *);
    456 
    457 extern void *async_remote_state_acquire(async_sess_t *);
    458 extern void async_remote_state_update(async_sess_t *, void *);
    459 extern void async_remote_state_release(async_sess_t *);
    460 extern void async_remote_state_release_exchange(async_exch_t *);
     395extern int async_data_write_forward_fast(int, sysarg_t, sysarg_t, sysarg_t,
     396    sysarg_t, sysarg_t, ipc_call_t *);
    461397
    462398#endif
Note: See TracChangeset for help on using the changeset viewer.