Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset b4cbef1 in mainline for uspace/lib/libc/include/async.h


Ignore:
Timestamp:
2010-02-03T16:52:37Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master
Children:
3b3e776, eda925a
Parents:
472c09d
Message:

add minimal data size check into async_data_receive
introduce more convenience wrappers for common IPC patterns:

async_data_read_forward_fast
async_data_void
async_data_forward_fast

File:
1 edited

Legend:

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

    r472c09d rb4cbef1  
    277277extern int async_share_out_receive(ipc_callid_t *, size_t *, int *);
    278278extern int async_share_out_finalize(ipc_callid_t, void *);
     279
     280/*
     281 * User-friendly wrappers for async_data_read_forward_fast().
     282 */
     283#define async_data_read_forward_0_0(phoneid, method, answer) \
     284        async_data_read_forward_fast((phoneid), (method), 0, 0, 0, 0, NULL)
     285#define async_data_read_forward_0_1(phoneid, method, answer) \
     286        async_data_read_forward_fast((phoneid), (method), 0, 0, 0, 0, (answer))
     287#define async_data_read_forward_1_0(phoneid, method, arg1, answer) \
     288        async_data_read_forward_fast((phoneid), (method), (arg1), 0, 0, 0, NULL)
     289#define async_data_read_forward_1_1(phoneid, method, arg1, answer) \
     290        async_data_read_forward_fast((phoneid), (method), (arg1), 0, 0, 0, (answer))
     291#define async_data_read_forward_2_0(phoneid, method, arg1, arg2, answer) \
     292        async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, NULL)
     293#define async_data_read_forward_2_1(phoneid, method, arg1, arg2, answer) \
     294        async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
     295            (answer))
     296#define async_data_read_forward_3_0(phoneid, method, arg1, arg2, arg3, answer) \
     297        async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
     298            NULL)
     299#define async_data_read_forward_3_1(phoneid, method, arg1, arg2, arg3, answer) \
     300        async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
     301            (answer))
     302#define async_data_read_forward_4_0(phoneid, method, arg1, arg2, arg3, arg4, answer) \
     303        async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
     304            (arg4), NULL)
     305#define async_data_read_forward_4_1(phoneid, method, arg1, arg2, arg3, arg4, answer) \
     306        async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
     307            (arg4), (answer))
     308
    279309extern int async_data_read_start(int, void *, size_t);
    280310extern int async_data_read_receive(ipc_callid_t *, size_t *);
    281311extern int async_data_read_finalize(ipc_callid_t, const void *, size_t);
     312extern int async_data_read_forward_fast(int, ipcarg_t, ipcarg_t, ipcarg_t,
     313    ipcarg_t, ipcarg_t, ipc_call_t *);
     314
     315/*
     316 * User-friendly wrappers for async_data_forward_fast().
     317 */
     318#define async_data_forward_0_0(phoneid, method, answer) \
     319        async_data_forward_fast((phoneid), (method), 0, 0, 0, 0, NULL)
     320#define async_data_forward_0_1(phoneid, method, answer) \
     321        async_data_forward_fast((phoneid), (method), 0, 0, 0, 0, (answer))
     322#define async_data_forward_1_0(phoneid, method, arg1, answer) \
     323        async_data_forward_fast((phoneid), (method), (arg1), 0, 0, 0, NULL)
     324#define async_data_forward_1_1(phoneid, method, arg1, answer) \
     325        async_data_forward_fast((phoneid), (method), (arg1), 0, 0, 0, (answer))
     326#define async_data_forward_2_0(phoneid, method, arg1, arg2, answer) \
     327        async_data_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, NULL)
     328#define async_data_forward_2_1(phoneid, method, arg1, arg2, answer) \
     329        async_data_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
     330            (answer))
     331#define async_data_forward_3_0(phoneid, method, arg1, arg2, arg3, answer) \
     332        async_data_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
     333            NULL)
     334#define async_data_forward_3_1(phoneid, method, arg1, arg2, arg3, answer) \
     335        async_data_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
     336            (answer))
     337#define async_data_forward_4_0(phoneid, method, arg1, arg2, arg3, arg4, answer) \
     338        async_data_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
     339            (arg4), NULL)
     340#define async_data_forward_4_1(phoneid, method, arg1, arg2, arg3, arg4, answer) \
     341        async_data_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \
     342            (arg4), (answer))
     343
    282344extern int async_data_write_start(int, const void *, size_t);
    283345extern int async_data_write_receive(ipc_callid_t *, size_t *);
    284346extern int async_data_write_finalize(ipc_callid_t, void *, size_t);
    285 
    286 extern int async_data_receive(void **, const size_t, const size_t, size_t *);
     347extern int async_data_receive(void **, const size_t, const size_t,
     348    const size_t, size_t *);
    287349extern int async_string_receive(char **, const size_t, size_t *);
     350extern void async_data_void(const int);
     351extern int async_data_forward_fast(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t,
     352    ipcarg_t, ipc_call_t *);
    288353
    289354#endif
Note: See TracChangeset for help on using the changeset viewer.