Changeset a33f0a6 in mainline for uspace/lib/c/include/async.h
- Timestamp:
- 2011-08-03T17:34:57Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1940326
- Parents:
- 52a79081 (diff), 3fab770 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/async.h
r52a79081 ra33f0a6 41 41 42 42 #include <ipc/common.h> 43 #include <async_sess.h>44 43 #include <fibril.h> 44 #include <fibril_synch.h> 45 45 #include <sys/time.h> 46 46 #include <atomic.h> … … 53 53 typedef void (*async_client_data_dtor_t)(void *); 54 54 55 typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *); 55 /** Client connection handler 56 * 57 * @param callid ID of incoming call or 0 if connection initiated from 58 * inside using async_connect_to_me() 59 * @param call Incoming call or 0 if connection initiated from inside 60 * @param arg Local argument passed from async_new_connection() or 61 * async_connect_to_me() 62 */ 63 typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *, void *); 64 65 /** Interrupt handler */ 66 typedef void (*async_interrupt_handler_t)(ipc_callid_t, ipc_call_t *); 67 68 /** Exchange management style 69 * 70 */ 71 typedef enum { 72 /** No explicit exchange management 73 * 74 * Suitable for protocols which use a single 75 * IPC message per exchange only. 76 * 77 */ 78 EXCHANGE_ATOMIC = 0, 79 80 /** Exchange management via phone cloning 81 * 82 * Suitable for servers which support client 83 * data tracking by task hashes and do not 84 * mind cloned phones. 85 * 86 */ 87 EXCHANGE_PARALLEL, 88 89 /** Exchange management via mutual exclusion 90 * 91 * Suitable for any kind of client/server communication, 92 * but can limit parallelism. 93 * 94 */ 95 EXCHANGE_SERIALIZE 96 } exch_mgmt_t; 97 98 /** Session data */ 99 typedef struct { 100 /** List of inactive exchanges */ 101 list_t exch_list; 102 103 /** Exchange management style */ 104 exch_mgmt_t mgmt; 105 106 /** Session identification */ 107 int phone; 108 109 /** First clone connection argument */ 110 sysarg_t arg1; 111 112 /** Second clone connection argument */ 113 sysarg_t arg2; 114 115 /** Third clone connection argument */ 116 sysarg_t arg3; 117 118 /** Exchange mutex */ 119 fibril_mutex_t mutex; 120 121 /** Number of opened exchanges */ 122 atomic_t refcnt; 123 } async_sess_t; 124 125 /** Exchange data */ 126 typedef struct { 127 /** Link into list of inactive exchanges */ 128 link_t sess_link; 129 130 /** Link into global list of inactive exchanges */ 131 link_t global_link; 132 133 /** Session pointer */ 134 async_sess_t *sess; 135 136 /** Exchange identification */ 137 int phone; 138 } async_exch_t; 56 139 57 140 extern atomic_t threads_in_ipc_wait; … … 68 151 * User-friendly wrappers for async_send_fast() and async_send_slow(). The 69 152 * macros are in the form async_send_m(), where m denotes the number of payload 70 * arguments. 153 * arguments. Each macros chooses between the fast and the slow version based 71 154 * on m. 72 155 */ 73 156 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, 157 #define async_send_0(exch, method, dataptr) \ 158 async_send_fast(exch, method, 0, 0, 0, 0, dataptr) 159 #define async_send_1(exch, method, arg1, dataptr) \ 160 async_send_fast(exch, method, arg1, 0, 0, 0, dataptr) 161 #define async_send_2(exch, method, arg1, arg2, dataptr) \ 162 async_send_fast(exch, method, arg1, arg2, 0, 0, dataptr) 163 #define async_send_3(exch, method, arg1, arg2, arg3, dataptr) \ 164 async_send_fast(exch, method, arg1, arg2, arg3, 0, dataptr) 165 #define async_send_4(exch, method, arg1, arg2, arg3, arg4, dataptr) \ 166 async_send_fast(exch, method, arg1, arg2, arg3, arg4, dataptr) 167 #define async_send_5(exch, method, arg1, arg2, arg3, arg4, arg5, dataptr) \ 168 async_send_slow(exch, method, arg1, arg2, arg3, arg4, arg5, dataptr) 169 170 extern aid_t async_send_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, 92 171 sysarg_t, sysarg_t, ipc_call_t *); 172 extern aid_t async_send_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, 173 sysarg_t, sysarg_t, sysarg_t, ipc_call_t *); 174 93 175 extern void async_wait_for(aid_t, sysarg_t *); 94 176 extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t); 95 177 96 178 extern fid_t async_new_connection(sysarg_t, sysarg_t, ipc_callid_t, 97 ipc_call_t *, void (*)(ipc_callid_t, ipc_call_t *)); 179 ipc_call_t *, async_client_conn_t, void *); 180 98 181 extern void async_usleep(suseconds_t); 99 182 extern void async_create_manager(void); … … 102 185 extern void async_set_client_data_constructor(async_client_data_ctor_t); 103 186 extern void async_set_client_data_destructor(async_client_data_dtor_t); 104 105 extern void *async_client_data_get(void); 187 extern void *async_get_client_data(void); 106 188 107 189 extern void async_set_client_connection(async_client_conn_t); 108 extern void async_set_interrupt_received(async_ client_conn_t);190 extern void async_set_interrupt_received(async_interrupt_handler_t); 109 191 110 192 /* … … 112 194 */ 113 195 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, 196 extern void async_msg_0(async_exch_t *, sysarg_t); 197 extern void async_msg_1(async_exch_t *, sysarg_t, sysarg_t); 198 extern void async_msg_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t); 199 extern void async_msg_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t); 200 extern void async_msg_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t, 120 201 sysarg_t); 202 extern void async_msg_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t, 203 sysarg_t, sysarg_t); 121 204 122 205 /* … … 138 221 */ 139 222 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);223 extern int async_forward_fast(ipc_callid_t, async_exch_t *, sysarg_t, sysarg_t, 224 sysarg_t, unsigned int); 225 extern int async_forward_slow(ipc_callid_t, async_exch_t *, sysarg_t, sysarg_t, 226 sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int); 144 227 145 228 /* … … 150 233 */ 151 234 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, \ 235 #define async_req_0_0(exch, method) \ 236 async_req_fast(exch, method, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL) 237 #define async_req_0_1(exch, method, r1) \ 238 async_req_fast(exch, method, 0, 0, 0, 0, r1, NULL, NULL, NULL, NULL) 239 #define async_req_0_2(exch, method, r1, r2) \ 240 async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, NULL, NULL, NULL) 241 #define async_req_0_3(exch, method, r1, r2, r3) \ 242 async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, NULL, NULL) 243 #define async_req_0_4(exch, method, r1, r2, r3, r4) \ 244 async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, NULL) 245 #define async_req_0_5(exch, method, r1, r2, r3, r4, r5) \ 246 async_req_fast(exch, method, 0, 0, 0, 0, r1, r2, r3, r4, r5) 247 248 #define async_req_1_0(exch, method, arg1) \ 249 async_req_fast(exch, method, arg1, 0, 0, 0, NULL, NULL, NULL, NULL, \ 250 NULL) 251 #define async_req_1_1(exch, method, arg1, rc1) \ 252 async_req_fast(exch, method, arg1, 0, 0, 0, rc1, NULL, NULL, NULL, \ 253 NULL) 254 #define async_req_1_2(exch, method, arg1, rc1, rc2) \ 255 async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, NULL, NULL, \ 256 NULL) 257 #define async_req_1_3(exch, method, arg1, rc1, rc2, rc3) \ 258 async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, NULL, \ 259 NULL) 260 #define async_req_1_4(exch, method, arg1, rc1, rc2, rc3, rc4) \ 261 async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \ 262 NULL) 263 #define async_req_1_5(exch, method, arg1, rc1, rc2, rc3, rc4, rc5) \ 264 async_req_fast(exch, method, arg1, 0, 0, 0, rc1, rc2, rc3, rc4, \ 265 rc5) 266 267 #define async_req_2_0(exch, method, arg1, arg2) \ 268 async_req_fast(exch, method, arg1, arg2, 0, 0, NULL, NULL, NULL, \ 269 NULL, NULL) 270 #define async_req_2_1(exch, method, arg1, arg2, rc1) \ 271 async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, NULL, NULL, \ 272 NULL, NULL) 273 #define async_req_2_2(exch, method, arg1, arg2, rc1, rc2) \ 274 async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, NULL, NULL, \ 275 NULL) 276 #define async_req_2_3(exch, method, arg1, arg2, rc1, rc2, rc3) \ 277 async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, NULL, \ 278 NULL) 279 #define async_req_2_4(exch, method, arg1, arg2, rc1, rc2, rc3, rc4) \ 280 async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \ 281 NULL) 282 #define async_req_2_5(exch, method, arg1, arg2, rc1, rc2, rc3, rc4, rc5) \ 283 async_req_fast(exch, method, arg1, arg2, 0, 0, rc1, rc2, rc3, rc4, \ 284 rc5) 285 286 #define async_req_3_0(exch, method, arg1, arg2, arg3) \ 287 async_req_fast(exch, method, arg1, arg2, arg3, 0, NULL, NULL, NULL, \ 288 NULL, NULL) 289 #define async_req_3_1(exch, method, arg1, arg2, arg3, rc1) \ 290 async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, NULL, NULL, \ 291 NULL, NULL) 292 #define async_req_3_2(exch, method, arg1, arg2, arg3, rc1, rc2) \ 293 async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, NULL, \ 294 NULL, NULL) 295 #define async_req_3_3(exch, method, arg1, arg2, arg3, rc1, rc2, rc3) \ 296 async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \ 297 NULL, NULL) 298 #define async_req_3_4(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4) \ 299 async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \ 300 rc4, NULL) 301 #define async_req_3_5(exch, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4, \ 302 rc5) \ 303 async_req_fast(exch, method, arg1, arg2, arg3, 0, rc1, rc2, rc3, \ 304 rc4, rc5) 305 306 #define async_req_4_0(exch, method, arg1, arg2, arg3, arg4) \ 307 async_req_fast(exch, method, arg1, arg2, arg3, arg4, NULL, NULL, \ 190 308 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, \309 #define async_req_4_1(exch, method, arg1, arg2, arg3, arg4, rc1) \ 310 async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, NULL, \ 193 311 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), \ 312 #define async_req_4_2(exch, method, arg1, arg2, arg3, arg4, rc1, rc2) \ 313 async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, NULL, \ 314 NULL, NULL) 315 #define async_req_4_3(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3) \ 316 async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \ 317 NULL, NULL) 318 #define async_req_4_4(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \ 319 rc4) \ 320 async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \ 321 rc4, NULL) 322 #define async_req_4_5(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \ 323 rc4, rc5) \ 324 async_req_fast(exch, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, \ 325 rc4, rc5) 326 327 #define async_req_5_0(exch, method, arg1, arg2, arg3, arg4, arg5) \ 328 async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, NULL, \ 329 NULL, NULL, NULL, NULL) 330 #define async_req_5_1(exch, method, arg1, arg2, arg3, arg4, arg5, rc1) \ 331 async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, \ 332 NULL, NULL, NULL, NULL) 333 #define async_req_5_2(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2) \ 334 async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \ 196 335 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, \ 336 #define async_req_5_3(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \ 255 337 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, \338 async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \ 339 rc3, NULL, NULL) 340 #define async_req_5_4(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \ 259 341 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, \342 async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \ 343 rc3, rc4, NULL) 344 #define async_req_5_5(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \ 263 345 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, 346 async_req_slow(exch, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, \ 347 rc3, rc4, rc5) 348 349 extern sysarg_t async_req_fast(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, 270 350 sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *, 271 351 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); 352 extern sysarg_t async_req_slow(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, 353 sysarg_t, sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, 354 sysarg_t *, sysarg_t *); 355 356 extern async_sess_t *async_connect_me(exch_mgmt_t, async_exch_t *); 357 extern async_sess_t *async_connect_me_to(exch_mgmt_t, async_exch_t *, sysarg_t, 358 sysarg_t, sysarg_t); 359 extern async_sess_t *async_connect_me_to_blocking(exch_mgmt_t, async_exch_t *, 360 sysarg_t, sysarg_t, sysarg_t); 361 extern async_sess_t *async_connect_kbox(task_id_t); 362 363 extern int async_connect_to_me(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, 364 async_client_conn_t, void *); 365 366 extern int async_hangup(async_sess_t *); 289 367 extern void async_poke(void); 290 368 369 extern async_exch_t *async_exchange_begin(async_sess_t *); 370 extern void async_exchange_end(async_exch_t *); 371 291 372 /* 292 373 * User-friendly wrappers for async_share_in_start(). 293 374 */ 294 375 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 *); 376 #define async_share_in_start_0_0(exch, dst, size) \ 377 async_share_in_start(exch, dst, size, 0, NULL) 378 #define async_share_in_start_0_1(exch, dst, size, flags) \ 379 async_share_in_start(exch, dst, size, 0, flags) 380 #define async_share_in_start_1_0(exch, dst, size, arg) \ 381 async_share_in_start(exch, dst, size, arg, NULL) 382 #define async_share_in_start_1_1(exch, dst, size, arg, flags) \ 383 async_share_in_start(exch, dst, size, arg, flags) 384 385 extern int async_share_in_start(async_exch_t *, void *, size_t, sysarg_t, 386 unsigned int *); 305 387 extern bool async_share_in_receive(ipc_callid_t *, size_t *); 306 388 extern int async_share_in_finalize(ipc_callid_t, void *, unsigned int); 307 389 308 extern int async_share_out_start( int, void *, unsigned int);390 extern int async_share_out_start(async_exch_t *, void *, unsigned int); 309 391 extern bool async_share_out_receive(ipc_callid_t *, size_t *, unsigned int *); 310 392 extern int async_share_out_finalize(ipc_callid_t, void *); … … 314 396 */ 315 397 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); 398 #define async_data_read_forward_0_0(exch, method, answer) \ 399 async_data_read_forward_fast(exch, method, 0, 0, 0, 0, NULL) 400 #define async_data_read_forward_0_1(exch, method, answer) \ 401 async_data_read_forward_fast(exch, method, 0, 0, 0, 0, answer) 402 #define async_data_read_forward_1_0(exch, method, arg1, answer) \ 403 async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, NULL) 404 #define async_data_read_forward_1_1(exch, method, arg1, answer) \ 405 async_data_read_forward_fast(exch, method, arg1, 0, 0, 0, answer) 406 #define async_data_read_forward_2_0(exch, method, arg1, arg2, answer) \ 407 async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, NULL) 408 #define async_data_read_forward_2_1(exch, method, arg1, arg2, answer) \ 409 async_data_read_forward_fast(exch, method, arg1, arg2, 0, 0, answer) 410 #define async_data_read_forward_3_0(exch, method, arg1, arg2, arg3, answer) \ 411 async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, NULL) 412 #define async_data_read_forward_3_1(exch, method, arg1, arg2, arg3, answer) \ 413 async_data_read_forward_fast(exch, method, arg1, arg2, arg3, 0, \ 414 answer) 415 #define async_data_read_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \ 416 answer) \ 417 async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \ 418 NULL) 419 #define async_data_read_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \ 420 answer) \ 421 async_data_read_forward_fast(exch, method, arg1, arg2, arg3, arg4, \ 422 answer) 423 424 extern aid_t async_data_read(async_exch_t *, void *, size_t, ipc_call_t *); 425 extern int async_data_read_start(async_exch_t *, void *, size_t); 346 426 extern bool async_data_read_receive(ipc_callid_t *, size_t *); 347 427 extern int async_data_read_finalize(ipc_callid_t, const void *, size_t); 348 428 349 extern int async_data_read_forward_fast( int, sysarg_t, sysarg_t, sysarg_t,350 sysarg_t, sysarg_t, ipc_call_t *);429 extern int async_data_read_forward_fast(async_exch_t *, sysarg_t, sysarg_t, 430 sysarg_t, sysarg_t, sysarg_t, ipc_call_t *); 351 431 352 432 /* … … 354 434 */ 355 435 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); 436 #define async_data_write_forward_0_0(exch, method, answer) \ 437 async_data_write_forward_fast(exch, method, 0, 0, 0, 0, NULL) 438 #define async_data_write_forward_0_1(exch, method, answer) \ 439 async_data_write_forward_fast(exch, method, 0, 0, 0, 0, answer) 440 #define async_data_write_forward_1_0(exch, method, arg1, answer) \ 441 async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, NULL) 442 #define async_data_write_forward_1_1(exch, method, arg1, answer) \ 443 async_data_write_forward_fast(exch, method, arg1, 0, 0, 0, answer) 444 #define async_data_write_forward_2_0(exch, method, arg1, arg2, answer) \ 445 async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, NULL) 446 #define async_data_write_forward_2_1(exch, method, arg1, arg2, answer) \ 447 async_data_write_forward_fast(exch, method, arg1, arg2, 0, 0, answer) 448 #define async_data_write_forward_3_0(exch, method, arg1, arg2, arg3, answer) \ 449 async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \ 450 NULL) 451 #define async_data_write_forward_3_1(exch, method, arg1, arg2, arg3, answer) \ 452 async_data_write_forward_fast(exch, method, arg1, arg2, arg3, 0, \ 453 answer) 454 #define async_data_write_forward_4_0(exch, method, arg1, arg2, arg3, arg4, \ 455 answer) \ 456 async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \ 457 NULL) 458 #define async_data_write_forward_4_1(exch, method, arg1, arg2, arg3, arg4, \ 459 answer) \ 460 async_data_write_forward_fast(exch, method, arg1, arg2, arg3, arg4, \ 461 answer) 462 463 extern int async_data_write_start(async_exch_t *, const void *, size_t); 388 464 extern bool async_data_write_receive(ipc_callid_t *, size_t *); 389 465 extern int async_data_write_finalize(ipc_callid_t, void *, size_t); … … 393 469 extern void async_data_write_void(sysarg_t); 394 470 395 extern int async_data_write_forward_fast(int, sysarg_t, sysarg_t, sysarg_t, 396 sysarg_t, sysarg_t, ipc_call_t *); 471 extern int async_data_write_forward_fast(async_exch_t *, sysarg_t, sysarg_t, 472 sysarg_t, sysarg_t, sysarg_t, ipc_call_t *); 473 474 extern int async_exchange_clone(async_exch_t *, async_exch_t *); 475 extern async_sess_t *async_clone_receive(exch_mgmt_t); 476 extern async_sess_t *async_callback_receive(exch_mgmt_t); 477 extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *); 397 478 398 479 #endif
Note:
See TracChangeset
for help on using the changeset viewer.