Ignore:
File:
1 edited

Legend:

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

    r8e80d3f r5da7199  
    4141
    4242#include <ipc/common.h>
    43 #include <async_sess.h>
    4443#include <fibril.h>
    4544#include <sys/time.h>
     
    5352typedef void (*async_client_data_dtor_t)(void *);
    5453
    55 typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *);
     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 */
     62typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *, void *);
     63
     64/** Interrupt handler */
     65typedef void (*async_interrupt_handler_t)(ipc_callid_t, ipc_call_t *);
     66
     67/** Exchange management style
     68 *
     69 */
     70typedef 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 */
     98struct async_exch;
     99struct async_sess;
     100
     101typedef struct async_sess async_sess_t;
     102typedef struct async_exch async_exch_t;
    56103
    57104extern atomic_t threads_in_ipc_wait;
     
    68115 * User-friendly wrappers for async_send_fast() and async_send_slow(). The
    69116 * macros are in the form async_send_m(), where m denotes the number of payload
    70  * arguments.  Each macros chooses between the fast and the slow version based
     117 * arguments. Each macros chooses between the fast and the slow version based
    71118 * on m.
    72119 */
    73120
    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 
    89 extern aid_t async_send_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    90     sysarg_t, ipc_call_t *);
    91 extern aid_t async_send_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     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
     134extern aid_t async_send_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
    92135    sysarg_t, sysarg_t, ipc_call_t *);
     136extern 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
    93139extern void async_wait_for(aid_t, sysarg_t *);
    94140extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
    95141
    96 extern fid_t async_new_connection(sysarg_t, sysarg_t, ipc_callid_t,
    97     ipc_call_t *, void (*)(ipc_callid_t, ipc_call_t *));
     142extern fid_t async_new_connection(task_id_t, sysarg_t, ipc_callid_t,
     143    ipc_call_t *, async_client_conn_t, void *);
     144
    98145extern void async_usleep(suseconds_t);
    99146extern void async_create_manager(void);
     
    102149extern void async_set_client_data_constructor(async_client_data_ctor_t);
    103150extern void async_set_client_data_destructor(async_client_data_dtor_t);
    104 
    105 extern void *async_client_data_get(void);
     151extern void *async_get_client_data(void);
     152extern void *async_get_client_data_by_id(task_id_t);
     153extern void async_put_client_data_by_id(task_id_t);
    106154
    107155extern void async_set_client_connection(async_client_conn_t);
    108 extern void async_set_interrupt_received(async_client_conn_t);
     156extern void async_set_interrupt_received(async_interrupt_handler_t);
    109157
    110158/*
     
    112160 */
    113161
    114 extern void async_msg_0(int, sysarg_t);
    115 extern void async_msg_1(int, sysarg_t, sysarg_t);
    116 extern void async_msg_2(int, sysarg_t, sysarg_t, sysarg_t);
    117 extern void async_msg_3(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
    118 extern void async_msg_4(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
    119 extern void async_msg_5(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     162extern void async_msg_0(async_exch_t *, sysarg_t);
     163extern void async_msg_1(async_exch_t *, sysarg_t, sysarg_t);
     164extern void async_msg_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
     165extern void async_msg_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
     166extern void async_msg_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    120167    sysarg_t);
     168extern void async_msg_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     169    sysarg_t, sysarg_t);
    121170
    122171/*
     
    138187 */
    139188
    140 extern int async_forward_fast(ipc_callid_t, int, sysarg_t, sysarg_t, sysarg_t,
    141     unsigned int);
    142 extern int async_forward_slow(ipc_callid_t, int, sysarg_t, sysarg_t, sysarg_t,
    143     sysarg_t, sysarg_t, sysarg_t, unsigned int);
     189extern int async_forward_fast(ipc_callid_t, async_exch_t *, sysarg_t, sysarg_t,
     190    sysarg_t, unsigned int);
     191extern 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);
    144193
    145194/*
     
    150199 */
    151200
    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, \
    172             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, \
    175             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, \
    178             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), \
    181             NULL, NULL)
    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, \
     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, \
     235            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, \
     238            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, \
     254            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, \
     257            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, \
     268    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, \
    190274            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, \
     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, \
    193277            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), \
     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, \
     285    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, \
     289    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, \
    196301            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, \
    222     rc5) \
    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, \
    238     rc4) \
    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, \
    242     rc4, rc5) \
    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, \
     302#define async_req_5_3(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
    255303    rc3) \
    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, \
     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, \
    259307    rc3, rc4) \
    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, \
     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, \
    263311    rc3, rc4, rc5) \
    264         async_req_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
    265             (arg5), (rc1), (rc2), (rc3), (rc4), (rc5))
    266 
    267 extern 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 *);
    269 extern sysarg_t async_req_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     312        async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \
     313            rc3, rc4, rc5)
     314
     315extern sysarg_t async_req_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
    270316    sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
    271317    sysarg_t *);
    272 
    273 static inline void async_serialize_start(void)
    274 {
    275         fibril_inc_sercount();
    276 }
    277 
    278 static inline void async_serialize_end(void)
    279 {
    280         fibril_dec_sercount();
    281 }
    282 
    283 extern int async_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t,
    284     async_client_conn_t);
    285 extern int async_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t);
    286 extern int async_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t);
    287 extern int async_connect_kbox(task_id_t);
    288 extern int async_hangup(int);
     318extern 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
     322extern async_sess_t *async_connect_me(exch_mgmt_t, async_exch_t *);
     323extern async_sess_t *async_connect_me_to(exch_mgmt_t, async_exch_t *, sysarg_t,
     324    sysarg_t, sysarg_t);
     325extern async_sess_t *async_connect_me_to_blocking(exch_mgmt_t, async_exch_t *,
     326    sysarg_t, sysarg_t, sysarg_t);
     327extern async_sess_t *async_connect_kbox(task_id_t);
     328
     329extern int async_connect_to_me(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
     330    async_client_conn_t, void *);
     331
     332extern int async_hangup(async_sess_t *);
    289333extern void async_poke(void);
    290334
     335extern async_exch_t *async_exchange_begin(async_sess_t *);
     336extern 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 */
     342void async_sess_args_set(async_sess_t *sess, sysarg_t, sysarg_t, sysarg_t);
     343
    291344/*
    292345 * User-friendly wrappers for async_share_in_start().
    293346 */
    294347
    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 
    304 extern int async_share_in_start(int, void *, size_t, sysarg_t, unsigned int *);
     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
     357extern int async_share_in_start(async_exch_t *, void *, size_t, sysarg_t,
     358    unsigned int *);
    305359extern bool async_share_in_receive(ipc_callid_t *, size_t *);
    306360extern int async_share_in_finalize(ipc_callid_t, void *, unsigned int);
    307361
    308 extern int async_share_out_start(int, void *, unsigned int);
     362extern int async_share_out_start(async_exch_t *, void *, unsigned int);
    309363extern bool async_share_out_receive(ipc_callid_t *, size_t *, unsigned int *);
    310364extern int async_share_out_finalize(ipc_callid_t, void *);
     
    314368 */
    315369
    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 
    345 extern int async_data_read_start_generic(int, void *, size_t, int);
     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
     396extern aid_t async_data_read(async_exch_t *, void *, size_t, ipc_call_t *);
     397extern int async_data_read_start(async_exch_t *, void *, size_t);
    346398extern bool async_data_read_receive(ipc_callid_t *, size_t *);
    347399extern int async_data_read_finalize(ipc_callid_t, const void *, size_t);
    348400
    349 extern int async_data_read_forward_fast(int, sysarg_t, sysarg_t, sysarg_t,
    350     sysarg_t, sysarg_t, ipc_call_t *);
     401extern int async_data_read_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
     402    sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
    351403
    352404/*
     
    354406 */
    355407
    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 
    387 extern int async_data_write_start_generic(int, const void *, size_t, int);
     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
     435extern int async_data_write_start(async_exch_t *, const void *, size_t);
    388436extern bool async_data_write_receive(ipc_callid_t *, size_t *);
    389437extern int async_data_write_finalize(ipc_callid_t, void *, size_t);
     
    393441extern void async_data_write_void(sysarg_t);
    394442
    395 extern int async_data_write_forward_fast(int, sysarg_t, sysarg_t, sysarg_t,
    396     sysarg_t, sysarg_t, ipc_call_t *);
     443extern int async_data_write_forward_fast(async_exch_t *, sysarg_t, sysarg_t,
     444    sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
     445
     446extern int async_exchange_clone(async_exch_t *, async_exch_t *);
     447extern async_sess_t *async_clone_receive(exch_mgmt_t);
     448extern async_sess_t *async_callback_receive(exch_mgmt_t);
     449extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
     450
     451extern int async_state_change_start(async_exch_t *, sysarg_t, sysarg_t,
     452    sysarg_t, async_exch_t *);
     453extern bool async_state_change_receive(ipc_callid_t *, sysarg_t *, sysarg_t *,
     454    sysarg_t *);
     455extern int async_state_change_finalize(ipc_callid_t, async_exch_t *);
     456
     457extern void *async_remote_state_acquire(async_sess_t *);
     458extern void async_remote_state_update(async_sess_t *, void *);
     459extern void async_remote_state_release(async_sess_t *);
     460extern void async_remote_state_release_exchange(async_exch_t *);
    397461
    398462#endif
Note: See TracChangeset for help on using the changeset viewer.